:root {
  color-scheme: dark;
  --ink: #f7f2e9;
  --muted: #b8b2a8;
  --night: #111118;
  --panel: rgba(26, 27, 35, 0.88);
  --line: rgba(247, 242, 233, 0.14);
  --pink: #ff4f87;
  --cyan: #20d7c9;
  --gold: #ffcd4b;
  --green: #74e66d;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--night);
  color: var(--ink);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.public {
  overflow-x: hidden;
  background:
    linear-gradient(120deg, rgba(255, 79, 135, 0.22), transparent 30%),
    linear-gradient(240deg, rgba(32, 215, 201, 0.18), transparent 32%),
    #111118;
}

.radio-shell {
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(16px, 4vw, 40px);
  display: grid;
  gap: 20px;
  place-items: center;
}

.stage {
  position: relative;
  width: min(1064px, 95%);
  min-height: min(722px, calc(95vh - 32px));
  min-height: min(722px, calc(95svh - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111118;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

.signal-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 18px),
    linear-gradient(180deg, rgba(17, 17, 24, 0.12), rgba(17, 17, 24, 0.86));
  pointer-events: none;
}

.brand-mark,
.broadcast-actions,
.player-panel {
  position: relative;
  z-index: 1;
}

.brand-mark {
  position: absolute;
  top: clamp(18px, 4vw, 34px);
  left: clamp(18px, 4vw, 34px);
  display: grid;
  gap: 4px;
  text-transform: uppercase;
}

.brand-mark span {
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  font-weight: 900;
  color: var(--ink);
}

.brand-mark strong {
  width: 100%;
  padding: 4px 9px;
  background: var(--gold);
  color: #17110a;
  font-size: clamp(1.5rem, 4vw, 3.5rem);
  line-height: 0.95;
  font-weight: 950;
  text-align: center;
}

.broadcast-actions {
  position: absolute;
  top: clamp(18px, 4vw, 34px);
  right: clamp(18px, 4vw, 34px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(17, 17, 24, 0.72);
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.78rem;
}

.live-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
}

.player-panel {
  position: absolute;
  left: clamp(18px, 5vw, 70px);
  right: clamp(18px, 5vw, 70px);
  bottom: clamp(18px, 5vw, 70px);
  max-width: 720px;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.player-panel h1 {
  min-height: 1.1em;
  margin: 0;
  font-size: clamp(2rem, 6vw, 5rem);
  line-height: 0.98;
  overflow-wrap: anywhere;
}

.now-playing-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.artwork-frame {
  width: 132px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.artwork-frame[hidden] {
  display: none;
}

.artwork-frame.is-placeholder {
  border-color: transparent;
  background: transparent;
}

.artwork-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artist,
.detail {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  overflow-wrap: anywhere;
}

.track-progress {
  width: 100%;
}

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

.track-progress-rail {
  height: 5px;
  overflow: hidden;
  background: rgba(123, 69, 166, 0.46);
}

.track-progress-rail span {
  display: block;
  width: 0;
  height: 100%;
  background: #c26cff;
  transition: width 300ms linear;
}

.track-progress-times {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 5px;
  color: #ad7dce;
  font-size: 0.82rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.track-time-divider {
  color: #81559f;
}

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.level-controls {
  display: grid;
  width: min(260px, 100%);
  gap: 8px;
}

.listen-button,
.icon-button,
.news-button,
.primary-button,
.secondary-button,
.text-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
}

.listen-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  background: var(--pink);
  color: white;
  font-weight: 900;
}

.listen-button svg,
.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.listen-button.is-hidden {
  display: none;
}

.news-button {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(17, 17, 24, 0.72);
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
}

.news-button:hover:not(:disabled) {
  border-color: rgba(255, 205, 75, 0.72);
  background: rgba(255, 205, 75, 0.14);
}

.news-button.is-cancel {
  border-color: rgba(255, 79, 135, 0.66);
  background: rgba(255, 79, 135, 0.18);
  color: var(--pink);
}

.news-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
}

.icon-button.is-muted {
  color: var(--pink);
}

.volume {
  width: 100%;
  accent-color: var(--cyan);
}

.admin-body {
  min-height: 100vh;
  background: #15151b;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px clamp(18px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: #111118;
}

.admin-topbar h1,
.login-box h1,
.admin-panel h2 {
  margin: 0;
}

.admin-topbar nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-topbar a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--cyan);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 18px;
  padding: clamp(18px, 4vw, 40px);
}

