:root {
  color-scheme: light;
  --page: #f4f2ee;
  --surface: #f8f7f4;
  --surface-strong: #fffefa;
  --ink: #20252c;
  --muted: #7c838b;
  --line: rgba(46, 52, 60, 0.075);
  --accent: #788c80;
  --accent-dark: #586c60;
  --accent-soft: #dce3dd;
  --shadow-raised: 11px 11px 25px rgba(91, 86, 77, 0.11), -11px -11px 25px rgba(255, 255, 255, 0.88);
  --shadow-small: 6px 6px 15px rgba(91, 86, 77, 0.09), -6px -6px 15px rgba(255, 255, 255, 0.78);
  --shadow-pressed: inset 4px 4px 9px rgba(91, 86, 77, 0.1), inset -4px -4px 9px rgba(255, 255, 255, 0.8);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 255, 255, 0.95), transparent 27rem),
    var(--page);
  overscroll-behavior-y: none;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(88, 108, 96, 0.32);
  outline-offset: 4px;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
}

.app-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding-right: 20px;
  padding-left: 20px;
}

.home-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100vh;
  height: 100svh;
  padding-top: calc(14px + env(safe-area-inset-top));
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 6px 2px 10px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(25px, 7vw, 32px);
  font-weight: 720;
  letter-spacing: -0.035em;
}

.network-badge {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #647069;
  background: rgba(255, 255, 255, 0.36);
  box-shadow: var(--shadow-small);
  font-size: 12px;
  font-weight: 600;
}

.network-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6d9379;
  box-shadow: 0 0 0 4px rgba(109, 147, 121, 0.13);
}

.network-badge.is-offline {
  color: #8a6d68;
}

.network-badge.is-offline .network-dot {
  background: #b77a70;
  box-shadow: 0 0 0 4px rgba(183, 122, 112, 0.13);
}

.player-card {
  position: relative;
  isolation: isolate;
  flex: 0 0 auto;
  padding: 30px 22px 24px;
  border-radius: 34px;
  background: transparent;
  box-shadow: var(--shadow-raised);
  text-align: center;
}

.player-card-surface {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: inherit;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.52), rgba(244, 242, 238, 0.76));
  background-clip: padding-box;
  clip-path: inset(0 round 34px);
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  pointer-events: none;
  transform: translateZ(0);
}

.player-card > :not(.player-card-surface) {
  position: relative;
  z-index: 1;
}

.ambient {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.ambient-one {
  top: -70px;
  right: -45px;
  width: 190px;
  height: 190px;
  background: var(--station-soft, rgba(156, 174, 162, 0.19));
}

.ambient-two {
  bottom: -92px;
  left: -78px;
  width: 210px;
  height: 210px;
  border: 1px solid var(--station-soft, rgba(156, 174, 162, 0.2));
}

.station-artwork {
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 0 auto 24px;
  border: 8px solid rgba(255, 255, 255, 0.46);
  border-radius: 42px;
  color: rgba(255, 255, 255, 0.95);
  background:
    radial-gradient(circle at 30% 23%, rgba(255, 255, 255, 0.38), transparent 28%),
    linear-gradient(145deg, var(--station-from, #9bad9f), var(--station-to, #60796a));
  box-shadow: 12px 13px 28px rgba(74, 81, 76, 0.2), -9px -9px 24px rgba(255, 255, 255, 0.74);
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.station-artwork::after {
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 31px;
  content: "";
}

.signal {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65);
}

.signal-one { width: 112%; height: 112%; }
.signal-two { width: 132%; height: 132%; }
.signal-three { width: 154%; height: 154%; }

.is-playing .signal {
  animation: signal-wave 2.4s ease-out infinite;
}

.is-playing .signal-two { animation-delay: 0.55s; }
.is-playing .signal-three { animation-delay: 1.1s; }

@keyframes signal-wave {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
  23% { opacity: 0.55; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.now-playing-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.player-card h2 {
  margin-bottom: 7px;
  font-size: 28px;
  font-weight: 740;
  letter-spacing: -0.035em;
}

.station-description {
  min-height: 20px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 14px;
}

.playback-status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  color: #6f767b;
  background: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  font-weight: 600;
}

.status-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a4a9a6;
}

.is-playing .status-pulse {
  background: #6c9479;
  box-shadow: 0 0 0 4px rgba(108, 148, 121, 0.13);
  animation: soft-pulse 1.8s ease-out infinite;
}

@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(108, 148, 121, 0.13); }
  50% { box-shadow: 0 0 0 6px rgba(108, 148, 121, 0); }
}

.primary-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 27px;
  margin-top: 27px;
}

.control-button,
.timer-button,
.station-row,
.station-list-button {
  border: 0;
  cursor: pointer;
}

.control-button {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.73);
  border-radius: 50%;
  background: linear-gradient(145deg, #fbfaf7, #efede8);
  box-shadow: var(--shadow-small);
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.control-button:active,
.timer-button:active,
.station-row:active,
.station-list-button:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(1px) scale(0.98);
}

.control-button:disabled {
  cursor: default;
  opacity: 0.34;
  box-shadow: var(--shadow-pressed);
  transform: none;
}

.secondary-control {
  width: 52px;
  height: 52px;
  color: #596169;
}

