/* Tokens from the "Kalėdų burtai" design system. Day by default, Night follows the system setting. */
:root {
  --surface: #f3f6f2; --surface-raised: #ffffff;
  --ink: #17261f; --ink-muted: #4a5d53; --line: #6b7e73;
  --berry: #b8222a; --on-berry: #ffffff;
  --pine: #14583d; --on-pine: #ffffff;
  --gold: #e2ad2f; --slip: #ffffff; --on-slip: #17261f;
  --alert-surface: #fbe9e8; --alert-ink: #7d1218; --focus: #14583d;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --radius-sm: 2px; --radius-md: 12px; --radius-lg: 20px; --radius-pill: 999px;
  --shadow-card: 0 2px 8px #17261f33;

  --font-display: "Lobster", "Brush Script MT", cursive;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0f2219; --surface-raised: #173328;
    --ink: #f2f6f3; --ink-muted: #b4c7bb; --line: #6f8d7d;
    --berry: #e04a50; --on-berry: #1a0507;
    --pine: #7fd1a3; --on-pine: #08170f;
    --gold: #f0c04f;
    --alert-surface: #3a1518; --alert-ink: #ffc9cc; --focus: #f0c04f;
    --shadow-card: 0 2px 8px #00000066;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--surface); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 24px;
  min-height: 100vh; min-height: 100dvh;
  padding: var(--space-6) max(var(--space-4), env(safe-area-inset-left, 0px)) var(--space-7);
  padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
}
@media (min-width: 640px) { body { padding-inline: var(--space-6); } }

.page { position: relative; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-5); }

/* Type styles */
.display-xl { font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 52px; margin: 0; }
.display { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 46px; margin: 0; }
.reveal-name { font-family: var(--font-display); font-weight: 400; font-size: 48px; line-height: 56px; margin: 0; overflow-wrap: anywhere; }
.label { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0; }
.body-sm { font-size: 14px; line-height: 20px; margin: 0; }
@media (min-width: 640px) { .display-xl { font-size: 56px; line-height: 60px; } }

header { display: flex; flex-direction: column; gap: var(--space-2); }
header .tagline { color: var(--ink-muted); margin: 0; }

/* Subtle decoration: three small stars at the page edges, behind the content */
.stars { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.star { position: absolute; width: 18px; height: 18px; fill: var(--gold); opacity: 0.9; }
.star:nth-child(1) { top: 4px; right: 0; }
.star:nth-child(2) { top: 64px; right: 36px; width: 12px; height: 12px; }
.star:nth-child(3) { top: 22px; right: 64px; width: 10px; height: 10px; }
header, section, .notice { position: relative; z-index: 1; }

section { display: flex; flex-direction: column; gap: var(--space-4); }
.eyebrow { color: var(--pine); }
.hint { color: var(--ink-muted); }

/* Pick state */
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.person {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4); text-align: left; cursor: pointer;
  background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md);
  font: 700 16px/24px var(--font-body);
}
.person:hover { border-color: var(--pine); }

/* Spin state */
.chosen { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.chosen .who { margin: 0; color: var(--pine); font-weight: 700; }
.link {
  background: none; border: 0; padding: var(--space-2) 0; min-height: 44px; cursor: pointer;
  color: var(--pine); font: 700 14px/20px var(--font-body); text-decoration: underline; text-underline-offset: 3px;
}
.stage { display: flex; flex-direction: column; align-items: center; gap: var(--space-5); }
.box { width: 220px; max-width: 70%; height: auto; filter: drop-shadow(0 16px 12px #00000040); overflow: visible; }
.slip { fill: var(--slip); rx: var(--radius-sm); }
.slip-line { fill: var(--on-slip); opacity: 0.35; }
.box-body, .box-lid { fill: var(--berry); rx: var(--radius-md); }
.box-shade { fill: var(--on-slip); opacity: 0.18; }
.ribbon { fill: var(--gold); }
.box.spinning g.all { transform-origin: 120px 200px; animation: shake 0.5s ease-in-out infinite; }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }

.field { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: var(--space-1); }
.field label { font-weight: 700; }
.field input {
  min-height: 48px; padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface-raised); color: var(--ink); font: 700 20px/24px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; text-align: center;
}
.field input::placeholder { color: var(--ink-muted); letter-spacing: 0.12em; opacity: 1; }

.spin {
  min-height: 56px; min-width: 160px; padding: 0 var(--space-6); border: 0; cursor: pointer;
  border-radius: var(--radius-pill); background: var(--berry); color: var(--on-berry);
  font: 700 20px/24px var(--font-body); letter-spacing: 0.02em; box-shadow: var(--shadow-card);
}
.spin:hover { filter: brightness(0.92); }
.spin:active { transform: translateY(1px); box-shadow: none; }
.spin:disabled { cursor: progress; background: var(--surface-raised); color: var(--ink-muted); box-shadow: none; outline: 2px solid var(--line); outline-offset: -2px; filter: none; }

/* Reveal state */
.card {
  padding: var(--space-6) var(--space-5); background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center;
  animation: rise 300ms ease-out both;
}
.card .badge { display: inline-block; padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--pine); color: var(--on-pine); }
.card .lead { margin: 0; color: var(--ink-muted); }
.card .limit { margin: 0; max-width: 36ch; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Notice */
.notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--alert-surface); color: var(--alert-ink); border: 1px solid var(--alert-ink); }
.notice svg { flex: none; width: 20px; height: 20px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.notice p { margin: 0; }

/* Focus */
button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .box.spinning g.all { animation: none; }
  .card { animation: none; }
}
