/* ═══════════════ FANSUBSTREAM THEME ═══════════════
   Design language: a subtitle timing sheet wrapped around a letterboxed frame.
   Serif carries the story (titles, descriptions); mono carries the pipeline
   (timecodes, episode tags, encode specs, form labels). Sharp corners, hairline
   borders, one warm gold accent — no glossy gradients, no rounded-pill chrome. */
:root {
  --bg: #0B0A08;
  --bg-2: #0F0D09;
  --surface: #15130E;
  --card: #15130E;
  --card-hover: #1F1C15;
  --border: rgba(237, 232, 220, 0.12);
  --border-strong: rgba(237, 232, 220, 0.22);
  --text: #EDE8DC;
  --muted: #948C77;
  --accent: #F2C744;
  --accent-ink: #201804;
  --green: #6FBF9E;
  --gold: #F2C744;
  --badge: #C4432E;
  --radius: 3px;
  --radius-sm: 2px;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Source Serif 4', 'Iowan Old Style', Palatino, Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  --font-head: var(--font-mono);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  --navbar-h: 58px;
}

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

/* author display rules (e.g. display:grid on .modal-backdrop) would otherwise
   override the hidden attribute — force it so [hidden] always hides */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ═══════════════ BUTTONS ═══════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.05em;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }
.btn-lg { padding: 12px 24px; font-size: 0.85rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn-ghost { background: none; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: none; border: 1px solid var(--border);
  border-radius: 50%; color: var(--text); position: relative;
  transition: border-color 0.2s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 20px; background: var(--accent);
  color: var(--accent-ink); font-size: 0.62rem; font-weight: 700;
  display: grid; place-items: center;
}

/* ═══════════════ NAVBAR ═══════════════ */
.navbar {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--navbar-h);
  transition: background 0.3s, border-color 0.3s;
  background: transparent; border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.watch-page .navbar, .admin-page .navbar {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1180px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 22px; padding: 0 28px;
}

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-weight: 600; font-size: 0.92rem; letter-spacing: 0.16em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); display: grid; place-items: center;
  font-size: 0.72rem; color: var(--accent); overflow: hidden; flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name em { font-style: normal; color: var(--accent); font-weight: 700; }

.nav-links { display: flex; gap: 22px; margin-left: 10px; }
.nav-link {
  position: relative; padding: 4px 0; color: var(--muted);
  font-size: 0.86rem; border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--text); border-color: var(--accent); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.search-box {
  position: relative; display: flex; align-items: center;
  transition: width 0.3s ease;
}
.search-icon { position: absolute; left: 12px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 36px; padding: 9px 14px 9px 36px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; outline: none;
  transition: border-color 0.2s, width 0.25s;
}
.search-box input:focus,
.search-box input:not(:placeholder-shown) { border-color: var(--accent); width: 220px; cursor: text; }
.search-box input::placeholder { color: var(--muted); }

.menu-btn { display: none; }

.nav-cta { padding: 8px 16px; font-size: 0.76rem; }

