:root {
  color-scheme: dark;
  --bg: #090b0d;
  --surface: #111519;
  --surface-2: #171c21;
  --line: #293139;
  --text: #f3f5f6;
  --muted: #96a0aa;
  --orange: #ff6b32;
  --orange-2: #ff925e;
  --green: #68e09b;
  --danger: #ff6e78;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -4rem;
  padding: .75rem 1rem;
  background: white;
  color: black;
  border-radius: .5rem;
}
.skip-link:focus { top: 1rem; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 .65rem;
  color: var(--orange-2);
  font: 700 .72rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .18em;
}
.wordmark {
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: -.04em;
}
.wordmark span { color: var(--orange); margin-left: .2rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 750;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, summary:focus-visible, audio:focus-visible {
  outline: 3px solid rgba(255, 107, 50, .35);
  outline-offset: 2px;
}
.button:disabled { cursor: wait; opacity: .65; transform: none; }
.button-primary { background: var(--orange); color: #160903; }
.button-primary:hover { background: var(--orange-2); }
.button-secondary { background: #252d34; border-color: #3a444d; color: var(--text); }
.button-quiet { min-height: 38px; background: transparent; border-color: var(--line); color: #cbd1d6; }
.button-wide { width: 100%; }

.alert {
  padding: .85rem 1rem;
  border: 1px solid;
  border-radius: 12px;
  margin: 1rem 0;
}
.alert-error { color: #ffd7da; background: rgba(255, 74, 87, .09); border-color: rgba(255, 110, 120, .38); }
.alert-success { color: #cffff0; background: rgba(47, 211, 122, .09); border-color: rgba(104, 224, 155, .35); }

.login-shell, .settings-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 107, 50, .12), transparent 28rem),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}
.login-card, .settings-card {
  width: min(100%, 450px);
  padding: clamp(1.5rem, 5vw, 2.4rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(17, 21, 25, .94);
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
}
.login-card h1, .settings-card h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.5rem); letter-spacing: -.04em; }
.brand-mark { display: flex; align-items: flex-end; gap: 4px; height: 34px; margin-bottom: 1.7rem; }
.brand-mark span { display: block; width: 6px; border-radius: 9px; background: var(--orange); }
.brand-mark span:nth-child(1) { height: 18px; }
.brand-mark span:nth-child(2) { height: 32px; }
.brand-mark span:nth-child(3) { height: 24px; }
.stack-form { display: grid; gap: 1rem; margin-top: 1.4rem; }
.stack-form label, .upload-form label { display: grid; gap: .45rem; color: #cbd1d6; font-size: .9rem; font-weight: 650; }
input[type="text"], input[type="password"], input[type="file"] {
  width: 100%;
  min-height: 47px;
  border: 1px solid #35404a;
  border-radius: 10px;
  padding: .65rem .8rem;
  background: #0b0e11;
  color: var(--text);
}
input[type="file"] { padding: .55rem; font-size: .82rem; }
input::file-selector-button {
  margin-right: .65rem;
  border: 0;
  border-radius: 7px;
  padding: .45rem .65rem;
  background: #293139;
  color: white;
}
.security-note, .field-hint { margin: 1.2rem 0 0; color: #79838d; font-size: .78rem; }

.public-hero {
  min-height: 520px;
  padding: 1.4rem max(1.2rem, calc((100vw - 1200px) / 2));
  background:
    radial-gradient(circle at 76% 24%, rgba(255, 107, 50, .18), transparent 28rem),
    linear-gradient(115deg, #0e1114, #090b0d 64%);
  border-bottom: 1px solid var(--line);
}
.public-nav, .admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.live-pill, .system-badge {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  color: #b6c0c8;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .07em;
}
.live-pill i, .system-badge i, .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #59636d;
}
.live-pill i, .system-badge i, .status-dot.is-online { background: var(--green); box-shadow: 0 0 0 5px rgba(104, 224, 155, .1); }
.hero-copy { max-width: 820px; margin-top: clamp(6rem, 14vh, 10rem); }
.hero-copy h1 {
  margin: 0;
  font-size: clamp(3.2rem, 9vw, 7rem);
  line-height: .88;
  letter-spacing: -.075em;
}
.hero-copy h1 em { color: var(--orange); font-style: normal; }
.hero-copy > p:last-child { max-width: 570px; margin-top: 1.7rem; color: #a5afb7; font-size: 1.05rem; }
.public-main, .admin-main { width: min(1200px, calc(100% - 2.4rem)); margin: 0 auto; padding: 4rem 0; }
.section-heading, .admin-intro { display: flex; justify-content: space-between; gap: 2rem; align-items: flex-end; margin-bottom: 1.7rem; }
.section-heading h2, .admin-intro h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: -.055em; }
.station-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.15rem; }
.station-card {
  --accent: var(--orange);
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,.045), transparent 45%), var(--surface);
  box-shadow: 0 16px 45px rgba(0,0,0,.18);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.station-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--accent);
  opacity: .8;
}
.station-card::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  right: -90px;
  top: -95px;
  border-radius: 50%;
  background: var(--accent);
  filter: blur(70px);
  opacity: .11;
  pointer-events: none;
}
.station-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 22px 55px rgba(0,0,0,.28);
}
.accent-cyan { --accent: #45d5e8; }
.accent-violet { --accent: #9a7bff; }
.accent-lime { --accent: #b1de58; }
.accent-red { --accent: #ff5968; }
.accent-blue { --accent: #5b9cff; }
.station-topline { display: flex; align-items: center; gap: .55rem; color: #7f8992; font-size: .68rem; font-weight: 800; letter-spacing: .1em; }
.listeners { margin-left: auto; letter-spacing: 0; font-weight: 500; }
.station-card h3 { margin: 1.3rem 0 .1rem; font-size: 2rem; letter-spacing: -.05em; }
.station-description { margin: 0; color: var(--muted); font-size: .88rem; }
.now-playing { min-height: 75px; display: grid; align-content: center; gap: .25rem; margin: 1.35rem 0 .8rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.now-playing span { color: #74808a; text-transform: uppercase; font-size: .65rem; letter-spacing: .12em; }
.now-playing strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
audio { display: block; width: 100%; height: 38px; }
.station-card code { display: block; margin-top: .9rem; overflow: hidden; color: #64707a; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.public-footer { display: flex; justify-content: space-between; padding: 1.5rem max(1.2rem, calc((100vw - 1200px) / 2)); border-top: 1px solid var(--line); color: #68727a; font-size: .75rem; }

.public-grid { align-items: stretch; }
.public-grid .station-card { padding: 1.35rem; min-height: 415px; display: flex; flex-direction: column; }
.station-card-head { position: relative; z-index: 1; display: flex; align-items: center; min-height: 34px; }
.station-number {
  color: color-mix(in srgb, var(--accent) 76%, white);
  font: 800 .7rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .08em;
}
.station-signal { display: flex; align-items: center; gap: 3px; height: 20px; margin-left: 1rem; color: var(--accent); }
.station-signal i { width: 3px; border-radius: 10px; background: currentColor; opacity: .72; animation: signal 1.1s ease-in-out infinite alternate; }
.station-signal i:nth-child(1) { height: 7px; animation-delay: -.7s; }
.station-signal i:nth-child(2) { height: 14px; animation-delay: -.4s; }
.station-signal i:nth-child(3) { height: 20px; animation-delay: -.1s; }
.station-signal i:nth-child(4) { height: 11px; animation-delay: -.55s; }
.station-signal i:nth-child(5) { height: 5px; animation-delay: -.25s; }
@keyframes signal { to { transform: scaleY(.42); opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .station-signal i { animation: none; }
  .station-card, .button { transition: none; }
}
.station-card-head .station-topline {
  margin-left: auto;
  padding: .38rem .58rem;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 99px;
  background: rgba(5,7,9,.45);
}
.station-identity { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.station-identity .station-description { margin-top: .15rem; }
.station-identity h3 { margin: 0; font-size: clamp(2rem, 4vw, 2.65rem); }
.listener-chip { flex: 0 0 auto; padding: .35rem .55rem; border-radius: 8px; color: #89949d; background: rgba(255,255,255,.045); font-size: .67rem; }
.listener-chip b { color: #d7dde1; }
.public-grid .now-playing {
  position: relative;
  z-index: 1;
  min-height: 92px;
  margin: 1.35rem 0 1rem;
  padding: .85rem .9rem;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  background: rgba(5,7,9,.42);
}
.public-grid .now-playing span { display: flex; align-items: center; gap: .45rem; }
.public-grid .now-playing span i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.public-grid .now-playing strong { font-size: .95rem; }
.station-player { position: relative; z-index: 1; padding: .55rem; border-radius: 12px; background: #080a0c; }
.station-player audio { height: 40px; }
.stream-address { position: relative; z-index: 1; display: grid; gap: .2rem; margin-top: auto; padding-top: 1rem; }
.stream-address > span { color: #56616a; font-size: .61rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.stream-address code { margin: 0; color: #77828b; }

.admin-header {
  min-height: 68px;
  padding: 0 max(1.2rem, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 13, .9);
}
.admin-actions { display: flex; align-items: center; gap: .65rem; }
.admin-actions form { display: contents; }
.admin-user { color: #8e98a1; font-size: .82rem; margin-right: .25rem; }
.admin-main { padding-top: 3rem; }
.admin-intro { align-items: center; }
.admin-intro h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
.admin-intro p:last-child { margin-bottom: 0; }
.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-card { padding: 1.4rem; }
.admin-station-title { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-top: 1.25rem; }
.admin-station-title h2 { margin: 0; font-size: 1.8rem; letter-spacing: -.045em; }
.admin-station-title p { margin: .1rem 0 0; color: var(--muted); font-size: .84rem; }
.track-count { padding: .32rem .55rem; border: 1px solid var(--line); border-radius: 99px; color: #9ca6ae; font-size: .7rem; white-space: nowrap; }
.control-row { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; }
.stream-health { color: #65717a; font-size: .7rem; }
.upload-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .7rem; margin-top: 1.3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.upload-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: .45rem;
  padding: .8rem .9rem;
  border: 1px solid #303941;
  border-radius: 11px;
  background: rgba(5,7,9,.42);
}
.upload-progress[hidden] { display: none; }
.upload-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: #aeb7be; font-size: .72rem; }
.upload-progress-head strong { color: var(--accent); font: 800 .7rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.upload-progress progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #20272c;
  color: var(--accent);
  appearance: none;
}
.upload-progress progress::-webkit-progress-bar { border-radius: 99px; background: #20272c; }
.upload-progress progress::-webkit-progress-value { border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, white)); transition: width .15s ease; }
.upload-progress progress::-moz-progress-bar { border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, white)); }
.upload-current { overflow: hidden; color: #68737c; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.upload-result { color: #91a0a9; font-size: .68rem; }
.upload-result.is-success { color: var(--green); }
.upload-result.is-error { color: #ff9aa2; }
.track-list { margin-top: 1.15rem; border: 1px solid var(--line); border-radius: 13px; background: rgba(5,7,9,.32); overflow: hidden; }
.track-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  cursor: pointer;
  color: #c7cdd2;
  font-size: .82rem;
  font-weight: 750;
  list-style: none;
}
.track-list summary::-webkit-details-marker { display: none; }
.track-list summary::after { content: "+"; margin-left: auto; color: var(--accent); font-size: 1.15rem; font-weight: 400; }
.track-list[open] summary::after { content: "−"; }
.track-list summary small { margin-left: .25rem; color: #66717a; font-size: .68rem; font-weight: 600; }
.track-list[open] summary { border-bottom: 1px solid var(--line); }
.playlist-table { max-height: 390px; overflow: auto; margin: 0; padding: .35rem .65rem; list-style: none; scrollbar-color: #3d4851 transparent; }
.playlist-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
  padding: .65rem .35rem;
  border-bottom: 1px solid rgba(255,255,255,.055);
}
.playlist-row:last-child { border-bottom: 0; }
.track-index { color: #4f5a63; font: 700 .68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.track-info { min-width: 0; display: grid; gap: .14rem; }
.track-info strong { overflow: hidden; color: #d7dce0; font-size: .78rem; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.track-info small { color: #626d75; font-size: .62rem; text-transform: uppercase; }
.track-actions { display: flex; align-items: center; gap: .35rem; }
.track-actions form { display: contents; }
.track-action {
  min-height: 30px;
  padding: .35rem .52rem;
  border: 1px solid #313a42;
  border-radius: 7px;
  background: #1a2025;
  color: #aeb7be;
  cursor: pointer;
  font-size: .64rem;
  font-weight: 750;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.track-action:hover { border-color: #53606a; color: white; }
.track-action-air { border-color: color-mix(in srgb, var(--accent) 38%, #313a42); color: color-mix(in srgb, var(--accent) 72%, white); }
.track-action-air:hover { background: color-mix(in srgb, var(--accent) 17%, #1a2025); border-color: var(--accent); }
.track-action-delete { background: transparent; color: #a26c72; }
.track-action-delete:hover { border-color: rgba(255,110,120,.55); background: rgba(255,110,120,.08); color: #ff9aa2; }
.empty-playlist { display: grid; gap: .2rem; padding: 1.2rem 1rem; color: #aeb6bc; font-size: .8rem; }
.empty-playlist span { color: #66717a; font-size: .7rem; }

.preview-dock {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 1.2rem;
  width: min(760px, calc(100% - 2rem));
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.2fr) 34px;
  align-items: center;
  gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid #3a454e;
  border-radius: 16px;
  background: rgba(17,21,25,.97);
  box-shadow: 0 22px 70px rgba(0,0,0,.55);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}
.preview-dock[hidden] { display: none; }
.preview-copy { min-width: 0; display: grid; gap: .14rem; }
.preview-copy span { color: var(--orange-2); font-size: .58rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.preview-copy strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.preview-close { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: #929ca4; cursor: pointer; font-size: 1.25rem; line-height: 1; }
.preview-close:hover { color: white; border-color: #59656e; }
.compact-header { position: fixed; inset: 0 0 auto; z-index: 2; }

@media (max-width: 900px) {
  .station-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .public-hero { min-height: 450px; }
  .station-grid { grid-template-columns: 1fr; }
  .section-heading, .admin-intro { display: block; }
  .section-heading > p, .system-badge { margin-top: 1rem; }
  .admin-header { align-items: flex-start; padding-top: .9rem; padding-bottom: .9rem; }
  .admin-actions { flex-wrap: wrap; justify-content: flex-end; }
  .admin-user { display: none; }
  .upload-form { grid-template-columns: 1fr; }
  .upload-form .button { width: 100%; }
  .public-footer { display: grid; gap: .4rem; }
  .public-grid .station-card { min-height: 390px; }
  .listener-chip { display: none; }
  .playlist-row { grid-template-columns: 28px minmax(0, 1fr); }
  .track-actions { grid-column: 2; flex-wrap: wrap; }
  .preview-dock { grid-template-columns: 1fr 34px; gap: .65rem; }
  .preview-dock audio { grid-column: 1 / -1; grid-row: 2; }
  .preview-close { grid-column: 2; grid-row: 1; }
}
