/* ==========================================================================
   학교명상 — Netflix-style dark UI
   Palette: #141414 page, #000 nav/player, #E50914 red accent, white / #e5e5e5
   text, #808080 secondary, #2f2f2f surfaces. Token architecture preserved
   (green/amber token NAMES kept as compatibility aliases; VALUES are now
   Netflix-dark so any lingering class hook still reads correctly).
   ========================================================================== */

:root {
  /* Ink base (surfaces) — Netflix dark */
  --ink-900: #141414;   /* page background */
  --ink-800: #181818;   /* cards / detail panel */
  --ink-700: #1f1f1f;   /* raised surface */
  --ink-600: #2f2f2f;   /* controls / tracks */
  --ink-500: #3a3a3a;   /* hover surface */
  --black: #000000;

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #808080;
  --text-soft: #e5e5e5;

  /* Netflix red accent */
  --red: #e50914;
  --red-bright: #f6121d;
  --red-deep: #b0060f;

  /* Legacy accent token NAMES kept as aliases so old class hooks resolve to
     the new Netflix palette instead of green/amber. */
  --green: var(--red);
  --green-soft: var(--red-bright);
  --amber: var(--red);
  --amber-soft: #ffffff;
  --blue: #808080;
  --blue-soft: #b3b3b3;

  /* Semantic roles */
  --accent: var(--red);
  --focus-ring: #ffffff;
  --border: #2f2f2f;

  /* Layout */
  --radius-card: 4px;
  --radius-sm: 4px;
  --container-max: 1600px;
  --gap: 0.6rem;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: var(--text-soft);
  background: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--text-soft);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button {
  font: inherit;
  cursor: pointer;
}

/* ---- Thin dark scrollbars ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: #4d4d4d transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #4d4d4d;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #6b6b6b; background-clip: content-box; }

/* --------------------------------------------------------------------------
   Focus-visible — keyboard accessibility
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* --------------------------------------------------------------------------
   Layout containers
   -------------------------------------------------------------------------- */
#app { min-height: 100vh; }

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 3.75rem);
}

.section {
  padding-block: clamp(1rem, 2vw, 1.5rem);
}

