/* ===========================================================================
   The live broadcast room.
   ===========================================================================

   TWO RULES HERE ARE LOAD-BEARING, NOT COSMETIC, and both are the same traps
   the assignment notice hit:

     custom.css sets `body { overflow: hidden }` and every ordinary page
     releases it from its preloader's onload. This page has no preloader, so
     without the override below it cannot be scrolled past the first screen.

     The shared .header is position:fixed with no `top`, so it needs one here or
     it floats over the content.

   Everything else is scoped under .osc-live-body so it cannot leak into the
   rest of the site.
   ========================================================================= */

.osc-live-body {
    overflow-y: auto !important;
    background: #0b1622;
    color: #e8eef6;
}
.osc-live-body .header { top: 0; }

:root {
    --osc-live-ink: #0b1622;
    --osc-live-line: rgba(143, 195, 242, .18);
    --osc-live-blue: #1f4e79;
    --osc-live-sky: #8fc3f2;
    --osc-live-red: #d7263d;
}

.osc-live {
    max-width: 1500px;
    margin: 0 auto;
    /* 160px of top padding clears the fixed masthead. Not a guess -- it is what
       assignment.css uses for the same header, and 26px left the room jammed
       under it. */
    padding: 160px 20px 60px;
}

/* ---------------------------------------------------------------------------
   THE GATE — code, then name
   ------------------------------------------------------------------------- */

.osc-live-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 62vh;
    padding: 20px 0;
}
/* Stages are all in the document; this is what decides which one is on screen.
   Instant, rather than a page load, which matters if the broadcast has already
   started while somebody is still typing a code. */
.osc-live[data-stage="code"] #stageName,
.osc-live[data-stage="code"] #stageRoom,
.osc-live[data-stage="name"] #stageCode,
.osc-live[data-stage="name"] #stageRoom,
.osc-live[data-stage="room"] #stageCode,
.osc-live[data-stage="room"] #stageName { display: none; }

.osc-live-gate-card {
    width: min(560px, 100%);
    padding: 38px 40px 32px;
    background: linear-gradient(160deg, #14243a 0%, #0f1c2c 100%);
    border: 1px solid var(--osc-live-line);
    border-top: 3px solid var(--osc-live-red);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.osc-live-kicker {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 10px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .19em;
    text-transform: uppercase;
    color: var(--osc-live-sky);
}

/* The one piece of motion on the gate. A newsroom signal, not decoration --
   it says the page is live rather than a screenshot. */
.osc-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--osc-live-red);
    box-shadow: 0 0 0 0 rgba(215, 38, 61, .7);
    animation: oscLivePulse 2s infinite;
}
@keyframes oscLivePulse {
    0%   { box-shadow: 0 0 0 0 rgba(215, 38, 61, .65); }
    70%  { box-shadow: 0 0 0 9px rgba(215, 38, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(215, 38, 61, 0); }
}

.osc-live-gate-title {
    margin: 0 0 12px;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.2;
    color: #ffffff;
}

.osc-live-gate-note {
    margin: 0 0 24px;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #b9cde3;
}

.osc-live-form label {
    display: block;
    margin: 0 0 7px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #91a8c2;
}

.osc-live-form input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.1rem;
    letter-spacing: .08em;
    color: #ffffff;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(143, 195, 242, .3);
    border-radius: 6px;
}
#guestName { font-family: Georgia, serif; letter-spacing: 0; }

.osc-live-form input[type="text"]:focus {
    outline: none;
    border-color: var(--osc-live-sky);
    box-shadow: 0 0 0 3px rgba(143, 195, 242, .22);
}

.osc-live-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;          /* comfortably above the 44px thumb minimum */
    margin-top: 14px;
    padding: 12px 26px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .9rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--osc-live-blue);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}
.osc-live-btn:hover { background: #2b6396; transform: translateY(-1px); }
.osc-live-btn:disabled { opacity: .55; cursor: default; transform: none; }
.osc-live-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(143, 195, 242, .5); }

.osc-live-error {
    margin: 12px 0 0;
    padding: 10px 13px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .84rem;
    color: #ffd7dc;
    background: rgba(215, 38, 61, .16);
    border-left: 3px solid var(--osc-live-red);
    border-radius: 0 5px 5px 0;
}

.osc-live-fineprint {
    margin: 22px 0 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .78rem;
    line-height: 1.6;
    color: #7b93ad;
}

/* ---------------------------------------------------------------------------
   THE ROOM
   ------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   THE RUNNER — a thin line to the results, above the broadcast
   ------------------------------------------------------------------------- */

.osc-live-runner {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 12px;
    padding: 9px 16px;
    background: linear-gradient(90deg, rgba(31, 78, 121, .55), rgba(20, 36, 58, .55));
    border: 1px solid var(--osc-live-line);
    border-left: 3px solid var(--osc-live-sky);
    border-radius: 5px;
    text-decoration: none;
    transition: background .18s ease;
}
.osc-live-runner:hover { background: linear-gradient(90deg, rgba(31, 78, 121, .8), rgba(20, 36, 58, .7)); }
.osc-live-runner:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(143, 195, 242, .45); }