.secondary-control svg {
  width: 23px;
  height: 23px;
}

.play-control {
  width: 76px;
  height: 76px;
  color: #252a31;
  border-color: rgba(255, 255, 255, 0.88);
  background: linear-gradient(145deg, #fffefa, #eceae5);
  box-shadow: 9px 10px 22px rgba(82, 77, 69, 0.14), -8px -8px 20px rgba(255, 255, 255, 0.92);
}

.play-control svg {
  width: 29px;
  height: 29px;
}

.play-control:active,
.is-playing .play-control {
  color: var(--station-to, #596169);
  background: linear-gradient(145deg, #efede8, #fbfaf7);
  box-shadow: var(--shadow-pressed);
}

.timer-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 39px;
  margin-top: 24px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #6f767c;
  background: rgba(248, 247, 244, 0.66);
  box-shadow: var(--shadow-small);
  font-size: 13px;
  font-weight: 620;
}

.timer-button svg {
  width: 18px;
  height: 18px;
}

.timer-button.is-active {
  color: var(--station-to, #586c60);
  box-shadow: var(--shadow-pressed);
}

.station-selector {
  position: relative;
  z-index: 10;
  width: 100%;
}

.station-list-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 18px;
  color: #555e65;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(238, 236, 231, 0.94));
  box-shadow: var(--shadow-small);
  font-size: 14px;
  font-weight: 680;
}

.station-list-button-meta {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.station-list-button svg {
  width: 18px;
  height: 18px;
  transition: transform 180ms ease;
}

.station-selector.is-open .station-list-button {
  box-shadow: var(--shadow-pressed);
}

.station-selector.is-open .station-list-button svg {
  transform: rotate(180deg);
}

.station-list-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  left: 0;
  max-height: min(58svh, 310px);
  padding: 14px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 26px;
  background: rgba(245, 243, 239, 0.96);
  box-shadow: 0 22px 48px rgba(64, 61, 56, 0.2), inset 0 1px rgba(255, 255, 255, 0.85);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.985);
  transform-origin: bottom center;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.station-selector.is-open .station-list-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.station-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 4px 12px;
  color: #4f565c;
  font-size: 13px;
  font-weight: 680;
}

.station-count {
  color: var(--muted);
  font-size: 12px;
}

.station-list {
  display: grid;
  gap: 12px;
}

.station-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 62px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.54), rgba(242, 240, 235, 0.84));
  box-shadow: var(--shadow-small);
  text-align: left;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.station-row[aria-current="true"] {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(233, 235, 230, 0.84));
  box-shadow: var(--shadow-pressed);
}

.row-copy {
  min-width: 0;
}

.row-name,
.row-description {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name {
  margin-bottom: 5px;
  color: #343a41;
  font-size: 15px;
  font-weight: 680;
}

.row-description {
  color: var(--muted);
  font-size: 12px;
}

.timer-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  background: rgba(45, 48, 47, 0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.timer-backdrop[hidden] {
  display: none;
}

.timer-dialog {
  width: min(100%, 480px);
  padding: 12px 20px 20px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 30px;
  background: #f5f3ef;
  box-shadow: 0 24px 60px rgba(38, 41, 39, 0.24), inset 0 1px rgba(255, 255, 255, 0.8);
}

.dialog-handle {
  display: block;
  width: 38px;
  height: 4px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: #d6d3cd;
}

.timer-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timer-dialog-heading h2 {
  margin: 0;
  font-size: 22px;
}

.dialog-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #70767a;
  background: #f5f3ef;
  box-shadow: var(--shadow-small);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.timer-hint {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.timer-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.timer-options button {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 20px;
  color: #4d555b;
  background: linear-gradient(145deg, #fbfaf7, #eceae5);
  box-shadow: var(--shadow-small);
  cursor: pointer;
}

.timer-options button:active {
  box-shadow: var(--shadow-pressed);
  transform: scale(0.98);
}

.timer-options strong {
  font-size: 21px;
  font-weight: 730;
}

.timer-options span {
  color: var(--muted);
  font-size: 11px;
}

.cancel-timer-button {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 0;
  border-radius: 16px;
  color: #9b6260;
  background: rgba(169, 102, 99, 0.08);
  font-weight: 650;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 20px;
  width: min(calc(100% - 40px), 460px);
  margin: 0 auto;
  padding: 13px 16px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 16px;
  color: #f8f7f3;
  background: rgba(49, 54, 59, 0.93);
  box-shadow: 0 12px 35px rgba(33, 35, 37, 0.25);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 700px) {
  body {
    padding: 28px 0;
  }

  .app-page {
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 42px;
    box-shadow: 24px 24px 54px rgba(91, 86, 77, 0.1), -20px -20px 48px rgba(255, 255, 255, 0.82);
  }
}

@media (max-width: 370px) {
  .app-page { padding-right: 15px; padding-left: 15px; }
  .player-card { padding-right: 16px; padding-left: 16px; }
  .primary-controls { gap: 20px; }
  .station-artwork { width: 120px; height: 120px; }
}

@media (max-height: 740px) {
  .home-page { gap: 8px; padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .topbar { padding: 2px 2px 6px; }
  .eyebrow { margin-bottom: 3px; }
  .station-list-button { min-height: 44px; }
}

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