:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #5c574f;
  --border: #d9d3c7;
  --accent: #b3261e;
  --accent-text: #ffffff;
  --accent-soft: #fbeae8;
  --ok: #1d6b3a;
  --ok-soft: #e5f3ea;
  --warn: #8a5300;
  --warn-soft: #fff4e0;
  --focus: #1a56c4;
  --whatsapp: #128c4a;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181614;
    --surface: #23201d;
    --text: #f1ede6;
    --muted: #b6afa4;
    --border: #45403a;
    --accent: #f08a80;
    --accent-text: #1b0b09;
    --accent-soft: #3a2220;
    --ok: #7fd39b;
    --ok-soft: #1c3324;
    --warn: #f3c171;
    --warn-soft: #3a2d17;
    --focus: #8fb3ff;
    --whatsapp: #5fd394;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

h1 { font-size: 1.75rem; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 0 0 16px;
}

.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-left-width: 5px;
}
.notice.warn { background: var(--warn-soft); border-left-color: var(--warn); }
.notice.ok { background: var(--ok-soft); border-left-color: var(--ok); }
.notice.error { background: var(--accent-soft); border-left-color: var(--accent); }
.notice strong:first-child { display: block; }

label { display: block; font-weight: 600; margin: 0 0 4px; }
.field { margin: 0 0 14px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }
.field-error { color: var(--accent); font-size: 0.92rem; margin-top: 4px; }
.field-error:empty { display: none; }

input[type="text"], input[type="url"], input[type="date"], input[type="number"], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 46px;
}
textarea { min-height: 72px; resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--accent); border-width: 2px; }

button, .button {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  min-height: 46px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: var(--accent-text); }
button.danger { color: var(--accent); border-color: var(--accent); }
button.small { min-height: 40px; padding: 6px 12px; font-size: 0.95rem; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > input { flex: 1 1 180px; width: auto; }
.stack > * + * { margin-top: 10px; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain > li {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}
ul.plain > li:first-child { border-top: 0; }

.person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.person .name { flex: 1 1 140px; font-weight: 600; overflow-wrap: anywhere; }

.link-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.link-card .actions button { flex: 1 1 150px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-top: 10px; }
.check input { width: 22px; height: 22px; }

.big-result { font-size: 1.6rem; font-weight: 700; margin: 4px 0 0; overflow-wrap: anywhere; }

.wish { overflow-wrap: anywhere; }
.wish a { color: var(--focus); }
.wish-edit { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.wish-edit legend { font-weight: 700; padding: 0 4px; }

.status { min-height: 1.5em; }
.hidden { display: none !important; }
.copyable { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; overflow-wrap: anywhere; background: var(--bg); padding: 8px; border-radius: 8px; border: 1px dashed var(--border); }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  max-width: min(520px, calc(100vw - 32px));
  padding: 20px;
}
dialog::backdrop { background: rgb(0 0 0 / 0.5); }

footer { margin-top: 32px; }

.mt { margin-top: 12px; }
.grow { flex: 1 1 140px; }
.grow select { margin-top: 0; }
.offscreen { position: fixed; top: 0; left: -9999px; opacity: 0; }

/* ---------- Sinterklaas theme (participant page) ---------- */

@font-face {
  font-family: "Pacifico";
  src: url("/fonts/pacifico-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Fixed palette in light and dark mode: the theme is the look. */
body.theme-sint {
  --sint-red: #a3161a;
  --sint-red-deep: #5e0b0e;
  --gold: #f2c14e;
  --gold-deep: #9a6b00;
  --cream: #fff8ea;
  --bg: #fffdf6;
  --surface: var(--cream);
  --text: #3a2216;
  --muted: #6b4f3e;
  --border: #e5cd96;
  --accent: var(--sint-red);
  --accent-text: #ffffff;
  --accent-soft: #fde7e5;
  --ok: #1d6b3a;
  --ok-soft: #e5f3ea;
  --warn: #8a5300;
  --warn-soft: #fff1d6;
  --focus: #1a56c4;
  color-scheme: light;
  color: var(--text);
  background:
    url("/sint-pattern.svg") repeat,
    radial-gradient(ellipse at top, #b81d22 0%, var(--sint-red-deep) 70%) fixed;
  background-color: var(--sint-red-deep);
  min-height: 100vh;
}

.theme-sint .on-red { color: var(--cream); }
.theme-sint .on-red.muted { color: #f5dcc8; }
.theme-sint h1.on-red { text-shadow: 0 2px 6px rgb(0 0 0 / 0.35); }
.theme-sint :focus-visible { outline-color: var(--gold); }
.theme-sint .card :focus-visible { outline-color: var(--focus); }

.sint-hero { text-align: center; padding: 8px 0 4px; }
.sint-hero .mijter { width: 52px; height: auto; display: block; margin: 0 auto -4px; filter: drop-shadow(0 3px 4px rgb(0 0 0 / 0.35)); }
.family-title {
  font-family: "Pacifico", "Brush Script MT", cursive;
  font-size: clamp(2.1rem, 10vw, 3.2rem);
  line-height: 1.25;
  color: var(--gold);
  margin: 0 0 14px;
  text-shadow: 0 3px 0 var(--sint-red-deep), 0 6px 16px rgb(0 0 0 / 0.4);
  overflow-wrap: anywhere;
}

.polaroid {
  display: inline-block;
  background: var(--cream);
  padding: 10px 10px 14px;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgb(0 0 0 / 0.4);
  transform: rotate(-2.5deg);
  margin: 4px 0 18px;
}
.polaroid img {
  display: block;
  width: min(260px, 68vw);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  background: #e9dcc0;
}

.theme-sint .card { border: 0; border-top: 6px solid var(--gold); box-shadow: 0 6px 18px rgb(0 0 0 / 0.25); }

.lootje {
  position: relative;
  text-align: center;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgb(242 193 78 / 0.12) 14px 28px),
    var(--cream);
  outline: 3px dashed var(--gold-deep);
  outline-offset: -12px;
  padding: 26px 20px 28px !important;
}
.lootje .big-result {
  font-family: "Pacifico", "Brush Script MT", cursive;
  font-weight: 400;
  font-size: clamp(2rem, 9vw, 2.8rem);
  color: var(--sint-red);
  line-height: 1.3;
}
.lootje .seal {
  position: absolute;
  top: -14px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d8343a, #8e1015);
  box-shadow: 0 3px 6px rgb(0 0 0 / 0.3);
  display: grid;
  place-items: center;
  color: var(--gold);
  font: 700 1.3rem/1 Georgia, serif;
}

.theme-sint footer { color: #f5dcc8; }
