/* Green Infrastructure live quiz. Palette from the subject: leaf greens, Barcelona terracotta,
   sunlight and rainwater. Presenter screen for a projector; player screen for phones. */
:root {
  --bg: #f4f1e8; --surface: #fffdf8; --sunk: #ebe6d8; --ink: #1c2a22; --muted: #5d6a60; --line: #d9d2c0;
  --accent: #1d5236; --on-accent: #fffdf8; --focus: #1d5236;
  --leaf: #3d9a4f; --lime: #9ccc5a; --clay: #c8643b; --water: #2f7fb5; --sun: #d99a1e;
  --o0: #c8643b; --o1: #2f7fb5; --o2: #c58a12; --o3: #3d8a4a;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1a14; --surface: #172620; --sunk: #13201a; --ink: #eaf1ea; --muted: #a3b3a7; --line: #2a3b32;
    --accent: #9ccc5a; --on-accent: #10200f; --focus: #9ccc5a; }
}
.kicker { margin: 0; font: 700 0.8125rem/1.3 "Archivo", system-ui, sans-serif; letter-spacing: 0.04em; color: var(--leaf); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.qr { display: inline-block; padding: 10px; background: #fff; border-radius: 12px; line-height: 0; }
.art { width: 100%; height: auto; display: block; border-radius: 18px; }
.code { font: 400 1em/1 "Archivo Black", "Archivo", system-ui, sans-serif; letter-spacing: 0.08em; }

/* avatars (shared drawing code with Team games) */
.av { display: inline-block; flex: none; line-height: 0; }
.av svg { width: 100%; height: 100%; display: block; }
.av-sm { width: 32px; height: 32px; } .av-md { width: 48px; height: 48px; }
.av-lg { width: clamp(56px, 6vw, 88px); height: clamp(56px, 6vw, 88px); }
.av-xl { width: clamp(96px, 12vw, 150px); height: clamp(96px, 12vw, 150px); }
.av-blank { display: inline-block; border-radius: 50%; background: var(--sunk); }
.av-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.av-pick { aspect-ratio: 1; padding: 6px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; }
.av-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--sunk); }
.av-pick .av { width: 100%; height: 100%; }
.join-av-row { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.join-av-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.join-av .av-xl { width: 92px; height: 92px; }

/* ---- start page ---- */
.start { max-width: 640px; margin: 0 auto; padding: 32px 20px 48px; display: flex; flex-direction: column; gap: 12px; }
.start-art { max-width: 420px; }
.start-title { margin: 0; font-size: clamp(2.2rem, 7vw, 3.4rem); color: var(--accent); }
.start-sub { margin: 0; font-size: 1.2rem; font-weight: 700; }
.start-desc { margin: 4px 0 8px; color: var(--muted); }
.start-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.start-join { display: flex; gap: 8px; }
.start-join .input { width: 9em; text-transform: uppercase; }
.start-recent a { margin-right: 10px; }
.start-small { font-size: 0.875rem; color: var(--muted); margin-top: 16px; }

/* ---- presenter ---- */
.host-mode { min-height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto; }
.host-mode #app { display: contents; }
.h-bar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; flex-wrap: wrap; }
.h-bar .brand { font: 400 1.1rem/1 "Archivo Black", "Archivo", sans-serif; color: var(--accent); }
.h-meta { color: var(--muted); font-weight: 600; }
.h-code { margin-left: auto; font-weight: 600; }
.h-code .code { font-size: 1.4rem; margin-left: 6px; color: var(--accent); }
.progress { height: 6px; background: var(--sunk); }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--leaf), var(--lime)); transition: width 0.6s ease; }
.stage { padding: clamp(16px, 3vw, 40px); display: flex; flex-direction: column; min-height: 0; }
.controls { display: flex; justify-content: flex-end; gap: 12px; padding: 12px 24px 20px; }
.controls .btn { min-height: 52px; padding: 12px 28px; font-size: 1.1rem; }
.center-card { max-width: 520px; margin: auto; text-align: center; }

