:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: rgba(18, 23, 35, .88);
  --panel2: rgba(24, 30, 45, .92);
  --line: rgba(255,255,255,.10);
  --text: #f6f7fb;
  --muted: #9da8ba;
  --accent: #7d78ff;
  --accent2: #3dd8ff;
  --good: #43e39a;
  --bad: #ff647c;
  --warn: #ffca6a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 15%, rgba(125,120,255,.16), transparent 32rem),
    radial-gradient(circle at 85% 25%, rgba(61,216,255,.10), transparent 28rem),
    var(--bg);
  color: var(--text);
}

body { min-height: 100vh; }

a { color: inherit; }

.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.hero-card {
  width: min(840px, 100%);
  padding: clamp(28px, 5vw, 62px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(22,27,42,.92), rgba(12,16,26,.90));
  box-shadow: 0 30px 100px rgba(0,0,0,.45);
  backdrop-filter: blur(16px);
  position: relative;
  z-index: 2;
}

.eyebrow {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .22em;
  color: var(--accent2);
}

h1 {
  font-size: clamp(40px, 8vw, 76px);
  line-height: .98;
  margin: 14px 0 16px;
  letter-spacing: -.055em;
}

.admin-header h1 {
  font-size: clamp(28px, 4vw, 46px);
  margin: 8px 0 0;
}

.tagline {
  color: var(--muted);
  font-size: clamp(18px, 2.6vw, 24px);
  margin: 0 0 28px;
}

.badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}

.badge.accent {
  color: white;
  background: linear-gradient(90deg, rgba(125,120,255,.28), rgba(61,216,255,.15));
}
.badge.online { color: var(--good); }
.badge.offline { color: var(--warn); }

.player-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  border-radius: 22px;
  padding: 18px;
}

.play-button {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 0;
  color: #0b0e15;
  background: linear-gradient(135deg, #f7f7ff, #90edff);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(61,216,255,.20);
}

.player-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.player-copy strong { font-size: 18px; }
.player-copy span { color: var(--muted); }

.listeners {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.listener-number {
  display: block;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stats-grid > div {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}

.label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 6px;
}

.stats-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.footnote {
  margin: 18px 4px 0;
  color: #788398;
  font-size: 13px;
  line-height: 1.55;
}

.glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .12;
}
.glow-one { background: var(--accent); top: -120px; left: -100px; }
.glow-two { background: var(--accent2); bottom: -180px; right: -100px; }

.admin-page {
  padding: 28px;
}

.admin-header {
  width: min(1280px, 100%);
  margin: 0 auto 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.header-actions form { margin: 0; }

.admin-grid {
  width: min(1280px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0,0,0,.25);
}

.full { grid-column: 1 / -1; }

.panel h2 {
  margin: 6px 0 18px;
  font-size: 26px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 18px currentColor;
}
.status-dot.good { color: var(--good); background: var(--good); }
.status-dot.bad { color: var(--bad); background: var(--bad); }

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

.metric {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255,255,255,.02);
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.metric strong { font-size: 22px; }

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.button-row form { margin: 0; }

button, .ghost-button {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}

.primary {
  color: #080b12;
  background: linear-gradient(135deg, #a39fff, #71e6ff);
}
.secondary {
  color: var(--text);
  background: rgba(255,255,255,.09);
  border: 1px solid var(--line);
}
.danger {
  color: #fff;
  background: rgba(255,100,124,.20);
  border: 1px solid rgba(255,100,124,.35);
}
.ghost-button {
  color: var(--text);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
}

.config-form, .login-card form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
  margin-top: 7px;
}

input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 13px 14px;
  background: rgba(0,0,0,.25);
  color: var(--text);
  font: inherit;
  outline: none;
}
input:focus { border-color: rgba(125,120,255,.75); }

#logs {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #080b12;
  color: #b9c5d8;
  padding: 16px;
  line-height: 1.55;
}

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.flash.ok {
  background: rgba(67,227,154,.10);
  border: 1px solid rgba(67,227,154,.30);
}
.flash.error {
  background: rgba(255,100,124,.10);
  border: 1px solid rgba(255,100,124,.30);
}

