/* =========================================================
   Calendario dell'Avvento - mobile first (iPhone Safari)
   ========================================================= */
:root {
  --night: #0b1530;
  --night2: #16234a;
  --night3: #22336a;
  --gold: #ffd166;
  --gold2: #f4b400;
  --red: #e63946;
  --red2: #b5202e;
  --green: #2a9d8f;
  --green2: #1d6f66;
  --snow: #f8fbff;
  --ink: #1a1f36;
  --muted: #a9b6d9;
  --accent: #ffd166;
  --accent2: #fff3b0;
  --radius: 18px;
  --font-title: 'Mountains of Christmas', 'Georgia', serif;
  --font-text: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--night);
  height: -webkit-fill-available;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  color: var(--snow);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.45;
  background:
    radial-gradient(120% 60% at 50% 0%, #2b3f7a 0%, rgba(43, 63, 122, 0) 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button, a, input, [role="button"] { touch-action: manipulation; }
button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
a { color: var(--gold); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  display: flex;
  flex-direction: column;
}
.loading { text-align: center; margin-top: 40vh; color: var(--muted); }

/* ---------- snow ---------- */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.flake {
  position: absolute; top: -10px; border-radius: 50%; background: #fff; opacity: .8;
  animation: fall linear infinite;
  will-change: transform;
}
@keyframes fall {
  from { transform: translate3d(0, -10px, 0); }
  to { transform: translate3d(var(--drift, 20px), 105vh, 0); }
}
.twinkle { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: 6px;
}
.topbar .spacer { flex: 1; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 22px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; cursor: pointer; font-size: 15px; font-weight: 700;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active { transform: scale(.96); }

/* ---------- titles ---------- */
.h-title {
  font-family: var(--font-title); font-weight: 700; color: var(--gold);
  font-size: clamp(34px, 11vw, 46px); line-height: 1.05; margin: 4px 0 4px; text-align: center;
  text-shadow: 0 2px 0 #b07a00, 0 0 24px rgba(255, 209, 102, .35);
}
.h-sub { font-family: var(--font-title); font-size: 24px; text-align: center; color: var(--accent2); margin: 0 0 8px; }
.h2 { font-family: var(--font-title); color: var(--gold); font-size: 30px; margin: 22px 0 10px; text-align: center; }
.lead { text-align: center; color: #dfe7ff; margin: 6px auto 0; max-width: 34ch; }

/* ---------- home ---------- */
.hero-art { width: min(78vw, 300px); margin: 10px auto 0; filter: drop-shadow(0 10px 30px rgba(0,0,0,.4)); border-radius: 50%; overflow: hidden; aspect-ratio: 1; }
.hero-art svg { width: 100%; height: 100%; }
.rules { display: grid; gap: 12px; }
.rule {
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: start;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px;
}
.rule svg { width: 52px; height: 52px; }
.rule h3 { margin: 0 0 2px; font-size: 18px; color: var(--gold); }
.rule p { margin: 0; color: #dfe7ff; font-size: 16px; }
.choose { margin-top: 8px; }
.footer-note { text-align: center; margin: 28px 0 8px; font-size: 14px; color: var(--muted); }
.footer-note a { color: var(--muted); }

/* bottom action area (thumb zone) */
.actions {
  position: sticky; bottom: 0; z-index: 5;
  margin: auto calc(-16px - var(--safe-right)) calc(-16px - var(--safe-bottom)) calc(-16px - var(--safe-left));
  padding: 12px calc(16px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background: linear-gradient(180deg, rgba(11,21,48,0) 0%, rgba(11,21,48,.92) 30%, var(--night2) 100%);
  padding-top: 30px;
  display: grid; gap: 10px;
}
.actions.two { grid-template-columns: 1fr 1fr; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 12px 18px; border-radius: 16px; border: 0; cursor: pointer;
  font-size: 18px; font-weight: 800; text-decoration: none; text-align: center;
  background: var(--gold); color: var(--ink);
  box-shadow: 0 4px 0 var(--gold2), 0 8px 20px rgba(0,0,0,.3);
  transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold2); }
.btn[disabled] { opacity: .5; }
.btn svg { width: 28px; height: 28px; flex: none; }
.btn.red { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red2), 0 8px 20px rgba(0,0,0,.3); }
.btn.green { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green2), 0 8px 20px rgba(0,0,0,.3); }
.btn.ghost { background: rgba(255,255,255,.1); color: var(--snow); box-shadow: none; border: 1px solid rgba(255,255,255,.25); }
.btn.small { min-height: 44px; font-size: 15px; padding: 8px 12px; }
.btn.lud { background: #9b5de5; color: #fff; box-shadow: 0 4px 0 #6f3bb0, 0 8px 20px rgba(0,0,0,.3); }
.btn.reb { background: #ff5fa2; color: #fff; box-shadow: 0 4px 0 #c93a78, 0 8px 20px rgba(0,0,0,.3); }

/* ---------- card / forms ---------- */
.card {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 18px;
}
.paper {
  background: #fffaf0; color: var(--ink); border-radius: var(--radius); padding: 20px 18px; position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); border: 3px solid var(--gold);
}
.paper::before {
  content: ''; position: absolute; inset: 6px; border: 2px dashed rgba(230,57,70,.35); border-radius: 12px; pointer-events: none;
}
.field { display: grid; gap: 6px; margin-top: 14px; }
.field label { font-weight: 700; font-size: 15px; }
input[type="text"], input[type="password"], input[type="date"], select {
  font: inherit; font-size: 18px; /* >= 16px: no iOS zoom */
  min-height: 52px; width: 100%; padding: 10px 14px; border-radius: 14px;
  border: 2px solid #cfd6ea; background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--gold2); }
.msg { min-height: 1.5em; margin: 10px 0 0; font-weight: 700; }
.msg.err { color: #ff9aa5; }
.paper .msg.err { color: var(--red2); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.login-art { width: 120px; margin: 18px auto 6px; }

/* ---------- calendar ---------- */
.cal-head { text-align: center; }
.cal-head .h-title { font-size: clamp(30px, 9.5vw, 40px); color: var(--accent); text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 22px color-mix(in srgb, var(--accent) 40%, transparent); }
.today-line { color: #dfe7ff; margin: 0; font-weight: 700; }
.progress-line { color: var(--muted); font-size: 14px; margin: 2px 0 10px; }
.progress-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; margin: 0 auto 14px; max-width: 280px; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 4px; }

.grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  padding: 12px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.1);
}
.door {
  position: relative; aspect-ratio: 1 / 1.08; min-height: 64px; border: 0; padding: 0; cursor: pointer;
  border-radius: 12px; overflow: visible; background: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.door .box {
  position: absolute; inset: 8px 0 0 0; border-radius: 10px;
  background: var(--c1, var(--red));
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 4px 10px rgba(0,0,0,.3);
  overflow: hidden;
}
.door .box::before { /* vertical ribbon */
  content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 16%; transform: translateX(-50%); background: var(--c2, var(--gold));
}
.door .box::after { /* pattern dots */
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.25) 1.5px, transparent 2px); background-size: 12px 12px; opacity: var(--dots, 0);
}
.door .lid {
  position: absolute; left: -3px; right: -3px; top: 6px; height: 26%; border-radius: 8px;
  background: var(--c1, var(--red)); filter: brightness(.88); box-shadow: 0 2px 4px rgba(0,0,0,.25); z-index: 2;
}
.door .lid::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 16%; transform: translateX(-50%); background: var(--c2, var(--gold)); }
.door .bow { position: absolute; left: 50%; top: -4px; width: 46%; transform: translateX(-50%); z-index: 3; }
.door .num {
  position: absolute; z-index: 4; left: 50%; top: 58%; transform: translate(-50%, -50%);
  font-family: var(--font-title); font-weight: 700; font-size: clamp(22px, 7vw, 30px); line-height: 1;
  color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35);
  background: rgba(11,21,48,.35); border-radius: 50%; width: 1.6em; height: 1.6em; display: grid; place-items: center;
}
.door .tag {
  position: absolute; z-index: 5; bottom: -6px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-size: 10.5px; font-weight: 800; padding: 1px 6px; border-radius: 10px; background: var(--gold); color: var(--ink);
  text-transform: uppercase; letter-spacing: .04em;
}
.door.locked { cursor: default; }
.door.locked .box, .door.locked .lid { filter: saturate(.35) brightness(.6); }
.door.locked .bow { filter: saturate(.3) brightness(.6); }
.door.locked .num { color: rgba(255,255,255,.75); }
.door.locked .lock { position: absolute; z-index: 5; right: 2px; bottom: 2px; width: 22px; height: 22px; }
.door.today .box, .door.today .lid { animation: glow 1.6s ease-in-out infinite; }
.door.today::before {
  content: ''; position: absolute; inset: -6px; border-radius: 16px; border: 3px solid var(--gold);
  box-shadow: 0 0 18px var(--gold), inset 0 0 12px rgba(255,209,102,.5);
}
@keyframes glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
.door.missed .tag { background: var(--accent); color: var(--ink); }
.door.missed-closed .box, .door.missed-closed .lid { filter: grayscale(1) brightness(.5); }
.door.solved .open {
  position: absolute; inset: 8px 0 0 0; border-radius: 10px; z-index: 2;
  background: radial-gradient(circle at 50% 45%, #fff6d6 0%, #ffe39a 60%, #f4c35a 100%);
  box-shadow: inset 0 0 0 3px var(--c1, var(--red)), inset 0 0 14px rgba(0,0,0,.2);
  display: grid; place-items: center;
}
.door.solved .open svg { width: 62%; height: 62%; }
.door.solved .num {
  top: 4px; left: 4px; transform: none; width: auto; height: auto; padding: 1px 6px; border-radius: 8px; font-size: 16px;
  background: var(--c1, var(--red));
}
.door.solved .check { position: absolute; z-index: 5; right: -4px; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff; font-size: 15px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.door:focus-visible { outline: 3px solid var(--snow); outline-offset: 3px; }
.door:not(.locked):active { transform: scale(.95); }

.words { margin-top: 18px; }
.words ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.words li {
  display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.07); border-radius: 14px; padding: 10px 12px;
  border-left: 4px solid var(--accent);
}
.words .d { font-family: var(--font-title); font-size: 22px; color: var(--accent); min-width: 2ch; text-align: center; }
.words .w { font-weight: 800; font-size: 18px; color: var(--gold); }
.words svg { width: 30px; height: 30px; margin-left: auto; }
.muted { color: var(--muted); }

/* ---------- day page ---------- */
.day-head { text-align: center; }
.day-head .kicker { display: inline-block; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; background: var(--accent); color: var(--ink); padding: 3px 10px; border-radius: 10px; }
.day-head .h-title { font-size: clamp(30px, 9vw, 40px); }
.question { font-size: 20px; line-height: 1.45; margin: 4px 0 0; font-weight: 700; }
.riddle-icon { width: 64px; height: 64px; margin: -50px auto 6px; background: #fffaf0; border-radius: 50%; padding: 8px; border: 3px solid var(--gold); position: relative; z-index: 1; }
.hint {
  margin-top: 12px; background: #fff3c4; border-radius: 12px; padding: 10px 12px; color: var(--ink); font-size: 16px;
  display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start;
}
.hint svg { width: 26px; height: 26px; }
.hint b { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #8a6400; }
.hint-note { font-size: 14px; color: #6b7290; margin-top: 8px; }
.solved-box { text-align: center; }
.word-big {
  font-family: var(--font-title); font-weight: 700; color: var(--red); font-size: clamp(34px, 11vw, 48px); line-height: 1.05; margin: 8px 0;
  overflow-wrap: anywhere;
}

/* ---------- reveal overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  background: rgba(6, 12, 30, .86); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  overscroll-behavior: contain;
}
.reveal { width: min(100%, 420px); text-align: center; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.reveal .gift-open { width: 120px; margin: 0 auto -6px; }
.reveal .paper { padding: 22px 18px; }
.reveal .h-title { color: var(--red); text-shadow: none; }
.reveal p { margin: 6px 0; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: confetti linear forwards; }
@keyframes confetti { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }

.toast {
  position: fixed; left: 50%; top: calc(16px + var(--safe-top)); transform: translate(-50%, -20px); z-index: 70;
  background: var(--snow); color: var(--ink); font-weight: 700; padding: 12px 16px; border-radius: 14px; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 30px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- test banner ---------- */
.test-banner {
  position: sticky; top: 0; z-index: 20; margin: calc(-12px - var(--safe-top)) -16px 8px; padding: calc(6px + var(--safe-top)) 16px 6px;
  background: repeating-linear-gradient(45deg, #ffd166, #ffd166 12px, #ffbf3c 12px, #ffbf3c 24px); color: var(--ink);
  display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px;
}
.test-banner button { margin-left: auto; min-height: 36px; border-radius: 10px; border: 0; background: var(--ink); color: #fff; padding: 0 10px; font-weight: 700; }

/* ---------- games ---------- */
body.playing { overflow: hidden; overscroll-behavior: none; position: fixed; inset: 0; width: 100%; }
.game-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.game-bar { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; margin: 6px 0 8px; min-height: 28px; }
.game-bar .pill { background: rgba(255,255,255,.12); padding: 3px 10px; border-radius: 12px; }
.timer { flex: 1; height: 10px; border-radius: 5px; background: rgba(255,255,255,.15); overflow: hidden; }
.timer span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); transform-origin: left; }
.timer.low span { background: var(--red); }
.game-area {
  position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none;
}
.game-area * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.rules-card { text-align: center; }
.rules-card svg.big { width: 90px; height: 90px; margin: 0 auto 6px; }
.rules-card p { font-size: 18px; }
.easy-note { background: #d9f7f1; color: #0f4d45; border-radius: 12px; padding: 8px 10px; font-weight: 700; font-size: 15px; }
.lose-card { text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .snow, .confetti { display: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (min-width: 700px) {
  body { font-size: 18px; }
}

/* ---------- admin ---------- */
.admin-table { display: grid; gap: 8px; }
.admin-row { display: grid; grid-template-columns: 40px 1fr; gap: 10px; background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px; font-size: 15px; }
.admin-row.is-solved { border-left: 4px solid var(--green); }
.ad-day { font-family: var(--font-title); font-size: 26px; color: var(--gold); text-align: center; }
.ad-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ad-actions .btn { flex: 1 1 auto; }
.gold { color: var(--gold); }
.small { font-size: 13px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; margin-top: 6px; }
.check-row input { width: 24px; height: 24px; accent-color: var(--gold); }
.card select { color: var(--ink); }

.reveal .btn { width: 100%; }
.avatar { position: relative; width: 112px; height: 112px; margin: 14px auto 6px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 4px solid var(--accent); box-shadow: 0 0 0 4px rgba(255,255,255,.15), 0 8px 24px rgba(0,0,0,.4); background: var(--night3); }
.avatar .santa-hat { position: absolute; width: 70px; left: -16px; top: -26px; transform: rotate(-22deg); filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }

/* memory */
.mem-grid { display: grid; gap: 8px; width: min(100%, 62vh, 420px); }
.mem-card { aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; perspective: 600px; cursor: pointer; min-height: 44px; }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.mem-back { background: repeating-linear-gradient(45deg, #e63946, #e63946 8px, #d62839 8px, #d62839 16px); border: 3px solid #ffd166; }
.mem-back svg { width: 50%; opacity: .7; }
.mem-front { background: #fffaf0; transform: rotateY(180deg); border: 3px solid #ffd166; }
.mem-front svg { width: 72%; }
.mem-card.matched .mem-front { background: #d9f7f1; border-color: var(--green); }

/* quiz */
.quiz { width: 100%; }
.quiz-q { font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 18px; }
.quiz-opts { display: grid; gap: 12px; }
.quiz-opt.right { background: var(--green); border-color: var(--green); }
.quiz-opt.wrong { background: var(--red); border-color: var(--red); }

/* simon */
.simon-msg { font-size: 22px; font-weight: 800; min-height: 1.4em; margin: 0 0 12px; color: var(--gold); }
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: min(88%, 50vh, 360px); }
.simon-ball { border: 0; background: none; padding: 0; aspect-ratio: 1; cursor: pointer; opacity: .55; transition: opacity .1s, transform .1s, filter .1s; }
.simon-ball.lit { opacity: 1; transform: scale(1.08); filter: drop-shadow(0 0 18px var(--c)) brightness(1.3); }

/* anagram */
.ana { width: 100%; display: grid; gap: 22px; justify-items: center; }
.ana-slots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ana-slot { width: 38px; height: 46px; border-radius: 10px; border: 2px dashed rgba(255,255,255,.4); display: grid; place-items: center; font-size: 24px; font-weight: 800; }
.ana-slot.filled { border-style: solid; background: #fffaf0; color: var(--ink); border-color: var(--gold); }
.ana-slot.hint small { color: var(--gold); font-size: 18px; opacity: .8; }
.ana-slots.ok .ana-slot { background: var(--green); color: #fff; border-color: var(--green); }
.ana-letters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ana-letter { width: 48px; height: 52px; border-radius: 12px; border: 0; background: var(--gold); color: var(--ink); font-size: 24px; font-weight: 900; box-shadow: 0 4px 0 var(--gold2); cursor: pointer; }
.ana-letter:disabled { opacity: .25; box-shadow: none; }
.ana-tools { display: flex; gap: 10px; }

/* dots */
.dots { width: min(100%, 60vh, 420px); background: #fffaf0; border-radius: 18px; border: 3px solid var(--gold); }
.dots-line { stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dots.complete .dots-line { fill: rgba(255, 209, 102, .5); }
.dot { cursor: pointer; }
.dot-c { fill: var(--night); }
.dot.done .dot-c { fill: var(--red); }
.dot text { font-size: 6px; font-weight: 800; fill: #4a5275; font-family: var(--font-text); }

/* maze */
.maze { width: min(100%, 52vh, 420px); border-radius: 14px; touch-action: none; }
.maze-me { transition: transform .18s ease-out; }
.maze-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(100%, 360px); margin-top: 12px; }
.maze-pad .btn { min-height: 52px; font-size: 20px; }

/* sliding puzzle + jigsaw */
.puz-wrap { width: min(100%, 56vh, 420px); display: grid; gap: 10px; justify-items: center; }
.puz-ref { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid var(--gold); justify-self: end; }
.puz-ref svg { width: 100%; height: 100%; }
.puz { width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; background: rgba(255,255,255,.15); border-radius: 12px; padding: 3px; }
.puz-tile { position: relative; border: 0; padding: 0; background: none; border-radius: 6px; overflow: hidden; cursor: pointer; aspect-ratio: 1; }
.puz-tile svg { width: 100%; height: 100%; }
.puz-tile i { position: absolute; left: 3px; top: 2px; font-style: normal; font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; }
.puz-tile.empty { background: rgba(11,21,48,.6); cursor: default; }
.puz-tile.sel { outline: 4px solid var(--gold); outline-offset: -4px; transform: scale(.94); }
.puz-tile.ok { box-shadow: inset 0 0 0 3px var(--green); }
.puz.solved { gap: 0; padding: 0; transition: gap .4s; }

/* word search */
.ws-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, 54vh, 420px); background: #fffaf0; border-radius: 14px; padding: 6px; border: 3px solid var(--gold); touch-action: none; }
.ws-cell { aspect-ratio: 1; display: grid; place-items: center; font-weight: 900; color: var(--ink); font-size: clamp(14px, 4.6vw, 22px); border-radius: 50%; }
.ws-cell.sel, .ws-cell.anchor { background: var(--gold); }
.ws-cell.found { background: var(--fc); }
.ws-cell.first { box-shadow: inset 0 0 0 2px var(--red); }
.ws-words { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.ws-word { padding: 4px 10px; border-radius: 12px; background: rgba(255,255,255,.12); font-weight: 800; font-size: 15px; }
.ws-word.found { background: var(--fc); color: var(--ink); text-decoration: line-through; }

/* spot the difference */
.spot-wrap { width: min(100%, 50vh * 1.5, 440px); display: grid; gap: 10px; }
.spot { width: 100%; aspect-ratio: 3 / 2; border-radius: 12px; border: 3px solid var(--gold); display: block; }
.spot.bottom { cursor: crosshair; }
.spot .miss { fill: var(--red); font-size: 26px; font-weight: 900; }

/* catch */
.game-area canvas.catch { display: block; width: 100%; height: 100%; border-radius: 16px; background: linear-gradient(#22336a, #16234a); touch-action: none; }

/* hangman */
.hm { width: 100%; display: grid; gap: 10px; justify-items: center; }
.hm-snow { width: 84px; height: 84px; }
.hm-hint { margin: 0; text-align: center; font-weight: 700; color: var(--accent2); font-size: 17px; }
.hm-word { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: center; min-height: 44px; }
.hm-part { display: flex; gap: 4px; }
.hm-l { width: 24px; height: 34px; border-bottom: 3px solid var(--gold); font-size: 24px; font-weight: 900; text-align: center; }
.hm-word.solved .hm-l { color: var(--green); }
.hm-keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; width: min(100%, 420px); margin-top: 6px; }
.hm-key { min-height: 46px; border-radius: 10px; border: 0; background: var(--snow); color: var(--ink); font-size: 19px; font-weight: 900; cursor: pointer; }
.hm-key.ok { background: var(--green); color: #fff; }
.hm-key.no { background: rgba(255,255,255,.15); color: rgba(255,255,255,.5); }

.icon-btn .note { position: relative; font-size: 24px; line-height: 1; color: var(--gold); }
.icon-btn .note.off { color: #8e9ac0; }
.icon-btn .note.off::after { content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 2.5px; background: #ff9aa5; transform: rotate(-40deg); border-radius: 2px; }

/* the heart on the user buttons sits on a white badge so it shows on the same-colour button */
.btn.lud svg, .btn.reb svg { background: #fff; border-radius: 50%; padding: 4px; width: 34px; height: 34px; }