.card {
  background: var(--ink-800);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* --------------------------------------------------------------------------
   Empty-state
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: clamp(2rem, 6vw, 4rem) 1.5rem;
  color: var(--text-secondary);
}
.empty-state__icon { font-size: 2.5rem; line-height: 1; opacity: 0.85; }
.empty-state__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}
.empty-state__message {
  margin: 0;
  max-width: 42ch;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Buttons — Netflix style
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  background: rgba(109, 109, 110, 0.7);
  transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.06s ease;
}
.btn:hover { background: rgba(109, 109, 110, 0.5); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* White primary "play" button — black text (Netflix billboard) */
.btn--primary {
  background: #ffffff;
  color: #000000;
}
.btn--primary:hover { background: rgba(255, 255, 255, 0.78); }
.btn--primary:disabled { background: rgba(255,255,255,0.4); }

/* Gray translucent secondary "info" button */
.btn--ghost {
  background: rgba(109, 109, 110, 0.7);
  color: var(--text-primary);
}
.btn--ghost:hover { background: rgba(109, 109, 110, 0.5); }

/* Red action button (assign / complete) */
.btn--red {
  background: var(--red);
  color: #ffffff;
}
.btn--red:hover { background: var(--red-bright); }
.btn--red:disabled { background: #5a5a5a; color: #b3b3b3; }

.btn--small { padding: 0.4rem 0.9rem; font-size: 0.9rem; }

/* ==========================================================================
   Top nav — fixed, black-to-transparent gradient
   ========================================================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 10%, rgba(0, 0, 0, 0));
  transition: background-color 0.3s ease;
}
.app-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.7rem;
}

/* Brand wordmark — streaming-brand style, red */
.brand {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}
.brand__name {
  color: var(--red);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1;
  text-shadow: 0 0 12px rgba(229, 9, 20, 0.35);
}
.brand__mark { display: none; }

/* Inline text menu (담임 홈 / 관리자) */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 0.2rem 0;
  font-weight: 400;
  font-size: 0.95rem;
  transition: color 0.15s ease;
  position: relative;
}
.mode-btn:hover { color: #b3b3b3; }
.mode-btn.is-active { color: #ffffff; font-weight: 700; }

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

/* Compact dark select */
.class-select {
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-soft);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
}
.class-select:hover { border-color: #808080; }

/* Reset as subtle icon/text */
.reset-btn {
  background: transparent;
  color: var(--text-muted);
  border: 0;
  padding: 0.3rem 0.2rem;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}
.reset-btn:hover { color: #ffffff; }

/* Main content offset for fixed nav */
main { display: block; }

.section__heading {
  margin: 0 0 0.8rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* ==========================================================================
   Breathing field — reused as the "video"/tile visual, blended dark
   ========================================================================== */
.breathing-field {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 120% at 30% 20%,
      color-mix(in srgb, var(--series-color, #444) 60%, transparent), transparent 62%),
    radial-gradient(120% 120% at 82% 92%,
      color-mix(in srgb, var(--series-color, #333) 42%, transparent), transparent 58%),
    linear-gradient(160deg, #1a1a1a, #0a0a0a);
  isolation: isolate;
}
.breathing-field__orb,
.breathing-field__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.breathing-field__orb {
  width: 42%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 50% 45%,
    color-mix(in srgb, var(--series-color, #888) 85%, white 8%),
    color-mix(in srgb, var(--series-color, #555) 50%, transparent) 60%,
    transparent 72%);
  filter: blur(3px);
  opacity: 0.85;
  animation: breathe 9s ease-in-out infinite;
}
.breathing-field__ring {
  width: 55%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--series-color, #888) 55%, transparent);
  opacity: 0.4;
  animation: breathe-ring 9s ease-in-out infinite;
}
.breathing-field__ring--2 { animation-delay: -3s; width: 72%; }
.breathing-field--mini .breathing-field__orb { animation-duration: 11s; }

@keyframes breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.82); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.08); opacity: 0.9; }
}
@keyframes breathe-ring {
  0%, 100% { transform: translate(-50%, -50%) scale(0.7); opacity: 0.12; }
  50% { transform: translate(-50%, -50%) scale(1.12); opacity: 0.45; }
}
.breathing-field.is-paused .breathing-field__orb,
.breathing-field.is-paused .breathing-field__ring {
  animation-play-state: paused;
}

/* ==========================================================================
   Hero billboard (continue / featured panel)
   ========================================================================== */
.billboard-wrap {
  position: relative;
  padding: 0;
  margin: 0;
}
/* flex (was block) so the 학급 현황 카드 can sit beside the text column and
   claim the empty right-hand side. __visual and ::after are absolutely
   positioned, so they are out of flow and are NOT flex items — the only flex
   children are .continue-panel__body and .class-status. */
.continue-panel {
  position: relative;
  display: flex;
  align-items: stretch;
  /* Sized to its content instead of a fixed cinematic band — a 640px box
     around a ~300px content block left a large dead area above 시작하기. */
  min-height: 0;
  overflow: hidden;
  background: var(--black);
}
.continue-panel__visual {
  position: absolute;
  inset: 0;
  z-index: 0;
}
/* Cinematic scrims: bottom fade to page bg + left fade for text legibility */
.continue-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(20,20,20,0.9) 0%, rgba(20,20,20,0.55) 35%, rgba(20,20,20,0) 70%),
    linear-gradient(0deg, #141414 0%, rgba(20,20,20,0.4) 22%, rgba(20,20,20,0) 55%);
}
.continue-panel__body {
  position: relative;
  z-index: 2;
  /* Keeps the 640px cap as its flex basis and never gets squeezed by the card. */
  flex: 1 1 640px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  /* Grows past the 640px basis on wide screens — a 640px cap forced titles
     like "마음챙김 5분 명상" onto a second line while ~600px of hero sat
     empty. The status card still claims its own width to the right. */
  max-width: min(820px, 100%);
  /* No forced height and no vertical centering — together they pushed
     시작하기 down by roughly 200px. The panel is now exactly as tall as its
     content plus this padding, and the status card centres against that. */
  min-height: 0;
  justify-content: flex-start;
  padding: 2rem clamp(1rem, 4vw, 3.75rem) 2.5rem;
}
.continue-panel__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.7rem 0.28rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.5);
  border-left: 3px solid var(--red);
  border-radius: 0 3px 3px 0;
}
.continue-panel__title {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.02;
  /* Korean has no spaces inside a word — keep-all stops mid-word breaks, and
     balance evens the lines out when a title genuinely needs two. */
  word-break: keep-all;
  text-wrap: balance;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}
.continue-panel__episode {
  margin: 0;
  color: var(--text-soft);
  font-weight: 600;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.continue-panel__note {
  margin: 0;
  color: var(--text-soft);
  max-width: 42ch;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.continue-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.6rem;
}
.continue-panel__actions .btn { padding: 0.7rem 1.8rem; font-size: 1.1rem; }

/* Page-wide ambient glow — a soft breathing "orb" fixed behind ALL content so
   it never gets clipped by a short panel. Shows through wherever content is
   transparent (notably the empty hero below). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58% 52% at 66% 24%,
      rgba(190, 200, 222, 0.13), rgba(190, 200, 222, 0) 68%),
    radial-gradient(42% 40% at 30% 30%,
      rgba(120, 150, 190, 0.07), rgba(120, 150, 190, 0) 70%);
  animation: ambient-breathe 14s ease-in-out infinite;
}
@keyframes ambient-breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

/* Empty billboard — compact: hug the message, no full-height hero, so the
   series rails sit right below instead of floating in the middle. The panel
   goes transparent (and drops its own clipped orb + scrim) so the page-wide
   ambient glow shows behind the text uncropped. */
.continue-panel:has(.continue-empty) {
  min-height: auto;
  background: transparent;
}
.continue-panel:has(.continue-empty)::after { display: none; }
.continue-panel:has(.continue-empty) .continue-panel__visual { display: none; }
.continue-empty {
  position: relative;
  z-index: 2;
  min-height: auto;
  justify-content: flex-start;
  gap: 0.5rem;
  padding-top: 1.6rem;
  padding-bottom: 2.6rem;
}
/* Smaller heading in the empty state so the "둘러보기" rails sit right below
   and are visible without scrolling. */
.continue-empty .continue-panel__title {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}
.billboard-wrap .continue-empty {
  align-items: flex-start;
  text-align: left;
  padding-inline: clamp(1rem, 4vw, 3.75rem);
  max-width: 640px;
}

/* ==========================================================================
   학급 현황 카드 — 히어로 오른쪽 (우리 반 명상 현황 + 함께 명상하는 학급)
   Laid out by the hero's own flex row: no absolute positioning, so it can never
   overlap .continue-panel__body. z-index 2 puts it above the ::after scrim (1).
   No transitions are declared here at all; if one is ever added it must be
   opacity/transform only — the global @media (prefers-reduced-motion: reduce)
   block further down already neutralizes transition/animation durations.
   ========================================================================== */
.class-status {
  /* Single column (우리 반 명상 현황 only — the school-wide section was removed). */
  flex: 0 0 clamp(260px, 24vw, 340px);
  align-self: center;
  position: relative;
  z-index: 2;
  margin-left: auto; /* soak up the free space so the card hugs the right edge */
  margin-right: clamp(1rem, 4vw, 3.75rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.15rem;
  padding: 1.05rem 1.15rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  /* Solid-ish fallback first; the blurred, more transparent version is only
     applied where backdrop-filter actually works. */
  background: rgba(20, 20, 20, 0.86);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
  .class-status {
    background: rgba(20, 20, 20, 0.58);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
}
.class-status__section {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  min-width: 0;
}
.class-status__heading {
  margin: 0 0 0.15rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.class-status__class {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-primary);
}
.class-status__series {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}
.class-status__series.is-missing { color: var(--text-muted); }
.class-status__idle,
.class-status__meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
/* Slimmer variant of the shared .progress bar for the narrow card. */
.class-status__progress {
  max-width: none;
  gap: 0.55rem;
  margin-top: 0.15rem;
}
.class-status__progress .progress__track { height: 3px; }
.class-status__progress .progress__label { font-size: 0.76rem; }


/* Empty hero: the panel stays flex but hugs its content, so pin the card to the
   top and mirror .continue-empty's tuned 1.6rem / 2.6rem paddings — the panel
   may grow to the card's height, but adds no extra vertical space. */
.continue-panel:has(.continue-empty) .class-status {
  align-self: flex-start;
  margin-top: 1.6rem;
  margin-bottom: 2.6rem;
}

/* Narrow viewports: stack the card BELOW the hero text at full width.
   .continue-panel__body's min-height and paddings stay exactly as tuned. */
@media (max-width: 1100px) {
  .continue-panel { flex-direction: column; }
  /* In a column, flex-basis becomes HEIGHT — 640px would pin the text column's
     height. flex:none restores auto sizing so its own min-height/padding rule
     (untouched above) keeps deciding the height. */
  .continue-panel__body { flex: none; }
  .class-status {
    flex: none;
    align-self: stretch;
    width: auto;
    max-width: none;
    margin: 0 clamp(1rem, 4vw, 3.75rem) 2rem;
  }
  /* Full width below the hero — the two columns have plenty of room here. */
  .continue-panel:has(.continue-empty) .class-status {
    align-self: stretch;
    margin-top: 0;
    margin-bottom: 2.6rem;
  }
}


/* Progress bar (shared) */
.progress {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  max-width: 420px;
}
.progress__track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: var(--red);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress__label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ==========================================================================
   Series rails — Netflix rows
   ========================================================================== */
.rail { margin-bottom: 1.6rem; }
.rail__title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-soft);
}
.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(200px, 20vw, 260px);
  gap: 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.6rem 0 2.4rem;
  scroll-snap-type: x proximity;
}
.rail__track > * { scroll-snap-align: start; }

/* 16:9 dark tile using the series gradient */
.series-card {
  position: relative;
  display: block;
  text-align: left;
  padding: 0;
  aspect-ratio: 16 / 9;
  background: var(--ink-800);
  border: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  transform-origin: center;
  will-change: transform;
}
.series-card:hover,
.series-card:focus-visible {
  transform: scale(1.12);
  z-index: 5;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
}
.series-card.is-selected { outline: 2px solid var(--red); outline-offset: -2px; }
.series-card__art {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
}
/* Bottom-gradient meta overlay */
.series-card__meta {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.6rem 0.8rem 0.7rem;
  background: linear-gradient(0deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.55) 55%, rgba(0,0,0,0) 100%);
}
.series-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.series-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}
.series-card__mood {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.series-card__stats {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0;
  max-height: 0;
  transition: opacity 0.28s ease, max-height 0.28s ease;
}
.series-card:hover .series-card__stats,
.series-card:focus-within .series-card__stats {
  opacity: 1;
  max-height: 2rem;
}

/* Netflix-style status badges */
.status-chip {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.14rem 0.5rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-secondary);
  border: 1px solid #4d4d4d;
}
.status-chip.is-active { color: #fff; background: var(--red); border-color: var(--red); }
.status-chip.is-completed { color: #fff; background: #333; border-color: #4d4d4d; }
.status-chip.is-idle { color: var(--text-muted); }

/* ==========================================================================
   Series detail — Netflix title-detail panel
   ========================================================================== */
.series-detail {
  position: relative;
  background: var(--ink-800);
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 30px rgba(0, 0, 0, 0.6);
  padding: 0 !important;
  margin-block: clamp(1rem, 2vw, 1.5rem);
}
/* Hero strip on top */
.series-detail::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 230px;
  z-index: 0;
  background:
    linear-gradient(0deg, #181818 2%, rgba(24,24,24,0.2) 60%, rgba(24,24,24,0) 100%),
    radial-gradient(120% 160% at 20% 0%,
      color-mix(in srgb, var(--series-color, #444) 70%, transparent), transparent 60%),
    linear-gradient(160deg, #262626, #141414);
}
.series-detail__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem clamp(1.5rem, 3vw, 2.5rem) 0;
}
.series-detail__eyebrow {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.series-detail__title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.series-detail__stats { margin: 0.3rem 0 0; color: var(--text-secondary); font-size: 0.95rem; }
.series-detail__desc {
  position: relative;
  z-index: 1;
  color: var(--text-soft);
  max-width: 60ch;
  padding: 1rem clamp(1.5rem, 3vw, 2.5rem) 0;
}
.series-detail__assign {
  position: relative;
  z-index: 1;
  padding: 1.2rem clamp(1.5rem, 3vw, 2.5rem);
}
.series-detail__close {
  flex-shrink: 0;
}

/* Episode rows */
.ep-list {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0 clamp(1.5rem, 3vw, 2.5rem) 1.8rem;
  display: flex;
  flex-direction: column;
}
.ep {
  display: grid;
  grid-template-columns: 2rem 150px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0.5rem;
  border-top: 1px solid #404040;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}
.ep:hover { background: #333; }
.ep.is-locked { opacity: 0.5; }
.ep__index {
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
}
/* thumbnail block */
.ep__thumb {
  aspect-ratio: 16 / 9;
  width: 150px;
  border-radius: 4px;
  overflow: hidden;
}
.ep__main { min-width: 0; }
.ep__head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.ep__title { font-weight: 700; color: #fff; font-size: 1rem; }
.ep__desc { margin: 0.3rem 0 0.2rem; font-size: 0.9rem; color: var(--text-secondary); }
.ep__dur { font-size: 0.82rem; color: var(--text-muted); }
.ep__flag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  border-radius: 3px;
}
.ep__flag.is-done { color: #fff; background: var(--red); }
.ep__flag.is-current { color: #000; background: #fff; }
.ep__flag.is-locked { color: var(--text-muted); background: #2f2f2f; }
.ep__lock { font-size: 1.2rem; opacity: 0.7; }
.ep__action { justify-self: end; }
/* Completed episode: red progress accent under the thumb */
.ep.is-done .ep__thumb { position: relative; }
.ep.is-done .ep__thumb::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--red);
}

/* ==========================================================================
   Player — near-black cinematic overlay
   ========================================================================== */
.player {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  background: var(--black);
}
.player__visual {
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: brightness(0.55) saturate(0.9);
}
.player__visual .breathing-field__orb { width: 30%; filter: blur(8px); }
/* Top/bottom cinematic vignette */
.player::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0) 22%),
    linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 32%);
}
/* Close (←) top-left */
.player__close {
  position: absolute;
  top: 1.4rem;
  left: 1.6rem;
  z-index: 4;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 0;
  background: rgba(20, 20, 20, 0.5);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  display: grid;
  place-items: center;
}
.player__close:hover { background: rgba(60, 60, 60, 0.7); }

/* Title fades in at top-center */
.player__eyebrow {
  position: absolute;
  top: 1.6rem;
  left: 0; right: 0;
  z-index: 3;
  text-align: center;
  margin: 0;
  color: var(--text-soft);
  font-weight: 600;
  font-size: 0.95rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}

/* The panel becomes the bottom control bar */
.player__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  width: 100%;
  text-align: left;
  padding: 1.5rem clamp(1.5rem, 5vw, 4rem) 2rem;
  background: transparent;
}
.player__title {
  margin: 0 0 0.3rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.player__desc {
  margin: 0 0 1.2rem;
  color: var(--text-soft);
  max-width: 60ch;
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.player__timeline { margin-bottom: 1rem; }
.player__progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  position: relative;
}
.player__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--red);
  border-radius: 999px;
  transition: width 0.9s linear;
  position: relative;
}
/* Round handle look (CSS only) */
.player__progress-fill::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 6px rgba(229, 9, 20, 0.8);
}
.player__clock {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}
.player__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
}
.player__playpause {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.05rem;
  padding: 0.5rem 0.2rem;
}
.player__playpause:hover { background: transparent; color: #b3b3b3; }

/* Video mode — real YouTube playback in a centered, responsive 16:9 frame.
   Sized against both viewport width and height so it never overflows and
   never collides with the bottom control panel. */
.player__video {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.5rem clamp(1rem, 4vw, 3rem) 14rem;
  overflow: hidden;
}
.player__video-frame {
  position: relative;
  width: min(100%, calc((100vh - 18.5rem) * 16 / 9));
  max-width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.player__video-frame iframe,
.player__video-frame #yt-player-mount {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.player__video-error {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-soft);
  background: rgba(0, 0, 0, 0.85);
  font-size: 1rem;
  line-height: 1.6;
}
.player__video-error[hidden] { display: none; }
/* Trim the sim-mode description in video mode: the bottom bar stays compact
   so the video gets the room. */
.player--video .player__desc { display: none; }
@media (max-width: 640px) {
  .player__video { padding: 4rem 0.8rem 15rem; }
  .player__video-frame { border-radius: 6px; }
}

/* Admin status-chip variants */
.status-chip.is-unassigned { color: #fff; background: var(--red); border-color: var(--red); }
.status-chip.is-notstarted { color: var(--text-secondary); background: #333; border-color: #4d4d4d; }

/* ==========================================================================
   Admin (관리자) dashboard — dark theme
   ========================================================================== */
.admin { padding-top: 6rem; }
.admin__head { margin-bottom: 1.6rem; }
.admin__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}
.admin__title { margin: 0 0 0.5rem; font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 900; color: #fff; }
.admin__lead { margin: 0; color: var(--text-secondary); max-width: 60ch; }
.admin__section-heading { margin-top: 2.2rem; }

.admin-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--gap);
}
.admin-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.2rem 1.3rem;
  background: var(--ink-800);
  border-radius: var(--radius-card);
  border-left: 4px solid var(--red);
}
.admin-metric--active { border-left-color: var(--red); }
.admin-metric--unassigned { border-left-color: #808080; }
.admin-metric--completed { border-left-color: #fff; }
.admin-metric--today { border-left-color: var(--red-deep); }
.admin-metric__value { font-size: 2.2rem; font-weight: 900; line-height: 1.1; color: #fff; }
.admin-metric__label { font-weight: 700; color: var(--text-soft); }
.admin-metric__hint { font-size: 0.8rem; color: var(--text-muted); }

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--gap);
}
.admin-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.2rem 1.3rem;
  background: var(--ink-800);
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  transition: background-color 0.15s ease;
}
.admin-card:hover { background: #232323; }
.admin-card--unassigned { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.admin-card--not-started { border-color: #4d4d4d; }
.admin-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.admin-card__class { margin: 0; font-size: 1.15rem; font-weight: 700; color: #fff; }
.admin-card__teacher { margin: 0.15rem 0 0; font-size: 0.85rem; color: var(--text-secondary); }
.admin-card__series { margin: 0; font-weight: 700; color: var(--text-soft); }
.admin-card__episode { margin: 0; font-size: 0.88rem; color: var(--text-secondary); }
.admin-card__progress { max-width: none; }
.admin-card__watched { margin: 0; font-size: 0.82rem; color: var(--text-muted); }

.admin-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  background: var(--ink-800);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  padding: 0.8rem 1rem;
  text-align: left;
  white-space: nowrap;
}
.admin-table thead th {
  background: #0a0a0a;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* dark-striped */
.admin-table tbody tr:nth-child(odd) td { background: #1a1a1a; }
.admin-table tbody tr:nth-child(even) td { background: #202020; }
.admin-table tbody tr:hover td { background: #2f2f2f; }
.admin-row--unassigned td { box-shadow: inset 3px 0 0 var(--red); }
.admin-row--not-started td { box-shadow: inset 3px 0 0 #808080; }

@media (max-width: 860px) {
  .ep { grid-template-columns: 1.6rem 110px 1fr auto; }
  .ep__thumb { width: 110px; }
}

@media (max-width: 480px) {
  .ep { grid-template-columns: 1.6rem 84px 1fr auto; gap: 0.6rem; }
  .ep__thumb { width: 84px; }
}

@media (max-width: 720px) {
  .continue-panel__body { max-width: 100%; }
  .header-controls { width: 100%; }
  .class-select { flex: 1; min-width: 0; }

  .admin-table thead { display: none; }
  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td { display: block; width: 100%; }
  .admin-table tr { border-bottom: 1px solid var(--border); }
  .admin-table td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.4rem 1rem;
    white-space: normal;
  }
  .admin-table tbody tr:nth-child(odd) td,
  .admin-table tbody tr:nth-child(even) td { background: #1a1a1a; }
  .admin-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-muted);
  }
}

/* ==========================================================================
   Opening intro — full-screen video splash (assets/intro.mp4).
   A fixed black overlay above everything (z-index 9999) holds a muted,
   auto-playing video that covers the viewport. JS removes the overlay when
   the video ends or the user skips (click / key), fading it out via
   .is-leaving. Under reduced motion JS shows the first frame paused.
   ========================================================================== */
.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;              /* above player's 100 */
  display: block;
  overflow: hidden;
  background: #000;
  opacity: 1;
  transition: opacity 0.85s ease;   /* JS removes the node at 900ms */
}
.intro.is-leaving { opacity: 0; }

/* Shown only when the browser refused to autoplay with sound. A click on it is
   a real user gesture, which is always allowed to unmute. Sits above the video
   and stops the click from being read as "skip the intro". */
.intro__sound {
  position: absolute;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 2;
  padding: 0.6rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.intro__sound:hover {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.8);
}
.intro__sound[hidden] { display: none; }

@media (max-width: 600px) {
  .intro__sound {
    right: 1rem;
    bottom: 1rem;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
  }
}

/* The splash video fills the viewport, cropped to cover (no letterboxing). */
.intro__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* --------------------------------------------------------------------------
   Motion preferences — disable transforms/animations
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .series-card:hover,
  .series-card:focus-visible {
    transform: none !important;
  }
  /* The opening splash is exempt: it always plays, so cutting its fade-out to
     0.01ms would make it vanish abruptly instead of settling into the page. */
  .intro {
    transition-duration: 0.85s !important;
  }
}

/* --------------------------------------------------------------------------
   Mode badge (header) + offline notice + admin password gate
   -------------------------------------------------------------------------- */
.mode-badge {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid #4d4d4d;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  white-space: nowrap;
}
.mode-badge--admin {
  color: #ffffff;
  border-color: var(--red);
}

.offline-notice {
  background: rgba(229, 9, 20, 0.12);
  border-top: 1px solid rgba(229, 9, 20, 0.4);
  border-bottom: 1px solid rgba(229, 9, 20, 0.4);
  color: var(--text-soft);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.55rem 1rem;
}

.admin__toolbar {
  margin-top: 0.9rem;
}

/* Admin password gate — centered dark card, Netflix-style */
.admin-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 2rem 1rem;
}
.admin-gate__card {
  width: min(420px, 100%);
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2.2rem 2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.admin-gate__title {
  margin: 0.4rem 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}
.admin-gate__lead {
  margin: 0 0 1.4rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}
.admin-gate__form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.admin-gate__label {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 600;
}
.admin-gate__input {
  background: var(--ink-600);
  color: var(--text-primary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  font-size: 1rem;
}
.admin-gate__input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: transparent;
}
.admin-gate__error {
  margin: 0;
  color: #ff8a92;
  font-size: 0.85rem;
}
.admin-gate__submit {
  margin-top: 0.4rem;
  padding: 0.7rem 1rem;
  font-size: 1rem;
}

/* Admin 암호 변경 — inline panel at the top of the logged-in dashboard.
   Reuses .admin-gate__label / __input / __error for the fields. */
.admin-changepw {
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.6rem clamp(1.2rem, 3vw, 2rem) 1.8rem;
  margin-top: 1.6rem;
}
.admin-changepw__lead {
  margin: 0.2rem 0 1.1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.admin-changepw__form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 420px;
}
.admin-changepw__submit {
  margin-top: 0.4rem;
  align-self: flex-start;
  padding: 0.7rem 1.4rem;
}
.admin-changepw__notice {
  margin: 1.6rem 0 0;
  padding: 0.7rem 1rem;
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Cover images (YouTube thumbnails) — layered over the breathing-field
   placeholder; if the image is missing or fails to load, JS removes the <img>
   and the color visual underneath shows through.
   -------------------------------------------------------------------------- */
.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  z-index: 1;
}
/* Keep the hero scrims/text legible over a photographic panel visual. */
.continue-panel__visual .cover-img { opacity: 0.85; }

/* Series detail hero poster (16:9, rounded, dark-card border) */
.series-detail__poster {
  position: relative;
  flex: 0 0 auto;
  width: clamp(180px, 26vw, 320px);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.series-detail__headtext { min-width: 0; flex: 1 1 auto; }

@media (max-width: 720px) {
  .series-detail__header { flex-wrap: wrap; }
  .series-detail__poster { width: 100%; order: -1; }
  .series-detail__close { order: -2; margin-left: auto; }
}

/* --------------------------------------------------------------------------
   Admin: 시리즈 추가 panel + series management list
   -------------------------------------------------------------------------- */
.add-series {
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.6rem clamp(1.2rem, 3vw, 2rem) 1.8rem;
  margin-top: 1.6rem;
}
.add-series__lead {
  margin: 0.2rem 0 1.1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.add-series__form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.add-series__label {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 600;
}
.add-series__input {
  background: var(--ink-600);
  color: var(--text-primary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  width: 100%;
}
.add-series__input::placeholder { color: var(--text-muted); }
.add-series__input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: transparent;
}
.add-series__textarea { resize: vertical; font-family: inherit; }
.add-series__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}
.add-series__submit {
  align-self: flex-start;
  padding: 0.65rem 1.6rem;
}
.add-series__success {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  border-left: 3px solid var(--red);
  padding-left: 0.7rem;
}
.add-series__success-line { margin: 0 0 0.3rem; }
.add-series__success-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.83rem;
  line-height: 1.5;
}
/* Helper note under the 소개 field */
.add-series__hint {
  margin: -0.2rem 0 0.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
/* Long-running progress note while the description is web-searched */
.add-series__progress {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.85rem;
  padding: 0.55rem 0.7rem;
  background: rgba(229, 9, 20, 0.1);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
}

.series-manage__heading {
  margin: 1.6rem 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-soft);
}
.series-manage__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.series-manage__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.2rem;
  border-top: 1px solid #333;
}
.series-manage__row.is-custom .series-manage__title { color: #ffffff; }
.series-manage__info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.series-manage__title {
  font-weight: 600;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.series-manage__meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.series-manage__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.series-manage__chip {
  color: var(--text-muted);
  font-size: 0.78rem;
  border: 1px solid #4d4d4d;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  white-space: nowrap;
}
.series-manage__confirm-text {
  color: var(--text-soft);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Admin: per-series category picker + 숨긴 기본 시리즈 + 카테고리 관리 패널
   -------------------------------------------------------------------------- */
.series-manage__cat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.series-manage__cat-select {
  background: var(--ink-700, #1c1c1c);
  color: var(--text-soft);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  max-width: 12rem;
  cursor: pointer;
}
.series-manage__cat-select:disabled { opacity: 0.55; cursor: default; }
.series-manage__cat-input { max-width: 11rem; font-size: 0.82rem; padding: 0.3rem 0.5rem; }

.series-manage__row.is-hidden { opacity: 0.75; }
.series-manage__row.is-hidden .series-manage__title { color: var(--text-muted); }

/* 카테고리 관리 */
.cat-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.6rem 0.2rem;
  border-top: 1px solid #333;
  flex-wrap: wrap;
}
.cat-row__info {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}
.cat-row__name {
  font-weight: 600;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.cat-row__count { color: var(--text-muted); font-size: 0.8rem; }
.cat-row__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cat-row__input { max-width: 14rem; font-size: 0.9rem; }
.cat-row__confirm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}
.cat-row.is-confirming, .cat-row.is-editing { background: rgba(255, 255, 255, 0.03); }

/* 카테고리 자동 정리 */
.cat-cleanup {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid #333;
}
.cat-cleanup.is-open {
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  margin-top: 1rem;
}
.cat-cleanup__title {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-soft);
}
.cat-cleanup__list {
  margin: 0 0 0.8rem;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cat-cleanup__item { color: var(--text-soft); font-size: 0.85rem; }

.cat-add { margin-top: 1.2rem; }
.cat-add__row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.cat-add__row .add-series__input { flex: 1 1 12rem; min-width: 0; }

@media (max-width: 720px) {
  .series-manage__cat { width: 100%; }
  .series-manage__cat-select { max-width: none; flex: 1 1 auto; }
  .cat-row { align-items: stretch; }
  .cat-row__actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  .add-series__grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Admin: episode editor (custom series) — reorder + title/description edit
   -------------------------------------------------------------------------- */
/* The manage row now holds a header + an optional editor, so it stacks. */
.series-manage__row { flex-direction: column; align-items: stretch; }
.series-manage__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.series-manage__row.is-editing { padding-bottom: 1rem; }
.btn--small.is-active { color: #fff; background: var(--ink-600); }

.ep-editor {
  margin-top: 0.9rem;
  padding: 1rem;
  background: var(--ink-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.ep-editor__caution {
  margin: 0 0 0.8rem;
  color: #f5c86b;
  font-size: 0.82rem;
  line-height: 1.4;
}
.ep-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.ep-editor__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.ep-editor__row {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.7rem;
  background: var(--ink-800);
  border: 1px solid #333;
  border-radius: var(--radius-sm);
}
.ep-editor__order {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.ep-editor__num {
  font-weight: 700;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.ep-editor__moves {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.ep-editor__move {
  background: var(--ink-600);
  color: var(--text-soft);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  width: 2rem;
  height: 1.5rem;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ep-editor__move:hover:not(:disabled) { background: var(--ink-500); }
.ep-editor__move:disabled { opacity: 0.35; cursor: default; }
.ep-editor__fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.ep-editor__desc { min-height: 3rem; }
.ep-editor__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

@media (max-width: 720px) {
  .series-manage__head { flex-wrap: wrap; }
  .ep-editor__row { grid-template-columns: 2.2rem 1fr; }
}

/* --------------------------------------------------------------------------
   Clickable brand (home button) + class controls (반 변경) + class picker +
   welcome banner + admin 학년 grouping — all Netflix-dark consistent.
   -------------------------------------------------------------------------- */
.brand__home {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.brand__home:hover .brand__name { color: var(--red-bright); }
.brand__home:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.current-class {
  color: var(--text-soft);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.change-class-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.change-class-btn:hover { color: #fff; border-color: #808080; }

/* ---- Class picker (first visit) ---- */
.picker { max-width: 960px; padding-top: 2.5rem; }
.picker__intro { text-align: center; margin-bottom: 1.8rem; }
.picker__title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
}
.picker__lead { margin: 0; color: var(--text-secondary); font-size: 0.95rem; }
.picker__back {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.3rem 0;
  margin-bottom: 0.8rem;
}
.picker__back:hover { color: #fff; }
.picker__grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.picker__grid--grades { max-width: 560px; margin: 0 auto; }
.picker__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  aspect-ratio: 16 / 11;
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}
.picker__tile:hover,
.picker__tile:focus-visible {
  transform: translateY(-3px);
  background: var(--ink-700);
  border-color: var(--red);
  outline: none;
}
.picker__tile-num {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  color: #fff;
  line-height: 1;
}
.picker__tile-label { font-size: 0.85rem; color: var(--text-secondary); }

/* ---- Welcome banner (return visit) ---- */
.welcome-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
  background: linear-gradient(90deg, rgba(229,9,20,0.16), rgba(229,9,20,0.06));
  border-bottom: 1px solid rgba(229, 9, 20, 0.35);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.7rem 1rem;
  animation: welcome-fade 0.5s ease both;
}
.welcome-banner__spark { color: var(--red); }
@keyframes welcome-fade {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Admin: 학년 grouping ---- */
.admin-grade { margin-top: 1.8rem; }
.admin-grade__head {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--red);
  margin-bottom: 0.8rem;
}
.admin-grade__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}
.admin-grade__count { color: var(--text-secondary); font-size: 0.85rem; }

@media (max-width: 720px) {
  .current-class { font-size: 0.85rem; }
  .picker__grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* --------------------------------------------------------------------------
   Fixed-header scroll offset. .app-header is position:fixed, so any element
   scrolled to via scrollIntoView() (the opened series detail, the rails, their
   headings) must reserve header-height clearance or it tucks under the header.
   5.5rem safely covers the two-row wrapped header on narrow widths.
   -------------------------------------------------------------------------- */
.series-detail,
#series-rails,
#series-rails .section__heading,
.rail__title {
  scroll-margin-top: 5.5rem;
}
/* The detail panel is programmatically focused after selection; show a ring
   only for keyboard focus, not the programmatic (post-click) focus. */
.series-detail:focus { outline: none; }
.series-detail:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* ==========================================================================
   건의함 (suggestion box) — teacher modal + admin management
   ========================================================================== */

/* Header trigger button (matches change-class-btn ghost style) */
.request-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.request-btn:hover { color: #fff; border-color: #808080; }

/* ---- Modal overlay ---- */
.req-modal {
  position: fixed;
  inset: 0;
  z-index: 200; /* above player (100) */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4.5rem 1rem 2rem;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.72);
}
.req-modal__dialog {
  width: 100%;
  max-width: 640px;
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.4rem 1.5rem 1.6rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.req-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.req-modal__title { margin: 0; font-size: 1.35rem; font-weight: 800; }
.req-modal__close {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
}
.req-modal__close:hover { color: #fff; background: var(--ink-600); }
.req-modal__lead {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---- Submit form ---- */
.req-form { display: flex; flex-direction: column; gap: 0.7rem; }
.req-form__label {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 600;
}
.req-form__input {
  background: var(--ink-600);
  color: var(--text-primary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  width: 100%;
}
.req-form__input::placeholder { color: var(--text-muted); }
.req-form__input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: transparent;
}
.req-form__textarea { resize: vertical; font-family: inherit; }
.req-form__error { margin: 0; color: #ff8a92; font-size: 0.85rem; }
.req-form__success { margin: 0; color: #82c99a; font-size: 0.85rem; }
.req-form__submit { margin-top: 0.2rem; padding: 0.7rem 1rem; font-size: 1rem; }

/* ---- Request list (teacher "우리 반 건의 내역") ---- */
.req-list-wrap { margin-top: 1.4rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.req-list__heading { margin: 0 0 0.7rem; font-size: 1rem; font-weight: 700; }
.req-list__empty { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.req-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.7rem; }

.req-item {
  background: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.req-item__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}
.req-item__title { margin: 0; font-weight: 700; font-size: 0.95rem; }
.req-item__content { margin: 0; color: var(--text-soft); font-size: 0.9rem; white-space: pre-wrap; }
.req-item__url {
  color: #7fb3d5;
  font-size: 0.82rem;
  word-break: break-all;
}
.req-item__note {
  margin: 0.2rem 0 0;
  padding: 0.5rem 0.7rem;
  background: var(--ink-600);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.85rem;
  white-space: pre-wrap;
}
.req-item__date { color: var(--text-muted); margin-left: auto; }
.req-item__class { color: var(--text-secondary); font-weight: 600; }

/* Type + status chips */
.req-type,
.req-status {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
}
.req-type--series { background: rgba(118, 199, 192, 0.18); color: #76c7c0; }
.req-type--feature { background: rgba(127, 179, 213, 0.18); color: #7fb3d5; }
.req-type--opinion { background: rgba(201, 160, 220, 0.18); color: #c9a0dc; }
.req-status--pending { background: rgba(245, 185, 113, 0.18); color: #f5b971; }
.req-status--done { background: rgba(130, 201, 154, 0.18); color: #82c99a; }
.req-status--rejected { background: rgba(239, 154, 165, 0.18); color: #ef9aa5; }

/* ---- Admin management section ---- */
.req-admin__badge {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.15rem 0.6rem;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}
.req-list--admin { gap: 0.9rem; }
.req-item--admin { background: var(--ink-800); }
.req-admin__controls {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
}
.req-admin__status-group { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.req-admin-status {
  background: var(--ink-600);
  color: var(--text-secondary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.req-admin-status:hover:not(:disabled) { color: #fff; border-color: #808080; }
.req-admin-status:disabled { cursor: default; opacity: 0.6; }
.req-admin-status.is-current { color: #fff; }
.req-admin-status--pending.is-current { background: rgba(245, 185, 113, 0.3); border-color: #f5b971; }
.req-admin-status--done.is-current { background: rgba(130, 201, 154, 0.3); border-color: #82c99a; }
.req-admin-status--rejected.is-current { background: rgba(239, 154, 165, 0.3); border-color: #ef9aa5; }

.req-admin__note { display: flex; flex-direction: column; gap: 0.5rem; }
.req-admin__note-actions { display: flex; gap: 0.5rem; }
.req-admin__note-save,
.req-admin__delete { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.req-admin__delete:hover:not(:disabled) { background: rgba(229, 9, 20, 0.4); color: #fff; }

@media (max-width: 600px) {
  .req-modal { padding: 3.5rem 0.6rem 1.5rem; }
  .req-modal__dialog { padding: 1.1rem 1rem 1.3rem; }
}

/* ==========================================================================
   직접 관리 리스트 — tabs + list cards
   ========================================================================== */

/* ---- Tab bar ---- */
.list-tabs {
  display: flex;
  gap: 0.4rem;
  padding-top: 4.6rem; /* clear the fixed header */
  padding-bottom: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}
.list-tabs__tab {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.list-tabs__tab:hover { color: #fff; border-color: #808080; }
.list-tabs__tab.is-active {
  background: #fff;
  color: #000;
  border-color: #fff;
}

/* ---- Layout / toolbar ---- */
.lists-wrap { padding-top: 0.6rem; padding-bottom: 3rem; }
.lists-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.lists-toolbar .section__heading { margin: 0; }
.lists-notice {
  background: rgba(130, 201, 154, 0.15);
  color: #82c99a;
  border: 1px solid rgba(130, 201, 154, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  margin-bottom: 0.9rem;
}

/* ---- Create form ---- */
.cl-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem;
  margin-bottom: 1rem;
}
.cl-form__actions { display: flex; gap: 0.5rem; }

/* ---- Card grid ---- */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.9rem;
}

/* ---- List card ---- */
.list-card {
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.list-card.is-open { border-color: #4d4d4d; }
.list-card__header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}
.list-card__heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.list-card__title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.list-card__badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.list-card__badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
}
.list-card__badge--mine { background: rgba(118, 199, 192, 0.18); color: #76c7c0; }
.list-card__badge--sub { background: rgba(127, 179, 213, 0.18); color: #7fb3d5; }
.list-card__badge--shared { background: rgba(245, 185, 113, 0.18); color: #f5b971; }
.list-card__count { color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; }
.list-card__chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease;
  font-size: 0.9rem;
}
.list-card__chevron.is-open { transform: rotate(180deg); }
.list-card__desc { margin: 0; color: var(--text-secondary); font-size: 0.88rem; }
.list-card__add { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.list-card__add .req-form__input { flex: 1; min-width: 180px; }
.list-card__controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.list-card__danger:hover:not(:disabled) { background: rgba(229, 9, 20, 0.4); color: #fff; }

/* ---- Video rows inside a list ---- */
.lv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.lv-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
}
.lv-row__thumb {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--ink-600);
}
.lv-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.lv-row__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lv-row__dur { color: var(--text-muted); font-size: 0.78rem; }
.lv-row__actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.lv-row__del {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
}
.lv-row__del:hover:not(:disabled) { color: #ff8a92; background: var(--ink-600); }
.lv-row__del:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 600px) {
  .list-tabs { padding-top: 5.4rem; }
  .lv-row__thumb { width: 72px; }
}

/* --------------------------------------------------------------------------
   미리보기 배너 (/?class=<id>) — 관리자가 담임 화면을 열어 볼 때 뜨는 한 줄 띠.
   화면을 가리지 않도록 얇게, 그러나 평소 화면과 헷갈리지 않도록 또렷하게.
   -------------------------------------------------------------------------- */
.preview-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  background: rgba(229, 9, 20, 0.14);
  border-top: 1px solid rgba(229, 9, 20, 0.45);
  border-bottom: 1px solid rgba(229, 9, 20, 0.45);
  color: var(--text-soft);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem 1rem;
}
.preview-banner__icon {
  opacity: 0.85;
}
.preview-banner__exit {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.preview-banner__exit:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* --------------------------------------------------------------------------
   관리자 — 담임 화면 미리보기 · 진행 초기화 패널
   -------------------------------------------------------------------------- */
.admin-tools__block {
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.admin-tools__subtitle {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--text-primary);
}
.admin-tools__lead {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.87rem;
  line-height: 1.5;
}
.admin-tools__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.admin-tools__confirm {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}
.admin-tools__notice {
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid var(--red);
  color: var(--text-soft);
  font-size: 0.87rem;
  padding: 0.55rem 0.8rem;
  margin: 0 0 0.9rem;
}

/* 위험 구역 — 되돌릴 수 없는 전체 초기화. 시각적으로 확실히 분리한다. */
.admin-danger {
  background: rgba(229, 9, 20, 0.08);
  border: 1px solid var(--red-deep);
  border-radius: var(--radius-card);
  padding: 1rem 1.1rem;
}
.admin-danger__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--red-bright);
}
.admin-danger__lead {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.87rem;
  line-height: 1.5;
}
.admin-danger__label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-soft);
  font-size: 0.83rem;
}
.admin-danger__input {
  background: var(--ink-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  min-width: 160px;
}
.admin-danger__input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

/* 테스트 반 — 학년 표와 구분되는 별도 구역 + 행 배지 */
.admin-grade--test .admin-grade__count {
  color: var(--text-muted);
}
.admin-row--test {
  background: rgba(255, 255, 255, 0.04);
}
.admin-row__test-badge {
  display: inline-block;
  background: rgba(229, 9, 20, 0.22);
  border: 1px solid rgba(229, 9, 20, 0.5);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.7rem;
  padding: 0.05rem 0.45rem;
  margin-right: 0.35rem;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   반 코드 화면 (담임) — 관리자 게이트(.admin-gate)와 같은 카드 언어를 그대로
   쓰고, 여기서는 4자리 입력칸만 크게 키운다. 교실 PC와 태블릿에서 손가락으로
   누르는 화면이라 글자·터치 영역을 넉넉히 잡았다.
   -------------------------------------------------------------------------- */
.class-gate__card {
  width: min(480px, 100%);
  text-align: center;
}
.class-gate__eyebrow {
  margin: 0;
  color: var(--red-bright);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.class-gate__card .admin-gate__title {
  font-size: clamp(1.3rem, 3.4vw, 1.7rem);
}
.class-gate__card .admin-gate__lead {
  margin-bottom: 1.6rem;
  text-align: left;
}
.class-gate__form {
  gap: 0.5rem;
}
.class-gate__card .admin-gate__label {
  text-align: left;
}

/* 4자리 입력칸 — 크고, 가운데 정렬, 자간 넓게. 최소 높이 64px 로 터치 목표를
   충분히 확보한다. type="number" 를 쓰지 않으므로 스피너 걱정도 없다. */
.class-gate__code {
  width: 100%;
  min-height: 64px;
  background: var(--ink-600);
  color: var(--text-primary);
  border: 1px solid #4d4d4d;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.45em;
  text-indent: 0.45em; /* 자간 때문에 오른쪽으로 쏠리는 것을 되돌린다 */
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.class-gate__code::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}
.class-gate__code:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: transparent;
}
.class-gate__code:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.class-gate__submit {
  min-height: 52px;
  margin-top: 0.8rem;
  font-weight: 700;
}
.class-gate__submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 잠김 안내 — 남은 시간이 매초 바뀌는 곳이라 숫자 폭을 고정해 덜컹거리지 않게. */
.class-gate__locked {
  margin: 0.2rem 0 0;
  background: rgba(229, 9, 20, 0.1);
  border: 1px solid var(--red-deep);
  border-radius: var(--radius-sm);
  color: #ff8a92;
  font-size: 0.88rem;
  line-height: 1.55;
  padding: 0.7rem 0.8rem;
  text-align: left;
}
.class-gate__locked-msg {
  margin: 0;
}
.class-gate__locked-timer {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
}
.class-gate__countdown {
  color: var(--text-primary);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

/* "다른 반 선택" — 주요 동작이 아니라 빠져나가는 길이므로 조용한 링크 모양. */
.class-gate__other {
  display: inline-block;
  margin-top: 1.2rem;
  background: none;
  border: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
}
.class-gate__other:hover {
  color: var(--text-primary);
}
.class-gate__other:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (max-width: 600px) {
  .class-gate__card {
    padding: 1.6rem 1.1rem;
  }
  .class-gate__code {
    letter-spacing: 0.3em;
    text-indent: 0.3em;
  }
}

/* --------------------------------------------------------------------------
   관리자 — 반별 코드 관리 패널. .admin-tools__* / .admin-danger__* 와 같은 톤의
   카드 위에, 학년별 묶음 + 한 줄짜리 상태 행을 얹는다.
   -------------------------------------------------------------------------- */
.class-codes__summary {
  margin: 0 0 0.9rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
}
.class-codes__grades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}
.class-codes__grade {
  background: var(--ink-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 0.9rem 1rem;
}
.class-codes__grade-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}
.class-codes__grade-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}
.class-codes__grade-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.class-codes__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.class-codes__row {
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}
.class-codes__row:first-child {
  border-top: 0;
  padding-top: 0;
}
.class-codes__row-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.class-codes__name {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin-right: auto;
}
.class-codes__badge {
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
}
.class-codes__badge--set {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #4d4d4d;
  color: var(--text-soft);
}
.class-codes__badge--unset {
  background: transparent;
  border: 1px dashed #4d4d4d;
  color: var(--text-muted);
}
.class-codes__badge--locked {
  background: rgba(229, 9, 20, 0.22);
  border: 1px solid rgba(229, 9, 20, 0.5);
  color: #ff8a92;
}
.class-codes__action {
  flex-shrink: 0;
}
/* 인라인 확인 행 — .admin-tools__confirm 과 같은 배치, 위험 색만 덧입힌다. */
.class-codes__confirm {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.3rem;
  background: rgba(229, 9, 20, 0.08);
  border: 1px solid var(--red-deep);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
}

@media (max-width: 600px) {
  .class-codes__grades {
    grid-template-columns: 1fr;
  }
  .class-codes__name {
    flex-basis: 100%;
    margin-right: 0;
  }
}
