:root {
  color-scheme: dark;
  --ink: #201a12;
  --paper: #d8c9a9;
  --paper-bright: #f0e5cb;
  --paper-dim: #a09276;
  --amber: #d98a2b;
  --amber-soft: rgba(217, 138, 43, 0.24);
  --panel: #17130e;
  --line: rgba(216, 201, 169, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink);
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 50% 44%, rgba(89, 69, 39, 0.19), transparent 38rem),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--ink);
  background-size: auto, 100% 4px, auto;
  font-family: "DM Mono", ui-monospace, monospace;
  overscroll-behavior: none;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  content: "";
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.23'/%3E%3C/svg%3E");
}

button {
  color: inherit;
  font: inherit;
}

.station-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(32px, 6vh, 72px) 0 24px;
  display: flex;
  flex-direction: column;
}

.eyebrow {
  margin: 0 0 clamp(40px, 8vh, 88px);
  color: var(--paper-dim);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.radio {
  margin: auto 0;
}

.radio-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.station-console {
  position: relative;
  width: min(76vw, 760px);
  min-height: clamp(230px, 30vw, 290px);
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(216, 201, 169, 0.025), transparent 45%),
    rgba(23, 19, 14, 0.2);
}

.station-console::before,
.station-console::after {
  position: absolute;
  left: 0;
  width: 22px;
  height: 1px;
  content: "";
  background: var(--paper-dim);
}

.station-console::before { top: -1px; }
.station-console::after { bottom: -1px; }

