/* Phone-first single column. Face colours are the same in both themes. */
:root {
  --bg: #EEF1EF;
  --surface: #FFFFFF;
  --fg: #16201B;
  --muted: #5D6A63;
  --line: #D5DCD8;
  --ink: #111111;
  --s4: #22C47E;
  --s3: #A9D84A;
  --s2: #F5A524;
  --s1: #F02A4C;
  --accent: #1D6B4C;
  --display: "Nunito", "Avenir Next", system-ui, sans-serif;
  --body: "Inter Tight", "Helvetica Neue", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1412; --surface: #18201C; --fg: #E8EEEA; --muted: #9AA7A0; --line: #2A3530;
    --accent: #5FD3A0; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.6;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent;
}
.wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; min-height: 100%; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

h1 { font: 700 clamp(22px, 6vw, 30px)/1.35 var(--display); text-align: center; text-wrap: balance; margin: 0; }
.note { font-size: 13px; color: var(--muted); margin: 0; }
.status { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

/* Survey */
.screen { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding-block: 12px; }
.faces, .face-labels { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2.5vw, 16px); }
.face {
  border: 0; padding: 0; cursor: pointer; aspect-ratio: 1; width: 100%; border-radius: 6px;
  display: grid; place-items: center; transition: transform .12s ease; box-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.face svg { width: 78%; height: 78%; }
.face:active { transform: scale(.94); }
.face[data-score="4"] { background: var(--s4); }
.face[data-score="3"] { background: var(--s3); }
.face[data-score="2"] { background: var(--s2); }
.face[data-score="1"] { background: var(--s1); }
.face:disabled { cursor: default; }
.face-labels { text-align: center; font-size: 13px; line-height: 1.3; color: var(--muted); margin-top: -18px; }
.thanks { align-items: center; text-align: center; gap: 14px; }
.thanks .big { font: 900 clamp(26px, 8vw, 36px)/1.3 var(--display); }
.chosen { width: 96px; height: 96px; border-radius: 6px; display: grid; place-items: center; }
.chosen svg { width: 78%; height: 78%; }
.linkbtn { font: 500 14px var(--body); color: var(--accent); background: none; border: 0; text-decoration: underline; cursor: pointer; padding: 6px; }

/* Admin */
header.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
header.bar h1 { font-size: 22px; text-align: left; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h2 { font: 700 15px var(--display); margin: 0; }
.headline { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.headline .num { font: 900 44px/1 var(--display); font-variant-numeric: tabular-nums; }
.headline .unit { color: var(--muted); font-size: 13px; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); }
.stack span { display: block; height: 100%; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.chip { width: 28px; height: 28px; border-radius: 4px; display: grid; place-items: center; }
.chip svg { width: 80%; height: 80%; }
.row .bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.row .bar i { display: block; height: 100%; border-radius: 999px; }
.row .val { font-size: 14px; min-width: 6em; text-align: right; }
.row .val small { color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 150px; }
.day { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.day .col { display: flex; flex-direction: column-reverse; border-radius: 3px; overflow: hidden; min-height: 2px; background: var(--line); }
.day .lbl, .day .n { font-size: 10px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
input, textarea, select { font: 15px var(--body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; width: 100%; }
textarea { resize: vertical; min-height: 64px; }
.btn { font: 700 14px var(--body); background: var(--fg); color: var(--bg); border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; align-self: flex-start; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qr { background: #fff; padding: 12px; border-radius: 8px; align-self: flex-start; line-height: 0; }
.qr img { width: 180px; height: 180px; image-rendering: pixelated; }
code { font-size: 13px; word-break: break-all; }

@media (prefers-reduced-motion: reduce) { .face { transition: none; } }
