/*
  School Life — the look. Font stack and thin-line icon style follow ITEK's Claude Design; School
  Life has its OWN colours (palette block below).
  Layout borrows clean-card patterns (soft borders, generous spacing) and
  quiz-app patterns (big tappable options, progress bar, green/red feedback).
  Plain CSS, phone's own fonts, nothing from another website.
*/
/* ===== PALETTE — every colour lives here. Swap the palette in this block only.
   Indigo + Gold, chosen by the owner 2 Dec 2026. Gold is ONLY for ranks/prizes,
   never buttons. No pure black text. ===== */
:root {
  --primary:#4338ca; --primary-dark:#3730a3; --on-primary:#ffffff;
  --primary-soft:#eef0ff; --primary-line:#c9ccf5; --primary-text:#3730a3;
  --accent:#ffb100; --accent-soft:#fff6e0; --on-accent:#3a2800;
  --correct:#00a60e; --on-correct:#ffffff; --correct-soft:#e0f4e1; --correct-text:#007a0a;
  --wrong:#d92916; --on-wrong:#ffffff; --wrong-soft:#fbe7e5; --wrong-text:#a81f10; --wrong-line:#f2c0ba;
  --bg:#f7f8fa; --surface:#ffffff; --surface-2:#f0f1f5;
  --border:#e3e5ec; --line:var(--border); --line-2:#cfd2dc; --text:#21242c; --muted:#5f6470;
  --header:#4338ca; --on-header:#ffffff; --header-btn:rgba(255,255,255,.16);
  --shadow:0 1px 2px rgba(33,36,44,.05), 0 6px 16px rgba(33,36,44,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --primary:#6d6bf0; --primary-dark:#5654d6; --on-primary:#ffffff;
  --primary-soft:#23234a; --primary-line:#3a3a78; --primary-text:#a9a8ff;
  --accent:#ffb100; --accent-soft:#3a2c08; --on-accent:#2a1d00;
  --correct:#2fc23c; --on-correct:#04210a; --correct-soft:#12301a; --correct-text:#7ee088;
  --wrong:#f0533f; --on-wrong:#2a0703; --wrong-soft:#3a1713; --wrong-text:#ffb4aa; --wrong-line:#6b2a22;
  --bg:#12131a; --surface:#1c1e27; --surface-2:#242733;
  --border:#2d303d; --line:var(--border); --line-2:#3b3f4f; --text:#f1f2f6; --muted:#a2a6b4;
  --header:#1f1d4d; --on-header:#f1f2f6; --header-btn:rgba(255,255,255,.09);
  --shadow:none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary:#6d6bf0; --primary-dark:#5654d6; --on-primary:#ffffff;
  --primary-soft:#23234a; --primary-line:#3a3a78; --primary-text:#a9a8ff;
  --accent:#ffb100; --accent-soft:#3a2c08; --on-accent:#2a1d00;
  --correct:#2fc23c; --on-correct:#04210a; --correct-soft:#12301a; --correct-text:#7ee088;
  --wrong:#f0533f; --on-wrong:#2a0703; --wrong-soft:#3a1713; --wrong-text:#ffb4aa; --wrong-line:#6b2a22;
  --bg:#12131a; --surface:#1c1e27; --surface-2:#242733;
  --border:#2d303d; --line:var(--border); --line-2:#3b3f4f; --text:#f1f2f6; --muted:#a2a6b4;
  --header:#1f1d4d; --on-header:#f1f2f6; --header-btn:rgba(255,255,255,.09);
  --shadow:none; color-scheme: dark;
}
/* ===== end of palette ===== */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
       font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5;
      stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding-bottom: 80px; }

/* header */
.top { background: var(--header); color: var(--on-header); display: flex; align-items: center; gap: 10px;
       padding: 14px 16px; border-radius: 0 0 22px 22px; position: sticky; top: 0; z-index: 5; }
.wordmark { flex: 1; font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
.wordmark b { font-weight: 800; margin-left: 3px; }
.wordmark b::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 999px;
                     background: #22c55e; margin-left: 4px; vertical-align: 1px;
                     box-shadow: 0 0 0 0 rgba(34,197,94,.7); animation: live-pulse 2s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.7); } 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@media (prefers-reduced-motion: reduce) { .wordmark b::after { animation: none; } }
.icon-btn { width: 40px; height: 40px; border-radius: 999px; border: none; background: var(--header-btn);
            color: var(--on-header); display: flex; align-items: center; justify-content: center; padding: 0; }