.station-mark {
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.station-identity {
  width: min(68%, 470px);
  padding-left: clamp(28px, 6vw, 72px);
}

.brand {
  color: var(--paper-bright);
  font-family: "Libre Caslon Display", Georgia, serif;
  font-size: clamp(2rem, 4.6vw, 4.25rem);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-shadow: 0 1px 22px rgba(240, 229, 203, 0.08);
}

.subtitle {
  margin-top: 0.56em;
  padding-left: 0.2em;
  color: var(--paper-dim);
  font-size: clamp(0.68rem, 1.3vw, 1rem);
  letter-spacing: 0.25em;
  text-transform: lowercase;
}

.channel-field {
  position: relative;
  width: clamp(164px, 21vw, 208px);
  min-height: 54px;
  margin-top: clamp(24px, 4vw, 38px);
  padding: 0 34px 0 18px;
  overflow: hidden;
  border: 1px solid rgba(216, 201, 169, 0.13);
  background: rgba(216, 201, 169, 0.025);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 8px 26px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  text-align: left;
}

.channel-field.is-locked {
  border-color: rgba(217, 138, 43, 0.24);
}

.channel-field::after {
  position: absolute;
  right: 46px;
  bottom: 0;
  left: 0;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: 0;
  transform: translateX(-100%);
}

.radio.is-tuning .channel-field::after {
  opacity: 0.38;
  animation: tuning-scan 650ms ease-in-out;
}

@keyframes tuning-scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.channel-name {
  display: block;
  overflow: hidden;
  color: rgba(216, 201, 169, 0.88);
  font-size: clamp(0.72rem, 1.4vw, 0.94rem);
  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: none;
}

.radio.is-tuning .channel-name {
  color: rgba(217, 138, 43, 0.78);
}

.channel-arrows {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 31px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  border-left: 1px solid rgba(216, 201, 169, 0.11);
}

.channel-arrows button {
  padding: 0;
  border: 0;
  color: rgba(141, 128, 104, 0.65);
  background: transparent;
  cursor: pointer;
  font-size: 0.48rem;
  line-height: 1;
}

.channel-arrows button:first-child {
  border-bottom: 1px solid rgba(216, 201, 169, 0.09);
}

.channel-arrows button:hover:not(:disabled),
.channel-arrows button:focus-visible {
  color: var(--paper);
  background: rgba(216, 201, 169, 0.035);
}

.channel-arrows button:disabled {
  cursor: wait;
  opacity: 0.34;
}

.channel-name.is-changing {
  animation: tune-name 460ms ease;
}

@keyframes tune-name {
  0% { opacity: 0.2; filter: blur(3px); transform: translateY(-6px); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.volume-control {
  position: absolute;
  right: clamp(24px, 4vw, 46px);
  bottom: clamp(24px, 4vw, 40px);
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 10px;
  touch-action: none;
}

.control-label,
.volume-value {
  color: var(--paper-dim);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.volume-dial {
  position: relative;
  width: clamp(56px, 7.5vw, 82px);
  aspect-ratio: 1;
  border: 1px solid var(--paper-dim);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 36%, #393126, #16120e 60%, #080706 100%);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.4),
    inset 0 0 0 5px rgba(216, 201, 169, 0.04);
  cursor: ns-resize;
  touch-action: none;
}

.volume-dial:focus-visible,
.channel-arrows button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 5px;
}

.dial-line {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 2px;
  height: 27%;
  background: var(--amber);
  transform: translateX(-50%);
  box-shadow: 0 0 8px var(--amber-soft);
}

.volume-value::after {
  content: "%";
}

.radio-readout {
  width: min(620px, 82%);
  min-height: 128px;
  margin: clamp(48px, 8vh, 78px) auto 0;
  text-align: center;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--paper-dim);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.signal-lamp {
  width: 6px;
  height: 6px;
  border: 1px solid var(--paper-dim);
  border-radius: 50%;
  transition: 300ms ease;
}

.radio.is-playing .signal-lamp {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
}

.radio.is-tuning .signal-lamp {
  border-color: var(--amber);
  animation: tuning-lamp 420ms ease-in-out infinite alternate;
}

@keyframes tuning-lamp {
  from { background: transparent; box-shadow: none; }
  to { background: var(--amber); box-shadow: 0 0 10px var(--amber-soft); }
}

.status-separator {
  opacity: 0.5;
}

.track-title {
  margin: 18px 0 0;
  overflow: hidden;
  color: var(--paper-bright);
  font-family: "Libre Caslon Display", Georgia, serif;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-link {
  display: inline-block;
  margin-top: 11px;
  color: var(--amber);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.track-link:hover,
.track-link:focus-visible {
  color: var(--paper-bright);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.track-link[hidden] {
  display: none;
}

.channel-description {
  margin: 12px 0 0;
  color: var(--paper-dim);
  font-size: clamp(0.68rem, 1.3vw, 0.78rem);
  line-height: 1.7;
}

.tuning-hint {
  margin: 22px 0 0;
  text-align: center;
  color: rgba(160, 146, 118, 0.76);
  font-size: 0.61rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

footer {
  margin-top: clamp(54px, 10vh, 92px);
  display: flex;
  justify-content: center;
  color: rgba(160, 146, 118, 0.7);
  font-size: 0.59rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  body {
    height: 100svh;
    overflow: hidden;
  }

  .station-shell {
    width: min(100% - 24px, 640px);
    height: 100svh;
    min-height: 0;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  .eyebrow {
    display: block;
    margin: 0;
    position: relative;
    z-index: 2;
    color: rgba(216, 201, 169, 0.88);
    font-size: 0.62rem;
    line-height: 1.5;
    letter-spacing: 0.14em;
  }

  .radio {
    margin: 0;
    align-self: center;
  }

  .radio-stage {
    padding-left: 0;
  }

  .station-console {
    width: min(92vw, 610px);
    min-height: 230px;
    padding: 28px 24px;
  }

  .volume-control {
    position: absolute;
    right: 24px;
    bottom: 24px;
    margin: 0;
    transform: none;
  }

  .station-identity {
    width: calc(100% - 76px);
    padding: 0;
  }

  .station-mark {
    align-items: flex-start;
    padding: 0;
    text-align: left;
  }

  .channel-field {
    width: min(190px, 100%);
    margin: 30px 0 0;
  }

  .radio-readout {
    width: 94%;
    min-height: 108px;
    margin-top: 28px;
  }
}

@media (max-width: 480px) {
  .station-shell {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .station-console {
    min-height: 222px;
    padding: 24px 20px;
  }

  .station-identity {
    width: calc(100% - 68px);
  }

  .brand {
    font-size: clamp(1.75rem, 9vw, 2.65rem);
  }

  .subtitle {
    font-size: 0.62rem;
  }

  .channel-name {
    font-size: 0.68rem;
  }

  .volume-control {
    right: 20px;
    bottom: 22px;
    margin: 0;
    transform: none;
  }

  .volume-dial {
    width: 52px;
  }

  .channel-field {
    width: min(168px, 100%);
    margin-top: 28px;
  }

  .tuning-hint {
    display: none;
  }

  footer {
    margin-top: 0;
  }
}

@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;
  }
}