/* drawer (mobile) */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(300px, 82vw); z-index: 300;
  background: var(--bg-2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; padding: 22px;
  transform: translateX(105%); transition: transform 0.3s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 250; background: rgba(0, 0, 0, 0.6);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.drawer-links { display: flex; flex-direction: column; gap: 6px; }
.drawer-link { padding: 12px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 0.92rem; border-bottom: 1px solid var(--border); }
.drawer-link:hover { color: var(--accent); }
.drawer-cta { justify-content: center; margin-top: 14px; }

/* ═══════════════ HERO ═══════════════
   A bounded, letterboxed frame (not a full-viewport banner) — the hero is a
   single "poster" for the featured title, centered, click-through to watch. */
.hero-shell { max-width: 1180px; margin: 0 auto; padding: 24px 28px 0; }
.hero {
  position: relative; aspect-ratio: 21 / 9; min-height: 320px;
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  border: 1px solid var(--border);
  display: flex; align-items: flex-end; justify-content: center;
  animation: riseIn 0.4s ease both;
}
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.hero:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 130% at 15% 0%, color-mix(in srgb, var(--c1, #0e5a4d) 32%, transparent), transparent 60%),
    radial-gradient(110% 120% at 85% 100%, color-mix(in srgb, var(--c2, #2fbfa8) 36%, transparent), transparent 65%),
    var(--surface);
}
.hero-bg::after {
  content: ''; position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay; pointer-events: none;
  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' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hero-fade { display: none; }

.hero-fav {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg) 55%, transparent); color: var(--text);
  display: grid; place-items: center; transition: border-color 0.2s;
}
.hero-fav:hover { border-color: var(--accent); }
.hero-fav.active { border-color: var(--accent); }
.hero-fav.active svg { fill: var(--accent); stroke: var(--accent); }
.hero-fav svg { width: 16px; height: 16px; }

.hero-caption {
  position: relative; z-index: 2; max-width: 680px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; padding: 0 24px 30px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.8rem); line-height: 1.1; text-wrap: balance;
}
.hero-divider { width: 32px; height: 2px; background: var(--accent); }
.hero-jp { color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.1em; }
.hero-meta { font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.04em; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.hero-meta .dot { opacity: 0.5; }
.hero-meta .star { color: var(--accent); }
.chip-static {
  padding: 4px 11px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.03em;
  border: 1px solid var(--border); color: var(--muted);
}
.chip-static.rating { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ═══════════════ ROWS ═══════════════ */
.row-section { max-width: 1180px; margin: 0 auto; padding: 30px 28px 10px; }
.row-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.row-title { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; }
.row-more { color: var(--muted); font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.04em; transition: color 0.2s; display: inline-flex; align-items: center; gap: 4px; }
.row-more:hover { color: var(--accent); }
.row-note { color: var(--muted); font-family: var(--font-mono); font-size: 0.72rem; }

.row-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: 172px;
  gap: 16px; overflow-x: auto; padding: 6px 4px 18px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.row-scroll > * { scroll-snap-align: start; }

/* ═══════════════ RELEASE LOG ═══════════════ */
.log-section { max-width: 1180px; margin: 40px auto 0; padding: 30px 28px 10px; border-top: 1px solid var(--border); }
.log-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.log-row {
  display: grid; grid-template-columns: 88px 1fr auto auto; align-items: center; gap: 16px;
  padding: 13px 4px; border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.log-row:hover { background: var(--surface); }
.log-time { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.log-main { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.log-tag {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.04em;
  color: var(--badge); border: 1px solid color-mix(in srgb, var(--badge) 55%, transparent);
  padding: 1px 6px; border-radius: var(--radius-sm); white-space: nowrap; flex-shrink: 0;
}
.log-title { font-family: var(--font-display); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-ep { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.log-spec { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); white-space: nowrap; letter-spacing: 0.02em; }

/* ═══════════════ CARDS ═══════════════
   poster + caption below, matching the mock exactly — no image overlay chrome */
.card {
  display: flex; flex-direction: column; gap: 10px; cursor: pointer;
  animation: cardIn 0.4s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(155deg, color-mix(in srgb, var(--c1) 88%, transparent), color-mix(in srgb, var(--c2) 78%, var(--bg)));
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover .poster { border-color: var(--border-strong); transform: translateY(-2px); }
.poster .jp {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.5rem; color: color-mix(in srgb, var(--text) 65%, transparent);
  writing-mode: vertical-rl; letter-spacing: 0.14em;
}
.poster .rating {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--accent);
  background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 2px 6px; border-radius: var(--radius-sm);
}
.poster .strip {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.03em; color: var(--text);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  padding: 5px 8px; border-top: 1px solid var(--border);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}
.card:hover .poster .strip { opacity: 1; transform: none; }

.poster-fav {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--text);
  display: grid; place-items: center; opacity: 0;
  transition: opacity 0.2s, border-color 0.2s;
}
.card:hover .poster-fav { opacity: 1; }
.poster-fav:hover { border-color: var(--accent); }
.poster-fav.active { opacity: 1; border-color: var(--accent); }
.poster-fav.active svg { fill: var(--accent); stroke: var(--accent); }
.poster-fav svg { width: 12px; height: 12px; }

.card-title {
  font-family: var(--font-display); font-weight: 500; font-size: 0.96rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { color: var(--muted); font-family: var(--font-mono); font-size: 0.7rem; }

/* ═══════════════ CATALOG ═══════════════ */
.catalog-section { max-width: 1180px; margin: 0 auto; padding: 36px 28px; scroll-margin-top: 80px; border-top: 1px solid var(--border); }
.catalog-sub { color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; margin-top: 2px; }
.catalog-sub span { color: var(--accent); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 14px; }
.chip {
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: none; color: var(--muted);
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.02em;
  transition: border-color 0.15s, color 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.sort-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.sort-label { color: var(--muted); font-family: var(--font-mono); font-size: 0.74rem; }
.sort-select {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--font-mono); font-size: 0.78rem; outline: none;
  cursor: pointer;
}
.sort-select:focus { border-color: var(--accent); }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--border-strong); transition: 0.2s;
}
.switch .slider::before {
  content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  left: 3px; top: 3px; background: var(--text); transition: 0.2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); background: var(--accent-ink); }
.switch.small { width: 30px; height: 17px; }
.switch.small .slider::before { width: 11px; height: 11px; }
.switch.small input:checked + .slider::before { transform: translateX(13px); }

.grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 880px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
.grid .card { animation-duration: 0.35s; }

.empty-state { text-align: center; padding: 56px 0; color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; }
.empty-emoji { display: none; }

/* ═══════════════ SCHEDULE ═══════════════ */
.schedule-section { max-width: 1180px; margin: 0 auto; padding: 36px 28px 10px; scroll-margin-top: 80px; border-top: 1px solid var(--border); }
.schedule-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border);
  padding-bottom: 0;
}
.sched-day {
  background: var(--surface);
  padding: 15px 17px; transition: background 0.2s;
}
.sched-day:hover { background: var(--card-hover); }
.sched-day h4 { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.1em; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; }
.sched-day ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.sched-day li { font-size: 0.83rem; color: var(--muted); display: flex; align-items: baseline; gap: 8px; }
.sched-day li::before { content: '·'; color: var(--accent); }
.sched-day li b { color: var(--text); font-weight: 500; font-family: var(--font-display); }
.sched-day li[data-slug] { cursor: pointer; }
.sched-day li[data-slug]:hover b { color: var(--accent); }

/* ═══════════════ FOOTER ═══════════════ */
.footer { margin-top: 50px; border-top: 1px solid var(--border); background: var(--bg-2); }
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 36px 28px 22px;
  display: grid; grid-template-columns: 2fr 1fr; gap: 30px;
}
.footer-brand { font-family: var(--font-mono); font-size: 0.95rem; letter-spacing: 0.16em; font-weight: 600; }
.footer-desc { color: var(--muted); font-size: 0.82rem; line-height: 1.6; max-width: 380px; margin-top: 10px; }
.footer-links:empty { display: none; }
.footer-links { column-count: 2; column-gap: 20px; }
.footer-links a { display: block; margin-bottom: 10px; break-inside: avoid; color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { text-align: center; color: var(--muted); font-family: var(--font-mono); font-size: 0.7rem; padding: 0 20px 26px; letter-spacing: 0.02em; }

/* ═══════════════ AUTH MODAL + USER CHIP ═══════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(4, 4, 2, 0.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.auth-modal {
  position: relative; width: min(400px, 100%);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 28px 24px; box-shadow: var(--shadow);
  animation: modalPop 0.2s ease;
}
@keyframes modalPop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.auth-close {
  position: absolute; top: 12px; right: 12px; width: 28px; height: 28px;
  border-radius: 50%; border: 1px solid var(--border);
  background: none; color: var(--muted); font-size: 0.8rem; transition: border-color 0.2s, color 0.2s;
}
.auth-close:hover { border-color: var(--accent); color: var(--text); }

.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); margin-bottom: 22px; }
.auth-tab {
  padding: 10px; border: none; background: var(--surface);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; transition: all 0.15s;
}
.auth-tab.active { background: var(--accent); color: var(--accent-ink); }

.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-label { color: var(--muted); font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; margin-top: 6px; }
.auth-input {
  padding: 12px 14px; border-radius: var(--radius-sm); outline: none;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  font-size: 0.9rem; transition: border-color 0.2s;
}
.auth-input:focus { border-color: var(--accent); }
.auth-submit { justify-content: center; margin-top: 16px; padding: 12px; }
.auth-submit:disabled { opacity: 0.55; cursor: wait; }

.auth-error { color: var(--badge); font-size: 0.8rem; min-height: 18px; margin-top: 4px; }
.auth-error.ok { color: var(--green); }
.auth-note { color: var(--muted); font-size: 0.78rem; text-align: center; margin-top: 2px; }
.auth-power { color: var(--muted); font-family: var(--font-mono); font-size: 0.66rem; text-align: center; margin-top: 16px; letter-spacing: 0.05em; }

.nav-user { display: flex; align-items: center; }
.nav-demo-chip {
  padding: 5px 10px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.02em;
  color: var(--accent); border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
  cursor: help;
}
.btn-sm { padding: 7px 14px; font-size: 0.74rem; }

.user-chip {
  position: relative; display: flex; align-items: center; gap: 9px;
  padding: 5px 10px 5px 5px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}
.user-chip:hover { border-color: var(--accent); }
.avatar-sm {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 700; font-family: var(--font-mono); font-size: 0.72rem;
  background: var(--accent);
}
.user-name { font-size: 0.78rem; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-caret { color: var(--muted); font-size: 0.65rem; }
.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--shadow); animation: menuIn 0.15s ease;
}
.user-menu-head { padding: 8px 10px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); word-break: break-all; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-btn-plain {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: none; border: none; color: var(--badge); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.78rem; transition: background 0.15s;
}
.menu-btn-plain:hover { background: color-mix(in srgb, var(--badge) 14%, transparent); }
.menu-link-plain {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: none; border: none; color: var(--text); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.78rem; transition: background 0.15s, color 0.15s;
}
.menu-link-plain:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }

.comments-empty { color: var(--muted); font-family: var(--font-mono); font-size: 0.82rem; padding: 10px 0; }

/* ═══════════════ TOAST ═══════════════ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(70px);
  z-index: 500; background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--text); padding: 11px 20px; border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.8rem; opacity: 0; pointer-events: none;
  box-shadow: var(--shadow); transition: transform 0.25s ease, opacity 0.25s;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ═══════════════════════════════════════════════
   WATCH PAGE
   ═══════════════════════════════════════════════ */
.watch-page { background: var(--bg); }
.watch-main { max-width: 1180px; margin: 0 auto; padding: calc(var(--navbar-h) + 24px) 28px 0; }

.watch-layout { display: grid; grid-template-columns: 1fr 330px; gap: 24px; align-items: start; }

/* ── player shell ── */
.video-shell {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
}
.player-gradient {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 130% at 15% 0%, color-mix(in srgb, var(--c1, #1b1b4b) 30%, transparent), transparent 60%),
    radial-gradient(110% 120% at 85% 100%, color-mix(in srgb, var(--c2, #7a5cff) 34%, transparent), transparent 65%),
    var(--surface);
}
.video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; }
.embed-fill { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 1; }
.embed-notice {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4;
  background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--text);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.76rem; pointer-events: none;
}

.subtitle-layer {
  position: absolute; left: 0; right: 0; bottom: 78px; z-index: 4;
  text-align: center; pointer-events: none;
}
.subtitle-layer span {
  display: inline-block; background: rgba(0, 0, 0, 0.8); color: #fff;
  padding: 6px 15px; border-radius: var(--radius-sm); font-size: clamp(0.9rem, 2.2vw, 1.2rem);
  font-weight: 500; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  animation: subIn 0.2s ease;
  max-width: 90%;
}
@keyframes subIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.big-play {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.32); opacity: 0; pointer-events: none;
  transition: opacity 0.25s; cursor: pointer;
}
.big-play.visible { opacity: 1; pointer-events: auto; }
.big-play svg {
  width: 62px; height: 62px; color: var(--text);
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
  transform: scale(0.9); transition: transform 0.2s;
}
.big-play.visible:hover svg { transform: scale(1); color: var(--accent); }
.big-play[hidden] { display: none; }

.spinner {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.5);
}
.spinner::after {
  content: ''; width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── controls ── */
.controls {
  position: absolute; inset: auto 0 0 0; z-index: 6;
  padding: 34px 16px 12px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.86) 70%);
  opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.controls.show { opacity: 1; transform: none; pointer-events: auto; }
.controls-glow { display: none; }

.progress-row { position: relative; margin-bottom: 10px; cursor: pointer; padding: 8px 0; }
.progress {
  position: relative; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.22);
  transition: height 0.15s;
}
.progress-row:hover .progress { height: 4px; }
.progress-buffer { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: rgba(255, 255, 255, 0.3); width: 0; }
.progress-played {
  position: absolute; inset: 0 auto 0 0; border-radius: 2px; width: 0;
  background: var(--accent);
}
.progress-thumb {
  position: absolute; top: 50%; left: 0; width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s;
}
.progress-row:hover .progress-thumb { transform: translate(-50%, -50%) scale(1); }
.time-tip {
  position: absolute; bottom: 22px; left: 0; padding: 3px 9px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.88); font-family: var(--font-mono); font-size: 0.7rem;
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.time-tip.show { opacity: 1; }

.controls-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.controls-left, .controls-right { display: flex; align-items: center; gap: 4px; }

.ctl {
  position: relative; background: none; border: none; color: #fff;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: grid; place-items: center; transition: color 0.15s;
}
.ctl:hover { color: var(--accent); }
.ctl svg { width: 18px; height: 18px; }
.ctl .ic-pause { display: none; }
.playing .ic-pause { display: block; }
.playing .ic-play { display: none; }
.ctl .ic-mute { display: none; }
.muted .ic-vol { display: none; }
.muted .ic-mute { display: block; }

#speedBtn { font-family: var(--font-mono); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.02em; }

.volume-wrap { display: flex; align-items: center; gap: 4px; }
.volume {
  width: 0; opacity: 0; appearance: none; height: 3px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.28); outline: none; transition: width 0.2s, opacity 0.2s;
}
.volume-wrap:hover .volume { width: 70px; opacity: 1; }
.volume::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); cursor: pointer; }

.time-display { color: rgba(255,255,255,0.8); font-family: var(--font-mono); font-size: 0.74rem; margin-left: 4px; }

/* menus */
.menu {
  position: absolute; bottom: 60px; right: 16px; z-index: 7; min-width: 160px;
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px;
  box-shadow: var(--shadow); animation: menuIn 0.15s ease;
}
.menu-speed { right: 54px; }
@keyframes menuIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.menu-title { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; color: var(--muted); padding: 8px 10px 6px; text-transform: uppercase; }
.menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px;
  background: none; border: none; color: var(--text); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 0.8rem; transition: background 0.15s, color 0.15s;
}
.menu-item:hover { background: var(--card-hover); }
.menu-item.active { color: var(--accent); }
.menu-item.active::after { content: ' ·'; }

