:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1b1f24; --muted: #5b6573; --line: #dde1e6;
  --accent: #2f5bea; --accent-ink: #fff; --ok: #1a7f4b; --ok-bg: #e6f4ec; --bad: #b42318; --bad-bg: #fdecea;
  --flag: #b25e00; --glass: rgb(255 255 255 / .72);
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* "only" stops phone browsers' forced dark mode (Chrome's dark theme for sites, Samsung Internet) from darkening the light theme. */
  color-scheme: only light;
}
/* index.html sets data-theme before first paint: the saved choice, else the system theme.
   The header always takes the dark tokens, so the top bar looks the same in both themes. */
:root[data-theme="dark"], header {
  --bg: #0f1216; --card: #181c22; --ink: #e8ebef; --muted: #9aa4b1; --line: #2a3038;
  --accent: #6b8cff; --accent-ink: #0f1216; --ok: #5bd394; --ok-bg: #12291d; --bad: #ff8a80; --bad-bg: #2e1614;
  --flag: #ffb454; --glass: rgb(24 28 34 / .72);
  color-scheme: dark;
}
/* Solid bars and firmer edges for people who ask for less transparency or more contrast. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) { :root, :root[data-theme], header { --glass: var(--card); } }
@media (prefers-contrast: more) { :root, :root[data-theme], header { --line: #767f8c; } }
/* Fade colors while the theme flips, so the brightness change isn't a hard cut. */
.theming, .theming * { transition: background-color .25s, border-color .25s, color .25s !important; }
* { box-sizing: border-box; }
/* 100% keeps the reader's own text size setting; sizes below are in rem so they scale with it. */
body { margin: 0; background: var(--bg); color: var(--ink); font: 100%/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Translucent bar: content scrolls under it instead of being cut off by an opaque strip. */
header { display: flex; align-items: center; gap: 8px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); position: sticky; top: 0; z-index: 2; color: var(--ink); }
header a { color: var(--ink); text-decoration: none; font-weight: 700; }
.brand { display: flex; align-items: center; margin-right: 8px; letter-spacing: -.01em; }
.brand img { margin-right: 8px; }
.brand span { color: var(--accent); }
header nav { display: flex; gap: 4px; }
header nav a { padding: 6px 12px; border-radius: 980px; color: var(--muted); font-weight: 600; font-size: .9375rem; transition: color .15s, background-color .15s; }
header nav a:hover { color: var(--ink); }
header nav a[aria-current="page"] { color: var(--ink); background: var(--line); }
body.session header nav, body.session header .gh, body.session header .more { display: none; }
/* Menu in front of the logo: the home page that lists every practice site, then the other exams. */
.more { position: relative; }
/* The 34px button gets a 44px hit area, and presses in on pointer-down like every other control. */
.more button { position: relative; transition: color .15s, border-color .15s, transform .1s ease-out; }
.more button::before { content: ""; position: absolute; inset: -5px; }
.more button:active { transform: scale(.92); }
.more.open button { color: var(--ink); border-color: var(--accent); }
/* The panel grows out of the button and shrinks back into it along the same path. It stays in the page while
   closed (hidden from pointers, keyboard and screen readers) so a reopen mid-close continues from where it is. */
.menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 3; width: max-content; max-width: calc(100vw - 24px); padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 12px 32px rgb(0 0 0 / .32), 0 2px 6px rgb(0 0 0 / .2);
  transform-origin: 17px -25px; transform: scale(.9); opacity: 0; visibility: hidden; transition: transform .2s var(--ease), opacity .15s, visibility 0s .2s; }
