/* 정각 퀴즈 — the same night hall as the room (dark desk, warm lamp), made for reading: flat surfaces, hairlines, one accent.
   The bar and the info dialog come from shared/brand.css. Nothing here moves what is already on the screen: views swap as
   whole blocks, a question card is built anew, and the answer only fills places the card already kept free. */
:root {
  --ink: #f3efe6;
  --dim: rgba(243, 239, 230, 0.76);
  --faint: rgba(243, 239, 230, 0.6);
  --line: rgba(243, 239, 230, 0.16);
  --line-2: rgba(243, 239, 230, 0.28);
  --bg: #07080f;
  --panel: #0e1019;
  --accent: #ffcf8a;
  --accent-ink: #1d1408;
  --miss: #ffa392;
  --font: "Pretendard Variable", Pretendard, "Pretendard Fallback", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, "Noto Sans KR", "Malgun Gothic", "Noto Sans", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding-top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); }
a { color: inherit; }
[hidden] { display: none !important; }
html:not(:is(:lang(zh), :lang(ja), :lang(th), :lang(km), :lang(my))) :is(p, li, h1, h2, h3, summary, button, a) { word-break: keep-all; overflow-wrap: anywhere; }
:lang(ko) { word-break: keep-all; overflow-wrap: anywhere; }
html:is(:lang(th), :lang(km), :lang(my), :lang(si), :lang(bn), :lang(ne)) * { letter-spacing: 0 !important; }

/* the bar's link back to the app: a long app name (Sinhala, Japanese) ends in an ellipsis on a phone instead of running under the language menu */
.lab-bar__lab { min-width: 0; flex: 0 1 auto; justify-content: flex-start; }
.lab-bar__lab span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* AI-translation notice: the room's one-line strip under the bar (fixed). The language is known before the first paint
   (lang-boot sets html.ai-on), so the page starts lower by the strip's height and showing the strip moves nothing. */
.ai-note {
  position: fixed; z-index: 66; left: 0; right: 0; top: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; height: 28px; padding: 0 12px;
  background: #1e180c; border-bottom: 1px solid rgba(255, 207, 138, 0.3); color: #ffe7c2; font-size: 11.5px; line-height: 1; white-space: nowrap;
}
/* The sentence leaves room for the two language links and for the "suggest a better translation" button that i18n-suggest.js
   adds after the page has loaded: the strip starts at the left and the sentence never has to give way, so the links stay put. */