/* layout */
.screen { padding: 20px 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.hero h1 { margin: 2px 0 0; font-size: 28px; letter-spacing: -0.025em; line-height: 1.15; }
.hero p { margin: 6px 0 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.pad { padding: 18px 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.tag { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary-text); }
.note { border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.err { background: var(--wrong-soft); border: 1px solid var(--wrong-line); color: var(--wrong-text); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 32px 18px; }
.big-ic { width: 40px; height: 40px; color: var(--primary); margin-bottom: 6px; }

/* segmented control */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--line);
       border-radius: 999px; padding: 4px; }
.seg button { height: 40px; border: none; border-radius: 999px; background: none; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* forms + buttons */
label.field { display: flex; flex-direction: column; gap: 6px; }
label.field > span { font-size: 14px; font-weight: 600; }
input, select { height: 50px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface);
                color: var(--text); font: inherit; font-size: 16px; padding: 0 14px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
#f-pin { letter-spacing: .5em; font-size: 20px; }
.btn { height: 52px; border-radius: 999px; border: none; background: var(--primary); color: var(--on-primary);
       font-size: 16px; font-weight: 700; width: 100%; }
.btn:disabled { opacity: .6; }
.btn2 { height: 48px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
        font-size: 15px; font-weight: 600; width: 100%; }
.link { background: none; border: none; color: var(--primary-text); font-weight: 600; min-height: 44px; }

/* quiz list */
.quiz-card { display: flex; align-items: center; gap: 14px; padding: 16px; text-align: left; width: 100%; }
.quiz-badge { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary-text);
              border: 1px solid var(--primary-line); display: flex; align-items: center; justify-content: center;
              font-weight: 800; font-size: 12px; text-align: center; line-height: 1.1; flex-shrink: 0; }
.quiz-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.quiz-mid b { font-size: 16px; }
.chev { color: var(--muted); }

/* question */
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .25s; }
.q-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; }
.q-text { margin: 0; font-size: 20px; line-height: 1.35; letter-spacing: -0.01em; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 14px; width: 100%;
       text-align: left; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 16px;
       font-size: 16px; box-shadow: 0 2px 0 var(--line-2); }
.opt:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.opt .k { width: 30px; height: 30px; border-radius: 9px; border: 1.5px solid var(--line-2); display: flex;
          align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; color: var(--muted); }
.opt.right { border-color: var(--correct); background: var(--correct-soft); box-shadow: 0 2px 0 var(--correct); }
.opt.right .k { background: var(--correct); border-color: var(--correct); color: var(--on-correct); }
.opt.wrong { border-color: var(--wrong); background: var(--wrong-soft); box-shadow: 0 2px 0 var(--wrong); }
.opt.wrong .k { background: var(--wrong); border-color: var(--wrong); color: var(--on-wrong); }
.opt:disabled { cursor: default; color: var(--text); }
.opt.dim { opacity: .55; }
.verdict { font-weight: 800; font-size: 16px; }
.verdict.ok { color: var(--correct-text); } .verdict.no { color: var(--wrong-text); }
.why { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; }
.why summary { font-weight: 700; padding: 12px 0; cursor: pointer; color: var(--primary-text); }
.why div { padding: 0 0 14px; }

/* result */
.result { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 26px 16px; }
.ring { width: 140px; height: 140px; border-radius: 50%; display: flex; flex-direction: column; align-items: center;
        justify-content: center; background: radial-gradient(closest-side, var(--surface) 79%, transparent 80% 100%),
        conic-gradient(var(--primary) var(--p,0%), var(--surface-2) 0); }
.ring b { font-size: 40px; letter-spacing: -0.03em; line-height: 1; }
.ring span { color: var(--muted); font-size: 14px; }
.r-line { margin: 0; font-size: 18px; font-weight: 700; }
.r-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; width: 100%; }
.r-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px;
               display: flex; flex-direction: column; }
.r-stats b { font-size: 18px; } .r-stats span { font-size: 12px; color: var(--muted); }

/* lists (leaderboard, results) */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
        border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.rank { width: 30px; height: 30px; border-radius: 999px; background: var(--surface-2); display: flex; align-items: center;
        justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.rank.r1 { background: var(--accent); color: var(--on-accent); } .rank.r2, .rank.r3 { background: var(--accent-soft); color: var(--on-accent); border: 1px solid var(--accent); }
.row-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-mid b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; display: flex; flex-direction: column; font-weight: 700; }
.row-end span { font-weight: 400; font-size: 12px; color: var(--muted); }
.row.me { background: var(--primary-soft); }
.mine { display: flex; justify-content: space-between; align-items: center; border-color: var(--primary-line); }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.first { background: var(--primary-soft); color: var(--primary-text); }

/* bottom tabs */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center;
        background: var(--surface); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.tabs button { flex: 1; max-width: 240px; background: none; border: none; display: flex; flex-direction: column;
               align-items: center; gap: 2px; font-size: 12px; color: var(--muted); padding: 6px 0; }
.tabs button.on { color: var(--primary-text); font-weight: 700; }
.tabs button.on svg { stroke-width: 1.8; }

/* admin */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; background: var(--surface-2); }
.scroll { overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.kpis div { padding: 14px; } .kpis b { font-size: 26px; display: block; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row-btns .btn2 { width: auto; padding: 0 16px; height: 40px; font-size: 14px; }
.app.wide { max-width: 1100px; }

/* Version 1 notice (owner request 2 Dec 2026) — hidden while answering a quiz */
.v1-note { display:flex; flex-direction:column; gap:4px; margin:0 0 16px; padding:12px 14px; border-radius:14px;
  background:var(--primary-soft); border:1px solid var(--primary-line); color:var(--text); font-size:14px; line-height:1.45; }
.v1-note b { color:var(--primary-text); }
.v1-badge { align-self:flex-start; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  background:var(--accent); color:var(--on-accent); padding:2px 8px; border-radius:999px; }
.app:has(#s-quiz:not([hidden])) .v1-note { display:none; }