.more.open .menu { transform: none; opacity: 1; visibility: visible; transition: transform .35s var(--ease), opacity .2s, visibility 0s; }
.menu a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .9375rem; transition: background-color .15s; }
.menu a:hover { background: var(--line); }
.menu a:active { background: var(--line); transition: none; }
.menu a span { color: var(--muted); font-variant-numeric: tabular-nums; }
/* The first row is the way home, so its label takes the accent colour. */
.menu a:first-child span { color: var(--accent); }
#timer { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: auto; }
#end { padding: 6px 14px; }
header a.gh { font-size: .875rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 980px; padding: 6px 12px; transition: color .15s, border-color .15s; }
header a.gh:hover { color: var(--ink); border-color: var(--accent); }
#timer.low { color: var(--bad); }
/* Over a light body the translucent bar would turn gray, so it goes solid in the color it has over the dark body. */
:root:not([data-theme="dark"]) header { background: color-mix(in srgb, var(--card) 72%, var(--bg)); }
header .icon { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s; }
header .icon:hover { color: var(--ink); border-color: var(--accent); }
header .icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* The button shows where it takes you: a moon in the light theme, a sun in the dark theme. */
:root[data-theme="dark"] #theme .moon, :root:not([data-theme="dark"]) #theme .sun { display: none; }
/* anywhere (not break-word) so long AWS identifiers such as policy names and SSM paths can wrap inside flex options on phones. */
main { max-width: 820px; margin: 0 auto; padding: 28px 16px 48px; overflow-wrap: anywhere; }
footer { text-align: center; color: var(--muted); font-size: .8125rem; line-height: 1.8; padding: 0 16px 32px; }
main a, footer a { color: var(--accent); }
/* Tracking is size-specific: large type tightens, small caps loosen, body stays at 0. */
h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -.022em; margin: 0 0 8px; }
h2 { font-size: 1.25rem; line-height: 1.4; letter-spacing: -.012em; margin: 16px 0; }
.muted { color: var(--muted); }
h2.sub { font-size: 1.0625rem; letter-spacing: -.01em; margin: 32px 0 10px; }
.small { font-size: .875rem; }
.strip { font-size: .875rem; color: var(--muted); margin: 0; }
/* Grouped list with inset separators and a disclosure chevron, like iOS Settings. */
.domains { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.drow { position: relative; display: grid; grid-template-columns: 1fr auto auto; gap: 6px 12px; align-items: center; min-height: 52px; padding: 12px 16px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: background-color .15s; }
.drow + .drow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--line); }
.drow::after { content: "›"; grid-area: 1 / 3; color: var(--muted); font-size: 1.375rem; line-height: 1; }
.drow:hover { background: var(--bg); }
.drow:active { background: var(--line); transition: none; }
.drow .muted { font-size: .875rem; }
.drow .meter { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.drow .meter i { display: block; height: 100%; background: var(--accent); }
main a.teaser { display: block; margin: 16px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted); text-decoration: none; font-size: .9375rem; transition: transform .1s ease-out, border-color .15s; }
.teaser span { color: var(--accent); font-weight: 600; white-space: nowrap; }
.teaser:hover { border-color: var(--accent); }
.teaser:active { transform: scale(.99); }
.rules { padding-left: 20px; }
.rules li { margin: 4px 0; }
.keys { display: none; font-size: .875rem; }
@media (hover: hover) and (pointer: fine) { .keys { display: block; } }
.tag { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.actions, .nav { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
/* Press feedback lands on pointer-down (:active), not on release. */
.btn { padding: 10px 20px; border-radius: 980px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: transform .1s ease-out, border-color .15s, background-color .15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--flag); font: inherit; font-weight: 600; cursor: pointer; margin: -10px -4px -10px auto; padding: 10px 4px; }
.bar .qid { font-size: .75rem; }
.bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: .875rem; }
.bar strong { font-variant-numeric: tabular-nums; }
.progress { height: 4px; background: var(--line); border-radius: 2px; margin: 10px 0 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }
.scenario { margin: 18px 0 0; font-size: 1.0625rem; }
.scenario + h2 { margin-top: 12px; }
.why { display: block; margin-top: 6px; font-size: .875rem; line-height: 1.5; color: var(--muted); }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; cursor: pointer; transition: transform .1s ease-out, border-color .15s, background-color .15s; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt:active:not(:disabled) { transform: scale(.99); background: var(--bg); }
.opt:disabled { cursor: default; }
.opt .key { flex: none; width: 2em; height: 2em; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: .8125rem; font-weight: 700; }
/* Multiple response gets square keys, the checkbox shape, so it reads differently from pick-one. */
.opts.multi .key { border-radius: 7px; }
.opt.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.opt.picked .key { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.right .key { background: var(--ok); border-color: var(--ok); color: var(--card); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.wrong .key { background: var(--bad); border-color: var(--bad); color: var(--card); }
.explain { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid; }
.explain.ok { border-color: var(--ok); background: var(--ok-bg); }
.explain.bad { border-color: var(--bad); background: var(--bad-bg); }
.explain strong { display: block; margin-bottom: 4px; }
.explain.ok strong { color: var(--ok); }
.explain.bad strong { color: var(--bad); }
.explain p { margin: 6px 0 0; }
/* Feedback rises in right after Check, so it's clear the press caused it. */
.explain, .opt .why { animation: rise .28s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.palette button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: .8125rem; font-variant-numeric: tabular-nums; cursor: pointer; }
@media (pointer: coarse) { .palette button { width: 44px; height: 44px; } }
.palette .ans { background: var(--line); }
.palette .flag { border-color: var(--flag); color: var(--flag); font-weight: 700; }
.palette .cur { outline: 2px solid var(--accent); }
.score { font-size: 3.5rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.rows { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.row { display: grid; grid-template-columns: 1fr 64px; gap: 4px 12px; align-items: center; font-size: .875rem; }
.row strong { font-variant-numeric: tabular-nums; }
.row .meter { grid-column: 1 / -1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.row .meter i { display: block; height: 100%; background: var(--accent); }
details { border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px 14px; margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; }
summary .yes { color: var(--ok); }
summary .no { color: var(--bad); }
details ul { padding-left: 20px; }
details li.right { color: var(--ok); font-weight: 600; }
details li.wrong { color: var(--bad); }
details li { margin: 8px 0; }
details li .why { font-weight: 400; color: var(--muted); }
.facts { border: 1px solid var(--line); border-radius: 12px; background: var(--card); margin: 0; padding: 12px 16px 12px 34px; font-size: .9375rem; }
.facts li { margin: 4px 0; }
kbd { font: .75rem ui-monospace, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
@media (max-width: 520px) {
  h1 { font-size: 1.625rem; } h2 { font-size: 1.125rem; } .score { font-size: 2.75rem; }
  header { flex-wrap: wrap; padding: 10px 12px; column-gap: 8px; }
  /* Not sticky on phones, but still positioned so its z-index keeps the open menu above the page. */
  body:not(.session) header { position: relative; }
  header nav { order: 3; width: 100%; }
  header nav a { flex: 1; min-height: 44px; display: grid; place-items: center; padding: 0; }
  .gh span { display: none; }
  /* During a timed session the exam code is enough, so brand, timer, submit and theme stay on one row. */
  body.session .brand span { display: none; }
  body.session .nav { position: sticky; bottom: 0; z-index: 1; margin: 16px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
  body.session .nav .btn { flex: 1; }
}
/* Narrow phones also drop the logo during a session, so brand, timer, submit and theme still fit on one row. */
@media (max-width: 380px) { body.session .brand img { display: none; } }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  header, body.session .nav { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* Reduced motion keeps the feedback but drops the movement: fades only, no scaling or sliding. */
@media (prefers-reduced-motion: reduce) {
  :active { transform: none !important; }
  .menu, .more.open .menu { transform: none; transition: opacity .2s, visibility 0s; }
  @keyframes rise { from { opacity: 0; } }
}
