:root {
    /* Navy / white / black / gold. Variable names are kept from earlier
       themes so every rule below keeps working; only the values changed. */
    --navy-3: #0a1b36;      /* deepest navy: topbar, hero, watch-page ground */
    --navy: #12305c;        /* primary navy: buttons, headings */
    --navy-2: #1d4585;      /* interactive navy: links, focus */
    --navy-tint: #edf1f8;   /* pale navy wash: hovers, tags */
    --gold: #c9a24a;        /* the one accent */
    --gold-light: #e4cb83;
    --gold-dark: #8a6a1f;   /* gold used as text on light grounds */
    --gold-tint: #f8f1dd;

    --bg: #f3f5f9;
    --card-bg: #ffffff;
    --border: #d9dfea;
    --text: #0d1424;
    --muted: #55607a;
    --danger: #b42318;
    --draft: #64748b;
    --published: #17734a;

    --radius: 8px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(10, 27, 54, .08), 0 1px 3px rgba(10, 27, 54, .06);
    --shadow-md: 0 10px 24px rgba(10, 27, 54, .14), 0 2px 6px rgba(10, 27, 54, .08);

    --font-display: "Noto Serif Thai", "Sarabun", Georgia, serif;
}

/* Reserve the vertical scrollbar's space permanently instead of only
   showing it when content overflows. Without this, every time the
   subtitle panel's height change (see .sub-panel) pushes the page's total
   height across the viewport threshold, the scrollbar toggles on/off —
   which changes the page's available width by ~15px and reflows the
   whole width-fluid layout (video included) sideways each time. That's
   what read as "the whole page shrinking" and was genuinely
   uncomfortable to watch. A permanently-reserved scrollbar gutter means
   the page's width never moves regardless of how often the subtitle box
   resizes. */
html { overflow-y: scroll; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Sarabun", "Noto Sans Thai", Tahoma, sans-serif;
    font-size: 21px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* One consistent, visible keyboard focus ring across every control */
:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; }

/* Header / banner */
.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px 16px;
    padding: 14px 32px;
    background: linear-gradient(100deg, var(--navy-3), var(--navy));
    border-bottom: 3px solid var(--gold);
    box-shadow: var(--shadow-md);
    color: #fff;
}
.topbar h1 {
    font-size: 21px;
    margin: 0;
    color: #fff;
    line-height: 1.35;
    /* Session titles are often one long unbroken code (e.g.
       CDM2103_MCS1151) with no spaces to wrap on — without this, on a
       narrow screen it pushes the topbar wider than the viewport, which
       makes mobile browsers auto-zoom the whole page out to compensate
       (looks like the page "scale" is off). */
    overflow-wrap: break-word;
}
.topbar-subtext {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--gold-light);
}
.topbar-tag {
    margin: 2px 0 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--gold-light);
    line-height: 1.2;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    /* Let this flex item shrink below its content's natural width instead
       of forcing the row wider than the viewport (flex items default to
       min-width: auto, which ignores wrapping text entirely). */
    min-width: 0;
}
.topbar-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    background: #fff;
    border-radius: 999px;
    padding: 5px;
    box-shadow: 0 0 0 2px var(--gold);
    flex-shrink: 0;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 17px;
    color: #fff;
    min-width: 0;
}
.topbar-user a {
    color: var(--gold-light);
    font-weight: 600;
    overflow-wrap: break-word;
}
.topbar-user a:hover { color: #fff; text-decoration: none; }
@media (max-width: 600px) {
    .topbar { padding: 12px 16px; }
    .topbar-brand, .topbar-user { flex-basis: 100%; }
    .topbar h1 { font-size: 18px; }
}

.container { max-width: 1400px; margin: 32px auto; padding: 0 24px; }
.container-narrow { max-width: 640px; }
.watch-container { max-width: 1320px; }

/* Student landing band, directly under the topbar. Depth comes from layered
   navy shades only: a soft blue glow top-right and a thin gold line along
   the bottom edge that fades out toward the right. */
.hero {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 44px 32px 50px;
    background:
        radial-gradient(900px 340px at 88% -10%, rgba(88, 140, 214, .5), transparent 65%),
        radial-gradient(700px 300px at 0% 120%, rgba(201, 162, 74, .12), transparent 70%),
        linear-gradient(100deg, #06122a 0%, #0c2650 55%, #15427f 100%);
}
.hero::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), rgba(201, 162, 74, .35) 55%, transparent);
}
.hero-inner { position: relative; max-width: 1352px; margin: 0 auto; }
.hero h2 {
    margin: 0 0 10px;
    font-size: 36px;
    line-height: 1.25;
    color: #fff;
}
.hero p {
    margin: 0;
    max-width: 38em;
    font-size: 19px;
    line-height: 1.6;
    color: #d3ddf0;
}
@media (max-width: 600px) {
    .hero { padding: 28px 16px 30px; }
    .hero h2 { font-size: 26px; }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

/* Section / category headers, e.g. "เพิ่มวิชาใหม่", "รายวิชาทั้งหมด" */
h2 { font-size: 23px; font-weight: 700; margin: 0 0 14px; color: var(--navy); }
h3 { font-size: 20px; margin: 0; color: var(--navy); }

/* Subject postcard grid (student + admin index) — click a subject to see
   its session list on its own page, instead of every subject's full
   session list piled into one long scrolling page. */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
    gap: 22px;
}
.subject-postcard {
    position: relative;
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 6px solid var(--navy);
    border-radius: var(--radius);
    padding: 24px 26px 22px;
    box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: box-shadow .18s, transform .18s, border-left-color .18s;
}
.subject-postcard:hover {
    border-left-color: var(--gold);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}
