/* ExamKit — one shared stylesheet. System fonts only. Light/dark tokens. */
:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1a1d23; --muted: #4a5260; --border: #cfd5de;
  --primary: #0b57d0; --primary-ink: #fff; --accent-bg: #e8f0fe;
  --ok: #136c2e; --ok-bg: #e6f4ea; --warn: #7a4300; --warn-bg: #fff4e0; --bad: #b3261e; --bad-bg: #fdecea;
  --radius: 12px; --gap: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #171b21; --text: #e8eaed; --muted: #b3bac6; --border: #353d48;
    --primary: #8ab4f8; --primary-ink: #0b1220; --accent-bg: #1b283c;
    --ok: #81c995; --ok-bg: #11251a; --warn: #fdd663; --warn-bg: #2b2210; --bad: #f6aea9; --bad-bg: #2c1513;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --text: #e8eaed; --muted: #b3bac6; --border: #353d48;
  --primary: #8ab4f8; --primary-ink: #0b1220; --accent-bg: #1b283c;
  --ok: #81c995; --ok-bg: #11251a; --warn: #fdd663; --warn-bg: #2b2210; --bad: #f6aea9; --bad-bg: #2c1513;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif;
  overflow-wrap: break-word;
}
[lang="hi"] { font-family: "Noto Sans Devanagari", "Kohinoor Devanagari", "Mangal", system-ui, sans-serif; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 1.2rem 0 .6rem; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 1.6rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
p, ul, ol { margin: 0 0 .8rem; }
img, canvas { max-width: 100%; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
[hidden] { display: none !important; }

/* Header and nav */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; min-height: 44px; }
.nav { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; align-items: center; }
.nav > li > a, .menu > summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; cursor: pointer; }
.nav a[aria-current="page"] { color: var(--primary); text-decoration: underline; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; margin-left: 6px; font-size: .8em; }
.menu[open] > summary { background: var(--accent-bg); }
.menu ul { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 6px; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.menu li a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.menu li a:hover, .menu li a:focus-visible { background: var(--accent-bg); }

/* Footer */
.site-footer { margin-top: 48px; padding: 24px 0 32px; background: var(--surface); border-top: 1px solid var(--border); font-size: .95rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; }

/* Buttons */
.btn {
  display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 6px;
  min-height: 44px; min-width: 44px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { min-height: 52px; font-size: 1.05rem; padding: 10px 22px; }
.btn.small { padding: 4px 10px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .hi { font-weight: 500; }
@media (max-width: 480px) { .btn .hi { flex-basis: 100%; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.mobile-only { display: none !important; }
@media (pointer: coarse) { .mobile-only { display: inline-flex !important; } }

/* Cards and boxes */
.lead { font-size: 1.08rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); padding: 0; list-style: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h3 { margin-top: 0; }
.card a.stretch { font-weight: 700; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.privacy { background: var(--ok-bg); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.privacy p { margin: 0; }
.note-box { background: var(--accent-bg); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.warn-box { background: var(--warn-bg); border-left: 4px solid var(--warn); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.error { background: var(--bad-bg); border-left: 4px solid var(--bad); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.error p:last-child { margin-bottom: 0; }
.steps { padding-left: 1.3rem; }
.chip { display: inline-block; white-space: nowrap; padding: 1px 10px; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid currentColor; }
.chip.verified { color: var(--ok); background: var(--ok-bg); }
.chip.verified-indirect, .chip.partly-verified, .chip.conflict { color: var(--warn); background: var(--warn-bg); }
.chip.not-verified { color: var(--bad); background: var(--bad-bg); }
.pass { color: var(--ok); }
.fail { color: var(--bad); }
.warn { color: var(--warn); }
.source { font-size: .95rem; }
.reminder { font-weight: 500; }
blockquote.decl { margin: 8px 0 12px; padding: 10px 14px; border-left: 4px solid var(--primary); background: var(--surface); font-family: Georgia, "Times New Roman", serif; }

/* Forms */
label { font-weight: 600; }
select, input[type="number"], input[type="date"], input[type="text"] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  min-height: 44px; padding: 6px 10px; max-width: 100%;
}
select { width: 100%; max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 6px 0; font-weight: 500; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; }
input[type="range"] { width: 100%; max-width: 360px; min-height: 44px; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px 12px; margin: 12px 0; }
legend { font-weight: 700; padding: 0 4px; }
details.more > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--primary); }
.summary { font-weight: 700; font-size: 1.05rem; margin: 8px 0 4px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; }
.radios label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.radios input { width: 20px; height: 20px; margin: 0; }

/* Tool area */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px 16px; margin: 16px 0; }
.tool h2 { font-size: 1.12rem; }
.picker { border: 2px dashed var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.picker.drag { border-color: var(--primary); background: var(--accent-bg); }
.crop-canvas { display: block; width: 100%; max-width: 360px; background: #fff; border: 2px solid var(--border); border-radius: 6px; cursor: grab; }
.crop-canvas:active { cursor: grabbing; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tabs [role="tab"] { min-height: 44px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.tabs [role="tab"][aria-selected="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.preview-canvas { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--border); }
.result { border: 2px solid var(--ok); border-radius: var(--radius); padding: 4px 16px 12px; margin: 16px 0; background: var(--surface); }
.previews { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.previews figure { margin: 0; }
.previews img { display: block; height: auto; border: 1px solid var(--border); background: #fff; }
.previews img.zoomed { width: 320px; max-width: 100%; }
figcaption { font-size: .85rem; color: var(--muted); }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 3px 0; }
.checklist li.info { color: var(--muted); }
.thumbs { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.thumb-item { display: grid; grid-template-columns: 64px 1fr; gap: 6px 10px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.thumb-item .thumb { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 4px; }
.thumb-item .name { font-size: .95rem; }
.row-btns { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
@media (min-width: 640px) {
  .thumb-item { grid-template-columns: 64px 1fr auto; }
  .row-btns { grid-column: auto; }
}
.progress { min-height: 1.5em; font-weight: 600; }
.big { font-size: 1.4rem; font-weight: 800; margin: 4px 0; }

/* Spec tables: stacked cards on phones */
.table-wrap { margin: 12px 0 20px; }
table.spec { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); font-size: .95rem; }
table.spec caption { text-align: left; font-weight: 800; font-size: 1.05rem; padding: 8px 0; }
table.spec th, table.spec td { border: 1px solid var(--border); padding: 8px; vertical-align: top; text-align: left; }
table.spec thead th { background: var(--accent-bg); }
table.spec td ul { margin: 0; padding-left: 1.1rem; }
table.spec td:nth-child(2) { min-width: 5.5em; }
table.spec td:nth-child(5) { min-width: 15em; }
table.spec .btn { margin-top: 6px; }
@media (max-width: 760px) {
  table.spec, table.spec tbody, table.spec tr, table.spec th, table.spec td { display: block; width: 100%; }
  table.spec thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.spec { border: 0; background: transparent; }
  table.spec caption { display: block; width: 100%; }
  table.spec tr { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; padding: 4px 0; }
  table.spec th, table.spec td { border: 0; padding: 6px 12px; }
  table.spec th[scope="row"] { font-size: 1.05rem; }
  table.spec td::before { content: attr(data-label); display: block; font-weight: 700; font-size: .85rem; color: var(--muted); }
}

/* Exam index list */
.exam-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.exam-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.exam-list a { font-weight: 700; font-size: 1.05rem; }

/* Ad placeholders (OFF in v1). When enabled, each slot must reserve its height. */
.ad-slot { min-height: 250px; margin: 24px 0; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media print { .site-header, .site-footer, .tool, .ad-slot { display: none; } }
