/* Shared styles: public page, login and admin panel.
   Palette comes from the ANOSH DUDE logo: warm black and signal red. */
:root {
  --bg: #0f0b0c;
  --bg2: #150f10;
  --panel: #1a1314;
  --panel2: #221a1b;
  --line: #2e2426;
  --text: #f4ede9;
  --muted: #9d8f8c;
  --red: #e2262f;
  --red-hi: #ff3d47;
  --green: #43d49b;
  --amber: #ffb347;
  --display: "Bahnschrift", "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Impact, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- controls ---------- */
button { font: inherit; cursor: pointer; }
.btn {
  background: var(--red);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn:hover { background: var(--red-hi); }
a.btn { text-decoration: none; display: inline-block; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: 6px 10px; font-size: 0.9rem; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
}
input[type="checkbox"] { width: auto; accent-color: var(--red); }
input[type="range"] { padding: 0; accent-color: var(--red); }
input[type="color"] { padding: 2px; height: 42px; }
textarea { resize: vertical; min-height: 90px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--red-hi);
  outline-offset: 2px;
}
label { display: block; font-size: 0.9rem; color: var(--muted); margin: 0 0 6px; }
a { color: inherit; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 340px;
}
.toast.error { border-left-color: var(--red); }
.toast a { color: var(--green); margin-left: 8px; }

/* ---------- public page ----------
   Home page of the channel: name and a rolling subscriber counter first, the live stream (when there is
   one) right under it, then the latest uploads and the music bot. */
body.public { min-height: 100vh; position: relative; overflow-x: hidden; }
.backdrop {
  position: fixed;
  inset: -60px;
  background-size: cover;
  background-position: center;
  filter: blur(80px) saturate(1.5) brightness(0.45);
  opacity: 0;
  transition: opacity 1.2s;
  z-index: 0;
}
.backdrop.on { opacity: 1; }
.veil { position: fixed; inset: 0; background: linear-gradient(180deg, rgba(15, 11, 12, 0.35), var(--bg) 75%); z-index: 0; }
.stage {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 88px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}
.stage h2 { font-size: 1.05rem; font-weight: 700; }

/* hero */
.hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 28px 40px; }
.hero-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; max-width: 100%; }
.identity { display: flex; align-items: center; gap: 20px; min-width: 0; }
.avatar {
  width: 96px; height: 96px; flex: none; border-radius: 50%; object-fit: cover; background: var(--panel);
  outline: 3px solid var(--red); outline-offset: 4px;
}
.who { min-width: 0; }
.who h1 {
  font-family: var(--display);
  font-stretch: condensed;
  font-weight: 800;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.handle { margin-top: 6px; }
.tagline { max-width: 46ch; color: #d8ccc8; font-size: 1.05rem; }

.count { margin-top: 6px; }
.odo {
  display: flex;
  align-items: flex-start;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: condensed;
  font-size: clamp(3.6rem, 13vw, 8rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  height: 1em;
}
.odo .d { width: 0.6em; height: 1em; overflow: hidden; }
.odo .sep { width: 0.26em; text-align: center; color: var(--muted); font-size: 0.7em; align-self: flex-end; line-height: 1; }
.odo .reel { display: flex; flex-direction: column; transition: transform 2.2s cubic-bezier(0.16, 0.84, 0.24, 1); }
.odo .reel i { display: block; height: 1em; line-height: 1; font-style: normal; text-align: center; }
.count-label { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 1.15rem; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); animation: pulse 2s ease-in-out infinite; }
.count-meta { margin-top: 2px; font-size: 0.95rem; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 900px) {
  .links { flex-direction: column; flex-wrap: nowrap; width: 250px; flex: none; }
  .links a { text-align: center; }
}
.links a {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(26, 19, 20, 0.7);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.links a:hover { background: var(--panel2); border-color: #4a3a3c; }
.links a.primary { background: var(--red); border-color: transparent; }
.links a.primary:hover { background: var(--red-hi); }

/* live stream */
.onair { display: flex; flex-direction: column; gap: 14px; }
.onair-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.onair-bar h2 { flex: 1 1 260px; min-width: 0; font-size: 1.25rem; line-height: 1.25; overflow-wrap: anywhere; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; background: var(--red); color: #fff;
  font-weight: 800; letter-spacing: 0.06em; font-size: 0.85rem; padding: 5px 12px; border-radius: 4px;
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: pulse 1.4s ease-in-out infinite; }
.theatre { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: stretch; }
.player, .chat { background: #000; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.player { aspect-ratio: 16 / 9; }
.chat { min-height: 420px; }
.player iframe, .chat iframe { width: 100%; height: 100%; border: 0; display: block; }
body.is-live .hero { align-items: center; }
body.is-live .who h1 { font-size: clamp(1.8rem, 4.5vw, 3rem); }
body.is-live .odo { font-size: clamp(2.6rem, 8vw, 4.4rem); }
body.is-live .stage { gap: 36px; }

.soon { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; padding: 16px 20px; border-left: 4px solid var(--amber); background: rgba(34, 26, 27, 0.7); text-decoration: none; border-radius: 0 8px 8px 0; }
.soon-when { color: var(--amber); font-weight: 700; }
.soon-title { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* latest videos: the newest is large, the next four fill the rest of the grid */
.videos h2, .music-head h2 { margin-bottom: 0; }
.videos h2 { margin-bottom: 14px; }
.vgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 16px; }
.v { display: flex; flex-direction: column; gap: 10px; text-decoration: none; min-width: 0; }
.v .thumb { aspect-ratio: 16 / 9; background: var(--panel); border-radius: 6px; overflow: hidden; }
.v .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s; }
.v:hover .thumb img { transform: scale(1.04); }
.v .vt {
  font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.v .vm { font-size: 0.88rem; color: var(--muted); margin-top: -4px; }
.v:hover .vt { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.v.big { grid-column: span 2; grid-row: span 2; }
.v.big .vt { font-size: 1.35rem; -webkit-line-clamp: 3; }

/* music bot */
.music { border-top: 1px solid var(--line); padding-top: 28px; display: flex; flex-direction: column; gap: 22px; }
.music-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mstate { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; color: var(--muted); }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; height: 4px; background: var(--muted); border-radius: 1px; }
.mstate.playing { color: var(--text); }
.mstate.playing .eq i { background: var(--green); animation: eq 900ms ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -300ms; }
.eq i:nth-child(3) { animation-delay: -600ms; }
.eq i:nth-child(4) { animation-delay: -150ms; }
.m-now { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 24px; align-items: center; }
.m-art { aspect-ratio: 1; border-radius: 6px; background: var(--panel); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 2.4rem; }
.m-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-info h3 {
  font-family: var(--display); font-stretch: condensed; font-weight: 800;
  font-size: clamp(1.5rem, 3.6vw, 2.3rem); line-height: 1.08; overflow-wrap: anywhere; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.m-info h3 a { text-decoration: none; }
.m-info h3 a:hover { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 3px; }
.m-info .muted { margin-top: 6px; }
.m-progress { height: 4px; background: rgba(255, 255, 255, 0.14); border-radius: 2px; margin-top: 18px; overflow: hidden; }
.m-progress i { display: block; height: 100%; width: 0; background: var(--red); }
.m-times { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; margin-top: 8px; font-variant-numeric: tabular-nums; }
.m-next { max-width: 720px; }
.m-next h3 { font-size: 0.95rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.q { list-style: none; margin: 0; padding: 0; }
.q li { display: flex; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.q .n, .q .d { color: var(--muted); font-variant-numeric: tabular-nums; }
.q .n { width: 1.6em; }
.q .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q .empty { color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }

@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 14px; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (max-width: 900px) {
  .theatre { grid-template-columns: minmax(0, 1fr); }
  .chat { min-height: 460px; }
  .vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .stage { padding: 28px 16px 64px; gap: 44px; }
  .identity { gap: 14px; }
  .avatar { width: 68px; height: 68px; outline-width: 2px; outline-offset: 3px; }
  .links { width: 100%; }
  .links a { flex: 1 1 auto; text-align: center; }
  .vgrid { grid-template-columns: minmax(0, 1fr); }
  .v.big { grid-column: auto; grid-row: auto; }
  .m-now { grid-template-columns: 88px minmax(0, 1fr); gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .odo .reel { transition: none; }
  .dot, .badge i { animation: none; }
  .mstate.playing .eq i { animation: none; height: 10px; }
  .backdrop, .v .thumb img { transition: none; }
}

/* ---------- login ---------- */
body.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 520px at 50% -10%, rgba(226, 38, 47, 0.28), transparent 60%), var(--bg);
}
.login-box { width: 100%; max-width: 360px; }
.login-box h1 { font-family: var(--display); font-stretch: condensed; font-weight: 800; font-size: 2.2rem; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.msg { min-height: 1.5em; color: #ff8f96; margin: 4px 0 12px; }
.login-box .btn { width: 100%; }