.lobby { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 56px); align-items: start; }
.lobby-join { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.lobby-url { margin: 0; font-size: 1.1rem; }
.lobby-code { margin: 0; font-size: clamp(2.6rem, 6vw, 4.4rem); color: var(--accent); }
.lobby-side h2 { margin: 0; font-size: clamp(2.4rem, 5vw, 4rem); color: var(--accent); }
.lobby-sub { margin: 4px 0 20px; font-size: 1.3rem; font-weight: 700; }
.lobby-cards { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(96px, 9vw, 128px), 1fr)); gap: 10px; }
.lobby-cards li { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: center; font-weight: 700; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) {
  .lobby-cards li.pop { animation: pop-in 0.4s cubic-bezier(.2, 1.4, .4, 1) both; }
  @keyframes pop-in { from { transform: scale(0.5); opacity: 0; } }
  .bob { animation: bob 2.4s ease-in-out infinite; } @keyframes bob { 50% { transform: translateY(-8px); } }
}

.question { display: flex; flex-direction: column; gap: clamp(12px, 2vh, 24px); flex: 1; }
.q-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tag { padding: 6px 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 0.9rem; }
.q-topic { color: var(--muted); font-weight: 700; font-size: 1.05rem; }
.q-text { margin: 0; font: 400 clamp(1.8rem, 3.6vw, 3.2rem)/1.15 "Archivo Black", "Archivo", sans-serif; max-width: 30ch; }
.q-mid { display: flex; align-items: center; gap: 24px; }
.q-count { margin: 0; font-size: 1.3rem; color: var(--muted); } .q-count b { color: var(--ink); font-size: 1.8rem; }
.tmr { --p: 360deg; width: clamp(80px, 8vw, 120px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--leaf) var(--p), var(--sunk) 0); position: relative; }
.tmr::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--bg); }
.tmr b { position: relative; font: 400 clamp(1.8rem, 3vw, 2.8rem)/1 "Archivo Black", sans-serif; }
.tmr.low { background: conic-gradient(var(--clay) var(--p), var(--sunk) 0); }
.opts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.5vw, 18px); margin-top: auto; }
.opt { position: relative; display: flex; align-items: center; gap: 14px; padding: clamp(14px, 2vh, 24px) 20px; border-radius: 16px; color: #fff; font-weight: 700; font-size: clamp(1.1rem, 1.9vw, 1.7rem); overflow: hidden; }
.opt.o0 { background: var(--o0); } .opt.o1 { background: var(--o1); } .opt.o2 { background: var(--o2); } .opt.o3 { background: var(--o3); }
.opt-l { flex: none; width: 1.8em; height: 1.8em; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.25); }
.reveal .opt.wrong { opacity: 0.35; }
.reveal .opt.right { outline: 5px solid var(--ink); outline-offset: 3px; }
.opt-bar { position: absolute; left: 0; bottom: 0; height: 6px; width: var(--w); background: rgba(255, 255, 255, 0.85); transition: width 0.6s; }
.opt-n { margin-left: auto; font-size: 1.4em; }
.reveal-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.reveal-foot h3 { margin: 0 0 8px; }
.fastest ol, .board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fastest li, .board li { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.fastest li b, .board .pts { margin-left: auto; font-family: "Archivo Black", sans-serif; font-weight: 400; }
.board .pos { width: 1.6em; color: var(--muted); }
.board .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.slide { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(20px, 4vw, 56px); align-items: center; flex: 1; }
.slide-text h2 { margin: 6px 0 14px; font-size: clamp(2rem, 3.8vw, 3.4rem); color: var(--accent); line-height: 1.05; }
.slide-lead { margin: 0 0 16px; font-size: clamp(1.2rem, 1.9vw, 1.6rem); font-weight: 700; line-height: 1.3; }
.slide-points { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: clamp(1rem, 1.5vw, 1.3rem); line-height: 1.4; }
.slide-points li { position: relative; padding-left: 30px; }
.slide-points li::before { content: ""; position: absolute; left: 0; top: 0.3em; width: 16px; height: 10px; border-radius: 16px 0; background: var(--leaf); transform: rotate(-25deg); }
.stats { display: flex; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 110px; padding: 12px 14px; border-radius: 14px; background: var(--accent); color: var(--on-accent); }
.stat b { display: block; font: 400 clamp(1.6rem, 2.8vw, 2.4rem)/1 "Archivo Black", sans-serif; }
.stat span { font-size: 0.95rem; font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .slide-art .art { animation: grow 0.7s cubic-bezier(.2, 1.2, .4, 1) both; } @keyframes grow { from { transform: scale(0.92); opacity: 0; } }
  .slide-points li { animation: rise 0.5s both; } .slide-points li:nth-child(2) { animation-delay: 0.15s; } .slide-points li:nth-child(3) { animation-delay: 0.3s; }
  @keyframes rise { from { transform: translateY(10px); opacity: 0; } }
}

.end { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.end-title { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); color: var(--accent); text-align: center; }
.podium { display: flex; align-items: flex-end; gap: clamp(10px, 2vw, 28px); }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; width: clamp(130px, 16vw, 220px); }
.pod-name { margin: 0; font-weight: 800; font-size: 1.3rem; text-align: center; overflow-wrap: anywhere; }
.pod-pts { margin: 0; color: var(--muted); font-weight: 700; }
.pod-step { width: 100%; display: grid; place-items: center; border-radius: 14px 14px 0 0; color: #fff; font: 400 2.6rem/1 "Archivo Black", sans-serif; }
.p1 .pod-step { height: 170px; background: var(--sun); } .p2 .pod-step { height: 120px; background: var(--leaf); } .p3 .pod-step { height: 90px; background: var(--clay); }
.rest { width: min(640px, 100%); max-height: 30vh; overflow: auto; }
.end-thanks { font-weight: 700; color: var(--muted); }
@media (max-width: 900px) { .lobby, .slide, .reveal-foot { grid-template-columns: 1fr; } .opts { grid-template-columns: 1fr; } }

/* ---- player (phone) ---- */
.player-mode { min-height: 100dvh; }
.p-wrap { max-width: 480px; margin: 0 auto; padding: 20px 16px; }
.p-join { display: flex; flex-direction: column; gap: 14px; }
.p-join h1 { margin: 0; color: var(--accent); }
.big-input { font-size: 1.1rem; min-height: 48px; }
.p-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 2; }
.p-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-score { margin-left: auto; font: 400 1rem/1 "Archivo Black", sans-serif; color: var(--accent); }
.p-stage { padding: 16px; max-width: 520px; margin: 0 auto; }
.p-msg { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px 8px; }
.p-msg h2 { margin: 0; }
.p-msg .display { font-size: 2.6rem; color: var(--accent); }
.result.ok { background: color-mix(in srgb, var(--leaf) 16%, transparent); border-radius: 20px; }
.result.ko, .result.none { background: color-mix(in srgb, var(--clay) 14%, transparent); border-radius: 20px; }
.result.ko .display, .result.none .display { color: var(--clay); }
.gain { font: 400 1.4rem/1.2 "Archivo Black", sans-serif; color: var(--leaf); margin: 0; }
.rank { font-weight: 700; }
.p-chosen { padding: 12px 18px; border-radius: 14px; color: #fff; font-weight: 700; }
.p-chosen.o0 { background: var(--o0); } .p-chosen.o1 { background: var(--o1); } .p-chosen.o2 { background: var(--o2); } .p-chosen.o3 { background: var(--o3); }
.p-q { display: flex; flex-direction: column; gap: 12px; }
.p-qtext { margin: 0; font-size: 1.25rem; line-height: 1.25; }
.p-opts { display: grid; gap: 10px; }
.p-opt { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 16px; border: 0; border-radius: 16px; color: #fff; font: 700 1.05rem/1.25 "Archivo", sans-serif; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.p-opt:active { transform: scale(0.97); }
.p-opt.o0 { background: var(--o0); } .p-opt.o1 { background: var(--o1); } .p-opt.o2 { background: var(--o2); } .p-opt.o3 { background: var(--o3); }
.p-shape { flex: none; font-size: 1.4rem; width: 1.4em; text-align: center; }
.p-bar .av-sm { width: 30px; height: 30px; }

.credits-dialog { max-width: 32rem; border: 0; border-radius: 16px; padding: 24px; background: var(--surface); color: var(--ink); }
.credits-dialog::backdrop { background: rgb(0 0 0 / .45); }
.credits-dialog ul { padding-left: 1.2em; line-height: 1.5; }
.credits-dialog a { color: inherit; }