.login-wrap {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}
.login-card { width: min(460px, 100%); }
.login-card h1 { font-size: 42px; }
.wide { width: 100%; margin-top: 10px; }
.back-link {
  display: inline-block;
  margin-top: 18px;
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 760px) {
  .stats-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .full { grid-column: auto; }
  .player-shell {
    grid-template-columns: auto 1fr;
  }
  .listeners {
    grid-column: 1 / -1;
    text-align: left;
  }
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }
}


.hidden { display: none !important; }

.event-banner {
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(61,216,255,.28);
  background: linear-gradient(90deg, rgba(125,120,255,.12), rgba(61,216,255,.08));
  display: grid;
  gap: 3px;
}

.event-kicker {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .18em;
  color: var(--accent2);
}

.event-banner strong {
  font-size: 20px;
}

.event-banner span:last-child,
.next-event span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.next-event {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.02);
  display: grid;
  gap: 4px;
}

.active-source-box {
  border: 1px solid rgba(125,120,255,.22);
  background: rgba(125,120,255,.07);
  border-radius: 16px;
  padding: 15px 16px;
  margin-bottom: 16px;
}

.config-form small,
.panel-help {
  color: var(--muted);
  line-height: 1.5;
}

.schedule-zone {
  color: var(--accent2);
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
}

.schedule-form {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
  margin-top: 18px;
}

.schedule-form > div {
  min-width: 0;
}

.schedule-add {
  display: flex;
  align-items: end;
}

.schedule-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.schedule-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: rgba(255,255,255,.025);
}

.schedule-item.disabled {
  opacity: .56;
}

.schedule-info {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.schedule-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.schedule-info > span {
  color: var(--muted);
  font-size: 13px;
}

.schedule-info code {
  color: #aeb9ca;
  overflow-wrap: anywhere;
  white-space: normal;
}

.schedule-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.schedule-actions form {
  margin: 0;
}

.mini-badge {
  font-size: 9px;
  letter-spacing: .09em;
  font-weight: 900;
  padding: 4px 7px;
  border-radius: 999px;
}

.mini-badge.enabled {
  color: var(--good);
  background: rgba(67,227,154,.08);
  border: 1px solid rgba(67,227,154,.22);
}

.mini-badge.disabled-badge {
  color: var(--muted);
  border: 1px solid var(--line);
}

.empty-schedule {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
}

@media (max-width: 1050px) {
  .schedule-form {
    grid-template-columns: 1fr 1fr;
  }
  .schedule-url {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .schedule-form {
    grid-template-columns: 1fr;
  }
  .schedule-url {
    grid-column: auto;
  }
  .schedule-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .schedule-actions {
    width: 100%;
  }
}
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 13px 14px;
  background: rgba(0,0,0,.25);
  color: var(--text);
  font: inherit;
  outline: none;
}
select:focus { border-color: rgba(125,120,255,.75); }

.relay-picker {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.03);
}
.relay-picker label {
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  color: var(--muted);
}

.add-relay-form {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
  margin-top: 18px;
}
.add-relay-form > div { min-width: 0; }
.add-relay-form label { margin-top: 0; }

.relay-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stream-link {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(61,216,255,.25);
  border-radius: 16px;
  background: rgba(61,216,255,.06);
}
.stream-link code {
  color: #bfe9ff;
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.relay-sub {
  margin: 28px 0 6px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .16em;
  color: var(--accent2);
  text-transform: uppercase;
}

.relay-logs {
  margin-top: 28px;
}
.relay-logs .label { margin-top: 20px; margin-bottom: 10px; }

.relay-log {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #080b12;
  color: #b9c5d8;
  padding: 16px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 1050px) {
  .add-relay-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .add-relay-form {
    grid-template-columns: 1fr;
  }
}