/*
 * Peekopals web app: games, quiz and roleplay in a chat (htmx/webApp/chat/play/AGENTS.md).
 * Copies the phone's ActiveChatPlayModeBar, ChatGamesListBottomSheet, the play info / stop sheets,
 * QuizChatBubbleCta, the quiz session, results summary and quiz detail. Colours are the phone's
 * Material roles (--md-*), sizes come from dimens.kt (12 px corners, 16 px padding, 40 px wells).
 */

/* ==================== play bar (under the chat header) ==================== */

.wa-thread-page .wa-thread-header { flex-wrap: wrap; }
/* the running magic strip (htmx/webApp/chat/magics/chatRunningMagicBar.kt) is the same strip, under the play bar */
.wa-play-mode-bar,
.wa-running-magic-bar {
    order: 3;
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 8px;
    padding: 4px 8px 4px 12px;
    border-radius: 12px;
    /* the plain screen colour: the strip isn't tappable, only its (i) and action are */
    background: var(--md-background);
    color: var(--md-on-surface);
    pointer-events: auto;
}
.wa-play-mode-bar[hidden], .wa-running-magic-bar[hidden] { display: none; }
.wa-running-magic-bar { order: 4; }
.wa-running-magic-bar-emblem {
    width: 18px;
    height: 18px;
    flex: none;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--md-surface-container-high);
}
.wa-play-mode-bar-icon { display: inline-flex; flex: none; }
.wa-play-mode-bar-icon .wa-icon svg { width: 18px; height: 18px; }
.wa-play-mode-bar-title,
.wa-running-magic-bar-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: calc(16px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-play-mode-bar-info,
.wa-play-row-info {
    width: 40px;
    height: 40px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-on-surface-variant);
    cursor: pointer;
}
.wa-play-mode-bar-info .wa-icon svg,
.wa-play-row-info .wa-icon svg { width: 18px; height: 18px; }
.wa-play-mode-bar-stop,
.wa-play-row-stop {
    flex: none;
    padding: 4px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.wa-play-mode-bar-info:hover, .wa-play-mode-bar-stop:hover,
.wa-play-row-info:hover, .wa-play-row-stop:hover { background: var(--md-surface-container-highest); }
/* the bars float over the thread like the phone's header overlay, so the first messages move down (one more strip when both show) */
.wa-thread-page:has(.wa-play-mode-bar:not([hidden])) .wa-thread-scroller,
.wa-thread-page:has(.wa-running-magic-bar:not([hidden])) .wa-thread-scroller { padding-top: calc(max(8px, env(safe-area-inset-top)) + 112px); }
.wa-thread-page:has(.wa-play-mode-bar:not([hidden])) .wa-day-separator,
.wa-thread-page:has(.wa-running-magic-bar:not([hidden])) .wa-day-separator { top: calc(max(8px, env(safe-area-inset-top)) + 108px); }
.wa-thread-page:has(.wa-play-mode-bar:not([hidden])):has(.wa-running-magic-bar:not([hidden])) .wa-thread-scroller { padding-top: calc(max(8px, env(safe-area-inset-top)) + 164px); }
.wa-thread-page:has(.wa-play-mode-bar:not([hidden])):has(.wa-running-magic-bar:not([hidden])) .wa-day-separator { top: calc(max(8px, env(safe-area-inset-top)) + 160px); }

/* ==================== play sheets (games list, how to play, info, stop) ==================== */

.wa-play-sheet-top-row { display: flex; justify-content: flex-end; margin: 0 -8px 8px 0; }
.wa-play-sheet-close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    cursor: pointer;
}
.wa-play-ask-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.wa-avatar--play-ask { width: 56px; height: 56px; font-size: calc(22px * var(--wa-text-scale, 1)); flex: none; }
.wa-play-ask-bubble {
    min-width: 0;
    padding: 8px 12px;
    border-radius: 18px 18px 18px 6px;
    background: var(--wa-pal-bubble);
    color: var(--wa-on-pal-bubble);
    border: 1px solid var(--wa-hairline);
    font-size: calc(16px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-play-list { display: grid; gap: 8px; padding: 16px 0 48px; }
.wa-play-row {
    display: flex;
    align-items: center;
    border-radius: 12px;
    background: var(--md-surface-container-low);
    border: 1px solid var(--md-outline-variant);
    overflow: hidden;
}
.wa-play-row--active { border: 2px solid var(--md-secondary); }
.wa-play-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 8px 16px 16px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}
.wa-play-row-main:hover { background: var(--md-surface-container); }
.wa-play-index-badge {
    width: 40px;
    height: 40px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--md-secondary);
    color: #000;
    font-size: calc(16px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-play-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.wa-play-row-title { font-size: calc(16px * var(--wa-text-scale, 1)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wa-play-row-description { font-size: calc(14px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-play-row-stop { margin-right: 8px; }
.wa-play-now-playing-chip {
    margin-top: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--md-secondary);
    color: #000;
    font-size: calc(11px * var(--wa-text-scale, 1));
    font-weight: 600;
}
.wa-play-explainer { display: flex; flex-direction: column; align-items: center; text-align: center; }
.wa-play-explainer-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--md-secondary);
    color: #000;
}
.wa-play-explainer-icon .wa-icon svg { width: 28px; height: 28px; }
.wa-play-explainer-title { margin: 16px 0 0; font-size: calc(24px * var(--wa-text-scale, 1)); }
.wa-play-explainer-eyebrow { margin: 8px 0 0; color: var(--md-on-surface-variant); font-size: calc(14px * var(--wa-text-scale, 1)); }
.wa-play-explainer-body { margin: 16px 0 0; color: var(--md-on-surface-variant); }
.wa-play-section-eyebrow {
    margin: 24px 0 8px;
    padding-left: 8px;
    border-left: 3px solid var(--md-primary);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--md-on-surface-variant);
}
.wa-play-now-playing-card {
    padding: 16px 16px 16px 20px;
    border-radius: 16px;
    background: var(--md-surface-container-low);
    border: 1px solid var(--md-outline-variant);
    box-shadow: inset 4px 0 0 var(--md-secondary);
}
.wa-play-mode-name-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    background: var(--md-background);
    font-size: calc(11px * var(--wa-text-scale, 1));
}
.wa-play-mode-name-chip .wa-icon svg { width: 16px; height: 16px; }
.wa-play-now-playing-title { margin: 8px 0 0; font-size: calc(16px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-play-now-playing-body { margin: 8px 0 0; color: var(--md-on-surface-variant); white-space: pre-line; }
/* a live scene or game with a picture, and a game's "How to play" with one: the picture as a tall
   card (chat/WebAppTallPictureCardSheet.kt, styled in web-app-chat-magics-gifts.css), red for a scene
   and a game that is not live, yellow for the live game; then the short line under it */
.wa-tall-picture-sheet--roleplay-scene,
.wa-tall-picture-sheet--game { --wa-magic-mode-color: var(--md-primary); }
.wa-tall-picture-sheet--game-live { --wa-magic-mode-color: var(--md-secondary); }
.wa-play-scene-hero-picture { object-position: 50% 35%; }
.wa-play-scene-text { padding: 12px 4px 0; }
.wa-play-scene-text .wa-play-section-eyebrow { margin-top: 8px; }
.wa-play-scene-short-line { margin: 0; color: var(--md-on-surface-variant); white-space: pre-line; }

/* ==================== quiz pitch bubble ("Start quiz" / "View quiz") ==================== */

.wa-quiz-bubble-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    margin: 8px -12px -6px;
    padding: 12px;
    border-top: 1px solid var(--md-on-surface);
    color: var(--md-on-surface);
    font-weight: 600;
    text-decoration: none;
}
.wa-quiz-bubble-cta:hover { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }

/* ==================== quiz screens ==================== */

.wa-quiz-screen {
    position: relative;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    background: var(--md-background);
    color: var(--md-on-surface);
}
.wa-quiz-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wa-quiz-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
}
.wa-quiz-top-face { display: inline-flex; }
.wa-quiz-top-face .wa-avatar { width: 48px; height: 48px; }
.wa-quiz-top-spacer { width: 44px; height: 44px; flex: none; }
.wa-quiz-kind-chip {
    align-self: center;
    margin: 8px 16px 0;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--md-outline-variant);
    color: var(--md-on-surface-variant);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 500;
}
/* the phone's PeekoPalsLinearProgressBar: 8 high, hairline outline, background-coloured track, yellow fill */
.wa-quiz-progress {
    height: 8px;
    margin: 12px 16px 0;
    border: 0.5px solid var(--md-outline-variant);
    border-radius: 8px;
    background: var(--md-background);
    overflow: hidden;
}
.wa-quiz-progress-fill { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--md-secondary); transition: width 320ms ease; }
.wa-quiz-pages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 16px 16px; }
/* a sideways swipe moves a slide (web-app-chat-play.js); the browser keeps only up-and-down scrolling */
.wa-quiz-form .wa-quiz-pages { touch-action: pan-y; }
.wa-quiz-page[hidden] { display: none; }
.wa-quiz-page--intro { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.wa-quiz-intro-heading { margin: 0 0 16px; text-align: center; font-size: calc(24px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-quiz-intro-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: var(--md-surface-container-low);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.wa-quiz-intro-accent { width: 6px; flex: none; border-radius: 999px; background: var(--md-secondary); }
.wa-quiz-intro-text { margin: 0; font-size: calc(16px * var(--wa-text-scale, 1)); font-weight: 500; }
.wa-quiz-index { margin: 0; text-align: center; font-size: calc(14px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-quiz-index strong { color: var(--md-on-surface); }
.wa-quiz-prompt { margin: 8px 0 0; text-align: center; font-size: calc(22px * var(--wa-text-scale, 1)); font-weight: 600; line-height: 1.3; }
.wa-quiz-hint { margin: 8px 0 16px; text-align: center; font-size: calc(13px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-quiz-error { margin: 8px 0 16px; text-align: center; color: var(--md-error); }
.wa-quiz-options { display: grid; gap: 8px; }
.wa-quiz-options[hidden], .wa-quiz-true-order[hidden] { display: none; }
.wa-quiz-evaluate-instruction { margin: 20px 0 12px; text-align: center; font-size: calc(13px * var(--wa-text-scale, 1)); font-weight: 600; color: var(--md-on-surface-variant); }
.wa-quiz-verdict-buttons { display: flex; justify-content: center; gap: 12px; }
.wa-quiz-verdict-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.wa-quiz-verdict-button--right[aria-pressed="true"] { background: var(--md-success); border-color: var(--md-success); color: #fff; }
.wa-quiz-verdict-button--wrong[aria-pressed="true"] { background: var(--md-primary-container); border-color: var(--md-primary-container); color: #fff; }

/* one option row; its look is the shared QuizOptionChrome (data-chrome) */
.wa-quiz-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 0.5px solid var(--md-outline-variant);
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    font-size: calc(16px * var(--wa-text-scale, 1));
    list-style: none;
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
label.wa-quiz-option { cursor: pointer; }
.wa-quiz-option:has(.wa-quiz-option-input:focus-visible) { box-shadow: var(--wa-focus-ring); }
.wa-quiz-option:has(.wa-quiz-option-input:disabled) { cursor: default; }
.wa-quiz-option-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.wa-quiz-option-text { flex: 1; min-width: 0; }
.wa-quiz-option-mark { display: inline-flex; flex: none; }
.wa-quiz-option-mark .wa-icon { display: none; }
.wa-quiz-option--neutral-filled { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.wa-quiz-option--neutral-transparent { background: transparent; }
.wa-quiz-option--live-selected { background: var(--md-secondary); border: 1px solid var(--md-secondary); color: #000; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.wa-quiz-option--success-fill { background: var(--md-success); border: 1px solid var(--md-success); color: #fff; }
.wa-quiz-option--success-outline { background: var(--md-surface); border: 1px solid var(--md-success); }
.wa-quiz-option--success-outline-transparent { background: transparent; border: 1px solid var(--md-success); }
.wa-quiz-option--wrong { background: var(--md-surface); border: 1px solid var(--md-primary-container); }
.wa-quiz-option--wrong-transparent { background: transparent; border: 1px solid var(--md-primary-container); }
.wa-quiz-option--clickable-candidate { background: var(--md-surface-container-high); }
.wa-quiz-option[data-chrome="LIVE_SELECTED"] .wa-quiz-mark-check,
.wa-quiz-option[data-chrome="SUCCESS_FILL"] .wa-quiz-mark-check,
.wa-quiz-option[data-chrome="SUCCESS_OUTLINE"] .wa-quiz-mark-check,
.wa-quiz-option[data-chrome="SUCCESS_OUTLINE_TRANSPARENT"] .wa-quiz-mark-check,
.wa-quiz-option[data-chrome="WRONG"] .wa-quiz-mark-wrong,
.wa-quiz-option[data-chrome="WRONG_TRANSPARENT"] .wa-quiz-mark-wrong { display: inline-flex; }
/* like the phone: a small white check or cross in a 24px circle (success, primary container, or black for a live
   pick); on a solid success row the check is bigger and has no circle */
.wa-quiz-option-mark .wa-icon { width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; color: var(--md-on-primary); }
.wa-quiz-option-mark .wa-icon svg { width: 16px; height: 16px; }
.wa-quiz-option[data-chrome="LIVE_SELECTED"] .wa-quiz-mark-check { background: var(--md-on-secondary); }
.wa-quiz-option[data-chrome="SUCCESS_FILL"] .wa-quiz-mark-check svg { width: 24px; height: 24px; }
.wa-quiz-option[data-chrome="SUCCESS_OUTLINE"] .wa-quiz-mark-check,
.wa-quiz-option[data-chrome="SUCCESS_OUTLINE_TRANSPARENT"] .wa-quiz-mark-check { background: var(--md-success); }
.wa-quiz-option[data-chrome="WRONG"] .wa-quiz-mark-wrong,
.wa-quiz-option[data-chrome="WRONG_TRANSPARENT"] .wa-quiz-mark-wrong { background: var(--md-primary-container); }
.wa-quiz-option[data-chrome="LIVE_SELECTED"]:is(.wa-quiz-rank-row) .wa-quiz-mark-check { display: none; }
.wa-quiz-rank-list { display: grid; gap: 8px; margin: 0; padding: 0; }
.wa-quiz-rank-number {
    width: 28px;
    height: 28px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
    font-size: calc(14px * var(--wa-text-scale, 1));
    font-weight: 700;
}
.wa-quiz-rank-move {
    width: 36px;
    height: 36px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    cursor: pointer;
}
.wa-quiz-rank-row:first-child [data-quiz-rank-move="up"],
.wa-quiz-rank-row:last-child [data-quiz-rank-move="down"] { visibility: hidden; }

.wa-quiz-bottom {
    padding: 12px 16px max(16px, var(--wa-bottom-inset));
    border-top: 1px solid var(--md-outline-variant);
    display: grid;
    gap: 12px;
}
.wa-quiz-primary { width: 100%; }
.wa-quiz-primary[aria-disabled="true"] { opacity: 0.55; }

/* results summary */
.wa-quiz-results { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.wa-quiz-evaluating {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--md-background);
    animation: wa-quiz-hide-evaluating 1ms linear var(--wa-quiz-evaluating-ms, 0ms) forwards;
}
.wa-quiz-evaluating-spinner { width: 48px; height: 48px; }
.wa-quiz-evaluating-text { margin: 0; text-align: center; font-size: calc(22px * var(--wa-text-scale, 1)); font-weight: 600; }
@keyframes wa-quiz-hide-evaluating { to { visibility: hidden; opacity: 0; } }
.wa-quiz-rewards { display: flex; flex-direction: column; align-items: center; text-align: center; }
.wa-quiz-complete-title { margin: 12px 0 24px; font-size: calc(28px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-quiz-score-chip {
    margin: 0;
    padding: 12px 16px;
    border-radius: 999px;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
    font-weight: 700;
}
.wa-quiz-score-chip--positive { background: var(--md-secondary); color: #000; }
.wa-quiz-coin-reward { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 24px; }
.wa-quiz-coin-balance {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--md-surface-container-high);
    font-weight: 700;
}
.wa-quiz-delta-chip { padding: 2px 8px; border-radius: 999px; font-size: calc(12px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-quiz-delta-chip--positive { background: var(--md-success); color: #fff; }
.wa-quiz-delta-chip--negative { background: var(--md-primary-container); color: #fff; }
.wa-quiz-feelings-title { margin: 24px 0 12px; font-size: calc(16px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-quiz-feelings {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    background: var(--md-surface-container);
}
.wa-quiz-feeling { width: 86px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wa-quiz-feeling-ring {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background:
        radial-gradient(closest-side, var(--md-surface-container) 78%, transparent 80%),
        conic-gradient(var(--md-primary) calc(var(--wa-quiz-feeling-value, 0) * 1%), var(--md-surface-container-highest) 0);
}
.wa-quiz-feeling-value { font-size: calc(13px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-quiz-feeling-label { font-size: calc(12px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }

/* quiz detail (results page) */
.wa-quiz-pages--detail { display: flex; flex-direction: column; justify-content: center; }
.wa-quiz-card {
    padding: 16px;
    border-radius: 12px;
    background: var(--md-surface-container-low);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.wa-quiz-card .wa-quiz-prompt { font-size: calc(20px * var(--wa-text-scale, 1)); }
.wa-quiz-verdict { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 0; font-weight: 600; }
.wa-quiz-verdict--right .wa-icon, .wa-quiz-verdict--partial .wa-icon { color: var(--md-success); }
.wa-quiz-verdict--wrong .wa-icon { color: var(--md-primary-container); }
.wa-quiz-hold-to-peek { width: 100%; margin-top: 8px; user-select: none; -webkit-user-select: none; touch-action: none; }
.wa-quiz-card--info { text-align: center; }
.wa-quiz-info-title { margin: 0; font-size: calc(18px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-quiz-info-label { margin: 24px 0 12px; font-size: calc(13px * var(--wa-text-scale, 1)); font-weight: 600; color: var(--md-on-surface-variant); }
.wa-quiz-info-status { margin: 12px 0 0; color: var(--md-on-surface-variant); }
.wa-quiz-info-score-line { margin: 12px 0 0; font-size: calc(13px * var(--wa-text-scale, 1)); font-weight: 600; color: var(--md-on-surface-variant); }
.wa-quiz-stats { display: flex; gap: 8px; }
.wa-quiz-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px;
    border-radius: 12px;
    background: var(--md-surface-container-high);
}
.wa-quiz-stat-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    margin-bottom: 4px;
}
.wa-quiz-stat--success .wa-quiz-stat-icon { background: var(--md-success); color: #fff; }
.wa-quiz-stat--answered .wa-quiz-stat-icon { background: var(--md-primary-container); color: #fff; }
.wa-quiz-stat--coin .wa-quiz-stat-icon .wa-coin { width: 32px; height: 32px; }
.wa-quiz-stat-value { font-size: calc(22px * var(--wa-text-scale, 1)); font-weight: 700; }
.wa-quiz-stat-label { font-size: calc(11px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-quiz-go-back { width: 100%; margin-top: 16px; }
.wa-quiz-pager-controls { display: flex; align-items: center; justify-content: space-between; }
.wa-quiz-pager-arrow {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: var(--md-surface-container-high);
    color: var(--md-on-surface);
    cursor: pointer;
}
.wa-quiz-pager-arrow:disabled { opacity: 0.4; cursor: default; }
.wa-quiz-pager-dots { display: flex; gap: 6px; }
.wa-quiz-pager-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--md-outline-variant); }
.wa-quiz-pager-dot--current { width: 18px; background: var(--md-on-surface); }
.wa-quiz-screen--empty { align-items: stretch; }
.wa-quiz-screen--empty .wa-empty-state { margin: auto; }

@media (prefers-reduced-motion: reduce) {
    .wa-quiz-progress-fill, .wa-quiz-option { transition: none; }
}

/* ==================== roleplay: today's scene sheet, the live scene's pictures ==================== */

:root {
    /* the dark veil over a live scene's picture behind the chat, and text sitting straight on it
       (the same in light and dark, like the phone's scrim over the picture) */
    --wa-roleplay-scene-scrim: rgba(0, 0, 0, 0.5);
    --wa-on-roleplay-scene: #FFFFFF;
    /* where a tall scene picture (her head in its upper third) sits inside a small photo box */
    --wa-roleplay-scene-face-position: 50% 12%;
    /* the chat background colour washed at 50% over an active Romantic's large photo behind the chat,
       like the phone, so bubbles and times keep their usual colours (layout/WebAppActiveMagicPalPhotos.kt) */
    --wa-active-magic-wash: color-mix(in srgb, var(--md-background) 50%, transparent);
    /* how solid the bubbles and the message box's field are while a picture fills the chat
       behind them (the phone's CHAT_BUBBLE_ALPHA_OVER_BACKGROUND_PICTURE). The two picture style
       elements set --wa-chat-fill-strength to this on that pal's chat; without one it is 100%. */
    --wa-chat-fill-strength-over-background-picture: 75%;
}

/* the scene sheet is the Apply magic sheet's twin (web-app-chat-magics-gifts.css): same card, in the app's primary colour */
.wa-magic-card--roleplay-scene,
.wa-magic-mode-name--roleplay-scene,
.wa-magic-cards-dot--roleplay-scene { --wa-magic-mode-color: var(--md-primary); }
/* the scene picture is a tall portrait: keep her face in the card */
.wa-magic-card-photo--roleplay-scene { object-position: 50% 15%; }
.wa-magic-card--roleplay-scene.htmx-request { opacity: 0.7; cursor: progress; }

/* the games list with the pal's game pictures: the scene sheet's twin, one tall card per game.
   The app's yellow is the accent (the live card's border and pill, the name dot), text on it uses
   --md-on-secondary; the other cards keep a quiet outline like the phone's rows */
.wa-magic-card--game,
.wa-magic-mode-name--game {
    --wa-magic-mode-color: var(--md-secondary);
    --wa-on-magic-mode: var(--md-on-secondary);
}
.wa-magic-cards-dot--game { --wa-magic-mode-color: var(--md-on-surface-variant); }
/* a box holding the card-wide button, "How to play" and (live game) Stop; a size container so Stop
   sits just above the name on the 3:4 picture, like a running magic's End early */
.wa-magic-card.wa-magic-card--game {
    position: relative;
    cursor: default;
    container-type: inline-size;
    border-color: var(--md-outline-variant);
}
.wa-magic-card.wa-magic-card--game-live { border: 2px solid var(--md-secondary); }
.wa-magic-card--game:has(.wa-magic-card-open-button:focus-visible) { box-shadow: var(--wa-focus-ring); }
/* the game picture is a tall portrait: keep her face in the card */
.wa-magic-card-photo--game { object-position: 50% 15%; }
/* "How to play" on the picture's top left (the live card's "Now playing" pill is on the right):
   a circle only as big as the icon, inside a 48px tap area */
.wa-game-card-how-to-play {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--md-on-surface);
    cursor: pointer;
}
.wa-game-card-how-to-play .wa-icon {
    display: inline-flex;
    border-radius: 999px;
    background: color-mix(in srgb, var(--md-surface-container-highest) 85%, transparent);
}
.wa-game-card-how-to-play:hover .wa-icon { background: var(--md-surface-container-highest); }
.wa-game-card-how-to-play:focus-visible { outline: none; box-shadow: var(--wa-focus-ring); }
.wa-game-card-how-to-play .wa-icon svg { width: 24px; height: 24px; }
/* Stop on the live game's card: the app's yellow with its own text colour, in both themes */
.wa-magic-card-end-early-button.wa-game-card-stop-button {
    background: var(--md-secondary);
    color: var(--md-on-secondary);
}

/* "End this roleplay?": the line under the title about what she remembers */
.wa-roleplay-end-note { margin: 0; padding: 0 24px 20px; text-align: center; }

/* a live scene's picture fills the whole chat, edge to edge behind the header, the messages and the
   message box, like the phone. The page's live scene style element
   (layout/WebAppLiveRolePlayScenePictures.kt) sets the variables on this pal's chat while her scene
   is live (the scroller and message box bar then go clear), so it shows and goes without a reload.
   The picture stays put while the messages scroll, and covers only the thread's own pane. */
.wa-thread-page[data-open-character-id] {
    /* a live roleplay scene wins; then a live game's picture (layout/WebAppLiveGamePalPhotos.kt);
       then an active Romantic photo; otherwise nothing */
    background-image: var(--wa-roleplay-scene-thread-background, var(--wa-live-game-thread-background, var(--wa-active-magic-thread-background, none)));
    background-size: cover;
    background-position: 50% 0;
    background-repeat: no-repeat;
}
/* the typing marks sit straight on the picture */
.wa-thread-page .wa-thread-scroller .wa-typing-row[data-presence-stage] .wa-typing-dots > span {
    background: var(--wa-thread-ink-on-background, var(--md-on-surface-variant));
}

/* quiz question bubble in the chat: the phone's QuizQuestionChatBubbleContent (one question, tap to answer) */
.wa-quiz-question-bubble { display: grid; gap: 8px; min-width: min(280px, 70vw); }
.wa-quiz-question-index { text-align: center; font-size: calc(13px * var(--wa-text-scale, 1)); color: var(--md-on-surface-variant); }
.wa-quiz-question-index-current { font-weight: 700; color: var(--md-on-surface); }
.wa-quiz-question-prompt { margin: 0; font-weight: 600; font-size: calc(16px * var(--wa-text-scale, 1)); }
.wa-quiz-question-bubble .wa-quiz-hint { margin: 0; text-align: start; }
.wa-quiz-question-bubble button.wa-quiz-option { width: 100%; text-align: start; font: inherit; cursor: pointer; }
.wa-quiz-question-bubble button.wa-quiz-option:focus-visible { box-shadow: var(--wa-focus-ring); }
.wa-quiz-question-bubble button.wa-quiz-option.htmx-request { opacity: 0.7; pointer-events: none; }
.wa-quiz-question-verdict { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: calc(13px * var(--wa-text-scale, 1)); font-weight: 600; }
.wa-quiz-question-verdict .wa-icon svg { width: 16px; height: 16px; }
.wa-quiz-question-verdict--right .wa-icon { color: var(--md-success); }
.wa-quiz-question-verdict--wrong .wa-icon { color: var(--md-primary-container); }
/* the web's quiz delta chip (wa-quiz-delta-chip--positive), with the coin before the number */
.wa-quiz-question-coin-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: 8px;
    background: var(--md-success-container);
    border: 1px solid var(--md-on-surface);
    color: var(--md-on-surface);
}
.wa-quiz-question-coin-chip .wa-coin { width: 14px; height: 14px; }

/* a quiz question the quiz ended on before it was answered: dimmed, so it reads as closed */
.wa-quiz-options--ended { opacity: 0.5; }
