:root {
  --bg: #0a0a0c;
  --bg-2: #111114;
  --ink: #f2efe9;
  --muted: #8b867c;
  --line: #232227;
  --signal: #ff7a1a;
  --signal-2: #ffb061;
  --glow: rgba(255, 122, 26, 0.16);
  --ok: #5ad19a;
  --radius: 16px;
  --mono: "DM Mono", ui-monospace, monospace;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--display);
  background:
    radial-gradient(120% 90% at 50% -10%, #18130d 0%, var(--bg) 46%) fixed,
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 999; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); }

.wordmark {
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: clamp(2rem, 7vw, 3rem);
  background: linear-gradient(100deg, var(--ink) 30%, var(--signal-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: radial-gradient(80% 60% at 50% 40%, #1a140d, var(--bg) 70%);
}
.gate-inner { text-align: center; animation: rise 0.8s cubic-bezier(.2,.8,.2,1) both; }
.gate-mark { font-size: clamp(3rem, 14vw, 7rem); }
.gate-sub { color: var(--muted); letter-spacing: 0.32em; text-transform: uppercase; font-size: 0.72rem; margin-top: 0.2rem; font-family: var(--mono); }
.start-btn {
  margin-top: 2.4rem; display: inline-flex; align-items: center; gap: 0.7rem;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
  color: #120c05; background: linear-gradient(180deg, var(--signal-2), var(--signal));
  border: none; padding: 1rem 2.4rem; border-radius: 100px; cursor: pointer;
  box-shadow: 0 0 0 0 var(--glow), 0 14px 40px -12px var(--signal);
  transition: transform .15s, box-shadow .4s;
}
.start-btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 0 0 14px transparent, 0 18px 50px -10px var(--signal); }
.start-btn:active { transform: scale(.98); }
.start-ico { font-size: 0.85rem; }
.gate-hint { color: var(--muted); margin-top: 1.6rem; font-size: 0.8rem; letter-spacing: 0.04em; }
.gate-greeting { color: var(--signal-2); margin-top: 1.2rem; font-size: 0.85rem; font-family: var(--mono); letter-spacing: 0.06em; }

/* Access gate */
.access-inner { max-width: 380px; }
.access-label { display: block; color: var(--muted); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; margin: 1.6rem 0 0.5rem; text-align: left; }
#accessName { width: 100%; background: #0c0c0f; border: 1px solid var(--line); color: var(--ink); border-radius: 12px; padding: 0.9rem 1rem; font-family: var(--display); font-size: 1rem; }
#accessName:focus { outline: none; border-color: var(--signal); }
.access-hint { color: var(--muted); font-size: 0.78rem; margin-top: 1rem; line-height: 1.4; }
.access-err { color: #ff9b9b; font-size: 0.8rem; min-height: 1em; margin-top: 0.7rem; }
.access-spin { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--signal); border-radius: 50%; margin: 1.6rem auto 0.8rem; animation: spin 1s linear infinite; }
.access-name-line { color: var(--ink); margin-top: 0.4rem; font-size: 0.95rem; }
.access-bad { font-size: 2.5rem; margin: 1.4rem 0 0.4rem; }
.btn-link { background: none; border: none; color: var(--signal-2); font-family: var(--mono); font-size: 0.75rem; cursor: pointer; text-decoration: underline; margin-top: 1rem; }
.btn-link:hover { color: var(--signal); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- App ---------- */
.app {
  min-height: 100dvh; max-width: 720px; margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem); display: flex; flex-direction: column; gap: 1.4rem;
  animation: rise 0.6s cubic-bezier(.2,.8,.2,1) both;
}

.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; flex-direction: column; }
.brand .wordmark { font-size: clamp(1.6rem, 5vw, 2.1rem); }
.brand .sub { color: var(--muted); letter-spacing: 0.28em; text-transform: uppercase; font-size: 0.62rem; font-family: var(--mono); }
.onair { display: flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em; color: var(--signal-2); }
.onair .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 12px var(--signal); animation: pulse 1.6s ease-in-out infinite; }

/* Stage */
.stage {
  position: relative; background: linear-gradient(180deg, var(--bg-2), #0c0c0f);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem 1.6rem 1.6rem;
  overflow: hidden;
}
.stage::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 80% -10%, var(--glow), transparent 60%);
}

.eq { position: absolute; top: 0; right: 1.4rem; height: 56px; display: flex; align-items: flex-end; gap: 4px; opacity: 0.55; }
.eq span { width: 4px; height: 8px; background: linear-gradient(var(--signal-2), var(--signal)); border-radius: 2px; }
.playing .eq span { animation: bounce 0.9s ease-in-out infinite; }
.eq span:nth-child(2n){ animation-duration: 1.1s; }
.eq span:nth-child(3n){ animation-duration: 0.7s; }
.eq span:nth-child(4n){ animation-duration: 1.3s; }
.eq span:nth-child(odd){ animation-delay: 0.15s; }