.admin-panel,
.login-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 25, 32, 0.94);
  padding: 20px;
}

.status-panel {
  align-self: start;
}

.playlist-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.status-list dt {
  color: var(--muted);
}

.status-list dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.inline-form,
.root-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.inline-form {
  margin: 18px 0;
}

.inline-form input,
.login-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0f0f15;
  color: var(--ink);
}

.primary-button,
.secondary-button {
  min-height: 44px;
  padding: 0 14px;
  font-weight: 850;
}

.primary-button {
  background: var(--cyan);
  color: #06211f;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.1);
}

.text-button {
  padding: 8px 10px;
  background: rgba(255, 79, 135, 0.15);
  color: var(--ink);
}

.root-list {
  display: grid;
  gap: 8px;
}

.root-row {
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.root-row code {
  overflow-wrap: anywhere;
  color: var(--gold);
}

.file-list {
  max-height: 62vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-list h3 {
  position: sticky;
  top: 0;
  margin: 0;
  padding: 11px 14px;
  background: #101016;
  color: var(--gold);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  z-index: 1;
}

.file-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.file-row input {
  margin-top: 4px;
  accent-color: var(--cyan);
}

.file-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.file-row strong,
.file-row small {
  overflow-wrap: anywhere;
}

.file-row small {
  color: var(--muted);
}

.notice {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(32, 215, 201, 0.35);
  border-radius: 8px;
  background: rgba(32, 215, 201, 0.12);
}

.notice.warning {
  border-color: rgba(255, 205, 75, 0.45);
  background: rgba(255, 205, 75, 0.12);
}

.empty-state {
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-box {
  width: min(420px, 100%);
}

.login-box label {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .stage {
    width: 100%;
    min-height: calc(95vh - 32px);
    min-height: calc(95svh - 32px);
  }

  .brand-mark strong {
    font-size: 2.1rem;
  }

  .player-panel {
    bottom: 84px;
  }

  .level-controls {
    width: min(260px, 100%);
  }

  .now-playing-layout {
    gap: 14px;
  }

  .artwork-frame {
    width: 96px;
  }

  .admin-topbar,
  .panel-heading,
  .inline-form,
  .root-row {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 820px) {
  .radio-shell {
    min-height: 100vh;
    min-height: 100svh;
    padding: 8px;
  }

  .stage {
    width: 100%;
    min-height: calc(100vh - 16px);
    min-height: calc(100svh - 16px);
    border-radius: 6px;
  }

  .brand-mark {
    top: 10px;
    left: 12px;
    gap: 2px;
  }

  .brand-mark span {
    font-size: clamp(0.86rem, 2vw, 1.15rem);
  }

  .brand-mark strong {
    padding: 3px 6px;
    font-size: clamp(1.1rem, 3vw, 1.65rem);
  }

  .broadcast-actions {
    top: 10px;
    right: 12px;
    gap: 6px;
  }

  .live-pill,
  .news-button {
    padding: 6px 9px;
    font-size: 0.68rem;
  }

  .live-pill {
    gap: 6px;
  }

  .live-pill span {
    width: 7px;
    height: 7px;
  }

  .player-panel {
    left: 50%;
    right: auto;
    bottom: 10px;
    width: min(760px, calc(100% - 80px));
    max-width: none;
    padding: 14px 18px;
    transform: translateX(-50%);
  }

  .now-playing-layout {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 14px;
  }

  .artwork-frame {
    width: 80px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.68rem;
  }

  .player-panel h1 {
    font-size: clamp(1.65rem, 4vw, 3rem);
  }

  .artist,
  .detail {
    margin-top: 6px;
    font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  }

  .controls {
    gap: 10px;
    margin-top: 14px;
  }

  .listen-button,
  .icon-button {
    min-height: 44px;
  }

  .listen-button {
    padding: 0 14px;
  }

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

  .level-controls {
    width: min(250px, 100%);
    gap: 6px;
  }

  .track-progress-times {
    margin-top: 4px;
    font-size: 0.75rem;
  }
}