.osc-live-runner-tag {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 3px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #0b1622;
    background: var(--osc-live-sky);
}
.osc-live-runner-text {
    flex: 1 1 auto;
    min-width: 0;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: .88rem;
    line-height: 1.45;
    color: #cfe0f3;
}
.osc-live-runner-cta {
    flex: 0 0 auto;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .76rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   THE DESK'S NOTE TO THE ROOM
   -------------------------------------------------------------------------
   Amber, and above the video rather than over it, so it is readable whether the
   picture is up or the offline panel is covering it -- the moment it matters
   most is exactly when the picture has gone. */

.osc-live-note {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 12px;
    padding: 11px 16px;
    background: rgba(246, 199, 86, .13);
    border: 1px solid rgba(246, 199, 86, .4);
    border-left: 3px solid #f6c756;
    border-radius: 5px;
    animation: oscLiveNoteIn .3s ease-out both;
}
.osc-live-note[hidden] { display: none; }
@keyframes oscLiveNoteIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: none; }
}
.osc-live-note-tag {
    flex: 0 0 auto;
    padding: 3px 9px;
    border-radius: 3px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #2a1e00;
    background: #f6c756;
}
.osc-live-note-text {
    flex: 1 1 auto;
    min-width: 0;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: .97rem;
    line-height: 1.5;
    color: #f4e2b4;
}

@media (max-width: 640px) {
    .osc-live-runner, .osc-live-note { flex-wrap: wrap; gap: 8px; }
    .osc-live-runner-text, .osc-live-note-text { font-size: .85rem; }
    .osc-live-runner-cta { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .osc-live-note { animation: none; }
}

.osc-live-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--osc-live-line);
}
.osc-live-bar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }

.osc-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 8px 15px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #ffffff;
    background: var(--osc-live-red);
    border-radius: 4px;
}
.osc-live-badge-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #ffffff;
    animation: oscLiveBlink 1.4s infinite;
}
@keyframes oscLiveBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Offline is stated plainly rather than dressed up as live. */
.osc-live-badge.is-offline {
    color: #9fb3c8;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .16);
}
.osc-live-badge.is-offline .osc-live-badge-dot { background: #66798e; animation: none; }

.osc-live-bar-titles { min-width: 0; }
.osc-live-title {
    margin: 0;
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
}
.osc-live-standfirst {
    margin: 3px 0 0;
    font-family: Georgia, serif;
    font-size: .9rem;
    color: #9db4cc;
}

.osc-live-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .8rem;
    color: #9db4cc;
}
.osc-live-greeting strong { color: var(--osc-live-sky); }
.osc-live-watching {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    font-size: .74rem;
    font-weight: 700;
    color: #cfe0f3;
    background: rgba(255, 255, 255, .06);
    border-radius: 999px;
}

.osc-live-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 20px;
    align-items: start;
}

.osc-live-frame-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000000;
    border: 1px solid var(--osc-live-line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}
.osc-live-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000000;
}

/* Covers the frame while the stream is down. The frame keeps running
   underneath -- their player is reconnecting on its own -- and this lifts the
   moment our own server-side check says the manifest is back. */
.osc-live-offline {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 40%, rgba(31, 78, 121, .35), transparent 60%),
        rgba(6, 12, 20, .94);
    transition: opacity .3s ease, visibility .3s ease;
}
.osc-live-offline.is-hidden { opacity: 0; visibility: hidden; }

/* The end. Deliberately warmer than the offline panel and without any of its
   "we are watching for it" language -- the whole point of this state is that
   nobody should sit here waiting. */
.osc-live-over {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 40%, rgba(31, 78, 121, .5), transparent 62%),
        rgba(8, 15, 24, .97);
    transition: opacity .3s ease, visibility .3s ease;
}
.osc-live-over.is-hidden { opacity: 0; visibility: hidden; }

.osc-live-over-kicker {
    margin: 0 0 8px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .19em;
    text-transform: uppercase;
    color: var(--osc-live-sky);
}
.osc-live-over-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 18px;
    padding: 12px 26px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .875rem;
    font-weight: 700;
    color: #14243a;
    background: #ffffff;
    border-radius: 999px;
    text-decoration: none;
}
.osc-live-over-link:hover { background: #dceafc; }

.osc-live-offline-inner { max-width: 30rem; }
.osc-live-offline-title {
    margin: 0 0 10px;
    font-family: Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
}
.osc-live-offline-copy {
    margin: 0 0 12px;
    font-family: Georgia, serif;
    font-size: .97rem;
    line-height: 1.6;
    color: #a9c0d8;
}
.osc-live-offline-checked {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .72rem;
    color: #6d8299;
}

/* ---- the question panel ---- */

.osc-live-chat {
    display: flex;
    flex-direction: column;
    /* Matches the video, so the two columns end together on a desktop. */
    max-height: min(72vh, 720px);
    background: linear-gradient(180deg, #14243a 0%, #101d2e 100%);
    border: 1px solid var(--osc-live-line);
    border-radius: 8px;
    overflow: hidden;
}

.osc-live-chat-head {
    flex: 0 0 auto;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--osc-live-line);
}
.osc-live-chat-kicker {
    margin: 0 0 5px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--osc-live-sky);
}
.osc-live-chat-title {
    margin: 0 0 6px;
    font-family: Georgia, serif;
    font-size: 1.12rem;
    font-weight: 700;
    color: #ffffff;
}
.osc-live-chat-note {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .78rem;
    line-height: 1.55;
    color: #90a8c1;
}

