@import url('/fonts/fonts.css');
@import url('/assets/tokens.css');

/*
 * The public pages of Feudboard (Phase 0: the landing page, privacy, errors). Colours from tokens.css; Cairo for
 * text, Baloo Bhaijaan 2 for headings, numbers and points. Public pages without a side menu keep their content centred
 * (nhmsv LAYOUT_WIDTH.md §1): the landing page up to 1920px, forms and long text narrow.
 */
:root {
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --display: 'Baloo Bhaijaan 2', 'Cairo', system-ui, sans-serif;
  --content-max: 1920px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.7; }
a { color: var(--brand-ink); }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.3; margin: 0; text-wrap: balance; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Test strip (nhmsv PLATFORM_MODES.md §2): thin, amber, drawn by the server, no close button. */
.test-strip { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--warn-line); text-align: center; font-size: 13px; font-weight: 600; padding: 4px var(--gutter); }

/* Top bar */
.top { background: var(--head); color: var(--on-head); }
.top-inner { max-width: var(--content-max); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 20px; min-width: 0; }
.brand img { border-radius: 10px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-links { display: flex; gap: 8px; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; padding: 0; opacity: .85; }
.icon-button:hover { opacity: 1; background: var(--surface); color: var(--brand-ink); }
.icon-button svg { width: 18px; height: 18px; }

/* Content */
.wrap { flex: 1; width: 100%; max-width: 760px; margin-inline: auto; padding-block: 32px 56px;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 32px; }
.wrap-wide { max-width: var(--content-max); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.narrow { max-width: 560px; width: 100%; margin-inline: auto; }
.prose { max-width: 70ch; width: 100%; margin-inline: auto; }
.prose h1 { font-size: 28px; }
.prose h2 { font-size: 20px; margin-top: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 3px 0 var(--brand-deep); }
.cookie-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.cookie-list li { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* Landing */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 32px; align-items: center; }
.hero-text { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero h1 { font-size: clamp(40px, 6vw, 64px); color: var(--brand-ink); }
.hero-tagline { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 2.4vw, 28px); }
.chip { align-self: flex-start; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 2px 14px; font-weight: 700; font-size: 14px; }
.poll { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; box-shadow: 0 10px 0 var(--brand-soft); }
.poll figcaption { display: flex; flex-direction: column; gap: 2px; }
.poll-q { font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1.4; }
.poll-meta { font-size: 13px; color: var(--muted); }
.results { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.result { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; font-weight: 600; }
.result .pct { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.result .bar { grid-column: 1 / -1; height: 12px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.result .bar i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.result.lead .bar i { background: var(--accent); }
.result.lead .label::after { content: ' ★'; color: var(--accent); }
.result.hidden-answer .label { color: var(--muted); letter-spacing: .2em; }
.result.hidden-answer .bar i { background: var(--line); }
.w38 { width: 76%; } .w24 { width: 48%; } .w12 { width: 24%; }
.poll-note { font-size: 13px; color: var(--muted); }
.section { display: flex; flex-direction: column; gap: 16px; }
.section h2 { font-size: 26px; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.step { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step h3 { font-size: 18px; }
.step-n { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-family: var(--display); font-weight: 800; font-size: 20px; }
.uses { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.use { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px; font-weight: 600; }
.notice { background: var(--brand-soft); border-radius: var(--radius); padding: 24px; }

/* Footer */
.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-inner { max-width: var(--content-max); margin-inline: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; font-size: 14px; color: var(--muted);
  padding-block: 16px calc(16px + env(safe-area-inset-bottom, 0px)); padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.foot-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); }
.foot-brand img { border-radius: 6px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Coordinator accounts (nhmsv USER_AUTH_FLOW.md): narrow centred forms, the code screen, the account page. */
.top-account { color: inherit; font-weight: 700; text-decoration: none; padding: 0 12px; height: 36px; display: inline-flex; align-items: center; border-radius: 10px; border: 1px solid currentColor; }
.top-account:hover { background: var(--surface); color: var(--brand-ink); }
.auth { width: 100%; max-width: 480px; margin-inline: auto; display: flex; flex-direction: column; gap: 16px; }
.auth-card { display: flex; flex-direction: column; gap: 16px; }
.auth-head { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.auth-head img { border-radius: 14px; }
.auth-head h1 { font-size: 26px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label, .label-row label { font-weight: 700; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
input:not([type="radio"]):not([type="checkbox"]) { width: 100%; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0 14px; font: inherit; }
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.password-field { position: relative; }
.password-field input { padding-inline-end: 48px; }
.pw-reveal { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pw-reveal svg { width: 20px; height: 20px; }
.pw-reveal[aria-pressed="true"] { color: var(--brand-ink); }
.code-input { text-align: center; font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .4em; }
.btn.wide { width: 100%; }
.btn.danger-text { color: var(--bad); }
.small { font-size: 13px; }
.center { text-align: center; }
.alert { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.alert a { color: inherit; }
.notice { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.note { background: var(--warn-bg); color: var(--warn-ink); border-radius: 12px; padding: 10px 14px; }
.auth-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.auth-sep::before, .auth-sep::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.link-button { background: none; border: 0; color: var(--brand-ink); font: inherit; font-weight: 700; cursor: pointer; padding: 6px; }
.link-button:disabled { color: var(--muted); cursor: default; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.account-head { display: flex; flex-direction: column; gap: 8px; }
.account-head h1 { font-size: 30px; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 16px; align-items: start; }
.account-grid h2 { font-size: 20px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.palette-form { display: flex; flex-direction: column; gap: 10px; }
.palette-opt { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-weight: 600; }
.palette-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.palette-dots { display: inline-flex; gap: 2px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.top-account { white-space: nowrap; }
.brand { flex-shrink: 1; }
.top-links { flex-shrink: 0; }
@media (max-width: 420px) {
  .top-account { font-size: 14px; padding: 0 10px; }
  .brand { font-size: 18px; gap: 8px; }
  .brand img { width: 30px; height: 30px; }
}

/* Stage games (docs/GAMEPLAY_PLAN.md §2): the account's games, a new game, and the control panel (phone or iPad). */
.games-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.games-head h2 { font-size: 20px; }
.games-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.games-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.code { font-family: 'Baloo Bhaijaan 2', var(--font); font-weight: 800; letter-spacing: .12em; }
.big-code { font-size: 28px; color: var(--brand-ink); }
.game-new { max-width: 760px; width: 100%; margin-inline: auto; }
.game-new h1 { font-size: 28px; }
.game-new h2 { font-size: 20px; }
.audience-picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.audience-pick { display: grid; place-items: center; min-height: 64px; border: 1.5px solid var(--line); border-radius: 14px; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; }
.audience-pick.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.cat-picks { display: flex; flex-direction: column; gap: 8px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 8px; }
.cat-pick { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-weight: 600; min-height: 48px; }
.cat-pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.cat-pick input, .palette-opt input { width: 20px; height: 20px; accent-color: var(--brand); }
.team-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.lang-picks { display: flex; flex-wrap: wrap; gap: 10px; }
.lang-picks legend, .label-strong { font-weight: 700; margin-bottom: 6px; width: 100%; }

.panel { width: 100%; max-width: 980px; margin-inline: auto; display: flex; flex-direction: column; gap: 14px; }
.panel .card { padding: 18px; }
.panel-bar { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: var(--head); color: var(--on-head);
  border-radius: 16px; padding: 10px 12px; }
.panel-team { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 6px 12px;
  border: 2px solid transparent; min-width: 0; font-weight: 700; }
.panel-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-team strong { font-family: var(--display); font-size: 26px; color: var(--brand-ink); }
.panel-team.has-control { border-color: var(--accent); }
.panel-round { display: flex; flex-direction: column; align-items: center; font-weight: 800; text-align: center; font-size: 14px; }
.mult { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 10px; }
.panel-hint { background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.panel-question { font-size: 22px; }
.panel-answers { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.panel-answers li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 10px; min-height: 60px; }
.panel-answers li.shown { background: var(--ok-soft); border-color: var(--ok); }
.ans-n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-family: var(--display); font-weight: 800; }
.ans-text { display: flex; flex-direction: column; min-width: 0; }
.ans-text small { font-size: 12px; line-height: 1.4; }
.ans-points { font-family: var(--display); font-weight: 800; font-size: 20px; }
.ans-done { color: var(--ok); font-weight: 800; font-size: 22px; min-width: 64px; text-align: center; }
.act { display: inline; margin: 0; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: sticky; bottom: 8px; z-index: 2; box-shadow: 0 6px 20px var(--brand-soft); }
.panel-actions .act { flex: 1 1 200px; display: flex; }
.panel-actions .act .btn { width: 100%; min-height: 56px; font-size: 17px; }
.btn.wrong { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.strikes { color: var(--bad); font-weight: 800; font-size: 26px; letter-spacing: .2em; }
.bank { font-weight: 700; }
.bank strong { font-family: var(--display); font-size: 24px; color: var(--brand-ink); }
.lobby-steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 8px; }
.panel-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.screen-info { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.screen-info .code { font-size: 24px; color: var(--brand-ink); }
.more-tools { display: flex; flex-direction: column; gap: 8px; }
.more-tools[open] { flex-basis: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.more-tools summary { list-style: none; }
.more-tools summary::-webkit-details-marker { display: none; }
.fast-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.fast-head h2 { font-size: 20px; }
.fast-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.fast-q { font-weight: 700; }
.badge-shown { background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: 0 10px; font-size: 12px; margin-inline-start: 6px; }
.fast-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip-btn { min-height: 44px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; padding: 0 14px; cursor: pointer; }
.chip-btn .num { font-family: var(--display); font-weight: 800; color: var(--brand-ink); }
.chip-btn.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip-btn.on .num { color: var(--on-brand); }
.chip-btn:disabled { cursor: default; opacity: .55; }
.chip-btn.on:disabled { opacity: 1; }
@media (max-width: 560px) {
  .panel-bar { grid-template-columns: 1fr 1fr; }
  .panel-round { grid-column: 1 / -1; grid-row: 1; flex-direction: row; justify-content: center; gap: 8px; }
  .panel-answers li { grid-template-columns: auto 1fr auto; }
  .panel-answers li > .act, .panel-answers li > .ans-done { grid-column: 1 / -1; }
  .panel-answers li > .act .btn { width: 100%; }
}
.verify-phone b { direction: ltr; display: inline-block; unicode-bidi: isolate; }

/* The buzzers on the control panel */
.buzz-line { font-weight: 800; font-size: 18px; }
.buzz-line.has-first { background: var(--accent); color: var(--on-accent); border-radius: 12px; padding: 6px 12px; }
.buzz-qr summary { cursor: pointer; font-weight: 700; color: var(--brand-ink); min-height: 44px; display: flex; align-items: center; }
.qr-pair { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.qr-card { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.qr-card img { width: min(200px, 60vw); height: auto; }

/* «كيف أدير اللعبة؟» */
.guide { display: flex; flex-direction: column; gap: 18px; }
.guide-toc { background: var(--brand-soft); border-radius: var(--radius); padding: 14px 18px; }
.guide-toc ol { margin: 0; padding-inline-start: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 4px 18px; }
.guide-toc a { color: var(--brand-ink); font-weight: 700; }
.guide-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; scroll-margin-top: 16px; }
.guide-section ol { margin: 10px 0 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 8px; }
.games-head .row-actions { gap: 8px; }

/* «أسئلتي» */
.my-questions { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.my-questions .card { padding: 14px 16px; }
.answer-rows { display: flex; flex-direction: column; gap: 8px; }
.answer-row { display: grid; grid-template-columns: auto minmax(0, 2fr) 84px minmax(0, 2fr); gap: 8px; align-items: center; }
.points-input { text-align: center; }
@media (max-width: 560px) {
  .answer-row { grid-template-columns: auto minmax(0, 1fr) 72px; }
  .answer-row .aliases-input { grid-column: 2 / -1; }
}