/* Admin-only postcard grid modifier — dimmed + red left edge, so a subject
   hidden from students (see admin/subject.php's toggle) reads at a glance
   without having to open it first. */
.subject-postcard-hidden {
    opacity: .6;
    border-left-color: var(--danger);
}
.subject-postcard h2 {
    margin: 0 0 6px;
    font-size: 19px;
    /* Long codes like LAW1002_LAW1102_S1 have no spaces for the browser's
       default word-wrap to break on — without this they run past the
       card's edge instead of wrapping. */
    overflow-wrap: break-word;
    word-break: break-word;
}
.subject-postcard-name {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
    min-height: 44px;
    overflow-wrap: break-word;
}
.subject-postcard-count {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.empty-state { color: var(--muted); font-style: italic; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 17px; }
.alert-error { background: #fdeceb; color: var(--danger); border: 1px solid #f3c6c2; }

label { display: block; font-size: 16px; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
label input, label select, label textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-family: inherit;
    font-weight: 400;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
label input:focus, label select:focus, label textarea:focus {
    outline: none;
    border-color: var(--navy-2);
    box-shadow: 0 0 0 3px rgba(201, 162, 74, .45);
}

.inline-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; flex: 1; min-width: 180px; }

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto !important;
    white-space: nowrap;
}
.checkbox-label input[type="checkbox"] {
    display: inline-block !important;
    width: auto !important;
    margin-top: 0 !important;
    padding: 0 !important;
    border: none !important;
    accent-color: var(--navy-2, #1e3a5f);
    transform: scale(1.2);
}

button, .btn, .btn-small, .btn-primary, .btn-secondary, .btn-danger {
    cursor: pointer;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--navy);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
button:hover, .btn:hover { border-color: var(--navy-2); box-shadow: var(--shadow-sm); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn-small { padding: 7px 13px; font-size: 16px; }

.btn-primary, button[type="submit"].btn-primary {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}
.btn-primary:hover { background: var(--navy-3); border-color: var(--navy-3); }

/* Gold is reserved for the single "go live" action (Approve / publish) */
.btn-secondary {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--navy-3);
}
.btn-secondary:hover { background: var(--gold-light); border-color: var(--gold-light); }

.btn-danger { color: var(--danger); border-color: #ecc3bf; }
.btn-danger:hover { background: #fdeceb; border-color: var(--danger); }
button:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; transform: none; }

.term-tag {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    background: var(--navy-tint);
    border: 1px solid #d3dcee;
    padding: 2px 10px;
    border-radius: 4px;
    margin-left: 8px;
}
.subject-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.subject-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.subject-card { border-top: 4px solid var(--navy); }

.table { width: 100%; border-collapse: collapse; font-size: 17px; }
.table th {
    text-align: left;
    padding: 11px 10px;
    background: var(--navy-tint);
    border-bottom: 2px solid var(--navy);
    color: var(--navy);
    font-size: 16px;
    font-weight: 700;
}
.table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: #f7f9fc; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; }

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.badge-draft { background: var(--draft); }
.badge-published { background: var(--published); }
.badge-cancelled { background: var(--danger); }

.session-list { list-style: none; padding: 0; margin: 0; }
.session-list li { border-bottom: 1px solid var(--border); }
.session-list li:last-child { border-bottom: none; }
.session-list li:hover { background: var(--navy-tint); }
.session-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 10px;
    color: var(--text);
    font-weight: 600;
}
.session-list a::after {
    content: "›";
    font-size: 26px;
    line-height: 1;
    color: var(--gold);
    transition: transform .15s;
}
.session-list a:hover { color: var(--navy-2); text-decoration: none; }
.session-list a:hover::after { transform: translateX(3px); }
.session-list li.session-cancelled { padding: 14px 10px; color: var(--muted); cursor: default; }
.session-list li.session-cancelled:hover { background: none; }

/* Admin: cancelled-session rows/forms, and the subject-details edit form
   (same collapsible-<details> pattern) */
tr.row-cancelled { background: #fdf3f2; }
.cancelled-add, .cancelled-edit, .subject-edit { display: inline-block; }
.cancelled-add summary, .cancelled-edit summary, .subject-edit summary {
    cursor: pointer;
    list-style: none;
}
.cancelled-add summary::-webkit-details-marker, .cancelled-edit summary::-webkit-details-marker, .subject-edit summary::-webkit-details-marker { display: none; }
.cancelled-add-form, .cancelled-edit form, .subject-edit form {
    margin-top: 10px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Auth page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(160deg, var(--navy-3), var(--navy) 65%, #1a3f77);
    padding: 20px;
}
.auth-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    border-top: 4px solid var(--gold);
    padding: 36px 32px;
    width: 360px;
    max-width: 100%;
    box-shadow: 0 20px 48px rgba(0, 0, 0, .35);
    text-align: center;
}
.auth-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    margin: 0 auto 14px;
    display: block;
}
.auth-tagline {
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-dark);
    margin: 0 0 8px;
}
.auth-box h1 { font-size: 23px; margin: 0 0 22px; color: var(--navy); }
.auth-box label { text-align: left; }
.auth-box button { width: 100%; margin-top: 6px; }

/* Editor layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 22px;
    padding: 22px 28px;
    align-items: start;
}
@media (max-width: 900px) {
    .editor-layout { grid-template-columns: 1fr; padding: 16px; }
}

.editor-video-pane { position: sticky; top: 12px; }
.video-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); }
.video-js { width: 100%; height: auto; aspect-ratio: 16 / 9; }

.caption-overlay {
    position: absolute;
    left: 0; right: 0;
    bottom: 48px;
    text-align: center;
    color: #fff;
    font-size: 24px;
    line-height: 1.6;
    pointer-events: none;
    display: none;
    padding: 0 24px;
}
/* Live-edit preview while typing — one tightly-fit black box per line,
   so it reads like a caption background, not a full-width bar behind
   short text. */
.caption-overlay .cue-line {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    padding: 2px 8px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.live-time {
    margin-top: 10px;
    padding: 8px 12px;
    text-align: center;
    font-family: "Courier New", Consolas, monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .02em;
    /* Plain black-on-white — max, unambiguous contrast. */
    color: #000;
    background: #fff;
    border: 2px solid var(--gold);
    border-radius: var(--radius-sm);
    user-select: all; /* one click selects the whole timestamp, ready to copy */
}
.editor-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.save-status { font-size: 16px; color: var(--muted); }
.hint { font-size: 16px; color: var(--muted); margin-top: 8px; line-height: 1.55; }

.bookmark-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--gold-tint);
    border: 1px solid var(--gold-light);
    border-radius: var(--radius-sm);
}
.bookmark-status { font-size: 15px; color: var(--text); }
.bookmark-status a { color: var(--navy-2); font-weight: 600; }