.ai-note span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ai-note > span:first-child { max-width: calc(100% - 360px); }
.ai-note button { flex: none; appearance: none; border: 0; background: none; color: #fff; text-decoration: underline; font: inherit; cursor: pointer; padding: 6px 2px; }
html.ai-on body { padding-top: calc(var(--bar-h) + 28px + env(safe-area-inset-top, 0px)); }
html.ai-on .qz { min-height: calc(100vh - var(--bar-h) - 28px); min-height: calc(100svh - var(--bar-h) - 28px); }
@media (max-width: 720px) {
  /* on a phone: the sentence on its own line, the links and the button below it */
  .ai-note { flex-wrap: wrap; align-content: center; height: 50px; row-gap: 0; }
  .ai-note > span:first-child { flex: 0 0 100%; max-width: 100%; line-height: 1.5; }
  .ai-note button { padding: 5px 2px; }
  html.ai-on body { padding-top: calc(var(--bar-h) + 50px + env(safe-area-inset-top, 0px)); }
  html.ai-on .qz { min-height: calc(100vh - var(--bar-h) - 50px); min-height: calc(100svh - var(--bar-h) - 50px); }
}

.qz { width: min(1040px, 100%); margin: 0 auto; padding: 22px 20px 40px; min-height: calc(100vh - var(--bar-h)); min-height: calc(100svh - var(--bar-h)); outline: 0; }
.qz-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.qz-title { font-size: 26px; font-weight: 600; letter-spacing: 0.01em; line-height: 1.25; }
.qz-lede { font-size: 14.5px; line-height: 1.6; color: var(--dim); }

/* who is here now */
.qz-here { display: grid; gap: 9px; align-content: start; margin-top: 14px; padding: 13px 0 11px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.qz-here__text { font-size: 14px; line-height: 1.5; min-height: 1.5em; color: var(--dim); font-variant-numeric: tabular-nums; }
/* the lamps keep a fixed box (10 lamps), so the "answered / here" number beside them never moves */
.qz-here__marks { display: flex; align-items: center; gap: 10px; height: 14px; }
.qz-lamps { flex: none; display: inline-flex; align-items: center; gap: 6px; width: 154px; height: 14px; }
.qz-lamps i { flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(255, 207, 138, 0.55); transition: background 0.4s, box-shadow 0.4s; }
.qz-lamps i.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(255, 207, 138, 0.7); }
.qz-here__marks b { font-size: 12px; font-weight: 500; line-height: 14px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

.qz-view { margin-top: 22px; }
h2 { font-size: 17px; font-weight: 600; line-height: 1.4; }
.qz-plain p, .qz-box p { font-size: 14.5px; line-height: 1.7; color: var(--dim); }
.qz-note { font-size: 13.5px !important; color: var(--faint) !important; font-variant-numeric: tabular-nums; }

/* ───────── between rounds ───────── */
#lobby, .qz-col { display: grid; gap: 26px; align-content: start; min-width: 0; }
.qz-next { padding: 2px 0; }
.qz-eyebrow { font-size: 14px; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; min-height: 1.5em; line-height: 1.5; }
.qz-count { font-size: clamp(56px, 17vw, 92px); font-weight: 200; line-height: 1.06; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; color: #fff4e2; }
.qz-cap { font-size: 14px; line-height: 1.5; color: var(--dim); min-height: 1.5em; font-variant-numeric: tabular-nums; }
.qz-box { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 18px 18px 16px; display: grid; gap: 8px; }
.qz-mainleft { font-size: 14px !important; color: var(--accent) !important; font-variant-numeric: tabular-nums; min-height: 1.7em; }
.qz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.qz-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  font: inherit; font-size: 14.5px; font-weight: 500; line-height: 1.25; text-decoration: none; cursor: pointer; transition: background 0.2s;
}
.qz-btn:hover { background: rgba(243, 239, 230, 0.07); }
.qz-i { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lab-dialog .qz-btn { align-self: flex-end; }

.qz-result { border-color: rgba(255, 207, 138, 0.42); }
.qz-result__row { display: flex; align-items: flex-start; gap: 16px; }
.qz-result__text { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; }
.qz-squares { display: flex; gap: 6px; }
.qz-squares i { width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid var(--line-2); }
.qz-squares i.on { background: var(--accent); border-color: var(--accent); }
.qz-score { font-size: 20px !important; font-weight: 600; color: var(--ink) !important; line-height: 1.4 !important; }
.qz-streak { color: var(--accent) !important; }
.qz-cardpic { flex: none; width: 88px; height: 110px; border-radius: 8px; border: 1px solid var(--line); background: #0b0c18; }

.qz-plain { display: grid; gap: 10px; }
.qz-up { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qz-up li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; min-height: 62px; align-content: center; }
.qz-up time { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.qz-up span { font-size: 14.5px; font-weight: 500; line-height: 1.3; }
.qz-up li.is-main { border-color: rgba(255, 207, 138, 0.5); }
.qz-up li.is-main span { color: var(--accent); }

.qz-last { list-style: none; border-top: 1px solid var(--line); }
.qz-last > li { border-bottom: 1px solid var(--line); }
.qz-last summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: start; padding: 14px 0; min-height: 52px; font-size: 15px; line-height: 1.55; }
.qz-last summary::-webkit-details-marker { display: none; }
.qz-last summary > b { font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.qz-last summary > em { font-style: normal; font-size: 12.5px; line-height: 1.85; max-width: 8em; text-align: right; color: var(--faint); }
.qz-last summary > em.ok { color: var(--accent); }
.qz-last summary > em.bad { color: var(--miss); }
.qz-last summary .qz-p { margin-top: 4px; font-size: 14.5px; }
.qz-last details > div { padding: 0 0 18px; display: grid; gap: 10px; }
.qz-last .qz-opts { gap: 6px; }
.qz-last .qz-opt { min-height: 48px; padding: 8px 12px; font-size: 15px; }

/* ───────── a question ───────── */
.qz-card { max-width: 680px; margin: 0 auto; display: grid; gap: 12px; }
.qz-meta { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; color: var(--faint); }
.qz-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255, 207, 138, 0.5); color: var(--accent); font-weight: 600; white-space: nowrap; }
.qz-step { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qz-q { font-size: 20px; font-weight: 600; line-height: 1.5; }
.qz-p { font-size: 18px; line-height: 1.65; color: var(--ink); padding: 12px 14px; border-left: 2px solid var(--line-2); background: rgba(243, 239, 230, 0.035); border-radius: 0 10px 10px 0; white-space: pre-line; }
.qz-blank { display: inline-block; width: 3.2em; height: 1.1em; border-bottom: 2px solid var(--accent); vertical-align: -0.15em; margin: 0 0.15em; }
.qz-fill { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }

/* time: a thin line that drains evenly, one colour from start to end, no flashing and no numbers that jump */
.qz-time { height: 4px; border-radius: 2px; background: rgba(243, 239, 230, 0.1); overflow: hidden; }
.qz-time i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(1); will-change: transform; }
.qz-time.is-rest i { background: rgba(243, 239, 230, 0.34); }
.qz-left { font-size: 12.5px; line-height: 1.5; min-height: 1.5em; color: var(--faint); font-variant-numeric: tabular-nums; }

.qz-opts { display: grid; gap: 8px; }
.qz-opt {
  appearance: none; position: relative; overflow: hidden; display: grid; grid-template-columns: 30px minmax(0, 1fr) 76px; align-items: center; gap: 10px;
  width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(243, 239, 230, 0.03);
  color: var(--ink); font: inherit; font-size: 17px; line-height: 1.45; text-align: left; cursor: pointer; transition: background 0.2s, border-color 0.2s, opacity 0.3s;
}
div.qz-opt { cursor: default; }
button.qz-opt:not(:disabled):hover { background: rgba(243, 239, 230, 0.08); }
.qz-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); font-size: 13.5px; font-weight: 500; color: var(--dim); font-variant-numeric: tabular-nums; }
.qz-opt__side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 1px; min-height: 36px; font-size: 12px; line-height: 1.3; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.qz-opt__side b { font-size: 14px; font-weight: 600; color: var(--dim); }
.qz-opt__side .qz-i { width: 18px; height: 18px; }
.qz-opt__bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(243, 239, 230, 0.4); transform-origin: 0 50%; transform: scaleX(0); transition: transform 0.6s ease; }
.qz-opt:disabled { cursor: default; color: var(--ink); }
.qz-opt.is-off { opacity: 0.55; }
.qz-opt[aria-pressed='true'], .qz-opt.is-mine { border-color: var(--accent); background: rgba(255, 207, 138, 0.1); opacity: 1; }
.qz-opt[aria-pressed='true'] .qz-num, .qz-opt.is-mine .qz-num { border-color: var(--accent); color: var(--accent); }
.qz-opt.is-ok { border-color: var(--accent); opacity: 1; }
.qz-opt.is-ok .qz-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.qz-opt.is-ok .qz-opt__side, .qz-opt.is-ok .qz-opt__side b { color: var(--accent); }
.qz-opt.is-ok .qz-opt__bar { background: var(--accent); }
.qz-opt.is-bad { border-color: var(--miss); background: rgba(255, 163, 146, 0.08); opacity: 1; }
.qz-opt.is-bad .qz-num { border-color: var(--miss); color: var(--miss); }
.qz-opt.is-bad .qz-opt__side { color: var(--miss); }

