:root {
  --ink: #f3f7ef;
  --muted: rgba(226, 235, 230, 0.56);
  --panel: rgba(6, 18, 29, 0.66);
  --panel-stroke: rgba(215, 239, 231, 0.13);
  --accent: #ff8f70;
  --accent-rgb: 255, 143, 112;
  --sky-top: #07111f;
  --sky-bottom: #101526;
  --font-display: "Avenir Next", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--sky-top);
  color: var(--ink);
  font-family: var(--font-display);
}

body {
  -webkit-font-smoothing: antialiased;
  user-select: none;
  touch-action: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.aurora {
  position: fixed;
  inset: -30%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 77% 88%, rgba(var(--accent-rgb), 0.12), transparent 36%),
    radial-gradient(ellipse at 18% 22%, rgba(72, 182, 197, 0.08), transparent 33%);
  filter: blur(28px);
  animation: breathe 11s ease-in-out infinite alternate;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: soft-light;
  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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100dvh;
  min-height: 610px;
  padding: max(24px, env(safe-area-inset-top)) clamp(22px, 4.2vw, 72px) max(22px, env(safe-area-inset-bottom));
  pointer-events: none;
}

.topbar,
.readout,
.hint-card,
.mood-picker,
.console,
.footer-note {
  position: absolute;
}

.topbar {
  top: max(24px, env(safe-area-inset-top));
  left: clamp(22px, 4.2vw, 72px);
  right: clamp(22px, 4.2vw, 72px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  pointer-events: auto;
}

.brand-mark {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after,
.brand-mark i {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.brand-mark::before {
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.brand-mark::after {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(var(--accent-rgb), 0.36);
}

.brand-mark i:nth-child(1) {
  width: 44px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%) rotate(-24deg);
}

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.on-air {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.on-air b {
  min-width: 44px;
  color: rgba(245, 249, 244, 0.84);
  font-size: 10px;
  font-weight: 400;
}

.on-air-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: blink 1.8s ease-in-out infinite;
}

.readout {
  top: clamp(118px, 17vh, 180px);
  left: clamp(22px, 4.2vw, 72px);
  max-width: 420px;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
}

.readout h1 {
  margin: 0;
  font-size: clamp(34px, 4.6vw, 66px);
  font-weight: 250;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.26);
}

.readout-meta {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-top: 17px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.readout-meta b {
  color: rgba(245, 249, 244, 0.8);
  font-family: var(--font-mono);
  font-weight: 400;
}

.divider {
  width: 22px;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
}

.hint-card {
  top: 46%;
  left: 50%;
  display: flex;
  width: min(360px, calc(100vw - 44px));
  gap: 15px;
  align-items: center;
  padding: 16px 20px 16px 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.23);
  border-radius: 13px;
  background: rgba(5, 17, 28, 0.62);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: auto;
  transform: translate(-50%, -42%);
  animation: hint-in 0.7s 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.hint-card.is-hidden {
  opacity: 0 !important;
  pointer-events: none;
  transform: translate(-50%, -30%) scale(0.98);
}

.hint-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  font-size: 18px;
}

.hint-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.hint-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.hint-close {
  position: absolute;
  top: 5px;
  right: 7px;
  padding: 4px 7px;
  border: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.mood-picker {
  right: clamp(22px, 4.2vw, 72px);
  bottom: 152px;
  display: flex;
  gap: 13px;
  align-items: center;
  pointer-events: auto;
}

.mood-picker > span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--panel-stroke);
  border-radius: 999px;
  background: rgba(5, 15, 25, 0.46);
  backdrop-filter: blur(12px);
}

.mood {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 7px 11px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.2s;
}

.mood:hover {
  color: var(--ink);
  transform: translateY(-1px);
}

.mood.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
}

.mood i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 8px var(--swatch);
}

.console {
  right: clamp(22px, 4.2vw, 72px);
  bottom: 44px;
  left: clamp(22px, 4.2vw, 72px);
  display: grid;
  min-height: 90px;
  grid-template-columns: 190px minmax(250px, 1fr) 190px;
  gap: clamp(22px, 3.5vw, 62px);
  align-items: center;
  padding: 14px 22px;
  border: 1px solid var(--panel-stroke);
  border-radius: 19px;
  background: linear-gradient(105deg, rgba(11, 26, 39, 0.78), rgba(5, 14, 24, 0.64));
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.27), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(22px) saturate(120%);
  pointer-events: auto;
}

