/* ===== Base design system — «Сургуулийн аварга – CS2 2026» ===== */
:root {
  --navy: #1F2A44; --navy-2: #334155; --ink: #111827; --muted: #6B7280; --line: #E5E7EB; --bg: #F8FAFC; --card: #FFFFFF;
  --gold: #B8860B; --gold-ink: #8A6508; --gold-l: #FEF3C7;
  --gA: #2563EB; --gB: #16A34A; --gV: #EA580C; --gG: #9333EA;
  --gA-t: #2563EB; --gB-t: #15803D; --gV-t: #C2410C; --gG-t: #9333EA;           /* small text on white */
  --gA-l: #DBEAFE; --gB-l: #DCFCE7; --gV-l: #FFEDD5; --gG-l: #F3E8FF;
  --ok: #15803D; --ok-l: #DCFCE7; --warn: #B45309; --warn-l: #FEF3C7; --err: #B91C1C; --err-l: #FEE2E2;
  --radius: 14px; --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 4px 14px rgba(17, 24, 39, .06);
  --tab-h: 64px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
img { max-width: 100%; height: auto; }
a { color: var(--gA); }
h1, h2, h3 { line-height: 1.25; margin: .2em 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 99; }
:focus-visible { outline: 3px solid var(--gA); outline-offset: 2px; }

/* ---- layout ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; min-height: 44px; margin: -6px 0; min-width: 0; }   /* 44-px tap target, same header height */
.brand-logo { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; white-space: nowrap; }
.brand-text > span { font-size: .95rem; }
.brand-text b { color: #FCD34D; font-size: .85rem; letter-spacing: .04em; }
.school { color: #CBD5E1; font-size: .8rem; line-height: 1.2; text-align: right; max-width: 9.5em; }
.tel { white-space: nowrap; }
@media (min-width: 560px) {
  .brand-text > span { font-size: 1.05rem; }
  .brand-text b { font-size: .9rem; }
  .school { font-size: .88rem; max-width: none; }
}
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }
.footer { max-width: 720px; margin: 24px auto 0; padding: 16px; color: var(--muted); font-size: .85rem; text-align: center; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
  background: #fff; border-top: 1px solid var(--line); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .78rem; min-height: 44px; }
.tabbar a .ico { font-size: 1.3rem; line-height: 1; }
.tabbar a.active { color: var(--navy); font-weight: 700; }
body.fullscreen { padding-bottom: 0; background: #0B1220; color: #fff; }
body.fullscreen .topbar, body.fullscreen .tabbar, body.fullscreen .footer, body.fullscreen .banners { display: none; }
body.fullscreen .wrap { max-width: none; padding: 24px; }

/* ---- components ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card.error { border-color: var(--err); background: var(--err-l); color: var(--err); }
.card.ok { border-color: var(--ok); background: var(--ok-l); }
.card.warn { border-color: var(--warn); background: var(--warn-l); }
.grid { display: grid; gap: 12px; } .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .spacer { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--navy); background: var(--navy); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.secondary { background: #fff; color: var(--navy); }
.btn.gold { background: var(--gold-ink); border-color: var(--gold-ink); color: #fff; }   /* white on --gold = 3.3:1 → gold-ink 5.3:1 */
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; color: #fff; background: var(--navy-2); }
.chip.grp-A { background: var(--gA); } .chip.grp-B { background: var(--gB-t); } .chip.grp-V { background: var(--gV-t); } .chip.grp-G { background: var(--gG); }
.chip.ok { background: var(--ok); } .chip.warn { background: var(--warn); } .chip.err { background: var(--err); } .chip.gold { background: var(--gold-ink); }
.badge { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 8px; background: var(--line); font-size: .8rem; text-align: center; }
.banners .banner { padding: 10px 16px; text-align: center; font-weight: 600; }
.banner-info { background: #DBEAFE; color: #1E3A8A; } .banner-warn { background: var(--warn-l); color: #7C2D12; }
.toasts { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 16px); transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); }
.toast-ok { background: var(--ok); } .toast-err { background: var(--err); } .toast-warn { background: var(--warn); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; background: #fff; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .82rem; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
label { display: block; font-weight: 600; margin: 8px 0 4px; }
input, select, textarea { font: inherit; font-size: 16px; width: 100%; padding: 10px 12px; border: 1px solid #CBD5E1; border-radius: 10px; background: #fff; color: var(--ink); min-height: 44px; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; }
.field-error { color: var(--err); font-size: .85rem; margin-top: 4px; }
.input-error { border-color: var(--err); background: #FFF5F5; }
details { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; margin: 8px 0; }
details > summary { cursor: pointer; padding: 12px 0; font-weight: 600; min-height: 44px; }
.steps { display: grid; gap: 8px; counter-reset: step; padding: 0; list-style: none; }
.steps li { display: flex; gap: 10px; align-items: flex-start; }
.steps li::before { counter-increment: step; content: counter(step); flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.steps li.done::before { content: "✓"; background: var(--ok); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.5rem; }
.hero { background: linear-gradient(135deg, var(--navy), #2B3A5C); color: #fff; border-radius: var(--radius); padding: 20px; }
.hero .muted { color: #CBD5E1; }
.loading { padding: 24px 0; text-align: center; }
.content p, .content li { margin: .35em 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Page-specific styles live in css/public.css (public pages) and css/ops.css (class/referee/admin). */
