/* Same palette as jankaespacso.hu: sage green card on beige, identical in light and dark mode. */
:root {
  color-scheme: dark;
  --bg: #56634b;
  --bg-deep: #434e3a;
  --beige: #c4ab8c;
  --ink: #f7f4ec;
  --muted: rgba(247, 244, 236, 0.75);
  --line: rgba(247, 244, 236, 0.55);
  --gold: #f3d27a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; height: 100%; }

body {
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 80% 10%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(ellipse at 15% 90%, rgba(0, 0, 0, 0.18), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  text-align: center;
  overflow: hidden;
  font-variant-numeric: lining-nums;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* ---------- Picker ---------- */

.picker {
  height: 100svh;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

header { padding: 8px 0 16px; }

.script {
  margin: 0;
  font-family: "Monsieur La Doulaise", cursive;
  font-size: 44px;
  line-height: 1.1;
}

h1 {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hint {
  margin: 6px 0 0;
  font-style: italic;
  font-size: 20px;
  color: var(--muted);
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.score {
  font: inherit;
  font-size: clamp(34px, 9vh, 56px);
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.1s, background 0.1s;
}

.score:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.18); }

.score.top {
  color: var(--gold);
  border-color: rgba(243, 210, 122, 0.7);
}

/* ---------- Result ---------- */

.result {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background: var(--bg);
  overflow: hidden;
}

.result[hidden] { display: none; }

.result.wow {
  background: radial-gradient(circle at 50% 45%, #6f7f60 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

.result-label {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.big {
  position: relative;
  z-index: 2;
  font-size: min(68vw, 52vh);
  font-weight: 700;
  line-height: 1;
  animation: pop 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.wow .big {
  color: var(--gold);
  text-shadow: 0 0 30px rgba(243, 210, 122, 0.55), 0 0 80px rgba(243, 210, 122, 0.35);
  animation: pop 0.6s cubic-bezier(0.2, 1.8, 0.4, 1) both, glow 1.6s ease-in-out 0.6s infinite alternate;
}

.wow .result-label { color: var(--gold); }

@keyframes pop {
  from { transform: scale(0.2) rotate(-8deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes glow {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.reset {
  position: relative;
  z-index: 2;
  margin-top: 16px;
  padding: 16px 32px;
  font: inherit;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.reset:active { transform: scale(0.96); }

/* ---------- Stars (8, 9, 10) ---------- */

.sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

.star {
  position: absolute;
  left: 50%;
  top: 45%;
  color: var(--gold);
  line-height: 1;
  animation: burst var(--dur) cubic-bezier(0.15, 0.7, 0.3, 1) var(--delay) both;
}

@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--rot));
    opacity: 0;
  }
}

.twinkle {
  position: absolute;
  color: var(--ink);
  animation: twinkle var(--dur) ease-in-out var(--delay) infinite;
}

@keyframes twinkle {
  0%, 100% { transform: scale(0.2); opacity: 0; }
  50% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .big, .wow .big { animation: none; }
  .star { display: none; }
}
