@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=Noto+Sans+Bengali:wght@400;500&family=DM+Sans:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  --wine: #6e2019;
  --wine-dark: #3a1713;
  --ink: #29221d;
  --muted: #756960;
  --paper: #f5ead3;
  --paper-light: #fbf4e4;
  --canvas: #ded0b6;
  --green: #3e5b45;
  --rule: rgba(104, 126, 138, 0.19);
  --shadow: 0 24px 70px rgba(49, 31, 19, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 8%, rgba(255, 249, 231, 0.72), transparent 31rem),
    repeating-linear-gradient(91deg, rgba(67, 47, 30, 0.025) 0 1px, transparent 1px 5px),
    var(--canvas);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.app-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 max(26px, env(safe-area-inset-bottom));
}

.topbar, .brand, .controls, .page-footer, .diary-header {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; margin-bottom: 18px; }

.brand { gap: 10px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(58, 23, 19, 0.35);
  border-radius: 50%;
  color: var(--wine);
  font-family: "Noto Sans Bengali", sans-serif;
  font-size: 1.35rem;
}
.brand strong { display: block; font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.25rem; line-height: 1; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; }

.install-button {
  padding: 9px 12px;
  border: 1px solid rgba(58, 23, 19, 0.25);
  border-radius: 999px;
  color: var(--wine-dark);
  background: rgba(255, 248, 230, 0.55);
  font-size: 0.78rem;
  font-weight: 600;
}

.radio-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(320px, 1.12fr);
  min-height: 500px;
  overflow: hidden;
  border: 1px solid rgba(65, 38, 25, 0.2);
  border-radius: 7px;
  background: #211713;
  box-shadow: var(--shadow);
}