/* ── watch info ── */
.watch-info { margin-top: 24px; }
.watch-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.watch-title { font-family: var(--font-display); font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 600; }
.watch-jp { color: var(--muted); margin-top: 4px; font-family: var(--font-mono); letter-spacing: 0.06em; font-size: 0.82rem; }
.watch-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0; }
.episode-bar {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 12px 0; margin: 16px 0;
  flex-wrap: wrap; gap: 12px;
}
.ep-num { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.ep-actions { display: flex; gap: 8px; }
.ep-actions .btn { padding: 7px 14px; font-size: 0.74rem; }
#prevEp:disabled, #nextEp:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }
.watch-desc { color: var(--muted); line-height: 1.7; font-size: 0.93rem; max-width: 68ch; }

/* ── comments ── */
.comments { margin-top: 30px; max-width: 860px; }
.comments-title { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 16px; display: flex; align-items: baseline; gap: 8px; }
.comments-count {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted);
  vertical-align: middle;
}
.comment-form { display: flex; gap: 10px; margin-bottom: 20px; }
.comment-form input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 0.88rem; outline: none; transition: border-color 0.2s;
}
.comment-form input:focus { border-color: var(--accent); }
.comment-list { display: flex; flex-direction: column; }
.comment {
  display: flex; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 0.78rem; color: var(--accent-ink);
  background: var(--accent);
}
.comment-body { flex: 1; min-width: 0; }
.comment-name { font-family: var(--font-mono); font-weight: 600; font-size: 0.8rem; display: flex; gap: 10px; align-items: baseline; }
.comment-time { color: var(--muted); font-size: 0.68rem; font-weight: 400; }
.comment-text { color: var(--text); font-size: 0.9rem; margin-top: 4px; line-height: 1.55; word-break: break-word; }