.qz-status { font-size: 14.5px; line-height: 1.55; min-height: 3.1em; color: var(--dim); }
.qz-status.is-ok { color: var(--accent); font-weight: 600; }
.qz-status.is-bad { color: var(--ink); font-weight: 600; }

/* the answer: how people chose (all time first, labelled; this round only when others were there), then the explanation */
.qz-answer { display: grid; gap: 10px; }
.qz-stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14.5px; line-height: 1.55; color: var(--ink); font-variant-numeric: tabular-nums; }
.qz-stat > b { flex: none; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--dim); white-space: nowrap; }
.qz-ex { font-size: 15.5px; line-height: 1.75; color: var(--ink); }
.qz-sub { font-size: 14px; line-height: 1.7; color: var(--dim); }
.qz-sub > b { font-weight: 600; color: var(--faint); margin-right: 6px; }
.qz-links { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13.5px; line-height: 1.6; color: var(--faint); }
.qz-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--dim); text-underline-offset: 3px; }
.qz-links a:hover { color: var(--ink); }
.qz-links .qz-i { width: 15px; height: 15px; }
.qz-links > span { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 8px; min-height: 44px; }

/* during a question the footer is away: nothing below the card can move when the answer opens */
body.is-play .qz-foot { display: none; }
.qz-foot { width: min(1040px, 100%); margin: 0 auto; padding: 22px 20px calc(28px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 13px; color: var(--faint); }
.qz-foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 4px; }
.qz-foot a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.qz-foot a:hover { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 90; transform: translate(-50%, 10px); opacity: 0;
  background: #15161f; border: 1px solid var(--line-2); padding: 11px 18px; border-radius: 12px; font-size: 14px; line-height: 1.5; max-width: 88vw; text-align: center;
  transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 980px) {
  .qz { padding-top: 30px; }
  #lobby { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); column-gap: 48px; align-items: start; }
  .qz-q { font-size: 22px; }
}
@media (max-width: 560px) {
  /* room for two lines, so a longer sentence in another language does not push the page */
  .qz-here__text, .qz-cap { min-height: 3em; }
}
@media (max-width: 420px) {
  .qz { padding: 16px 16px 32px; }
  .qz-title { font-size: 23px; }
  .qz-opt { grid-template-columns: 28px minmax(0, 1fr) 64px; gap: 8px; padding: 10px; font-size: 16.5px; }
  .qz-q { font-size: 19px; }
  .qz-p { font-size: 17px; }
  .qz-cardpic { width: 72px; height: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  .qz-opt__bar, .qz-lamps i, .qz-opt, .toast { transition: none; }
}