.artwork-frame { position: relative; min-height: 500px; margin: 0; overflow: hidden; background: #15100d; }
.artwork-frame::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 65%, rgba(33, 23, 19, 0.65)), linear-gradient(0deg, rgba(19, 12, 9, 0.5), transparent 45%);
  content: "";
  pointer-events: none;
}
.artwork-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.78) sepia(0.08) contrast(1.04); transition: opacity 350ms ease, transform 8s ease; }
.radio-card.is-playing .artwork-frame img { transform: scale(1.035); }
.artwork-frame figcaption {
  position: absolute;
  z-index: 1;
  right: 18px;
  bottom: 16px;
  left: 18px;
  display: flex;
  justify-content: space-between;
  color: rgba(255, 245, 225, 0.75);
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.radio-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(30px, 6vw, 68px);
  color: #f8edda;
  background:
    radial-gradient(circle at 88% 10%, rgba(143, 52, 36, 0.38), transparent 17rem),
    linear-gradient(145deg, #4a1e19, #261612 66%);
}

.on-air { display: flex; align-items: center; gap: 8px; margin: 0 0 24px; color: #d8b9a3; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.on-air > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #d5684f; box-shadow: 0 0 0 5px rgba(213, 104, 79, 0.12); }
.station-modes { display: inline-flex; align-self: flex-start; gap: 3px; margin: 0 0 24px; padding: 3px; border: 1px solid rgba(244, 225, 201, 0.22); border-radius: 999px; background: rgba(20, 10, 8, 0.18); }
.station-modes button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 999px; color: #cbb9a8; background: transparent; cursor: pointer; font-size: 0.7rem; font-weight: 600; }
.station-modes button.is-selected { color: #3d1c16; background: #f0d2a9; }
.station-modes button:disabled { cursor: wait; opacity: 0.65; }
.station-modes button:focus-visible { outline: 3px solid rgba(230, 190, 142, 0.55); outline-offset: 2px; }
.radio-copy h1 { max-width: 13ch; margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: clamp(2.6rem, 6vw, 4.8rem); font-weight: 500; line-height: 0.91; letter-spacing: -0.035em; text-wrap: balance; }
.track-detail { max-width: 44ch; min-height: 2.8em; margin: 20px 0 0; color: #cbb9a8; font-size: 0.9rem; line-height: 1.55; }

.waveform { display: flex; height: 36px; align-items: center; gap: 5px; margin: 28px 0; opacity: 0.5; }
.waveform i { width: 2px; height: 28%; border-radius: 4px; background: #e8d1b8; transform-origin: center; }
.waveform i:nth-child(2n) { height: 62%; }
.waveform i:nth-child(3n) { height: 88%; }
.is-playing .waveform i { animation: pulse 900ms ease-in-out infinite alternate; }
.is-playing .waveform i:nth-child(2n) { animation-delay: -420ms; }
.is-playing .waveform i:nth-child(3n) { animation-delay: -680ms; }
@keyframes pulse { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }

.controls { gap: 10px; }
.controls button { min-height: 54px; border-radius: 999px; cursor: pointer; transition: transform 150ms ease, background 150ms ease, opacity 150ms ease; }
.controls button:active { transform: translateY(1px); }
.controls button:focus-visible, .install-button:focus-visible { outline: 3px solid rgba(230, 190, 142, 0.55); outline-offset: 3px; }
.controls button:disabled { cursor: wait; opacity: 0.6; }
.primary-button { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 10px; padding: 0 22px; border: 0; color: #3d1c16; background: #f0d2a9; font-weight: 600; }
.primary-button:hover { background: #f7dfbb; }
.control-icon { font-size: 0.78rem; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 1px solid rgba(244, 225, 201, 0.35); color: #f6e5ce; background: transparent; }
.secondary-button:hover { background: rgba(255, 255, 255, 0.07); }
.status { min-height: 1.3em; margin: 16px 0 0; color: #aa9787; font-size: 0.76rem; }
audio { display: none; }

.diary {
  position: relative;
  width: min(890px, calc(100% - 48px));
  min-height: 510px;
  margin: 42px auto 0;
  padding: 54px clamp(30px, 8vw, 90px) 36px clamp(50px, 10vw, 112px);
  border: 1px solid rgba(106, 82, 54, 0.2);
  border-radius: 2px 5px 4px 2px;
  background:
    linear-gradient(90deg, transparent 73px, rgba(155, 67, 57, 0.25) 74px, transparent 75px),
    repeating-linear-gradient(0deg, transparent 0 31px, var(--rule) 31px 32px),
    radial-gradient(circle at 12% 4%, rgba(133, 84, 44, 0.09), transparent 20rem),
    var(--paper-light);
  box-shadow: 0 16px 42px rgba(59, 42, 27, 0.14), inset 18px 0 34px rgba(76, 53, 30, 0.035);
  transform: rotate(-0.25deg);
}
.diary::before { position: absolute; inset: 14px; border: 1px solid rgba(111, 76, 46, 0.08); content: ""; pointer-events: none; }
.diary-header { position: relative; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid rgba(96, 69, 48, 0.18); }
.diary-date { margin: 0 0 4px; color: var(--wine); font-size: 0.67rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; }
.diary h2 { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: clamp(2.1rem, 5vw, 3.2rem); font-weight: 600; line-height: 1; }
.lyrics-content { position: relative; min-height: 290px; padding: 26px 0 18px; font-family: "Noto Sans Bengali", "Cormorant Garamond", serif; font-size: clamp(1.05rem, 2.5vw, 1.3rem); line-height: 2; }
.lyrics-content.is-loading { opacity: 0.55; }
.lyrics-content p { margin: 0; white-space: pre-line; }
.lyrics-content .diary-intro { max-width: 36ch; color: var(--muted); font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.25rem; font-style: italic; line-height: 1.65; }
.lyrics-image { display: block; width: min(100%, 680px); margin: 0 auto; border: 1px solid rgba(75, 52, 30, 0.12); filter: sepia(0.12) contrast(0.95); mix-blend-mode: multiply; }

.about-radio {
  width: min(760px, calc(100% - 48px));
  margin: 38px auto 8px;
  color: rgba(55, 44, 35, 0.76);
  text-align: center;
}
.about-radio h2 { margin: 6px 0 10px; color: var(--wine-dark); font-family: "Cormorant Garamond", Georgia, serif; font-size: clamp(1.65rem, 4vw, 2.25rem); font-weight: 600; line-height: 1.08; }
.about-radio > p:last-child { max-width: 64ch; margin: 0 auto; font-size: 0.83rem; line-height: 1.75; }
.about-kicker { margin: 0; color: var(--wine); font-size: 0.63rem; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; }

.page-footer { justify-content: space-between; padding: 26px 4px 0; color: rgba(55, 44, 35, 0.62); font-size: 0.7rem; }
.page-footer p { margin: 0; }

@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 560px); }
  .radio-card { grid-template-columns: 1fr; }
  .artwork-frame { min-height: min(79vw, 420px); }
  .artwork-frame::after { background: linear-gradient(0deg, rgba(35, 20, 15, 0.52), transparent 45%); }
  .radio-copy { padding: 30px 24px 26px; }
  .on-air { margin-bottom: 14px; }
  .station-modes { margin-bottom: 20px; }
  .radio-copy h1 { max-width: 12ch; font-size: clamp(2.7rem, 13vw, 4rem); }
  .track-detail { margin-top: 14px; }
  .waveform { margin: 18px 0; }
  .diary { width: calc(100% - 12px); margin-top: 28px; padding: 42px 22px 26px 48px; background-position: -28px 0, 0 0, 0 0, 0 0; }
  .lyrics-content { min-height: 250px; }
  .about-radio { width: calc(100% - 32px); margin-top: 30px; }
}

@media (max-width: 430px) {
  .brand small { display: none; }
  .install-button { padding-inline: 10px; }
  .controls { align-items: stretch; flex-direction: column; }
  .controls button { width: 100%; }
  .secondary-button { min-height: 48px !important; }
  .diary-header { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
