/* Shared by every page: the type, the colours (overridden from /api/theme), the parts. */

@font-face { font-family: 'Saira Stencil One'; src: url('/fonts/saira-stencil-one.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 500; src: url('/fonts/barlow-sc-500.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; src: url('/fonts/barlow-sc-700.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 800; src: url('/fonts/barlow-sc-800.woff2') format('woff2'); font-display: swap; }

:root {
  --bg: #12161a;
  --panel: #1d242b;
  --ink: #f3ecdc;
  --muted: #a7ad9f;
  --accent: #e3a23a;
  --good: #7fb069;
  --bad: #e0604c;
  --choice0: #17716f;
  --choice1: #7a2f7e;
  --choice2: #a8461a;
  --choice3: #42506c;
  --display: 'Saira Stencil One', 'Barlow Semi Condensed', system-ui, sans-serif;
  --body: 'Barlow Semi Condensed', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --panel-2: color-mix(in srgb, var(--panel) 80%, var(--ink) 6%);
  --radius: 14px;
  --tap: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 500 18px/1.35 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: .02em; margin: 0; line-height: 1.1; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--tap); padding: 0 1.2em; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #17130b; font-weight: 800; font-size: 1.05rem;
  cursor: pointer; text-decoration: none; touch-action: manipulation; user-select: none;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.quiet { background: var(--panel-2); color: var(--ink); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { min-height: 40px; font-size: .95rem; padding: 0 .9em; border-radius: 10px; }
.btn.wide { width: 100%; }

.card { background: var(--panel); border-radius: var(--radius); padding: 18px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.spacer { flex: 1; }

label.field { display: grid; gap: 6px; font-weight: 700; }
label.field > span { font-size: .9rem; color: var(--muted); font-weight: 700; }
input[type=text], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--line); background: color-mix(in srgb, var(--bg) 70%, black); color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }

.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  color: #fff; font-weight: 800; text-shadow: 0 1px 2px rgb(0 0 0 / .4);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 44px; width: auto; }
.brand-title { font-family: var(--display); font-size: 1.8rem; color: var(--accent); line-height: 1; }
.brand-company { color: var(--muted); font-size: .9rem; }
.brand.small .brand-title { font-size: 1.25rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700;
  max-width: min(92vw, 520px); text-align: center; z-index: 50; transition: transform .25s ease;
}
.toast.show { transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.good { background: var(--good); color: #10200a; }

.net-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40; text-align: center; padding: 6px;
  background: var(--bad); color: #fff; font-weight: 800; transform: translateY(-100%); transition: transform .2s;
}
.net-banner.show { transform: none; }

/* Answer colours, one class per position. Always with a letter and a mark. */
.c0 { --c: var(--choice0); } .c1 { --c: var(--choice1); } .c2 { --c: var(--choice2); } .c3 { --c: var(--choice3); }

.ring { color: var(--accent); }
.ring.low { color: var(--bad); }
.ring-text { fill: var(--ink); font: 800 20px var(--body); }

.badge {
  display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 999px;
  background: var(--panel-2); font-weight: 700; font-size: .9rem;
}
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); font-size: .8rem; font-weight: 700; }
.pill.warn { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.pill.bad { background: color-mix(in srgb, var(--bad) 35%, transparent); }

/* Reduced motion: the system setting, or the device's own toggle (html.calm). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
html.calm *, html.calm *::before, html.calm *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
