:root {
  --bg: #18120f;
  --panel: rgba(29, 23, 19, 0.82);
  --panel-strong: rgba(20, 17, 14, 0.94);
  --text: #f5eadb;
  --muted: #b8aa93;
  --accent: #e4b062;
  --accent-2: #8ad7cf;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: rgba(0, 0, 0, 0.38);
  --scan-opacity: 0.12;
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(228, 176, 98, 0.2), transparent 26rem),
    radial-gradient(circle at 82% 78%, rgba(138, 215, 207, 0.12), transparent 26rem),
    linear-gradient(135deg, #15100d 0%, var(--bg) 54%, #0d1318 100%);
  overflow-x: hidden;
  transition: background 650ms ease, color 350ms ease;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  opacity: var(--scan-opacity);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px);
  background-size: 100% 5px, 8px 8px;
  mix-blend-mode: screen;
  animation: scanMove 8s linear infinite;
}

body::after {
  opacity: 0.18;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04) 0 1px, transparent 1px 4px),
    linear-gradient(90deg, rgba(255,255,255,0.04), transparent 30%, rgba(255,255,255,0.03));
  mix-blend-mode: overlay;
}

body.era-1900 {
  --bg: #17130f;
  --accent: #d8bd84;
  --accent-2: #9db8a6;
  --scan-opacity: 0.08;
  filter: sepia(0.18);
}

body.era-1950 {
  --bg: #161616;
  --accent: #dbdbd6;
  --accent-2: #a6a6a6;
  --scan-opacity: 0.2;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.14), transparent 24rem),
    linear-gradient(135deg, #0d0d0d, #2a2a29 60%, #111111);
  filter: grayscale(0.7) contrast(1.08);
}

