/* Zern, Warmth v6 (zern-app docs/design/warmth.md + apps/zern/design/tokens.json v6).
   Colours come only from tokens.css, which is generated from the app's tokens.json.
   Type follows Warmth: wordmark 28/800, one 28/34 headline (the app's Home greeting size),
   body 17/26, sentence-case sans labels; mono only for the count. */
:root {
  --sans: 'Geist', 'Noto Sans Tamil', 'Noto Sans Sinhala', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/26px var(--sans); }
main, .top, .foot { max-width: 520px; margin: 0 auto; padding: 0 16px; }
main { padding-bottom: 48px; }
a { color: inherit; }

/* Roles */
.wordmark { font: 800 28px/31px var(--sans); letter-spacing: -0.05em; text-decoration: none; }
.display { font: 800 28px/34px var(--sans); letter-spacing: -0.03em; margin: 24px 0 8px; }
:lang(ta) .display, :lang(si) .display { font-size: 26px; line-height: 34px; letter-spacing: 0; }
.display:focus { outline: none; }
.heading { font: 700 17px/22px var(--sans); margin: 0 0 4px; }
.lede { margin: 0 0 24px; }
.small { font-size: 14px; line-height: 20px; color: var(--ink-muted); margin: 0; }
.meta { font: 500 13px/20px var(--mono); color: var(--ink-muted); margin: 0; font-variant-numeric: tabular-nums; }
.label { font: 600 14px/20px var(--sans); color: var(--ink-muted); }

/* Header */
.top { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; padding-bottom: 8px; }
.langs { display: flex; gap: 2px; }
.langs button {
  font: 600 14px/20px var(--sans); color: var(--ink-muted); background: none; border: 0;
  padding: 12px 8px; min-height: 44px; cursor: pointer; border-bottom: 2px solid transparent;
}
.langs button[aria-pressed='true'] { color: var(--ink); border-bottom-color: var(--ink); }

/* Counter: one quiet line */

/* Form */
form { display: grid; gap: 20px; }
.field { margin: 0; padding: 0; border: 0; min-width: 0; }
.field > .label { display: block; margin-bottom: 2px; }
legend.label { padding: 0; margin-bottom: 8px; }
input:not([type='radio']):not([type='checkbox']), select {
  width: 100%; height: 48px; font: 400 17px/24px var(--sans); color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--field); border-radius: 0; padding: 10px 0; appearance: none;
}
select { padding-right: 24px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 10px) 50%, calc(100% - 5px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { outline: none; border-bottom: 2px solid var(--ink); padding-bottom: 9px; }
input::placeholder { color: var(--ink-muted); opacity: 0.6; }
[aria-invalid='true'] { border-bottom-color: var(--danger) !important; }
.error { color: var(--danger); font-size: 14px; line-height: 20px; margin: 4px 0 0; }
.error:empty { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--field); border-radius: 4px; font-weight: 600; font-size: 15px; }
.chips input:checked + span { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chips input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.optional { border-top: 1px solid var(--rule-soft); padding-top: 4px; }
.optional summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: 15px; list-style: none; }
.optional summary::-webkit-details-marker { display: none; }
.optional summary::before { content: '+'; display: inline-block; width: 20px; font-weight: 700; }
.optional[open] summary::before { content: '−'; }
.optional[open] { display: grid; gap: 16px; padding-bottom: 4px; }
.check label { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 22px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); flex-shrink: 0; }

#captcha:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.button {
  display: inline-flex; justify-content: space-between; align-items: center; gap: 16px;
  width: 100%; min-height: 52px; padding: 14px 18px; border-radius: 4px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--on-ink); font: 600 17px/24px var(--sans); text-decoration: none; cursor: pointer;
  transition: transform 120ms ease-out;
}
.button:active { transform: scale(0.98); }
.button.ghost { background: transparent; color: var(--ink); justify-content: center; }
.button[disabled] { opacity: 0.6; cursor: progress; }
.button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.status { margin: 0; font-size: 15px; line-height: 22px; }
.status[data-tone='error'] { color: var(--danger); }
.status:empty { display: none; }
.privacy summary { cursor: pointer; text-decoration: underline; min-height: 32px; }
.privacy p { margin-top: 8px; }

.share { display: grid; gap: 12px; margin-top: 32px; }
.share-link { font: 500 13px/20px var(--mono) !important; }
#action, #again { margin: 8px 0 24px; }
.foot { padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--rule-soft); }

/* Celebration */
/* Behind the page's text (owner, 28 Nov: the burst covered "You're #N."): main sits above it. */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
main { position: relative; z-index: 1; }
.pop { animation: pop 360ms var(--ease); }
/* Scale only: the heading is full ink from the first frame, never a faded grey. */
@keyframes pop { from { transform: scale(0.92); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 120ms !important; animation-duration: 120ms !important; }
  .pop { animation-name: fade; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
main > p.small:last-child { margin-top: 24px; }