/* ── episode sidebar ── */
.episodes-sidebar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0; position: sticky; top: 84px; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.sidebar-title { font-family: var(--font-display); font-size: 1.02rem; }
.autoplay { display: flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; }
.episode-list { overflow-y: auto; display: flex; flex-direction: column; }
.episode-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); border-left: 2px solid transparent; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.episode-item:hover { background: var(--card-hover); }
.episode-item.active { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-left-color: var(--accent); }
.ep-thumb {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); width: 40px; flex-shrink: 0;
}
.episode-item.active .ep-thumb { color: var(--accent); }
.ep-info { flex: 1; min-width: 0; }
.ep-name { font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); margin-top: 2px; }
.ep-play { color: var(--muted); font-size: 0.8rem; opacity: 0; transition: opacity 0.2s, color 0.2s; }
.episode-item:hover .ep-play { opacity: 1; }
.episode-item.active .ep-play { opacity: 1; color: var(--accent); }
.episode-item.more-item { justify-content: center; color: var(--muted); font-family: var(--font-mono); font-size: 0.76rem; cursor: default; }
.episode-item.more-item:hover { background: none; }

/* ── related ── */
.related-section { padding-top: 44px; }

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (max-width: 1180px) {
  .watch-layout { grid-template-columns: 1fr; }
  .episodes-sidebar { position: static; max-height: none; }
  .episode-list { flex-direction: row; overflow-x: auto; }
  .episode-item { min-width: 230px; }
}