.osc-live-thread {
    flex: 1 1 auto;
    min-height: 120px;
    padding: 16px 20px;
    overflow-y: auto;
}
.osc-live-thread-empty {
    margin: 0;
    font-family: Georgia, serif;
    font-size: .88rem;
    line-height: 1.6;
    color: #7a91ab;
}

.osc-live-msg {
    margin: 0 0 12px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, .05);
    border-left: 3px solid rgba(143, 195, 242, .45);
    border-radius: 0 6px 6px 0;
    animation: oscLiveIn .25s ease-out both;
}
@keyframes oscLiveIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.osc-live-msg-text {
    margin: 0 0 7px;
    font-family: Georgia, serif;
    font-size: .92rem;
    line-height: 1.55;
    color: #e4edf7;
}
.osc-live-msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .68rem;
    letter-spacing: .04em;
    color: #7e95af;
}
.osc-live-tag {
    padding: 2px 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    border-radius: 3px;
}
.osc-live-tag--sent      { color: #cfe0f3; background: rgba(255,255,255,.09); }
.osc-live-tag--starred   { color: #2a1e00; background: #f6c756; }
.osc-live-tag--answered  { color: #04240f; background: #58d68d; }
/* Dismissed is shown to the asker as "not used", never as "rejected". The
   broadcaster has limited air time; that is not a judgement on the question. */
.osc-live-tag--dismissed { color: #cfd8e3; background: rgba(255,255,255,.06); }

.osc-live-msg.is-answered { border-left-color: #58d68d; }

/* Picked out. Given real weight rather than a chip, because a viewer who knows
   their question is next will stay and listen for it. */
.osc-live-msg.is-starred {
    border-left-color: #f6c756;
    background: rgba(246, 199, 86, .10);
}
.osc-live-msg-heads {
    margin: 0 0 7px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.45;
    color: #f6c756;
}

.osc-live-ask {
    flex: 0 0 auto;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--osc-live-line);
    background: rgba(0, 0, 0, .18);
}
.osc-live-ask-label {
    display: block;
    margin: 0 0 7px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #91a8c2;
}
.osc-live-ask textarea {
    width: 100%;
    padding: 11px 13px;
    font-family: Georgia, serif;
    font-size: .95rem;
    line-height: 1.5;
    color: #ffffff;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(143, 195, 242, .28);
    border-radius: 6px;
    resize: vertical;
}
.osc-live-ask textarea:focus {
    outline: none;
    border-color: var(--osc-live-sky);
    box-shadow: 0 0 0 3px rgba(143, 195, 242, .2);
}
.osc-live-ask-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}
.osc-live-count {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .74rem;
    color: #6d8299;
}
.osc-live-count.is-low { color: #f6c756; }
.osc-live-btn-send { margin-top: 0; padding: 10px 22px; min-height: 42px; }

.osc-live-closed {
    margin: 10px 0 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: .82rem;
    color: #f0c86a;
}

/* ---------------------------------------------------------------------------
   NARROW SCREENS — the video first, the questions under it
   ------------------------------------------------------------------------- */

@media (max-width: 1020px) {
    .osc-live-grid { grid-template-columns: minmax(0, 1fr); }
    .osc-live-chat { max-height: none; }
    .osc-live-thread { max-height: 320px; }
}

@media (max-width: 640px) {
    /* The masthead is shorter here; 120px is the assignment page's figure. */
    .osc-live { padding: 120px 12px 44px; }
    .osc-live-gate-card { padding: 26px 20px 22px; }
    .osc-live-gate-title { font-size: 1.5rem; }
    .osc-live-bar { gap: 12px; }
    .osc-live-bar-right { width: 100%; justify-content: space-between; }
    .osc-live-title { font-size: 1.12rem; }
    .osc-live-btn { width: 100%; }
    .osc-live-btn-send { width: auto; }
    .osc-live-frame-wrap { border-radius: 5px; }
}

@media (prefers-reduced-motion: reduce) {
    .osc-live-dot, .osc-live-badge-dot { animation: none; }
    .osc-live-msg { animation: none; }
    .osc-live-btn:hover { transform: none; }
}
