/* Visual layer only: no game state, question, payment or verification behavior changes. */
body:has(>main>.hero),body.group-quiz-page {
  --bg:#fafbf9;--text:#102b25;--muted:#52645e;--green:#17603e;--blue:#4d8560;--line:#dce4de;
  background:#fafbf9;color:#102b25;color-scheme:light;
}
html:has(body.group-quiz-page) {background:#fafbf9;color-scheme:light}
body:has(>main>.hero) #challenge {color:#102b25}
body:has(>main>.hero) #challenge :is(.quiz,.quiztop,.stat,.demo,.email) {
  background:#fff;border-color:#dce4de;color:#102b25;box-shadow:none;
}
body:has(>main>.hero) #challenge :is(h2,b,strong,.q,.score,.timer) {color:#102b25}
body:has(>main>.hero) #challenge :is(.muted,.copy,.consent,.quiz-session-notice) {color:#52645e}
body:has(>main>.hero) #challenge :is(.ans,input[type=email]) {
  background:#fff;border-color:#becfc2;color:#183c29;
}
body:has(>main>.hero) #challenge .ans:hover:not(:disabled) {background:#edf4ed;border-color:#47805b}
body:has(>main>.hero) #challenge .ans.correct {background:#e1f2e1;border-color:#358b49;color:#154a29}
body:has(>main>.hero) #challenge .ans.wrong {background:#fcebe8;border-color:#b56258;color:#76332b}
body:has(>main>.hero) #challenge .progress {background:#dce5de}
body:has(>main>.hero) #challenge .progress span {background:#90bc8b}
body:has(>main>.hero) #challenge :is(.feedback,.feedback.correct-result) {
  background:#edf5ed;border-color:#bed8c4;color:#254b34;
}
body:has(>main>.hero) #challenge .feedback.incorrect-result {background:#fcebe8;border-color:#c48c83}
body:has(>main>.hero) #challenge :is(.answer-explanation,.answer-guidance,.feedback>b) {color:#315b40}
body:has(>main>.hero) #challenge .answer-result-label.is-correct {color:#245b34}
body:has(>main>.hero) #challenge .answer-result-label.is-wrong,
body:has(>main>.hero) #challenge .feedback.incorrect-result>b {color:#8b342f}
body:has(>main>.hero) #challenge .timer.warn {color:#805200}
body:has(>main>.hero) #challenge .timer.danger {color:#a62e38}
body:has(>main>.hero) :is(.quiz-gate-panel,.question-version-dialog) {
  background:#fff;border-color:#cbdacf;color:#102b25;box-shadow:0 18px 50px #15342335;
}
body:has(>main>.hero) :is(.quiz-gate-panel,.question-version-dialog) :is(h2,p,.question-version-label) {color:#315b40}
body:has(>main>.hero) :is(.quiz-gate,.question-version-modal) {background:#16382780}
body:has(>main>.hero) :is(.quiz-gate-status,#quizStartStatus) {color:#805200}
body:has(>main>.hero) :is(#challenge,.quiz-gate,.question-version-dialog) .btn.primary {
  background:#155435;color:#fff;border:1px solid #155435;
}
body:has(>main>.hero) :is(#challenge,.quiz-gate,.question-version-dialog) .btn.ghost,
body:has(>main>.hero) .question-version-options button {
  background:#edf4ed;color:#244b35;border-color:#b9cbbb;
}
body:has(>main>.hero) .question-version-options button[aria-pressed=true] {
  background:#155435;color:#fff;border-color:#155435;
}
body:has(>main>.hero) #challenge :is(.tag,.promise span,.impact) {background:#edf4ed;color:#315b40;border-color:#d2dfd5}
body:has(>main>.hero) #challenge .title {font-size:clamp(24px,3vw,32px);line-height:1.2}
body:has(>main>.hero) #challenge .quiz-session-notice {background:#f6efdf;border-color:#dfd0ad}
body.group-quiz-page {font-family:system-ui,-apple-system,Segoe UI,sans-serif}
body.group-quiz-page :is(.card,.role-option,.group-version-picker,.invited-team,#feedback) {
  background:#fff;border-color:#d1dfd4;color:#183c29;box-shadow:none;
}
body.group-quiz-page :is(p,.muted,.role-option small,.group-version-picker small,#board small) {color:#52645e}
body.group-quiz-page :is(a,h1,h2,strong,.role-option strong,.group-version-picker strong,.invited-team strong,#pinBig,#overallTitle,.round-summary strong) {color:#16472d}
body.group-quiz-page :is(input,select) {background:#fff;color:#183c29;border-color:#b9cbbb}
body.group-quiz-page button {background:#155435;color:#fff;border:1px solid #155435}
body.group-quiz-page button.secondary {background:#edf4ed;color:#244b35;border-color:#b9cbbb}
body.group-quiz-page #roleChoice .role-option {
  background:linear-gradient(155deg,#faf8f1df,#e7dfd1ae),
    url('/assets/editorial-stone.webp') center / 420px auto;
  border-color:#d4cbbc;
  box-shadow:inset 0 1px 1px #fffc,inset 0 -2px 4px #7a695120,0 3px 5px #51463524;
}
body.group-quiz-page #roleChoice .role-option:is(:hover,:focus-visible) {
  background-image:linear-gradient(155deg,#eaf1e5df,#cfdfd1bd),url('/assets/editorial-stone.webp');
  border-color:#66856c;
}
body.group-quiz-page #roleChoice .role-option:focus-visible {outline-color:#17603e}
body.group-quiz-page .group-version-options button[aria-pressed=true] {background:#155435;color:#fff;border-color:#155435}
body.group-quiz-page :is(#message,#setupMessage) {color:#805200}
body.group-quiz-page #setupMessage {background:#f6efdf;border-color:#d5bf8f}
body.group-quiz-page .chosen-team {background:#edf4ed;color:#315b40;border-color:#c4d9c8}
body.group-quiz-page #answers button {background:#fff;color:#183c29;border-color:#b9cbbb}
body.group-quiz-page #answers button:hover {background:#edf4ed}
body.group-quiz-page #answers button.is-correct {background:#e1f2e1;color:#154a29;border-color:#358b49}
body.group-quiz-page #answers button.is-incorrect {background:#fcebe8;color:#76332b;border-color:#b56258}
body.group-quiz-page #feedback.is-incorrect {background:#fcebe8;border-color:#c48c83}
body.group-quiz-page #feedback :is(p,strong,.feedback-heading) {color:#315b40}
body.group-quiz-page #verifySuccess,body.group-quiz-page #verifySuccess span {color:#245b34}
body.group-quiz-page :is(button,input,select):focus-visible {outline:3px solid #47805b;outline-offset:3px}
@media(max-width:800px) {
  body:has(>main>.hero) #challenge .quiz {padding:16px}
  body:has(>main>.hero) #challenge .quiztop {gap:8px;flex-wrap:wrap}
  body:has(>main>.hero) #challenge .q {font-size:22px;line-height:1.3}
  body.group-quiz-page .card {padding:16px}
}
body.group-quiz-page :is(.rules-dialog,.rules-top) {background:#fff;border-color:#cbdacf}
body.group-quiz-page :is(.rules-body,.rules-tag,.rules-body h3,.topic-mix-option b) {color:#315b40}
body.group-quiz-page .rules-modal {background:#16382780}
body.group-quiz-page .rules-close {background:#edf4ed;color:#244b35;border-color:#b9cbbb}
/* Legacy inline styles use !important: override only the game surfaces they affect. */
body:has(>main>.hero) #challenge :is(.quiz,.email,.demo) {
  background:#fff!important;border-color:#dce4de!important;box-shadow:none;
}
body:has(>main>.hero) #challenge .progress span {background:#90bc8b!important}
body:has(>main>.hero) #challenge :is(.gold,.money,.impact-value) {color:#16472d!important}
body:has(>main>.hero) #challenge .email #emailBtn {background:#edf4ed;color:#315b40;border-color:#b9cbbb;box-shadow:none}
body:has(>main>.hero) #challenge .landing-cta {animation:none;box-shadow:none}
body:has(>main>.hero) #challenge .landing-cta::after {animation:none;background:none;box-shadow:none}

/* Replay uses the existing launch busy state; keep its progress ring visible. */
body:has(>main>.hero) #challenge #replay.desktop-action-busy {
  position:relative;padding-inline:2.5rem;
}
body:has(>main>.hero) #challenge #replay.desktop-action-busy::after {
  content:"";position:absolute;right:.75rem;top:50%;width:1rem;height:1rem;
  border-radius:50%;background:conic-gradient(from 0deg,transparent,currentColor);
  -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0);
  mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0);
  transform:translateY(-50%);animation:desktop-action-ring .8s linear infinite;
  pointer-events:none;
}
@media(prefers-reduced-motion:reduce){
  body:has(>main>.hero) #challenge #replay.desktop-action-busy::after{animation:none}
}

/* Entry screens use the existing mist landscape with an opaque reading surface. */
body.group-quiz-page:has(:is(#roleChoice,#setup,#lobby):not([hidden])):not(:has(:is(#game,#results):not([hidden]))) {
  background:linear-gradient(#fafbf99c,#fafbf9 720px),url('/assets/landing-landscape-mist.png') center top / cover no-repeat,#fafbf9;
  background-size:auto,min(100%,1440px) auto,auto;
}
body.group-quiz-page:has(:is(#roleChoice,#setup,#lobby):not([hidden])) :is(#roleChoice,#setup,#lobby) {
  background:rgb(255 255 255 / 94%);
}

/* Separate the outcome from the explanation while keeping the whole answer readable. */
body.prototype-landing #challenge #feedback,
body.group-quiz-page #feedback {
  padding:clamp(12px,2.4vw,16px);
  margin-block:12px;
  line-height:1.4;
}
body.prototype-landing #challenge #feedback .answer-explanation,
body.group-quiz-page #feedback .answer-explanation {
  margin-top:8px;
  padding:8px 10px;
  border-radius:8px;
  background:rgb(255 255 255 / 76%);
  color:#183c29;
  line-height:1.4;
}
body.prototype-landing #challenge #feedback .answer-explanation #fbText,
body.group-quiz-page #feedback .answer-explanation p {
  margin:3px 0 0;
  font-size:15px;
  line-height:1.45;
  color:#294a3a;
  overflow-wrap:anywhere;
}
body.prototype-landing #challenge #feedback .answer-explanation strong,
body.group-quiz-page #feedback .answer-explanation strong {
  display:block;
  color:#183c29;
  font-size:14px;
}
body.prototype-landing #challenge #feedback .answer-explanation:not(:has(#fbText:not(:empty))) {display:none}
body.group-quiz-page #feedback .feedback-heading {font-size:17px}
body.group-quiz-page #feedback>p {margin:4px 0;font-size:14px;line-height:1.4}
body.group-quiz-page #feedback.is-incorrect .feedback-heading {color:#8b342f}

/* Put the next action above the table and keep entry information out of results. */
body.group-quiz-page:has(#results:not([hidden])) .group-intro-facts {display:none}
body.group-quiz-page #results .game-title-row {margin-bottom:8px}
body.group-quiz-page #results .game-title-row h2 {margin-bottom:0}
body.group-quiz-page #results #roundActions {display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
body.group-quiz-page #results #roundActions button {flex:1 1 130px;width:auto;min-height:44px;padding:8px 12px;font-size:14px}
body.group-quiz-page #results #roundNote {margin:6px 0}
body.group-quiz-page #results #board :is(th,td) {padding-block:6px}
body.group-quiz-page #results .result-community {margin:10px 0 0}
body.group-quiz-page #results .result-community-credit {padding:10px;gap:8px}
body.group-quiz-page #results .result-progress {margin:10px 0 0;gap:10px}
body.group-quiz-page #results .result-community-how {margin-top:0;font-size:14px}
@media(min-width:850px){
  body.group-quiz-page:has(#results:not([hidden]))>main {max-width:1050px;padding-top:18px}
  body.group-quiz-page #results {
    display:grid;
    grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);
    gap:8px 16px;
    align-items:start;
  }
  body.group-quiz-page #results>:not(.group-result-board,.result-community) {grid-column:1/-1}
  body.group-quiz-page #results .result-community {margin:0}
  body.group-quiz-page #results #overallTitle {margin-top:0}
}
