:root{color-scheme:dark;--bg:#112520;--panel:#1c3730;--line:#496156;--paper:#fff5dc;--muted:#c1cfc3;--gold:#f4cd86;--red:#963d48;font:16px/1.55 system-ui,sans-serif}
*{box-sizing:border-box}
body{margin:0;background:radial-gradient(ellipse at top,#26483c,var(--bg) 60%);color:var(--paper);min-height:100vh}
.shell{max-width:960px;margin:auto;padding:0 clamp(16px,5vw,58px)}
header,footer{display:flex;justify-content:space-between;padding:20px 0;color:var(--muted);font-size:.85rem;letter-spacing:.08em;border-bottom:1px solid var(--line)}
footer{justify-content:center;gap:.7em;border:0}footer span,.ornament{color:var(--gold)}
.hero{text-align:center;padding:clamp(34px,7vw,68px) 0}
.ornament{line-height:1;font-size:3rem}
.eyebrow,#date{color:var(--gold);font-size:.75rem;letter-spacing:.2em;font-weight:700}
h1,h2,h3{font-family:Georgia,serif;line-height:1.1}
h1{font-weight:normal;font-size:clamp(3rem,10vw,6rem);margin:12px 0}
h1 em{color:var(--gold);font-weight:normal}
h2{font-size:clamp(1.65rem,4.6vw,2.55rem);margin:0 0 16px}
h3{font-size:1.36rem}
#today,#timer,#hints{color:var(--muted)}
button,input{font:inherit}button{background:var(--panel);border:1px solid var(--line);border-radius:8px;color:var(--paper);padding:.65rem 1rem;cursor:pointer;min-height:44px}
button:enabled:hover,button[aria-pressed=true]{border-color:var(--gold);background-color:#345347}
button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
button:disabled{cursor:default}
#open-today,.primary{background:var(--gold);color:#252114;border-color:var(--gold);font-weight:700}
#open-today:hover,.primary:hover{background:#ffe1a7}
#calendar{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:clamp(5px,1.4vw,13px)}
.door{position:relative;min-height:clamp(57px,12vw,103px);padding:5px;display:grid;place-content:center;font:clamp(1.3rem,4vw,2.2rem) Georgia,serif}
.door:disabled{color:#a7beb0;background:#19342d}
.door small{font:700 .69rem system-ui;position:absolute;top:5px;right:7px}
.door.current{background:var(--red);border-color:var(--gold)}
.door.done{color:var(--gold)}
dialog{width:min(94vw,630px);max-height:90dvh;border:1px solid var(--line);border-radius:18px;padding:clamp(16px,4vw,32px);background:var(--bg);color:var(--paper)}
dialog::backdrop{background:#081411d9}
.dialog-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
#close{font-size:1.5rem;padding:0 13px}
.intro{white-space:pre-line}.stage-number{color:var(--gold);font-size:.85rem}
.options{display:grid;gap:8px}.options button{text-align:left}
.row,form{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
input{background:#0b1e19;color:var(--paper);border:1px solid var(--line);border-radius:7px;padding:10px;min-width:0;flex:1 1 180px}
a,#feedback{color:var(--gold)}#feedback:empty,#timer:empty{display:none}
video{width:100%;max-height:38vh;border-radius:10px;margin-bottom:12px}
.puzzle button[aria-pressed=true]{outline:3px solid var(--gold);outline-offset:-3px}
.memory{display:grid;grid-template-columns:repeat(4,1fr);gap:7px}.memory button{font-size:1.4rem;padding:6px}

:root {
  --font-ui: "Aptos", "Segoe UI", system-ui, sans-serif;
  font: 16px/1.55 var(--font-ui);
}

.shell { max-width: 880px; }
header { align-items: center; gap: 8px; letter-spacing: .025em; }
#progress { font-variant-numeric: tabular-nums; }
.hero { padding-block: clamp(28px, 7vw, 57px); }
#today { margin: 14px 0 18px; }
.door { border-radius: 14px; }
#calendar-title { font-size: clamp(1.25rem, 5vw, 1.75rem); }
dialog { border-radius: 24px; }
.dialog-head { gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
#day-title { margin: 0; font-weight: 400; }
#close { flex: 0 0 44px; padding: 0; }
h3 { font: 650 clamp(1.08rem, 3.8vw, 1.23rem)/1.45 var(--font-ui); margin: 6px 0 16px; }
.stage-number { margin: 17px 0 0; }
.intro { color: var(--muted); }
#stage > a { display: inline-block; margin-bottom: 12px; }
#stage > button.primary { width: 100%; margin-top: 12px; }
button { min-height: 48px; border-radius: 11px; }
.options button { min-height: 52px; width: 100%; }
form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
form input { width: 100%; }
.game-status { min-height: 2.8em; margin: 10px 0; color: var(--muted); font-size: .95rem; }
.game-controls { display: grid; gap: 8px; }
.game-controls.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.game-controls button { font-size: clamp(.78rem, 2.65vw, .98rem); padding-inline: 3px; }
.duel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  text-align: center;
  background: #152f28;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 6px;
}
.duel-side { display: grid; justify-items: center; gap: 5px; font-size: clamp(.77rem, 3vw, 1rem); }
.duel-choice { color: var(--muted); }
.hand { font-size: clamp(2.15rem, 11vw, 3.5rem); line-height: 1.3; color: var(--gold); }
.duel-score { color: var(--gold); margin: 0; font: 700 clamp(1.28rem, 5vw, 2rem)/1 var(--font-ui); font-variant-numeric: tabular-nums; }
.rolling .hand { animation: windup 260ms ease-in-out 3; }
.rolling .duel-side:last-child .hand { animation-delay: 30ms; }
@keyframes windup { 50% { transform: translateY(-9px) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .rolling .hand { animation: none; } }

.hunt-grid, .echo-grid, .slide-grid { display: grid; gap: 7px; }
.hunt-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.echo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hunt-grid button, .echo-grid button, .slide-grid button {
  padding: 0;
  font-size: clamp(1.35rem, 5.5vw, 2rem);
}
.echo-grid button { min-height: 64px; }
.echo-grid button.lit { background: var(--gold); color: #242114; outline: 2px solid var(--paper); outline-offset: 1px; }
.reaction-pad { width: 100%; min-height: 104px; font-weight: 700; }
.reaction-pad[data-light="waiting"] { background: #963d48; }
.reaction-pad[data-light="go"] { background: #9fe78c; color: #112520; }
.aim-track {
  position: relative;
  height: 32px;
  margin: 15px 8px 10px;
  background: #29473e;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.aim-zone { position: absolute; inset: 0 34%; background: #83ca74; }
.aim-marker { position: absolute; width: 6px; height: 42px; top: -5px; border-radius: 4px; background: var(--paper); transform: translateX(-50%); box-shadow: 0 0 0 1px #12271f; }
.slide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(100%, 270px); margin: 12px auto; }
.slide-grid button { aspect-ratio: 1.35; }
.slide-grid button.empty { background: #0c1c18; border-style: dashed; }
.slide-grid.example { width: 115px; gap: 3px; margin: 5px 0 16px; }
.slide-grid.example span { display: grid; place-items: center; background: #263e35; border-radius: 4px; }
@media (max-width: 390px) {
  form { grid-template-columns: minmax(0, 1fr); }
}

.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#reset-preview:disabled { opacity: .6; }

.stage-prompt { white-space: pre-line; }
.door.rest { background: transparent; border-color: transparent; color: var(--muted); opacity: .65; }

.puzzle {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  width: min(100%, 390px, 53dvh);
  aspect-ratio: 1;
  margin: 0 auto 12px;
}
.puzzle button {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px #142c2780;
  background-image: url('media/delione.jpg');
  background-size: 500% 300%;
  touch-action: none;
}
.puzzle-reference { margin: 0 auto 10px; width: min(100%, 390px, 53dvh); }
.puzzle-reference summary { cursor: pointer; color: var(--gold); }
.puzzle-reference img { display: block; width: min(120px, 100%); margin: 8px 0; border-radius: 6px; }
.stage-prompt, #stage > a { overflow-wrap: anywhere; }