.transport {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-button,
.play-button {
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.icon-button:hover,
.play-button:hover {
  transform: translateY(-2px);
}

.icon-button:active,
.play-button:active {
  transform: scale(0.94);
}

.icon-button {
  width: 35px;
  height: 35px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.025);
}

.icon-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.subtle {
  color: rgba(232, 241, 237, 0.55);
}

.play-button {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  color: #08131c;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(var(--accent-rgb), 0.07), 0 0 30px rgba(var(--accent-rgb), 0.17);
}

.play-button svg {
  width: 19px;
  fill: currentColor;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.play-button .play-icon {
  margin-left: 2px;
}

.pause-icon,
.play-button.is-playing .play-icon {
  display: none;
}

.play-button.is-playing .pause-icon {
  display: block;
}

.tuner {
  min-width: 0;
}

.tuner-labels,
.signal-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
}

.tuner-labels output,
.signal-labels output {
  color: rgba(244, 248, 244, 0.82);
  letter-spacing: 0.06em;
}

.range-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
}

.range-wrap span {
  color: rgba(223, 235, 229, 0.32);
  font-size: 8px;
}

input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--range-progress, 30%), rgba(255,255,255,.13) var(--range-progress, 30%));
}

input[type="range"]::-moz-range-track {
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.13);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  background: var(--accent);
}

input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: -5.5px;
  appearance: none;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #0c1b27;
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.09), 0 0 15px rgba(var(--accent-rgb), 0.35);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #0c1b27;
}

.signal-meter {
  min-width: 0;
}

.meter-bars {
  display: flex;
  height: 17px;
  gap: 4px;
  align-items: flex-end;
}

.meter-bars i {
  flex: 1;
  min-width: 3px;
  height: calc(18% + var(--level, 0) * 7%);
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.1);
  transition: height 0.16s ease, background 0.2s, box-shadow 0.2s;
}

.meter-bars i.is-lit {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.32);
}

.footer-note {
  right: clamp(22px, 4.2vw, 72px);
  bottom: 14px;
  left: clamp(22px, 4.2vw, 72px);
  display: flex;
  gap: 18px;
  color: rgba(224, 235, 229, 0.32);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
}

kbd {
  font: inherit;
  color: rgba(232, 240, 235, 0.55);
}

.footer-coordinate {
  margin-left: auto;
}

.toast {
  position: fixed;
  z-index: 10;
  top: 86px;
  left: 50%;
  max-width: calc(100vw - 44px);
  padding: 9px 15px;
  border: 1px solid var(--panel-stroke);
  border-radius: 999px;
  color: rgba(242, 248, 244, 0.82);
  background: rgba(5, 17, 27, 0.7);
  backdrop-filter: blur(16px);
  font-size: 9px;
  letter-spacing: 0.1em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@keyframes blink {
  0%, 100% { opacity: 0.45; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes breathe {
  from { transform: translate3d(-1%, -1%, 0) scale(1); }
  to { transform: translate3d(1.5%, 1%, 0) scale(1.05); }
}

@keyframes hint-in {
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@media (max-width: 760px) {
  .shell {
    min-height: 560px;
  }

  .on-air > span:not(.on-air-dot),
  .on-air b,
  .footer-note span:not(.footer-coordinate) {
    display: none;
  }

  .readout {
    top: 108px;
  }

  .readout h1 {
    font-size: clamp(34px, 10vw, 48px);
  }

  .mood-picker {
    right: auto;
    bottom: 163px;
    left: 50%;
    width: max-content;
    transform: translateX(-50%);
  }

  .mood-picker > span {
    display: none;
  }

  .console {
    bottom: 38px;
    grid-template-columns: 132px 1fr;
    gap: 18px;
    min-height: 102px;
    padding: 14px 16px;
  }

  .transport {
    gap: 8px;
  }

  .play-button {
    width: 48px;
    height: 48px;
  }

  .icon-button {
    width: 32px;
    height: 32px;
  }

  .signal-meter {
    display: none;
  }

  .footer-note {
    bottom: 13px;
  }
}

@media (max-width: 440px) {
  .brand small {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .readout-meta {
    margin-top: 12px;
  }

  .hint-card {
    top: 47%;
  }

  .mood {
    padding: 7px 9px;
  }

  .console {
    right: 14px;
    left: 14px;
    grid-template-columns: 125px 1fr;
    gap: 11px;
    padding: 12px;
  }

  .range-wrap span {
    display: none;
  }

  .range-wrap {
    grid-template-columns: 1fr;
  }

  .tuner-labels {
    letter-spacing: 0.08em;
  }
}

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