.now { position: relative; }
.now-label, .next-label, .now-artist { font-family: var(--mono); }
.now-label { color: var(--signal); font-size: 0.62rem; letter-spacing: 0.3em; }
.now-title { font-weight: 700; font-size: clamp(1.5rem, 6vw, 2.4rem); line-height: 1.05; margin: 0.5rem 0 0.2rem; letter-spacing: -0.02em; }
.now-artist { color: var(--muted); font-size: 0.85rem; min-height: 1.1em; }

.progress { margin-top: 1.6rem; }
.bar { height: 4px; background: #26242a; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--signal), var(--signal-2)); box-shadow: 0 0 12px var(--glow); transition: width 0.25s linear; }
.times { display: flex; justify-content: space-between; margin-top: 0.5rem; font-size: 0.72rem; color: var(--muted); }

.next { margin-top: 1.3rem; display: flex; gap: 0.7rem; align-items: baseline; font-size: 0.85rem; color: var(--ink); }
.next-label { color: var(--muted); font-size: 0.6rem; letter-spacing: 0.24em; }
#nextTitle { color: var(--muted); }

/* Controls */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.vol { display: flex; align-items: center; gap: 0.8rem; flex: 1; max-width: 320px; }
.icon-btn { background: none; border: 1px solid var(--line); width: 42px; height: 42px; border-radius: 12px; color: var(--ink); font-size: 1rem; cursor: pointer; transition: border-color .2s, background .2s; }
.icon-btn:hover { border-color: var(--signal); background: var(--glow); }
input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 4px; background: #26242a; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 10px var(--signal); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: none; border-radius: 50%; background: var(--signal); }
.syncline { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

/* Channels */
.channels-head { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.3em; color: var(--muted); text-transform: uppercase; margin-bottom: 0.8rem; }
.tabs-pub { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tab-pub { background: none; border: none; padding: 0.55rem 0.9rem; color: var(--muted); font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer; border-bottom: 2px solid transparent; transition: color .15s; }
.tab-pub:hover { color: var(--ink); }
.tab-pub.active { color: var(--signal-2); border-bottom-color: var(--signal); }
.channel.radio .c-name::before { content: "📻 "; }
.channel.radio .c-genre { font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.15em; color: var(--signal); text-transform: uppercase; margin-bottom: 0.2rem; }
.channel.radio.active { box-shadow: 0 0 0 1px var(--signal) inset; }
.channel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
.channel {
  text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 0.9rem 1rem; cursor: pointer; color: var(--ink); transition: transform .15s, border-color .2s, background .2s;
  font-family: var(--display);
}
.channel:hover { transform: translateY(-2px); border-color: #3a3742; }
.channel.active { border-color: var(--signal); background: linear-gradient(180deg, #1a130b, var(--bg-2)); box-shadow: 0 0 0 1px var(--signal) inset; }
.channel .c-name { font-weight: 700; font-size: 0.98rem; }
.channel .c-meta { font-family: var(--mono); font-size: 0.64rem; color: var(--muted); margin-top: 0.3rem; }
.channel.active .c-name { color: var(--signal-2); }

/* Foot */
.foot { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.66rem; opacity: 0.7; }
.admin-link { color: var(--muted); text-decoration: none; letter-spacing: 0.2em; text-transform: uppercase; font-family: var(--mono); }
.admin-link:hover { color: var(--signal); }

.live-tag {
  display: inline-block; font-family: var(--mono); font-size: 0.5rem;
  letter-spacing: 0.18em; padding: 2px 6px; border-radius: 4px;
  background: var(--signal); color: #120c05; margin-left: 0.3rem; vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}
.channel.is-live { border-color: var(--signal); }
body.live .onair .dot { background: #ff3333; box-shadow: 0 0 12px #ff3333; }
body.live .onair { color: #ff8c8c; }

@keyframes pulse { 0%,100%{ transform: scale(1); opacity: 1;} 50%{ transform: scale(1.5); opacity: 0.5;} }
@keyframes bounce { 0%,100%{ height: 8px;} 50%{ height: 40px;} }
@keyframes rise { from { opacity: 0; transform: translateY(14px);} to { opacity: 1; transform: none;} }

@media (max-width: 480px) {
  .channel-list { grid-template-columns: repeat(2, 1fr); }
  .controls { flex-direction: column; align-items: stretch; }
  .vol { max-width: none; }
}
