:root {
  --green: #1B3B2B;
  --green-2: #24503A;
  --green-3: #2E6B4A;
  --cream: #FAF6F0;
  --cream-2: #F1E9DC;
  --gold: #C89D54;
  --gold-2: #E8C66A;
  --terra: #B85D43;
  --ink: #1E2B23;
  --muted: #6B6B5E;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 16px/1.55 var(--sans); color: var(--cream);
  background: radial-gradient(120% 70% at 50% 0%, var(--green-2) 0%, var(--green) 55%, #10261b 100%) fixed var(--green);
  -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
#snow, #confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#snow { z-index: 0; }
#confetti { z-index: 50; }
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); }
h1, h2 { font-family: var(--serif); font-weight: normal; line-height: 1.2; margin: 0; }
a { color: var(--gold-2); }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 4px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 20px;
  border: 0; border-radius: 999px; background: var(--gold); color: var(--green); font: 600 16px var(--sans);
  text-decoration: none; cursor: pointer; transition: transform .15s, opacity .15s; touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 1.5px rgba(250, 246, 240, .45); }
.hint { text-align: center; color: rgba(250, 246, 240, .75); font-size: 14px; min-height: 1.4em; }
.msg { text-align: center; min-height: 1.5em; margin: 10px 0; font-weight: 600; color: var(--gold-2); }
.sign { font-family: var(--serif); font-style: italic; color: var(--terra); margin: 14px 0 0; text-align: right; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- home ---------- */
.hero { text-align: center; padding: 20px 0 12px; }
.hero h1 { font-size: clamp(30px, 8vw, 42px); color: var(--cream); }
.sub { margin: 8px 0 18px; color: rgba(250, 246, 240, .8); }
.progress p { margin: 8px 0 0; font-size: 14px; color: rgba(250, 246, 240, .85); }
.bar { height: 8px; border-radius: 99px; background: rgba(250, 246, 240, .15); overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 99px; transition: width .6s; }
.doors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.door {
  position: relative; aspect-ratio: 1 / 1.15; border: 0; border-radius: 14px; cursor: pointer; font: inherit; color: var(--cream);
  background: linear-gradient(160deg, #2a5a41, #1f4532); box-shadow: inset 0 0 0 1.5px rgba(200, 157, 84, .35), 0 4px 10px rgba(0, 0, 0, .25);
  transition: transform .15s; touch-action: manipulation;
}
.door:active { transform: scale(.95); }
.door-num { font: 26px var(--serif); }
.door.is-ready { background: linear-gradient(160deg, var(--terra), #96462f); box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px rgba(232, 198, 106, .45); animation: glow 2.4s ease-in-out infinite; }
.door.is-open { background: var(--cream); color: var(--green); box-shadow: inset 0 0 0 1.5px var(--gold); }
.door.is-open .door-num { position: absolute; top: 6px; left: 9px; font-size: 14px; color: var(--terra); }
.door-badge { font-size: 30px; }
.door.is-locked { opacity: .82; }
.door-star { position: absolute; top: 4px; right: 7px; font-size: 12px; color: var(--gold-2); }
.door.is-open .door-star { color: var(--gold); }
@keyframes glow { 50% { box-shadow: inset 0 0 0 2px var(--gold), 0 0 26px rgba(232, 198, 106, .7); } }
.foot { text-align: center; margin-top: 28px; font-size: 13px; color: rgba(250, 246, 240, .6); }
.pill { display: inline-block; margin-bottom: 6px; padding: 2px 10px; border-radius: 99px; background: var(--terra); color: var(--cream); font-size: 12px; }

/* ---------- day ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: rgba(250, 246, 240, .7); padding: 4px 0 8px; }
.back { color: var(--cream); text-decoration: none; padding: 8px 0; font-weight: 600; }
.day-head { text-align: center; margin: 10px 0 14px; }
.day-head h1 { font-size: clamp(26px, 7vw, 34px); }
.badge {
  width: 84px; height: 84px; margin: 0 auto 12px; display: grid; place-items: center; font-size: 40px; border-radius: 50%;
  background: var(--cream); box-shadow: 0 0 0 4px var(--gold), 0 0 0 9px rgba(200, 157, 84, .25), var(--shadow);
}
.lead { text-align: center; color: rgba(250, 246, 240, .85); margin: 0 0 16px; }
.note, .reward, .letter, .riddle, .quiz, .tracker, .quiz-end {
  background: var(--cream); color: var(--ink); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow);
}
.note p:first-child { margin-top: 0; font: 19px/1.6 var(--serif); }
.reward { margin-top: 16px; text-align: center; border: 2px dashed var(--gold); animation: pop .5s ease-out both; }
.reward-text { font: 20px/1.45 var(--serif); margin: 6px 0; color: var(--green); }
.reward .sign { text-align: center; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.daynav { display: flex; justify-content: space-between; margin-top: 26px; font-size: 14px; }
.daynav a { color: rgba(250, 246, 240, .8); text-decoration: none; padding: 8px 0; }
.locked { text-align: center; padding: 40px 10px; }
.locked-icon { font-size: 70px; }
.locked h1 { font-size: 30px; margin: 8px 0 10px; }
.locked p { color: rgba(250, 246, 240, .85); margin-bottom: 22px; }

/* ---------- Tag 1 · Brief ---------- */
.envelope { position: relative; width: min(300px, 86vw); aspect-ratio: 3 / 2; margin: 50px auto 10px; cursor: pointer; perspective: 900px; transition: opacity .5s, transform .5s; }
.envelope.gone { opacity: 0; transform: scale(.85); height: 0; margin: 0 auto; pointer-events: none; transition: opacity .5s, transform .5s, height 0s .5s, margin 0s .5s; }
.env-back, .env-front, .env-flap { position: absolute; inset: 0; border-radius: 6px; }
.env-back { background: #a94f37; }
.env-paper {
  position: absolute; left: 7%; right: 7%; top: 8%; height: 84%; background: var(--cream); border-radius: 4px; padding: 14px;
  font: italic 16px var(--serif); color: var(--terra); transition: transform .8s .45s ease; box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.env-front { background: var(--terra); clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%); }
.env-flap { background: #c86e52; clip-path: polygon(0 0, 100% 0, 50% 58%); transform-origin: top; transition: transform .6s ease; z-index: 2; }
.env-seal { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -26px 0 0 -22px; z-index: 3; display: grid; place-items: center; border-radius: 50%; background: var(--gold); color: var(--cream); font-size: 20px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: opacity .3s; animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-seal { opacity: 0; }
.envelope.open .env-paper { transform: translateY(-62%); }
.letter, .tracker { display: none; }
.letter.show, .tracker.show { display: block; animation: pop .6s ease-out both; }
.letter p { font: 17px/1.65 var(--serif); }
.letter-hi { margin-top: 0; color: var(--terra); font-size: 20px !important; }
.tracker { margin-top: 14px; text-align: center; }
.tracker p { margin: 8px 0 0; }
.tracker-dots { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin: 10px 0; }
.tracker-dots i { aspect-ratio: 1; border-radius: 50%; background: var(--cream-2); box-shadow: inset 0 0 0 1.5px var(--gold); }
.tracker-dots i.on { background: var(--terra); box-shadow: none; }

/* ---------- Tag 4 · Wordle ---------- */
.wd-grid { display: grid; gap: 6px; width: min(300px, 100%); width: min(300px, 100%, calc((100svh - 330px) * .8)); min-width: 220px; margin: 0 auto; }
.wd-tile.active { border-color: var(--gold-2); animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { border-color: rgba(232, 198, 106, .25); } }
.wd-hint { text-align: center; margin: 0 0 10px; padding: 8px 12px; border-radius: 12px; background: rgba(200, 157, 84, .18); color: var(--cream); font-size: 14px; }
.away { margin: 0 0 16px; padding: 10px 14px; border-radius: 14px; background: rgba(250, 246, 240, .1); box-shadow: inset 0 0 0 1px rgba(200, 157, 84, .4); text-align: center; font-size: 14px; color: var(--cream); }
.has-game .day-head { margin: 4px 0 8px; }
.has-game .badge { width: 64px; height: 64px; font-size: 30px; margin-bottom: 8px; }
.wd-row { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 6px; }
.wd-tile {
  aspect-ratio: 1; display: grid; place-items: center; font: 700 clamp(22px, 7vw, 30px) var(--sans); text-transform: uppercase;
  border: 2px solid rgba(250, 246, 240, .25); border-radius: 8px; color: var(--cream);
  transition: background-color 0s, border-color 0s; transition-delay: var(--cd, 0s);
}
.wd-tile.filled { border-color: rgba(250, 246, 240, .6); }
.wd-tile.correct { background: var(--green-3); border-color: var(--green-3); }
.wd-tile.present { background: var(--gold); border-color: var(--gold); color: var(--green); }
.wd-tile.absent { background: rgba(0, 0, 0, .28); border-color: transparent; }
.wd-tile.flip { animation: flip .5s ease both; animation-delay: var(--d, 0s); }
@keyframes flip { 50% { transform: rotateX(90deg); } }
.kb { margin-top: 6px; user-select: none; }
.kb-row { display: flex; justify-content: center; gap: 5px; margin-bottom: 7px; }
.key {
  flex: 1 1 0; max-width: 44px; height: 52px; border: 0; border-radius: 7px; background: rgba(250, 246, 240, .9); color: var(--green);
  font: 700 16px var(--sans); cursor: pointer; padding: 0; touch-action: manipulation;
}
.key.wide { flex: 1.6 1 0; max-width: 66px; font-size: 14px; }
.key:active { transform: scale(.94); }
.key.correct { background: var(--green-3); color: var(--cream); }
.key.present { background: var(--gold); }
.key.absent { background: rgba(0, 0, 0, .3); color: rgba(250, 246, 240, .6); }

/* ---------- Tag 6 · Rubbellos ---------- */
.scratch { position: relative; aspect-ratio: 4 / 3; max-width: 420px; margin: 0 auto; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.scratch-prize { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 22px; text-align: center; background: var(--cream); color: var(--ink); border: 3px dashed var(--gold); border-radius: var(--r); }
.scratch-prize .sign { text-align: center; }
.scratch-cover { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .7s; }
.scratch-cover.gone { opacity: 0; }

/* ---------- Tag 10 · Quiz ---------- */
.quiz-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.quiz-dots { display: flex; gap: 5px; }
.quiz-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--cream-2); box-shadow: inset 0 0 0 1.5px var(--gold); }
.quiz-dots i.done { background: var(--gold); }
.quiz-dots i.cur { background: var(--terra); box-shadow: none; }
.quiz-q { font-size: 21px; margin: 14px 0 16px; color: var(--green); }
.quiz-opts { display: grid; gap: 9px; }
.opt { min-height: 50px; padding: 12px 14px; text-align: left; border: 1.5px solid #ddd2bf; border-radius: 12px; background: #fff; color: var(--ink); font: 16px var(--sans); cursor: pointer; touch-action: manipulation; }
.opt.right { background: #dcebd6; border-color: var(--green-3); }
.opt.wrong { background: #f4d9d0; border-color: var(--terra); }
.quiz-c { min-height: 1.5em; margin: 14px 0; color: var(--ink); }
.quiz-next { width: 100%; }
.quiz-end { text-align: center; }
.quiz-end .big { font: 48px var(--serif); color: var(--terra); margin: 0; }
.again { display: flex; margin: 16px auto 0; }

/* ---------- Tag 13 · Flappy Sandy ---------- */
.runner { position: relative; border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.runner canvas { display: block; width: 100%; height: 280px; }
.runner-hud { position: absolute; top: 10px; left: 14px; right: 14px; display: flex; justify-content: space-between; pointer-events: none; }
.rs { font: 32px var(--serif); color: var(--cream); text-shadow: 0 2px 4px rgba(0, 0, 0, .4); }
.rb { font-size: 13px; color: rgba(250, 246, 240, .8); padding-top: 8px; }
.runner-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: rgba(13, 33, 24, .62); }
.ro-title { font: 30px var(--serif); margin: 0; }
.ro-sub { margin: 8px 0 14px; color: rgba(250, 246, 240, .9); }

/* ---------- Tag 17 · Connections ---------- */
.cx { display: grid; gap: 8px; }
.cx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.cx-w {
  min-height: 64px; padding: 4px 2px; border: 0; border-radius: 10px; background: var(--cream); color: var(--green);
  font: 700 clamp(10px, 3.2vw, 14px) var(--sans); letter-spacing: .02em; word-break: break-word; hyphens: auto; cursor: pointer; touch-action: manipulation; transition: transform .12s;
}
.cx-w.long { font-size: clamp(8px, 2.5vw, 12px); }
.cx-w.sel { background: var(--terra); color: var(--cream); transform: scale(.96); }
.cx-bar { padding: 12px; border-radius: 10px; text-align: center; color: var(--ink); animation: pop .4s ease-out both; }
.cx-bar b { display: block; font: 600 15px var(--sans); text-transform: uppercase; letter-spacing: .05em; }
.cx-bar span { font-size: 13px; }
.cx-life { text-align: center; font-size: 14px; color: rgba(250, 246, 240, .8); margin: 14px 0 8px; }
.cx-life span { color: var(--gold-2); letter-spacing: 3px; }
.cx-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.cx-actions .btn { padding: 10px 14px; font-size: 14px; }

/* ---------- Tag 20 · Glücksrad ---------- */
.wheel-wrap { position: relative; width: min(330px, 88vw); aspect-ratio: 1; margin: 22px auto 6px; }
.wheel { width: 100%; height: 100%; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, .35)); }
.wheel-pointer { position: absolute; top: -14px; left: 50%; z-index: 2; width: 0; height: 0; margin-left: -14px; border: 14px solid transparent; border-top: 26px solid var(--cream); border-bottom: 0; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.wheel-hub { position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px; border: 4px solid var(--gold); border-radius: 50%; background: var(--terra); color: var(--cream); font: 700 14px var(--sans); cursor: pointer; box-shadow: 0 3px 8px rgba(0, 0, 0, .35); touch-action: manipulation; }
.wheel-hub:disabled { background: var(--green-3); cursor: default; }
.wheel-emoji { font-size: 46px; margin: 4px 0; }

/* ---------- Tag 24 · Tresor ---------- */
.countdown { text-align: center; margin: 0 0 14px; font-size: 15px; color: rgba(250, 246, 240, .9); }
.riddle { text-align: center; }
.riddle p { font: 17px/1.55 var(--serif); margin: 4px 0 0; }
.riddle .riddle-hint { font: 14px var(--sans); color: var(--terra); margin-top: 10px; }
.vault { position: relative; height: 250px; margin: 18px auto 0; max-width: 340px; border-radius: 16px; background: #10261b; box-shadow: inset 0 0 0 6px #6d5a35, var(--shadow); perspective: 1200px; }
.vault-inside { position: absolute; inset: 6px; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(circle, rgba(232, 198, 106, .5), transparent 70%); font-size: 70px; }
.vault-door {
  position: absolute; inset: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; border-radius: 12px;
  background: linear-gradient(145deg, #d8b46d, #a07c3c); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25), inset 0 -6px 14px rgba(0, 0, 0, .25);
  transform-origin: left center; transition: transform 1.1s cubic-bezier(.5, 0, .3, 1); backface-visibility: hidden;
}
.vault.open .vault-door { transform: rotateY(-105deg); }
.vault-bolt { position: absolute; right: 12px; top: 50%; width: 10px; height: 46px; margin-top: -23px; border-radius: 5px; background: #6d5a35; }
.dials { display: flex; gap: 10px; }
.dial { display: flex; flex-direction: column; align-items: center; width: 52px; border-radius: 10px; background: var(--green); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5); }
.dial button { width: 100%; height: 34px; border: 0; background: none; color: var(--gold-2); font-size: 14px; cursor: pointer; touch-action: manipulation; }
.dial-n { font: 32px var(--serif); color: var(--cream); cursor: pointer; user-select: none; }
.vault-open { background: var(--green); color: var(--cream); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 60; max-width: calc(100% - 32px); padding: 12px 18px;
  border-radius: 14px; background: var(--cream); color: var(--green); font-weight: 600; text-align: center; box-shadow: var(--shadow);
  transform: translate(-50%, 140%); opacity: 0; transition: transform .35s, opacity .35s; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- #print ---------- */
body.is-print { background: #d9d4cb; color: var(--ink); }
body.is-print #app { max-width: none; padding: 16px; }
.print-tools { max-width: 640px; margin: 0 auto 20px; padding: 20px; background: #fff; border-radius: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .1); }
.print-tools .back { color: var(--green); }
.print-tools h1 { margin: 8px 0 14px; color: var(--green); }
.print-tools label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.print-tools input[type=url] { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: 16px var(--sans); border: 1.5px solid #ccc; border-radius: 10px; }
.print-tools .chk { font-weight: normal; display: flex; gap: 8px; align-items: flex-start; }
.ptip { font-size: 13px; color: var(--muted); }
.ptip a { color: var(--terra); word-break: break-all; }
#sheets { overflow-x: auto; }
.sheet {
  width: 210mm; height: 297mm; margin: 0 auto 16px; background: #fff; display: grid;
  grid-template-columns: repeat(3, 65mm); grid-template-rows: repeat(4, 70mm); justify-content: center; align-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .18); color: #1E2B23; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pc { position: relative; display: grid; grid-template-rows: 35mm 35mm; outline: .5pt dashed #9a9a9a; outline-offset: -.25pt; overflow: hidden; }
.pc-front {
  transform: rotate(180deg); display: flex; align-items: center; justify-content: space-between; gap: 2mm; padding: 4mm 4.5mm;
  background: #1B3B2B; color: #FAF6F0;
}
.pc-in { position: relative; padding: 4mm 5mm 3mm; border-top: .6pt dotted #b4a88f; background: #FAF6F0; }
.pc-in p { margin: 0; font: 8.6pt/1.35 Georgia, serif; color: #1E2B23; }
.pc-sign { position: absolute; right: 4mm; bottom: 2.5mm; color: #B85D43; font-size: 9pt; }
.pc-meta { display: flex; flex-direction: column; min-width: 0; }
.pc-tag { font: 7pt var(--sans); letter-spacing: .18em; text-transform: uppercase; color: #C89D54; }
.pc-num { font: 26pt/1 Georgia, serif; color: #FAF6F0; }
.pc-scan { margin-top: 1.5mm; font: 6.6pt/1.3 var(--sans); color: #E8D9BC; }
.pc-qr { width: 25mm; height: 25mm; flex: none; border-radius: 1mm; }
.pc-badge { width: 22mm; height: 22mm; flex: none; display: grid; place-items: center; font-size: 34pt; border-radius: 50%; background: #FAF6F0; box-shadow: 0 0 0 1mm #C89D54; }

@page { size: A4 portrait; margin: 0; }
@media print {
  body, body.is-print { background: #fff !important; }
  #snow, #confetti, #toast, .print-tools { display: none !important; }
  body.is-print #app { padding: 0; }
  #sheets { overflow: visible; }
  .sheet { margin: 0; box-shadow: none; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
}