.editor-cue-pane {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}
.cue-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--card-bg);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--navy);
}
.cue-pane-header h2 { margin: 0; font-size: 19px; }

.cue-list { display: flex; flex-direction: column; gap: 10px; }
.cue-row {
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 22px;
    gap: 8px;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.cue-row:hover { border-color: var(--navy-2); border-left-color: var(--navy-2); }
.cue-row.active { border-color: var(--gold); border-left-color: var(--gold); background: var(--gold-tint); box-shadow: var(--shadow-sm); }
.cue-row-times { display: flex; align-items: center; gap: 6px; grid-column: 1 / 2; flex-wrap: wrap; }
.cue-row-times input { width: 120px; font-size: 15px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 4px; }
.cue-seq {
    font-weight: 700;
    color: var(--navy);
    font-size: 14px;
    min-width: 34px;
}
.anchor-pin { font-size: 14px; cursor: pointer; line-height: 1; }
.anchor-pin[hidden] { display: none; }
.cue-row-times input.locked {
    border-color: var(--danger);
    background: #fdeceb;
    color: var(--danger);
    cursor: not-allowed;
}
.btn-seek { padding: 3px 8px; font-size: 15px; }
.btn-nudge-earlier, .btn-nudge-later { padding: 3px 7px; font-size: 14px; }
.cue-text {
    grid-column: 1 / 2;
    width: 100%;
    resize: vertical;
    font-size: 17px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
}
.cue-preview { font-size: 15px; color: var(--muted); line-height: 1.5; }
.cue-preview em { color: #9aa3b5; font-style: normal; }
.cue-preview .cue-line-over em { color: var(--danger, #c0392b); font-weight: 600; }
.cue-preview-row {
    grid-column: 1 / 2;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}
.btn-auto-format {
    flex-shrink: 0;
    font-size: 13px;
    padding: 3px 10px;
    white-space: nowrap;
}
.btn-delete-cue {
    grid-row: 1 / span 3;
    grid-column: 2 / 3;
    align-self: start;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    padding: 4px;
}
.btn-delete-cue:hover { color: var(--danger); }

.student-video-wrap { margin-top: 16px; }

.btn-fs {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(10, 27, 54, .7);
    color: #fff;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}
.btn-fs:hover { background: rgba(10, 27, 54, .9); }

/* Fullscreen shows video + subtitle panel together (not just the <video>
   element, which is all the native video.js fullscreen button can show —
   anything outside the fullscreened element is hidden by the Fullscreen
   API, which is exactly why the panel used to disappear on fullscreen).
   .pseudo-fullscreen is the fallback for iOS Safari, which only supports
   the real Fullscreen API on the <video> element itself, never on an
   arbitrary wrapper div — there, JS toggles this class instead of calling
   requestFullscreen, covering the viewport with position:fixed to get the
   same visual result without needing browser fullscreen support at all. */
.watch-fs-wrap:fullscreen,
.watch-fs-wrap:-webkit-full-screen,
.watch-fs-wrap.pseudo-fullscreen {
    display: flex;
    flex-direction: column;
    background: #000;
    padding: 0;
}
.watch-fs-wrap.pseudo-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
}
.watch-fs-wrap:fullscreen .student-video-wrap,
.watch-fs-wrap:-webkit-full-screen .student-video-wrap,
.watch-fs-wrap.pseudo-fullscreen .student-video-wrap {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
    border-radius: 0;
}
.watch-fs-wrap:fullscreen .video-wrap,
.watch-fs-wrap:-webkit-full-screen .video-wrap,
.watch-fs-wrap.pseudo-fullscreen .video-wrap {
    height: 100%;
    border-radius: 0;
}
.watch-fs-wrap:fullscreen .video-js,
.watch-fs-wrap:-webkit-full-screen .video-js,
.watch-fs-wrap.pseudo-fullscreen .video-js {
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
}
.watch-fs-wrap:fullscreen .sub-panel,
.watch-fs-wrap:-webkit-full-screen .sub-panel,
.watch-fs-wrap.pseudo-fullscreen .sub-panel {
    /* ~150px = about 3 lines at this font-size/line-height + padding —
       most cues fit comfortably, so this stays the box's size (and the
       video above keeps a stable, maximized area) on nearly every cue
       change. Genuinely long cues (rare) grow the box up to 50vh instead
       of scrolling/truncating; anything past that scrolls as a last
       resort. Growing does cost a one-off resize of the video area for
       that particular cue, but that's an acceptable rare trade — a fixed
       height would either cut the text off or scroll it, both worse. */
    flex: 0 1 auto;
    min-height: 150px;
    max-height: 50vh;
    overflow-y: auto;
    margin-top: 0;
    border-radius: 0;
    border-left: none;
    border-top: 4px solid var(--gold);
    /* Same white background / dark text as the non-fullscreen panel — kept
       identical on request rather than the dark theme it used to switch
       to, so .sub-panel-text's own color (var(--text)) applies unchanged. */
    background: var(--card-bg);
}
/* Rotating a phone to landscape for fullscreen (the common way to watch
   fullscreen video) leaves very little viewport height overall — the
   panel's normal 150px/22px sizing, sized for a tall portrait screen, ends
   up eating a disproportionate share of a short landscape one and
   crowding the video down to a sliver. Scoped to max-height so it only
   ever applies inside fullscreen on a short viewport — normal (non-
   fullscreen) viewing and fullscreen on a device with real height to
   spare (desktop, iPad landscape) are untouched. */
@media (max-height: 500px) {
    .watch-fs-wrap:fullscreen .sub-panel,
    .watch-fs-wrap:-webkit-full-screen .sub-panel,
    .watch-fs-wrap.pseudo-fullscreen .sub-panel {
        min-height: 70px;
        max-height: 35vh;
        padding: 8px 16px;
    }
    .watch-fs-wrap:fullscreen .sub-panel-text,
    .watch-fs-wrap:-webkit-full-screen .sub-panel-text,
    .watch-fs-wrap.pseudo-fullscreen .sub-panel-text {
        font-size: 16px;
        line-height: 1.4;
    }
}

/* Separate subtitle block below the video (not overlaid on it) — shows
   whatever vocalog produced verbatim, no 2-line limit, wraps naturally. */
.sub-panel {
    margin-top: 16px;
    padding: 20px 26px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 6px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    /* Locked at ~3 lines (same target size as the fullscreen box). Most
       cues fit inside 3 lines, so pinning the floor there means most cue
       changes no longer resize the box at all; only a genuinely long
       (4+ line) cue grows it. On that rarer occasion the height still
       genuinely needs to change — JS keeps an explicit px height on this
       element (see setPanelContent in watch.php) so this transition
       animates that resize smoothly instead of snapping instantly. */
    min-height: 150px;
    max-height: 50vh;
    overflow-y: auto;
    transition: height .25s ease;
}
.sub-panel-text {
    margin: 0;
    font-size: 22px;
    line-height: 1.6;
    color: #000;
    /* Each cue swap replaces this element outright (innerHTML), so a plain
       CSS transition never fires — there's no "before" state to transition
       from. An animation re-triggers automatically on every fresh element
       instead, turning the instant hard-cut into a quick fade-in. */
    animation: sub-panel-fade-in .2s ease;
}
@keyframes sub-panel-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .subject-postcard, .session-list a::after, .sub-panel { transition: none; }
    .sub-panel-text { animation: none; }
}
