/* Candidate site design: quiet and precise. Neutral greys, the system font with tabular
   figures, grouped white lists with hairline separators, pill buttons, a translucent
   navbar, one green accent, no gradients or decoration. Light or dark: the theme button,
   else the system setting. */
:root {
  --paper: #f5f5f7;
  --sheet: #ffffff;
  --fill: #e8e8ed;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --rule: #d2d2d7;
  --accent: #1a7f4b;
  --accent-hover: #146a3e;
  --accent-ink: #ffffff;
  --accent-tint: #e7f3ec;
  --warn: #b25d00;
  --warn-tint: #fdf1e3;
  --danger: #d70015;
  --bar: rgba(245, 245, 247, 0.8);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Arial, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", Arial, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --focus: 0 0 0 4px rgba(26, 127, 75, 0.3);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #000000;
  --sheet: #1c1c1e;
  --fill: #2c2c2e;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --faint: #8e8e93;
  --rule: #38383a;
  --accent: #34c27a;
  --accent-hover: #4fd08e;
  --accent-ink: #00170b;
  --accent-tint: #13281d;
  --warn: #ffb340;
  --warn-tint: #2e2210;
  --danger: #ff6961;
  --bar: rgba(22, 22, 23, 0.8);
  --focus: 0 0 0 4px rgba(52, 194, 122, 0.35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000;
    --sheet: #1c1c1e;
    --fill: #2c2c2e;
    --ink: #f5f5f7;
    --muted: #a1a1a6;
    --faint: #8e8e93;
    --rule: #38383a;
    --accent: #34c27a;
    --accent-hover: #4fd08e;
    --accent-ink: #00170b;
    --accent-tint: #13281d;
    --warn: #ffb340;
    --warn-tint: #2e2210;
    --danger: #ff6961;
    --bar: rgba(22, 22, 23, 0.8);
    --focus: 0 0 0 4px rgba(52, 194, 122, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 15px/1.47 var(--sans);
  letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1 { margin: 0; font: 700 40px/1.1 var(--display); letter-spacing: -0.03em; }
h2 { margin: 0 0 6px; font: 600 22px/1.2 var(--display); letter-spacing: -0.02em; }
p { margin: 0; }
.mono { font-variant-numeric: tabular-nums; }
.label { font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* Navbar: translucent, blurred, hairline below */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 52px; padding: 0 22px; background: var(--bar); border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 15px; font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand small { font-size: 15px; font-weight: 400; color: var(--muted); }
.logo { display: block; width: auto; height: 22px; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

/* Buttons: pills */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 20px;
  padding: 12px 22px; border: 0; border-radius: 980px; background: var(--accent); color: var(--accent-ink);
  font: 500 15px/1.2 var(--sans); letter-spacing: -0.01em; cursor: pointer; transition: background 0.15s; }
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn:disabled:hover { background: var(--accent); }
.btn.secondary { background: var(--fill); color: var(--ink); }
.btn.secondary:hover, .btn.secondary:disabled:hover { background: var(--fill); }
.btn.auto { width: auto; margin-top: 0; padding: 7px 15px; font-size: 13px; }
.link-btn { border: 0; background: none; padding: 2px 0; color: var(--accent); font: 14px var(--sans); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn:disabled { color: var(--faint); text-decoration: none; cursor: default; }
.btn:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible, .theme-btn:focus-visible, a:focus-visible {
  outline: none; box-shadow: var(--focus); border-radius: 8px; }
.btn:focus-visible { border-radius: 980px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }

/* Menu button (phones) */
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0;
  border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* Theme button: the moon in light mode, the sun in dark mode */
/* Language switch (i18n.js), next to the theme button */
html.i18n-wait body { visibility: hidden; }
.lang-switch { display: inline-flex; flex: none; padding: 2px; border-radius: 980px; background: var(--fill); white-space: nowrap; } /* TEST-41: never wraps */
.lang-switch button { padding: 4px 10px; border: 0; border-radius: 980px; background: none; color: var(--muted);
  font: 600 12px var(--sans); cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.lang-switch button:focus-visible { outline: none; box-shadow: var(--focus); }
body.exam-running .lang-switch { display: none; }
.theme-btn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--muted); cursor: pointer; }
.theme-btn:hover { background: var(--fill); color: var(--ink); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn[data-mode="light"] .sun, .theme-btn[data-mode="dark"] .moon { display: none; }

/* Forms */
.field { display: grid; gap: 6px; margin-top: 22px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; padding: 13px 15px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet);
  color: var(--ink); font: 16px var(--sans); letter-spacing: -0.01em; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.input::placeholder { color: var(--faint); }
/* Dropdowns: our own chevron with room on the right (the browser's arrow sits at the edge) */
select.input { -webkit-appearance: none; appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px; }
.input:focus { border-color: var(--accent); box-shadow: var(--focus); }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.message { min-height: 20px; margin-top: 14px; font-size: 14px; }
.message.ok { color: var(--accent); }
.message.error { color: var(--danger); }

/* Status: a coloured dot and a word */
.status { font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--faint); }
.status.open { color: var(--accent); }
.status.late { color: var(--warn); }
.status.bad { color: var(--danger); }
/* How a finished test ended, under its state (home.js) */
.status-note { display: block; max-width: 22ch; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 400;
  line-height: 1.4; white-space: normal; }

/* Grouped list: white, rounded, hairlines between rows (used for the rules) */
.rules { margin: 0; padding: 0 20px; list-style: none; counter-reset: rule; background: var(--sheet); border-radius: 14px; }
.rules li { counter-increment: rule; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 15px 0;
  border-bottom: 1px solid var(--rule); }
.rules li:last-child { border-bottom: 0; }
.rules li::before { content: counter(rule); font-size: 15px; color: var(--faint); font-variant-numeric: tabular-nums; }
.rules strong { display: block; font-weight: 600; }
.rules span { color: var(--muted); font-size: 14px; }

/* Microsoft button (admin sign-in) */
.ms-btn { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.ms-btn:hover { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--faint); }
.ms-logo { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo i { display: block; width: 9px; height: 9px; }
.ms-logo i:nth-child(1) { background: #f25022; }
.ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; }
.ms-logo i:nth-child(4) { background: #ffb900; }

/* Confirm dialog (confirm.js) */
.confirm { width: min(380px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 14px; background: var(--sheet);
  color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.confirm::backdrop { background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.confirm-box { padding: 24px; text-align: center; }
.confirm-box h2 { font-size: 19px; }
.confirm-box p { margin-top: 4px; font-size: 14px; color: var(--muted); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.confirm-actions .btn { margin-top: 0; padding: 10px 16px; font-size: 14.5px; }
.confirm-actions:has(> :only-child) { grid-template-columns: 1fr; } /* one button: full width, centred */

/* Session dialogs (admin-session.js): an Apple-style alert, centred, icon on top, stacked
   pill buttons (the main one first), a soft pop-in. */
.session-sheet { width: min(340px, calc(100% - 40px)); border-radius: 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 24px 70px rgba(0, 0, 0, 0.28); }
.session-sheet[open] { animation: session-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.session-sheet::backdrop { background: rgba(0, 0, 0, 0.28); backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); }
@keyframes session-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.session-box { display: flex; flex-direction: column; align-items: center; padding: 30px 26px 22px; }
.session-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent); }
.session-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; }
.session-box h2 { margin: 0; font: 650 20px/1.25 var(--display); letter-spacing: -0.015em; }
.session-box p { max-width: 30ch; margin: 8px auto 0; font-size: 14.5px; line-height: 1.5; }
.session-actions { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; margin-top: 22px; }
.session-actions .btn { padding: 12px 16px; font-size: 15.5px; font-weight: 600; border-radius: 980px; }
@media (prefers-reduced-motion: reduce) { .session-sheet[open] { animation: none; } }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .btn, .input { transition: none; } }

/* Empty states (empty.js): a small animated picture, a title and one line */
.empty-state { display: grid; justify-items: center; gap: 4px; padding: 34px 20px; text-align: center;
  animation: es-in 0.35s ease both; }
.empty-state b { margin-top: 6px; font-size: 15.5px; }
.empty-state span { color: var(--muted); font-size: 14px; }
.es-art { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--fill);
  color: var(--faint); }
.es-art svg { width: 44px; height: 44px; overflow: visible; }
.es-check .es-art { background: var(--accent-tint); color: var(--accent); }
.es-ring { opacity: 0.35; transform-origin: 32px 32px; animation: es-pulse 2.4s ease-in-out infinite; }
.es-draw { stroke-dasharray: 40; stroke-dashoffset: 40; animation: es-draw 0.6s ease 0.2s forwards; }
.es-sway { transform-origin: 32px 32px; animation: es-sway 2.6s ease-in-out infinite; }
.es-float { animation: es-float 2.8s ease-in-out infinite; }
@keyframes es-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes es-draw { to { stroke-dashoffset: 0; } }
@keyframes es-pulse { 0%, 100% { transform: scale(1); opacity: 0.35; } 50% { transform: scale(1.12); opacity: 0.15; } }
@keyframes es-sway { 0%, 100% { transform: rotate(-8deg) translateX(-2px); } 50% { transform: rotate(8deg) translateX(2px); } }
@keyframes es-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  .empty-state, .es-ring, .es-sway, .es-float { animation: none; }
  .es-draw { animation: none; stroke-dashoffset: 0; }
}

/* 404 page */
.lost-main { display: grid; justify-items: center; align-content: center; gap: 28px; min-height: 100vh; padding: 32px 20px; }
.lost-card { display: grid; justify-items: center; gap: 8px; width: min(440px, 100%); padding: 36px 32px; border-radius: 18px;
  background: var(--sheet); text-align: center; animation: es-in 0.35s ease both; }
.lost-card h1 { font-size: 28px; }
.lost-card .btn { margin-top: 18px; }
.lost-art { display: grid; place-items: center; width: 84px; height: 84px; margin-bottom: 8px; border-radius: 50%;
  background: var(--fill); color: var(--faint); }
.lost-art svg { width: 50px; height: 50px; overflow: visible; }
.lost-more { margin-top: 6px; font-size: 14px; }
/* Serious consequences (e.g. "your application ends" in the test rules) are red. */
.danger-text, .strike-box .danger-text { color: var(--danger); font-weight: 700; }
