/* ---------------------------------------------------------------------
   trivia.css — the Trivia room.

   The Parlor is furniture and the prediction board is a ledger. Trivia is
   one card under a lamp: centred, generous type, everything else out of
   the way. That idea is why this file is mostly about width and air, and
   why nothing here is a table.

   Shared by /pages/trivia.php (the home) and /pages/trivia_play.php (the
   board), so anything below that is home-only is marked as such.

   Loaded via $page_css = ['common/common', 'pages/trivia'].
   --------------------------------------------------------------------- */

.trivia-room {
    max-width: 60rem;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    width: 100%;
}

/* the one paragraph that explains the room, then it gets out of the way */
.trivia-lead {
    text-align: center;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 44rem;
    margin: 0 auto var(--space-xl);
}

.trivia-h {
    text-align: center;
    margin: 0 0 var(--space-md);
}

/* ---------------------------------------------------------------------
   TODAY — home only.

   One row per league the player is in. A row, not a grid cell, because
   there are usually one or two of these and they are the reason the page
   exists: they should read as a short list of things to do, not as a wall
   of tiles competing with the join cards below.
   --------------------------------------------------------------------- */

.trivia-today {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.trivia-day {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: .9rem;
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* the left edge carries the state, so the list is scannable without
   reading a word of it */
.trivia-day.is-fresh   { border-left-color: var(--accent);  }
.trivia-day.is-partial { border-left-color: var(--warning); }
.trivia-day.is-done    { border-left-color: var(--success); }

.trivia-day-head {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 0;          /* lets a long league name wrap instead of pushing
                              the button off the card */
}

.trivia-day-head h3 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

.trivia-day-act { flex: 0 0 auto; }

.trivia-pill {
    align-self: flex-start;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-weight: 800;
    padding: .2rem .6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    white-space: nowrap;
}

.pill-fresh   { color: var(--accent);  border-color: var(--accent);  }
.pill-partial { color: var(--warning); border-color: var(--warning); }
.pill-done    { color: var(--success); border-color: var(--success); }

/* ---------------------------------------------------------------------
   JOIN — home only.

   There is no league list on this page: joining runs through leagues.php,
   which already has the type filter and the season handling. What is left
   here is the door to it.
   --------------------------------------------------------------------- */

.trivia-more {
    text-align: center;
    margin: 0;
}

/* ---------------------------------------------------------------------
   EMPTY / SIGNED-OUT
   --------------------------------------------------------------------- */

.trivia-note {
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: .9rem;
    padding: var(--space-xl);
    max-width: 40rem;
    margin: 0 auto;
}

.trivia-note p { margin: 0 0 var(--space-md); }

/* ---------------------------------------------------------------------
   PHONE. The board is played on one, so the room is laid out for one:
   the action goes full width and under the name rather than beside it.
   --------------------------------------------------------------------- */

@media (max-width: 34rem) {

    .trivia-room { padding: 0 var(--space-md); }

    .trivia-day {
        flex-direction: column;
        align-items: stretch;
    }

    .trivia-day-act .btn {
        display: block;
        width: 100%;
        text-align: center;
    }
}

/* ---------------------------------------------------------------------
   THE BOARD — trivia_play.php.

   One question at a time. Everything here serves that: only the current
   card is in the document flow, the options are full-width rows rather
   than pills, and the prompt is allowed to be long.
   --------------------------------------------------------------------- */

.trivia-board { max-width: 44rem; }

/* ---- progress rail ---- */

.tq-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    margin-bottom: var(--space-lg);
}

.tq-rail-count {
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-muted);
}

.tq-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
}

/* Buttons, because they navigate — mobile's dots are clickable and so are
   these. Sized up from decorative dots to something a thumb can hit. */