body.era-1980 {
  --bg: #16111f;
  --accent: #ffd35c;
  --accent-2: #61e9ff;
  --scan-opacity: 0.18;
  background:
    linear-gradient(120deg, rgba(255, 55, 118, 0.15), transparent 28rem),
    radial-gradient(circle at 80% 22%, rgba(97, 233, 255, 0.17), transparent 24rem),
    linear-gradient(135deg, #15101d, #1f2432 58%, #111017);
}

body.era-2000 {
  --bg: #131921;
  --accent: #9fd5ff;
  --accent-2: #ffc678;
  --scan-opacity: 0.1;
  background:
    radial-gradient(circle at 20% 15%, rgba(159, 213, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 80% 74%, rgba(255, 198, 120, 0.12), transparent 24rem),
    linear-gradient(135deg, #101620, #273245 55%, #10151e);
}

body.era-future {
  --bg: #081417;
  --panel: rgba(8, 18, 20, 0.72);
  --panel-strong: rgba(6, 16, 18, 0.92);
  --accent: #88ffe8;
  --accent-2: #c2abff;
  --scan-opacity: 0.08;
  background:
    linear-gradient(90deg, rgba(136,255,232,0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(194,171,255,0.06) 1px, transparent 1px),
    radial-gradient(circle at 22% 18%, rgba(136,255,232,0.16), transparent 26rem),
    linear-gradient(135deg, #071114, #101c24 56%, #090f16);
  background-size: 52px 52px, 52px 52px, auto, auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 30px;
  display: grid;
  gap: 20px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 48rem;
  line-height: 1.7;
}

.status-pill {
  min-width: 148px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: 0 12px 28px var(--shadow);
  text-align: center;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.left-column,
.right-column {
  min-width: 0;
}

.left-column {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 22px;
}

.radio-card,
.control-panel,
.broadcast-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.radio-card {
  padding: 20px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.1), transparent 18%, rgba(0,0,0,0.16) 52%, rgba(255,255,255,0.06)),
    repeating-linear-gradient(90deg, #5f361f 0 12px, #6d4227 12px 22px, #4d2d1c 22px 34px);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.1),
    inset 0 -14px 30px rgba(0,0,0,0.26),
    0 20px 44px rgba(0,0,0,0.34);
}

.radio-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #ffdd9e;
}

.radio-brand {
  font-weight: 900;
  font-size: 1.32rem;
}

.signal-bars {
  display: inline-grid;
  grid-template-columns: repeat(4, 5px);
  gap: 4px;
  align-items: end;
  height: 22px;
}

.signal-bars span {
  width: 5px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: signalPulse 900ms ease-in-out infinite alternate;
}

.signal-bars span:nth-child(1) { height: 8px; animation-delay: 0ms; }
.signal-bars span:nth-child(2) { height: 13px; animation-delay: 120ms; }
.signal-bars span:nth-child(3) { height: 18px; animation-delay: 240ms; }
.signal-bars span:nth-child(4) { height: 22px; animation-delay: 360ms; }

.radio-core {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
}

.speaker-grid {
  min-height: 214px;
  border-radius: 7px;
  background:
    radial-gradient(circle, rgba(0,0,0,0.44) 0 2px, transparent 3px),
    linear-gradient(145deg, #2d241d, #16120f);
  background-size: 13px 13px, auto;
  border: 10px solid rgba(43, 25, 14, 0.72);
  box-shadow: inset 0 0 28px rgba(0,0,0,0.78);
  position: relative;
  overflow: hidden;
}

.speaker-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: translateX(-100%);
}

.tuning .speaker-grid::after {
  animation: sweep 640ms ease-in-out infinite;
}

.tuner-stack {
  display: grid;
  gap: 14px;
}

.dial-window {
  position: relative;
  min-height: 102px;
  padding: 16px;
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255,240,174,0.22), rgba(31,26,20,0.74)),
    repeating-linear-gradient(90deg, rgba(255,232,154,0.28) 0 1px, transparent 1px 28px);
  border: 1px solid rgba(255, 234, 184, 0.35);
  box-shadow: inset 0 0 26px rgba(255, 185, 68, 0.13);
  overflow: hidden;
}

.dial-window::before {
  content: "";
  position: absolute;
  left: var(--needle-left, 50%);
  top: 8px;
  bottom: 7px;
  width: 2px;
  background: #ff4640;
  box-shadow: 0 0 12px rgba(255,70,64,0.76);
  transition: left 260ms ease;
}

.dial-scale {
  height: 42px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  color: #231a14;
  font-size: 0.76rem;
  font-weight: 900;
}

.dial-channel {
  margin-top: 12px;
  position: relative;
  z-index: 1;
  color: #fff2c2;
  font-weight: 800;
  min-height: 1.6em;
}

.knob-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.knob {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255,255,255,0.34), transparent 15%),
    radial-gradient(circle, #433229 0 26%, #241a16 27% 56%, #0f0c0a 57% 100%);
  box-shadow:
    inset 0 0 0 8px rgba(255,255,255,0.06),
    inset 0 -12px 22px rgba(0,0,0,0.44),
    0 12px 20px rgba(0,0,0,0.3);
  color: #f8d39a;
  display: grid;
  place-items: center;
  position: relative;
}

.knob::after {
  content: "";
  position: absolute;
  top: 14%;
  width: 4px;
  height: 24%;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transform-origin: center 150%;
  transform: rotate(var(--knob-rotate, 0deg));
  transition: transform 260ms ease;
}

.knob span {
  position: absolute;
  bottom: 17%;
  font-size: 0.74rem;
  font-weight: 700;
}

.meter-panel {
  margin-top: 18px;
  padding: 11px 12px;
  border-radius: 7px;
  background: rgba(21, 16, 12, 0.74);
  border: 1px solid rgba(255,255,255,0.14);
  display: grid;
  gap: 8px;
}

.meter-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}

.meter-bar span {
  display: block;
  width: var(--meter-width, 52%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--accent);
}

.meter-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 238, 203, 0.78);
  font-size: 0.77rem;
}

.control-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.year-row,
.api-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.year-display {
  color: var(--accent);
  font-size: 2rem;
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  height: 34px;
  accent-color: var(--accent);
}