@media (max-width: 960px) {
  .nav-links, .search-box { display: none; }
  .menu-btn { display: grid; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .nav-inner { padding: 0 16px; gap: 10px; }
  .hero-shell { padding-left: 16px; padding-right: 16px; }
  .hero { aspect-ratio: 4 / 5; }
  .row-section, .catalog-section, .schedule-section, .watch-main, .log-section { padding-left: 16px; padding-right: 16px; }
  .row-scroll { grid-auto-columns: 148px; }
  .footer-inner { grid-template-columns: 1fr; }
  .watch-title-row .btn { width: 100%; justify-content: center; }
  .comment-form { flex-direction: column; }
  .log-row { grid-template-columns: 60px 1fr; }
  .log-spec { display: none; }
}

/* ═══════════════ ADMIN ═══════════════ */
.admin-main { max-width: 1180px; margin: 0 auto; padding: calc(var(--navbar-h) + 24px) 28px 60px; }
.admin-pill {
  font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.08em; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); padding: 2px 8px; border-radius: var(--radius-sm);
}

.admin-gate {
  max-width: 520px; margin: 60px auto; padding: 22px 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); font-family: var(--font-mono); font-size: 0.86rem;
}
.admin-gate a { color: var(--accent); }

.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.admin-tab {
  padding: 10px 6px; margin-right: 20px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.admin-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.admin-section { display: flex; flex-direction: column; gap: 22px; }

.admin-form {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.admin-form label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em; }
.admin-form input, .admin-form select, .admin-form textarea {
  padding: 10px 12px; border-radius: var(--radius-sm); outline: none; font-size: 0.88rem;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text); font-family: var(--font-body);
}
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: var(--accent); }
.admin-form input:disabled { opacity: 0.5; }
.admin-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.admin-form-grid input[type="color"] { padding: 3px; height: 38px; }
.admin-check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.admin-form-actions { display: flex; gap: 10px; margin-top: 4px; }

.form-title { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; margin-top: 6px; }
.link-editor { display: flex; flex-direction: column; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; }
.link-row input {
  padding: 9px 12px; border-radius: var(--radius-sm); outline: none; font-size: 0.86rem;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text); font-family: var(--font-body);
}
.link-row input:focus { border-color: var(--accent); }
.link-row button { flex-shrink: 0; }

.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th, .admin-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table th { color: var(--muted); font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface); }
.admin-table td { font-family: var(--font-body); }
.admin-table tr:hover td { background: var(--card-hover); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .admin-ref-cell, .admin-table .admin-comment-cell { white-space: normal; max-width: 360px; word-break: break-all; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.admin-table td .btn { margin-right: 6px; }