.tq-dot {
    width: .85rem;
    height: .85rem;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.tq-dot:hover { border-color: var(--accent); }

.tq-dot:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.tq-dot.is-done { background: var(--success); border-color: var(--success); }

/* where you are outranks what you have done, so it is drawn last and bigger */
.tq-dot.is-at {
    border-color: var(--accent);
    background: var(--accent);
    transform: scale(1.5);
}

/* ---- the card ---- */

.tq-card { display: none; }

/* the lamp */
.tq-card.is-current {
    display: block;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: var(--space-xl);
}

.tq-chip {
    display: inline-block;
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: var(--space-sm);
}

/* generous, because a trivia prompt can be 500 characters and it is the
   only thing on the screen that matters */
.tq-prompt {
    margin: 0 0 var(--space-sm);
    font-size: 1.35rem;
    line-height: 1.45;
    color: var(--text);
    text-align: left;
    overflow-wrap: anywhere;
}

.tq-verdict {
    margin: 0 0 var(--space-lg);
    color: var(--text-soft);
    font-size: .95rem;
    line-height: 1.5;
}

.tq-verdict em { color: var(--text-muted); font-style: italic; }

/* ---- options: rows, not pills ----
   A row is the same width whether the answer is "True" or a full sentence,
   which is what stops a 6-option question looking like a mistake. It is
   also the only shape that stays tappable on a phone. */

.tq-options {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.tq-option {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: .7rem;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.4;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s ease, background .15s ease;
}

.tq-option:hover { border-color: var(--accent); }

.tq-option input { flex: 0 0 auto; margin: 0; cursor: pointer; }

.tq-option span { overflow-wrap: anywhere; }

.tq-option.is-picked {
    border-color: var(--accent);
    background: rgba(88, 166, 255, .12);
}

/* a visible focus ring, since the whole row is the target */
.tq-option:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- per-card actions ---- */

.tq-actions {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.tq-actions .btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.tq-review-note {
    color: var(--warning);
    font-size: .86rem;
    margin: 0;
    min-height: 1.2em;   /* reserve the line so the buttons don't jump */
}

@media (max-width: 34rem) {

    .tq-card.is-current { padding: var(--space-lg); }

    .tq-prompt { font-size: 1.2rem; }

    .tq-actions .btn { flex: 1 1 0; }
}

/* ---------------------------------------------------------------------
   THE CONFIRMATION PAGE — the last card on the board.

   Every question with what you chose, and any line takes you back to
   change it. It is a list of decisions, so it reads as one: prompt on
   top in the reading colour, the answer under it in the accent, and an
   unanswered one called out rather than left blank.
   --------------------------------------------------------------------- */

.tq-summary {
    list-style: none;
    margin: 0 0 var(--space-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    counter-reset: tqrow;
}

.tq-summary-row { counter-increment: tqrow; }

.tq-summary-jump {
    /* a button, because it acts like one — keyboard and screen readers get
       that for free, which a clickable <li> would not give them */
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .25rem .75rem;
    width: 100%;
    text-align: left;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: .7rem;
    padding: var(--space-md);
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color .15s ease, background .15s ease;
}

.tq-summary-jump::before {
    content: counter(tqrow);
    grid-row: 1 / span 2;
    align-self: start;
    font-size: .75rem;
    font-weight: 800;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    padding-top: .15rem;
}

.tq-summary-jump:hover { border-color: var(--accent); background: var(--bg-2); }

.tq-summary-jump:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.tq-summary-q {
    color: var(--text);
    font-size: .95rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.tq-summary-a {
    color: var(--accent);
    font-size: .88rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* skipped: say so plainly, in the warning colour, so it is not mistaken
   for an answer the player forgot they gave */
.tq-summary-row.is-empty .tq-summary-jump { border-left-color: var(--warning); }
.tq-summary-row.is-empty .tq-summary-a {
    color: var(--warning);
    font-weight: 400;
    font-style: italic;
}

.tq-review-note {
    color: var(--warning);
    font-size: .86rem;
    margin: 0 0 var(--space-md);
    min-height: 1.2em;   /* reserve the line so the buttons don't jump */
}

.tq-actions .btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 34rem) {
    .tq-summary-jump { padding: var(--space-sm); }
}

/* ---------------------------------------------------------------------
   THE LOCK-IN BAR — ported from mobile, where MainActivity keeps it
   "pinned and always visible" below a scrolling board.

   It is the only gate on submission, so it is the only thing on the page
   styled as a primary action, and it always says what it wants: "Pick 2
   more" until the board is done, then "Lock in my 3".
   --------------------------------------------------------------------- */

.tq-lockin {
    position: sticky;
    bottom: 0;
    margin-top: var(--space-lg);
    padding: var(--space-md) 0 var(--space-lg);
    /* fades the board out underneath rather than cutting it off */
    background: linear-gradient(to bottom, transparent, var(--bg-0) 35%);
}

.tq-lockin .btn {
    display: block;
    width: 100%;
    text-align: center;
    font-weight: 800;
    padding-top: .85rem;
    padding-bottom: .85rem;
}

.tq-lockin .btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.tq-lockin-note {
    margin: .6rem 0 0;
    text-align: center;
    font-size: .82rem;
    color: var(--text-muted);
    min-height: 1.1em;   /* reserve the line so the bar doesn't jump */
}

/* ---------------------------------------------------------------------
   THE ARCADE — arcade.php, the web half of CasualScreen.

   Louder than the league board on purpose. The daily board is the thing
   that counts and reads calm; the arcade is the one where nothing counts,
   so it can say so and move fast.
   --------------------------------------------------------------------- */

.arcade-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.arcade-round {
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-muted);
}

.arcade-clock {
    font-size: .95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;   /* no twitch at 9s */
    color: var(--text-soft);
}

/* mobile turns the clock red at 10 seconds; so does this */
.arcade-clock.is-urgent { color: var(--danger); }

.arcade-stage {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.arcade-q {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 1rem;
    padding: var(--space-lg);
}

.arcade-q .tq-prompt { font-size: 1.1rem; }

/* the options are buttons here, not labels round a radio — the arcade has
   no form to submit, so there is nothing for an input to carry */
.arcade-opt {
    font: inherit;
    color: var(--text);
    cursor: pointer;
}

.arcade-opt:disabled { cursor: default; }

.arcade-result {
    margin: var(--space-md) 0 0;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--text-soft);
    overflow-wrap: anywhere;
}

.arcade-q.is-win  { border-left-color: var(--success); }
.arcade-q.is-loss { border-left-color: var(--danger); }
.arcade-q.is-void { border-left-color: var(--text-muted); }

.arcade-result.is-win  { color: var(--success); }
.arcade-result.is-loss { color: var(--danger); }

/* The arcade button on a finished league card. Quieter than the results
   link beside it: the arcade is the thing that does NOT count, so it
   should never out-shout the thing that does. */
.btn-arcade {
    opacity: .85;
    font-size: .9em;
}

.btn-arcade:hover { opacity: 1; }