.year-ticks {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.74rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
}

select,
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(0,0,0,0.28);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--accent), white 10%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 78%);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary-button,
.secondary-button,
.tool-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button {
  color: #17120c;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #ffe0a7);
  box-shadow: 0 12px 22px color-mix(in srgb, var(--accent), transparent 78%);
}

.primary-button:hover,
.secondary-button:hover,
.tool-button:hover,
.knob:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent), white 8%);
}

.api-panel {
  display: none;
  gap: 12px;
  padding-top: 2px;
}

.api-panel.open {
  display: grid;
}

.api-title-row strong {
  font-size: 0.96rem;
}

.api-title-row span {
  color: var(--muted);
  font-size: 0.77rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0,0,0,0.18);
}

.switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  transition: 180ms ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff1dc;
  transition: 180ms ease;
}

.switch input:checked + .slider {
  background: color-mix(in srgb, var(--accent-2), transparent 35%);
}

.switch input:checked + .slider::before {
  transform: translateX(24px);
}

.broadcast-card {
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), transparent 10rem),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 18px 52px rgba(0,0,0,0.28);
}

.broadcast-top {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-strong);
  flex-wrap: wrap;
}

.broadcast-heading {
  min-width: 0;
  flex: 1 1 260px;
}

.broadcast-heading strong {
  display: block;
  font-size: 1.16rem;
  overflow-wrap: anywhere;
}

.broadcast-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tool-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}

.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.live-strip {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.04), transparent),
    rgba(0,0,0,0.18);
  overflow: hidden;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f25b4f;
  box-shadow: 0 0 14px #f25b4f;
  animation: livePulse 1.3s ease-in-out infinite;
  flex: 0 0 auto;
}

.script-pane {
  overflow: auto;
  padding: clamp(20px, 3vw, 34px);
  background:
    linear-gradient(180deg, rgba(0,0,0,0.08), transparent 16rem),
    repeating-linear-gradient(180deg, transparent 0 35px, rgba(255,255,255,0.035) 36px);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.section {
  max-width: 780px;
  margin: 0 auto 26px;
  padding: 0 0 22px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 900;
}

.section h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent), transparent 30%), transparent);
  opacity: 0.7;
}

.section p {
  margin: 0;
  max-width: 62ch;
  color: color-mix(in srgb, var(--text), white 2%);
  font-size: 1.03rem;
  line-height: 1.96;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

.paragraph {
  display: block;
  margin: 0 0 0.95em;
}

.paragraph:last-child {
  margin-bottom: 0;
}

.cursor::after {
  content: "▋";
  color: var(--accent);
  margin-left: 2px;
  animation: blink 700ms steps(1) infinite;
}

.page-footer {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.12) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
}

.noise-overlay.active {
  animation: noiseFlash 560ms linear infinite;
}

@keyframes scanMove {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 80px, 20px 20px; }
}

@keyframes signalPulse {
  from { opacity: 0.45; transform: scaleY(0.72); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes sweep {
  to { transform: translateX(100%); }
}

@keyframes livePulse {
  50% { transform: scale(0.72); opacity: 0.58; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes noiseFlash {
  0% { opacity: 0.05; transform: translateX(0); }
  20% { opacity: 0.22; transform: translateX(-2px); }
  45% { opacity: 0.1; transform: translateX(3px); }
  70% { opacity: 0.24; transform: translateX(-1px); }
  100% { opacity: 0.06; transform: translateX(0); }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .left-column {
    position: static;
  }

  .broadcast-card {
    min-height: 680px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding: 18px 0 24px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .radio-core,
  .field-grid,
  .button-grid,
  .knob-grid {
    grid-template-columns: 1fr;
  }

  .speaker-grid {
    min-height: 150px;
  }

  .script-pane {
    padding: 18px 16px 24px;
  }

  .section {
    margin-bottom: 22px;
  }

  .section p {
    max-width: none;
    font-size: 0.98rem;
  }
}

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