/* Hex & Hollow: colourful enchanted storybook. Palette per .kiro/steering/visual-design.md */
:root {
  --lavender: #B9A7F5; --teal: #65C9C0; --coral: #FF9D91; --butter: #FFD978; --mint: #A8DDBB; --sky: #91CFF5; --berry: #A96BC7; --cream: #FFF4DF; --indigo: #292746;
  --lav-d: #8d79d9; --teal-d: #3a9a92; --coral-d: #e8736a; --butter-d: #e8b84a; --mint-d: #6cb88b; --sky-d: #5aa7d9; --berry-d: #7a3fa0; --pink: #FF9EC4; --pink-d: #e0508a;
  --paper: #FFFAF0; --ink: var(--indigo); --ink-soft: #55507c; --mote: #B9A7F5;
  --serif: Georgia, 'Palatino Linotype', Palatino, 'Book Antiqua', 'Times New Roman', serif;
  --radius: 20px; --px: 0; --py: 0;
  --shadow: 0 2px 0 #fff inset, 0 7px 0 rgba(141, 121, 217, .28), 0 18px 30px rgba(41, 39, 70, .2);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #F3EBFF; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.5; overflow-x: hidden;
  background:
    radial-gradient(60% 40% at 12% 8%, rgba(255, 157, 145, .35), transparent 70%),
    radial-gradient(55% 40% at 92% 14%, rgba(145, 207, 245, .5), transparent 70%),
    radial-gradient(60% 45% at 80% 92%, rgba(168, 221, 187, .5), transparent 70%),
    linear-gradient(180deg, #E4DAFF 0%, #FFF1DD 55%, #FFE4DC 100%) fixed;
}
#particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; outline: none; }
.screen { max-width: 980px; margin: 0 auto; padding: 14px 14px calc(30px + env(safe-area-inset-bottom)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 99; background: var(--butter); color: var(--ink); padding: 10px 14px; }
.skip:focus { left: 8px; top: 8px; }
h1, h2, h3 { font-weight: 700; line-height: 1.15; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: clamp(1.7rem, 5.4vw, 2.5rem); } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; color: var(--berry-d); }
h1:focus, h2:focus, h1:focus-visible, h2:focus-visible { outline: none; box-shadow: none; }
p { margin: 0 0 .7em; }
.muted { color: var(--ink-soft); } .small { font-size: .86rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; } .row.center { justify-content: center; }
:focus-visible { outline: 4px solid var(--indigo); outline-offset: 3px; border-radius: 10px; box-shadow: 0 0 0 7px var(--butter); }
hr { border: 0; border-top: 2px dashed rgba(141, 121, 217, .4); margin: 14px 0; }
[hidden] { display: none !important; }
.noscript { padding: 20px; text-align: center; }

/* ---------- Glossy bevelled buttons ---------- */
.btn {
  position: relative; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; min-height: 46px; min-width: 46px; padding: 8px 20px; border-radius: 999px;
  border: 3px solid #fff; background: linear-gradient(180deg, #FFFFFF 0%, #E9E0FF 100%);
  box-shadow: 0 5px 0 var(--lav-d), 0 9px 14px rgba(41, 39, 70, .25); transition: transform .12s, box-shadow .12s, filter .2s; -webkit-tap-highlight-color: transparent;
}
.btn::before { content: ''; position: absolute; left: 10%; right: 10%; top: 3px; height: 38%; border-radius: 999px; background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0)); pointer-events: none; }
.btn:hover:not(:disabled):not([aria-disabled='true']) { transform: translateY(-2px); filter: brightness(1.04) saturate(1.1); box-shadow: 0 7px 0 var(--lav-d), 0 14px 18px rgba(41, 39, 70, .28); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--lav-d), 0 3px 6px rgba(41, 39, 70, .25); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .55; cursor: not-allowed; filter: grayscale(.4); }
.btn-primary { background: linear-gradient(180deg, #FFE699 0%, #FFB86B 100%); box-shadow: 0 5px 0 #e0832f, 0 9px 14px rgba(41, 39, 70, .25); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 7px 0 #e0832f, 0 14px 18px rgba(41, 39, 70, .28); } .btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 #e0832f; }
.btn-teal { background: linear-gradient(180deg, #B6F0E9, #65C9C0); box-shadow: 0 5px 0 var(--teal-d), 0 9px 14px rgba(41, 39, 70, .25); }
.btn-sky { background: linear-gradient(180deg, #D3EEFF, #91CFF5); box-shadow: 0 5px 0 var(--sky-d), 0 9px 14px rgba(41, 39, 70, .25); }
.btn-mint { background: linear-gradient(180deg, #DDF6E6, #A8DDBB); box-shadow: 0 5px 0 var(--mint-d), 0 9px 14px rgba(41, 39, 70, .25); }
.btn-lav { background: linear-gradient(180deg, #E6DEFF, #B9A7F5); box-shadow: 0 5px 0 var(--lav-d), 0 9px 14px rgba(41, 39, 70, .25); }
.btn-danger { background: linear-gradient(180deg, #FFD3CD, #FF9D91); box-shadow: 0 5px 0 var(--coral-d), 0 9px 14px rgba(41, 39, 70, .25); }
.btn-lg { min-height: 56px; font-size: 1.12rem; width: 100%; }
.btn-small { min-height: 46px; padding: 6px 16px; font-size: .95rem; }
.btn-icon { padding: 4px; width: 46px; height: 46px; border-radius: 14px; }
.btn-quiet { background: transparent; border-color: transparent; box-shadow: none; } .btn-quiet::before { display: none; }

/* ---------- Cards, chips, bars ---------- */
.panel { position: relative; background: linear-gradient(180deg, #FFFFFF 0%, var(--paper) 100%); border: 3px solid #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); outline: 3px solid rgba(185, 167, 245, .55); outline-offset: -9px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 14px; border-radius: 999px; min-height: 38px; font-weight: 700; background: linear-gradient(180deg, #fff, #F1EAFF); border: 2px solid var(--lavender); box-shadow: 0 3px 0 rgba(141, 121, 217, .35); }
.badge { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #E9E0FF; border: 2px solid var(--lavender); }
.hint-badge { background: var(--butter); border-color: var(--butter-d); }
.notice { border-left: 6px solid var(--coral); background: #FFEFE9; padding: 8px 12px; border-radius: 10px; }
.bar { display: block; height: 10px; border-radius: 99px; background: rgba(41, 39, 70, .12); overflow: hidden; box-shadow: inset 0 2px 3px rgba(41, 39, 70, .2); }
.bar.wide { height: 14px; margin: 8px 0; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--coral), var(--butter), var(--mint), var(--sky), var(--lavender)); background-size: 200% 100%; transition: width .6s; animation: slide 6s linear infinite; }
@keyframes slide { to { background-position: 200% 0; } }
.status { min-height: 1.6em; text-align: center; font-weight: 700; margin-top: 10px; } .status.big { font-size: 1.12rem; }
.hud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 6px 0 12px; }
.pips { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pip { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 3px solid var(--lavender); background: #fff; }
.pip.done { background: linear-gradient(180deg, #DDF6E6, var(--mint)); border-color: var(--mint-d); box-shadow: inset 0 0 0 3px #fff; }
.pip.now { background: linear-gradient(180deg, #FFF3C4, var(--butter)); border-color: var(--butter-d); box-shadow: 0 0 0 4px rgba(255, 217, 120, .5); }
.puzzle-title { text-align: center; margin-bottom: 10px; }
ol.clues { padding-left: 1.4em; margin: 0 0 10px; } ol.clues li { margin-bottom: 6px; } ol.clues li::marker { color: var(--berry); font-weight: 700; }
.legend { text-align: center; margin: 8px 0 0; }
.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.gem { display: inline-block; width: 13px; height: 13px; margin-right: 7px; vertical-align: -1px; background: linear-gradient(135deg, #FFF3C4, var(--butter-d)); transform: rotate(45deg); border-radius: 3px; box-shadow: 0 0 10px var(--butter); }
.gem.key { background: linear-gradient(135deg, #D3EEFF, var(--sky-d)); box-shadow: 0 0 10px var(--sky); } .gem.trophy { background: linear-gradient(135deg, #E6DEFF, var(--berry)); box-shadow: 0 0 10px var(--lavender); }
.gem.dim { background: transparent; border: 2px solid var(--lavender); box-shadow: none; }
.ico { display: inline-grid; place-items: center; width: 22px; height: 22px; } .ico .chev { width: 100%; height: 100%; display: block; }

/* ---------- Title ---------- */
.screen-title, .screen-ending { max-width: none; padding: 0; min-height: 100vh; min-height: 100dvh; display: grid; position: relative; overflow: hidden; background: linear-gradient(180deg, #7C69D8 0%, #B9A7F5 26%, #FFB5C2 58%, #FFD9A0 82%, #FFE9B8 100%); }
.screen-ending { background: linear-gradient(180deg, #8d79d9 0%, #C7B5FF 28%, #FFC0C8 60%, #FFE6A8 100%); }
.title-bg { position: absolute; inset: 0; overflow: hidden; }
.title-bg > span, .title-bg svg { width: 100%; height: 100%; display: block; position: absolute; inset: 0; }
.tl { transition: transform .2s ease-out; }
.tl0 { transform: translate(calc(var(--px) * -6px), calc(var(--py) * -3px)); } .tl1 { transform: translate(calc(var(--px) * -12px), calc(var(--py) * -4px)); }
.tl2 { transform: translate(calc(var(--px) * -4px), calc(var(--py) * -2px)); } .tl3 { transform: translate(calc(var(--px) * 12px), calc(var(--py) * 3px)); }
.title-content { position: relative; z-index: 2; align-self: start; width: min(460px, 92vw); margin: 0 auto; padding: 5vh 0 40px; text-align: center; }
.title-logo { display: flex; justify-content: center; align-items: baseline; gap: .22em; flex-wrap: wrap; font-size: clamp(2.7rem, 13vw, 4.2rem); line-height: 1; letter-spacing: .06em; margin: 0 0 .1em; }
.t-hex, .t-hollow, .t-amp { text-shadow: 0 2px 0 #fff, 0 4px 0 var(--indigo), 0 6px 0 var(--indigo), 0 8px 0 rgba(41, 39, 70, .8), 0 14px 22px rgba(41, 39, 70, .4); }
.t-hex { color: var(--butter); } .t-hollow { color: #fff; } .t-amp { color: var(--coral); font-style: italic; }
.title-logo.small { display: block; font-size: clamp(1.9rem, 8vw, 2.9rem); letter-spacing: .02em; color: #fff; text-shadow: 0 2px 0 var(--indigo), 0 4px 0 var(--indigo), 0 6px 0 var(--indigo), 0 12px 20px rgba(41, 39, 70, .4); }
.tagline { display: inline-block; margin: 10px auto 4px; padding: 6px 16px; border-radius: 16px; background: rgba(255, 250, 240, .92); color: var(--indigo); font-size: .98rem; font-style: italic; box-shadow: 0 4px 0 rgba(141, 121, 217, .45); }
.eyebrow { text-transform: uppercase; letter-spacing: .25em; font-size: .8rem; font-weight: 700; color: var(--indigo); background: var(--butter); display: inline-block; padding: 2px 14px; border-radius: 99px; }
.title-menu { display: grid; gap: 14px; margin-top: 20px; }
.stars-far path { animation: twinkle 3.6s infinite var(--d); transform-box: fill-box; transform-origin: center; }
.moon { animation: bob 8s ease-in-out infinite alternate; } .cloud { animation: drift-x 26s ease-in-out infinite alternate; } .cloud.c2 { animation-duration: 34s; animation-direction: alternate-reverse; }
.lantern { animation: sway 5s ease-in-out infinite alternate; animation-delay: var(--d); transform-box: fill-box; transform-origin: 50% 0; } .firefly { animation: twinkle 2.4s infinite var(--d); }
.mframe { fill: #3a9a92; } .mwin { fill: var(--butter); filter: drop-shadow(0 0 5px rgba(255, 217, 120, .95)); animation: flicker 5s infinite var(--d); }
.all-lit .mwin { fill: #FFF3C4; animation: lightup 1.2s both; animation-delay: calc(var(--d) * .7s); filter: drop-shadow(0 0 10px #fff3c4); }
@keyframes flicker { 0%, 100% { opacity: .95; } 47% { opacity: .95; } 50% { opacity: .7; } 53% { opacity: 1; } }
@keyframes lightup { from { opacity: .3; } to { opacity: 1; } } @keyframes twinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes bob { to { transform: translateY(8px); } } @keyframes drift-x { to { transform: translateX(46px); } } @keyframes sway { to { transform: rotate(7deg); } }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .title-content, .screen-ending .title-content { margin-left: 7vw; align-self: center; }
  .title-bg svg { width: 72%; left: auto; right: 0; }
}

/* ---------- Map ---------- */
.screen-map { padding-top: 12px; }
.map-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; margin-bottom: 10px; }
.map-title { margin: 0; font-size: clamp(1.9rem, 6vw, 2.7rem); color: var(--indigo); text-shadow: 0 2px 0 #fff, 0 4px 0 var(--lavender), 0 8px 14px rgba(141, 121, 217, .4); }
.meter-wrap { flex: 1 1 240px; max-width: 420px; }
.meter-label { display: flex; justify-content: space-between; font-weight: 700; }
.meter { height: 20px; border-radius: 99px; background: #fff; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--lavender), inset 0 3px 5px rgba(41, 39, 70, .2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--coral), var(--butter), var(--mint), var(--sky), var(--lavender)); background-size: 200% 100%; animation: slide 6s linear infinite; box-shadow: 0 0 14px rgba(255, 217, 120, .9); transition: width 1s; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.stat { text-align: center; padding: 8px 4px; border-radius: 16px; background: #fff; border: 3px solid #fff; box-shadow: 0 5px 0 var(--sc, var(--lavender)), 0 10px 16px rgba(41, 39, 70, .15); }
.stat:nth-child(1) { --sc: var(--butter-d); background: linear-gradient(180deg, #fff, #FFF3C4); } .stat:nth-child(2) { --sc: var(--coral-d); background: linear-gradient(180deg, #fff, #FFE3DE); }
.stat:nth-child(3) { --sc: var(--mint-d); background: linear-gradient(180deg, #fff, #DDF6E6); } .stat:nth-child(4) { --sc: var(--lav-d); background: linear-gradient(180deg, #fff, #E9E0FF); }
.stat-value { display: block; font-size: 1.3rem; font-weight: 700; } .stat-label { display: block; font-size: .74rem; color: var(--ink-soft); }
.roof-wrap { display: block; max-width: 540px; margin: 0 auto -6px; position: relative; z-index: 2; filter: drop-shadow(0 6px 6px rgba(41, 39, 70, .25)); }
.map-roof { display: block; width: 100%; height: auto; overflow: visible; }
.roof-window { fill: #FFF3C4; opacity: calc(.35 + var(--glow) * .65); filter: drop-shadow(0 0 calc(var(--glow) * 9px) var(--butter)); stroke: #e8b84a; stroke-width: 2; } .roof-mullion { stroke: #3a9a92; stroke-width: 2.4; }
.smoke { fill: #fff; opacity: calc(.4 + var(--glow) * .5); animation: smoke 5s ease-in infinite; } .smoke.s2 { animation-delay: 2s; }
@keyframes smoke { from { transform: translateY(6px) scale(.7); opacity: 0; } 50% { opacity: .85; } to { transform: translateY(-14px) scale(1.4); opacity: 0; } }
.facade-stage { perspective: 1100px; }
.mansion-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 780px; margin: 0 auto;
  grid-template-areas: 'heart heart heart' 'mirror potion library' 'garden entrance clock';
  padding: 14px; border-radius: 26px; border: 4px solid #fff; background: linear-gradient(180deg, #FFF4DF, #FFE3D2); box-shadow: 0 8px 0 #FF9D91, 0 16px 0 rgba(255, 157, 145, .35), 0 30px 40px rgba(41, 39, 70, .28);
  transform-style: preserve-3d; transform: rotateX(calc(4deg + var(--py) * -3deg)) rotateY(calc(var(--px) * 4deg)); transition: transform .25s ease-out;
}
.room-heart { grid-area: heart; } .room-mirror { grid-area: mirror; } .room-potion { grid-area: potion; } .room-library { grid-area: library; }
.room-garden { grid-area: garden; } .room-entrance { grid-area: entrance; } .room-clock { grid-area: clock; }
.room-card {
  --rc: var(--lavender); --rcd: var(--lav-d);
  position: relative; display: flex; flex-direction: column; padding: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer; overflow: hidden; background: #fff;
  border: 4px solid var(--rc); border-radius: 18px; min-height: 46px; box-shadow: 0 6px 0 var(--rcd), 0 12px 18px rgba(41, 39, 70, .22); transform: translateZ(14px); transition: transform .2s, box-shadow .2s;
}
.room-entrance { --rc: var(--coral); --rcd: var(--coral-d); } .room-clock { --rc: var(--sky); --rcd: var(--sky-d); } .room-library { --rc: var(--berry); --rcd: var(--berry-d); }
.room-potion { --rc: var(--mint); --rcd: var(--mint-d); } .room-mirror { --rc: var(--teal); --rcd: var(--teal-d); } .room-garden { --rc: #8fd49a; --rcd: #4fa36a; }
.room-heart { --rc: var(--pink); --rcd: var(--berry-d); border-image: none; }
.room-card:hover { transform: translateZ(34px) translateY(-4px); box-shadow: 0 10px 0 var(--rcd), 0 22px 26px rgba(41, 39, 70, .3); }
.room-card:active { transform: translateZ(10px) translateY(2px); }
.room-card.restored { box-shadow: 0 6px 0 var(--rcd), 0 12px 18px rgba(41, 39, 70, .22), 0 0 26px rgba(255, 217, 120, .75); }
.room-card.next { animation: nextpulse 2.4s ease-in-out infinite; }
.room-card.locked { cursor: not-allowed; border-style: dashed; --rc: #cfc5ee; --rcd: #a99fd0; }
.room-card.just-unlocked { animation: unlockflash 2s ease-out 2; }
@keyframes nextpulse { 50% { box-shadow: 0 6px 0 var(--rcd), 0 12px 18px rgba(41, 39, 70, .22), 0 0 0 7px rgba(255, 217, 120, .85); } }
@keyframes unlockflash { 0% { transform: translateZ(14px) scale(.94); } 40% { transform: translateZ(40px) scale(1.06); box-shadow: 0 0 40px 10px rgba(255, 217, 120, .95); } 100% { transform: translateZ(14px); } }
.room-num { position: absolute; z-index: 4; left: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--ink); border: 3px solid var(--rc); display: grid; place-items: center; font-size: .82rem; font-weight: 700; }
.room-icon { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 2px 0 rgba(41, 39, 70, .2)); }
.scene-wrap { position: relative; aspect-ratio: 240 / 150; overflow: hidden; background: #E9E0FF;
  --wall: #FFB5AA; --floor: #FFE3B8; --wood: #c98b5b; --wood2: #9c6240; }
.room-heart .scene-wrap { aspect-ratio: 240 / 84; }
.lock-veil { position: absolute; inset: 0 0 auto 0; aspect-ratio: 240 / 150; z-index: 3; display: grid; place-items: center; background: rgba(233, 224, 255, .4); backdrop-filter: blur(1px); color: var(--lav-d); }
.room-heart .lock-veil { aspect-ratio: 240 / 84; }
.lock-ico .glyph { width: 44px; height: 44px; filter: drop-shadow(0 3px 0 #fff); }
.room-info { padding: 6px 9px 9px; display: grid; gap: 3px; background: linear-gradient(180deg, #fff, var(--paper)); }
.room-title-row { display: flex; align-items: center; gap: 6px; }
.room-name { font-weight: 700; font-size: .95rem; line-height: 1.12; } .room-status { font-size: .76rem; line-height: 1.2; min-height: 1.8em; color: var(--ink-soft); font-weight: 700; }
.room-card.restored .room-status { color: var(--teal-d); } .room-card.next .room-status { color: var(--coral-d); }
.room-pct { font-size: .76rem; font-weight: 700; color: var(--ink-soft); }
.room-stars { display: flex; gap: 2px; } .star-wrap { display: inline-block; color: var(--butter-d); } .star { width: 18px; height: 18px; display: block; }
.map-nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 22px; }

/* ---------- Room scenes (SVG art) ---------- */
.scene { display: block; width: 100%; height: 100%; filter: saturate(.5) contrast(.94) brightness(1.03) sepia(.1); transition: filter 1.8s; }
.restored .scene { filter: saturate(1.12) contrast(1.03); }
.layer { transition: transform .2s ease-out; }
.lb { transform: translate(calc(var(--px) * -3px), calc(var(--py) * -2px)); } .lm { transform: translate(calc(var(--px) * 2px), calc(var(--py) * 1px)); } .lf { transform: translate(calc(var(--px) * 7px), calc(var(--py) * 4px)); }
.scene-entrance { --wall: #FFB5AA; --floor: #7FD8CF; } .scene-clock { --wall: #A9D8F8; --floor: #CDBFF8; } .scene-library { --wall: #B67AD0; --floor: #E8B77E; }
.scene-potion { --wall: #BDEACB; --floor: #FFD3CB; } .scene-mirror { --wall: #8FE0DA; --floor: #D9D2FA; } .scene-garden { --floor: #7FCB8F; } .scene-heart { --wall: #C9B8FF; --floor: #F5C6E8; }
.scene .wall { fill: var(--wall); } .scene .floor { fill: var(--floor); } .scene .grass { fill: #7FCB8F; } .restored .scene .grass { fill: #5DB87A; }
.haze { fill: #FFF4DF; opacity: .26; transition: opacity 1.8s; } .restored .haze { opacity: 0; }
.p-lav { fill: var(--lavender); } .p-lav-d { fill: var(--lav-d); } .p-teal { fill: var(--teal); } .p-teal-d { fill: var(--teal-d); } .p-coral { fill: var(--coral); } .p-coral-d { fill: var(--coral-d); }
.p-butter { fill: var(--butter); } .p-butter-d { fill: var(--butter-d); } .p-mint { fill: var(--mint); } .p-mint-d { fill: var(--mint-d); } .p-sky { fill: var(--sky); } .p-sky-d { fill: var(--sky-d); }
.p-berry { fill: var(--berry); } .p-berry-d { fill: var(--berry-d); } .p-pink { fill: var(--pink); } .p-cream { fill: var(--cream); } .p-indigo { fill: var(--indigo); } .p-silver { fill: #DDE4F2; }
.p-wood { fill: #c98b5b; } .p-wood-d { fill: #9c6240; }
.k-lav { stroke: var(--lavender); } .k-lav-d { stroke: var(--lav-d); } .k-teal { stroke: var(--teal); } .k-teal-d { stroke: var(--teal-d); } .k-coral { stroke: var(--coral); } .k-coral-d { stroke: var(--coral-d); }
.k-butter { stroke: var(--butter); } .k-butter-d { stroke: var(--butter-d); } .k-mint { stroke: var(--mint); } .k-mint-d { stroke: var(--mint-d); } .k-sky { stroke: var(--sky); } .k-berry { stroke: var(--berry); } .k-berry-d { stroke: var(--berry-d); }
.k-cream { stroke: var(--cream); } .k-indigo { stroke: var(--indigo); } .k-silver { stroke: #c9d3e6; } .k-wood-d { stroke: #9c6240; } .ln { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.flame { animation: flick 1.2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
.mirror-glass { fill: #cfe6ee; } .restored .mirror-glass { fill: #fff; }
.brew { fill: #7fe3d6; } .restored .brew { filter: drop-shadow(0 0 5px #7fe3d6); } .bubbles circle { fill: #e9fff9; animation: bubble 2s ease-in infinite; } .bubbles circle:nth-child(2) { animation-delay: .6s; } .bubbles circle:nth-child(3) { animation-delay: 1.2s; } .bubbles.big circle { fill: #fff; opacity: .8; }
.fountain-water { fill: #8fd8ff; } .fl { stroke: #fff; stroke-width: .8; } .fl0 { fill: var(--pink); } .fl1 { fill: var(--lavender); } .fl2 { fill: var(--butter); } .fl3 { fill: var(--sky); }
.rune-ring { stroke: url(#rainbow); } .restored .rune-ring { animation: runeglow 3s ease-in-out infinite alternate; }
.broken, .fixed { transition: opacity 1.3s; } .fixed { opacity: 0; } .restored .broken { opacity: 0; } .restored .fixed { opacity: 1; }
.warm { opacity: 0; transition: opacity 1.8s; mix-blend-mode: soft-light; } .restored .warm { opacity: .7; } .scene-heart .warm { display: none; }
.beam { opacity: .25; transition: opacity 1.8s; } .restored .beam { opacity: .85; }
.dust { opacity: .9; transition: opacity 1.4s; } .dust circle { fill: #fff; opacity: .6; animation: drift 7s ease-in-out infinite alternate; animation-delay: var(--d); } .restored .dust { opacity: 0; }
.sparkle { opacity: 0; transition: opacity 1.6s .4s; } .restored .sparkle { opacity: 1; } .spk { animation: twinkle 2.2s ease-in-out infinite; animation-delay: var(--d); transform-box: fill-box; transform-origin: center; }
.hand-min { transform-origin: 0 0; animation: spin 12s linear infinite; } .hand-hour { transform-origin: 0 0; animation: spin 144s linear infinite; }
.pendulum { transform-origin: 120px 94px; animation: swing 2.2s ease-in-out infinite alternate; }
.gearspin { animation: spin 10s linear infinite; } .gearspin.rev { animation-direction: reverse; } .restored .broken .gearspin { animation: none; }
.floatbook { animation: float 4s ease-in-out infinite alternate; } .floatbook.slow { animation-duration: 6s; } .floatbook.fast { animation-duration: 2.6s; }
.crystal-bob { animation: float 3.4s ease-in-out infinite alternate; }
.flutter { animation: flutter 3s ease-in-out infinite alternate; } .flutter.slow { animation-duration: 4.4s; }
.bloom { transform-origin: 50% 100%; transform-box: fill-box; animation: bloomin 1.4s backwards; animation-delay: var(--d); }
.heartbeat { transform-origin: 120px 58px; animation: beat 1.8s ease-in-out infinite; } .pulse { animation: beat 1.8s ease-in-out infinite; transform-origin: 120px 58px; }
.orbit { transform-origin: 120px 58px; animation: spin 24s linear infinite; } .rays { transform-origin: 120px 64px; animation: spin 60s linear infinite; }
.restoring::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .95), rgba(255, 217, 120, .5) 40%, transparent 72%); animation: flash 2.2s ease-out forwards; }
.burst { position: absolute; z-index: 6; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px; border-radius: 50%; pointer-events: none; border: 6px solid var(--butter); box-shadow: 0 0 0 6px var(--coral), 0 0 0 12px var(--sky), 0 0 0 18px var(--lavender); animation: burst 1.6s ease-out forwards; }
@keyframes burst { to { transform: scale(30); opacity: 0; } }
.banner { border: 4px solid #fff; border-radius: var(--radius); margin: 10px 0; aspect-ratio: 240 / 112; max-height: 300px; box-shadow: var(--shadow); width: 100%; transform: perspective(1000px) rotateX(calc(var(--py) * -2.5deg)) rotateY(calc(var(--px) * 3.5deg)); transition: transform .25s ease-out; }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes swing { from { transform: rotate(-14deg); } to { transform: rotate(14deg); } }
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(8px, 14px); } } @keyframes float { to { transform: translateY(-6px); } }
@keyframes flick { to { transform: scale(1.08, 1.14); } } @keyframes bubble { 0% { transform: translateY(6px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(-16px); opacity: 0; } }
@keyframes bloomin { from { transform: scale(0); opacity: 0; } 60% { transform: scale(1.3); } to { transform: scale(1); opacity: 1; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.09); } 30% { transform: scale(1); } 45% { transform: scale(1.05); } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } } @keyframes runeglow { to { opacity: .55; } } @keyframes flutter { from { transform: translate(0, 0) rotate(-6deg); } to { transform: translate(18px, -10px) rotate(8deg); } }
.confetti-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 60; }
.confetti { position: absolute; top: -12px; width: 10px; height: 16px; border-radius: 3px; background: var(--c); left: var(--x); animation: confetti 2.8s ease-in var(--d) forwards; opacity: 0; }
@keyframes confetti { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 1; transform: translateY(105vh) translateX(var(--dx)) rotate(var(--r)); } }

/* ---------- Room screen ---------- */
.room-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.room-titles h1 { margin: 0; text-shadow: 0 2px 0 #fff; } .room-titles p { margin: 0; } .pct { font-size: .86rem; font-weight: 700; color: var(--teal-d); }
.instructions { margin: 8px 0; padding: 10px 16px; } .instructions p { margin: 0; }
.hint-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0; }
.hint-text { flex: 1 1 100%; margin: 0; padding: 8px 14px; border-radius: 14px; background: #fff; border: 3px solid var(--butter); font-weight: 700; } .hint-text:empty { display: none; }
.puzzle { margin-top: 8px; }

/* Matching: thick 3D tiles */
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 470px; margin: 12px auto; perspective: 900px; }
.tile { aspect-ratio: 1; min-height: 66px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; transform-style: preserve-3d; -webkit-tap-highlight-color: transparent; }
.tile-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, 1.4, .5, 1); }
.tile:hover:not(.up) .tile-inner { transform: translateZ(10px) rotateX(8deg); } .tile.up .tile-inner { transform: rotateY(180deg); }
.tile-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 4px solid #fff; }
.tile-back { background: radial-gradient(circle at 30% 25%, #E9E0FF, var(--lavender) 55%, var(--lav-d)); box-shadow: 0 7px 0 var(--lav-d), 0 12px 14px rgba(41, 39, 70, .28), inset 0 0 0 3px rgba(255, 255, 255, .35); }
.tile-back::after { content: ''; position: absolute; inset: 12%; border-radius: 12px; border: 3px dashed rgba(255, 255, 255, .7); }
.tile-back .gem { width: 24px; height: 24px; margin: 0; z-index: 1; }
.tile-front { transform: rotateY(180deg); background: radial-gradient(circle at 30% 25%, #fff, var(--tc, #FFF3C4)); box-shadow: 0 7px 0 var(--tcd, var(--butter-d)), 0 12px 14px rgba(41, 39, 70, .28); color: var(--tcd, var(--butter-d)); }
.tile-glyph { display: grid; place-items: center; width: 100%; height: 100%; } .tile-glyph .glyph { width: 66%; height: auto; max-width: 58px; display: block; margin: auto; filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .9)); }
.tile.sym-moon { --tc: #CBE9FF; --tcd: #3f86bd; } .tile.sym-key { --tc: #FFE9A6; --tcd: #b8860b; } .tile.sym-star { --tc: #DCD0FF; --tcd: #6c52c9; }
.tile.sym-eye { --tc: #B6F0E9; --tcd: #1f7f78; } .tile.sym-flame { --tc: #FFD0C8; --tcd: #c9473a; } .tile.sym-leaf { --tc: #CDEFD8; --tcd: #2f8a55; }
.tile.matched .tile-front { border-color: #fff; box-shadow: 0 7px 0 var(--tcd), 0 0 22px 4px rgba(255, 217, 120, .9); }
.tile-check { position: absolute; right: 6px; top: 5px; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #2f8a55; display: none; padding: 2px; } .tile.matched .tile-check { display: block; }
.tile.hinted .tile-back { outline: 4px dashed var(--indigo); outline-offset: -8px; animation: nextpulse 1.2s infinite; }

/* Clock */
.clock-layout { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: center; } @media (min-width: 720px) { .clock-layout { grid-template-columns: 1fr 1fr; } }
.dial-wrap { display: grid; place-items: center; perspective: 800px; }
.dial { position: relative; width: min(100%, 330px); aspect-ratio: 1; border-radius: 50%; border: 10px solid var(--butter); background: radial-gradient(circle, #fff 0%, #E3F3FF 70%, var(--sky) 100%); box-shadow: 0 0 0 4px var(--butter-d), 0 12px 0 var(--butter-d), 0 22px 30px rgba(41, 39, 70, .3), inset 0 0 30px rgba(145, 207, 245, .8); transform: rotateX(calc(var(--py) * -5deg)) rotateY(calc(var(--px) * 6deg)); transition: transform .25s ease-out; }
.dial-btn { position: absolute; transform: translate(-50%, -50%); width: 50px; height: 50px; border-radius: 50%; border: 3px solid #fff; background: linear-gradient(180deg, #E6DEFF, var(--lavender)); color: var(--ink); font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; display: grid; place-items: center; z-index: 2; padding: 0; box-shadow: 0 4px 0 var(--lav-d), 0 8px 10px rgba(41, 39, 70, .22); }
.dial-btn:nth-child(3n+1) { background: linear-gradient(180deg, #FFE3DE, var(--coral)); box-shadow: 0 4px 0 var(--coral-d), 0 8px 10px rgba(41, 39, 70, .22); }
.dial-btn:nth-child(3n+2) { background: linear-gradient(180deg, #DDF6E6, var(--mint)); box-shadow: 0 4px 0 var(--mint-d), 0 8px 10px rgba(41, 39, 70, .22); }
.dial-btn .order { position: absolute; right: -5px; top: -7px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--indigo); color: #fff; font-size: .78rem; line-height: 22px; text-align: center; } .dial-btn .order:empty { display: none; }
.dial-btn.chosen { background: linear-gradient(180deg, #FFF3C4, var(--butter)); box-shadow: 0 0 0 4px var(--indigo), 0 0 20px 4px rgba(255, 217, 120, .95); transform: translate(-50%, -50%) scale(1.12); }
.dial-btn.muted-hour { opacity: .4; border-style: dashed; filter: grayscale(.6); }
.dial-hands .dh { position: absolute; left: 50%; bottom: 50%; transform-origin: 50% 100%; border-radius: 4px; }
.dh-min { width: 5px; height: 30%; background: var(--berry); margin-left: -2px; } .dh-hr { width: 7px; height: 21%; background: var(--indigo); margin-left: -3px; }
.dh-pin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: var(--coral); border: 3px solid #fff; box-shadow: 0 2px 0 var(--coral-d); }
.dial.running .dh-min { animation: spin 2.2s linear infinite; } .dial.running .dh-hr { animation: spin 26s linear infinite; }
.slots { display: flex; justify-content: center; gap: 12px; list-style: none; padding: 0; margin: 16px 0; }
.slot { width: 58px; height: 66px; border: 3px dashed var(--lavender); border-radius: 16px; display: grid; place-items: center; position: relative; background: #fff; }
.slot.filled { border-style: solid; border-color: var(--butter-d); background: linear-gradient(180deg, #fff, #FFF3C4); box-shadow: 0 4px 0 var(--butter-d); } .slot-n { position: absolute; left: 6px; top: 2px; font-size: .72rem; color: var(--ink-soft); font-weight: 700; } .slot-v { font-size: 1.6rem; font-weight: 700; }

/* Memory: colourful books */
.shelf { display: flex; justify-content: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; padding: 18px 10px 10px; border-radius: 18px; background: linear-gradient(180deg, #F0E6FF, #E0D2FF); border-bottom: 12px solid #c98b5b; box-shadow: 0 6px 0 #9c6240, inset 0 -6px 0 rgba(255, 255, 255, .35); perspective: 700px; }
.book { --bc: var(--lavender); --bcd: var(--lav-d); position: relative; width: 70px; min-height: 108px; padding: 6px 4px; border-radius: 10px 10px 4px 4px; border: 3px solid #fff; background: linear-gradient(180deg, #fff, var(--bc)); color: var(--bcd); cursor: pointer; font: inherit; display: grid; gap: 2px; place-items: center; box-shadow: 0 6px 0 var(--bcd), 0 10px 12px rgba(41, 39, 70, .25); transition: transform .18s, box-shadow .2s; }
.book[aria-disabled='true'] { cursor: default; } .book:hover:not([aria-disabled='true']) { transform: translateY(-4px) rotateX(-8deg); }
.book-art .glyph { width: 44px; height: 44px; display: block; } .book-name { font-size: .7rem; line-height: 1.1; text-align: center; color: var(--ink); font-weight: 700; }
.book-ember { --bc: #FFD0C8; --bcd: #c9473a; } .book-tide { --bc: #C0E8FF; --bcd: #2f7fb3; } .book-leaf { --bc: #CDEFD8; --bcd: #2f8a55; } .book-star { --bc: #FFE9A6; --bcd: #a97a00; } .book-dusk { --bc: #DCD0FF; --bcd: #6c52c9; }
.book.lit { transform: translateY(-14px) scale(1.1) rotate(-2deg); border-color: var(--indigo); box-shadow: 0 0 0 4px var(--butter), 0 0 30px 8px var(--butter), 0 10px 0 var(--bcd); z-index: 2; }

/* Potion */
.potion-layout { display: grid; gap: 16px; grid-template-columns: 1fr; } @media (min-width: 720px) { .potion-layout { grid-template-columns: 1fr 1fr; } }
.ingredients { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.ingredient { display: grid; grid-template-columns: 36px 1fr; gap: 6px; align-items: center; text-align: left; min-height: 52px; padding: 4px 10px; font: inherit; font-size: .86rem; font-weight: 700; color: var(--ink); background: linear-gradient(180deg, #fff, #F4EDFF); border: 3px solid #fff; border-radius: 16px; cursor: pointer; box-shadow: 0 4px 0 var(--lav-d), 0 8px 10px rgba(41, 39, 70, .18); }
.ingredient.used { opacity: .5; border-style: dashed; border-color: var(--lavender); box-shadow: none; } .ingredient.hinted { box-shadow: 0 0 0 4px var(--butter), 0 0 18px var(--butter); }
.ing-art .glyph { width: 32px; height: 32px; display: block; } .ing-art.sm .glyph { width: 30px; height: 30px; }
.ing-moonflower { color: #8d79d9; } .ing-crystal_dust { color: #3f86bd; } .ing-star_petals { color: #b8860b; } .ing-shadow_berries { color: #7a3fa0; } .ing-embers { color: #c9473a; } .ing-moonwater { color: #2f7fb3; } .ing-lavender_mist { color: #6c52c9; }
.cauldron { list-style: none; padding: 12px; margin: 6px 0 12px; display: grid; gap: 8px; border: 4px solid #fff; border-radius: 20px; background: radial-gradient(ellipse at 50% 0, #E3D6FF, #C9B8FF); box-shadow: 0 6px 0 var(--berry), 0 12px 16px rgba(41, 39, 70, .25), inset 0 0 18px rgba(122, 63, 160, .25); }
.cauldron.glow { box-shadow: 0 6px 0 var(--berry), 0 0 36px 8px rgba(127, 227, 214, .9); }
.cslot { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 14px; border: 3px dashed rgba(122, 63, 160, .45); min-height: 54px; flex-wrap: wrap; background: rgba(255, 255, 255, .45); }
.cslot.filled { border-style: solid; border-color: #fff; background: #fff; box-shadow: 0 3px 0 rgba(122, 63, 160, .3); }
.cslot.exact { border-color: var(--mint-d); background: #EAF9EF; } .cslot.present { border-color: var(--butter-d); background: #FFF6D6; } .cslot.absent { border-color: var(--coral-d); background: #FFEAE6; }
.cnum { width: 26px; height: 26px; border-radius: 50%; background: var(--butter); border: 2px solid var(--butter-d); display: grid; place-items: center; font-size: .82rem; font-weight: 700; flex: none; }
.cname { flex: 1; min-width: 90px; font-weight: 700; } .fb { font-weight: 700; } .fb small { font-weight: 400; } .cbtns { display: flex; gap: 6px; margin-left: auto; }
.fbtag { display: inline-block; padding: 0 8px; border-radius: 8px; font-size: .76rem; border: 2px solid currentColor; background: #fff; }
.fbtag.exact { color: #2f8a55; } .fbtag.present { color: #8a6500; } .fbtag.absent { color: #c13a2c; }

/* Mirrors */
.mirror-board { position: relative; width: min(100%, 470px); margin: 12px auto; border: 6px solid #fff; border-radius: 20px; overflow: hidden; background: linear-gradient(135deg, #C9F1EE, #E3D6FF); box-shadow: 0 8px 0 var(--teal-d), 0 16px 22px rgba(41, 39, 70, .3); transform: perspective(900px) rotateX(calc(4deg + var(--py) * -2deg)) rotateY(calc(var(--px) * 3deg)); transition: transform .25s ease-out; }
.mirror-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); }
.cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid rgba(141, 121, 217, .25); padding: 0; background: transparent; font: inherit; color: var(--lav-d); }
.cell:nth-child(odd) { background: rgba(255, 255, 255, .25); }
.cell-art { display: block; width: 80%; height: 80%; } .cell-art .glyph, .cell-art svg { width: 100%; height: 100%; display: block; }
.cell.mirror { cursor: pointer; background: linear-gradient(135deg, #fff, #E6DEFF); border: 3px solid #fff; border-radius: 12px; margin: 3px; aspect-ratio: auto; box-shadow: 0 4px 0 var(--lav-d), 0 7px 8px rgba(41, 39, 70, .2); }
.cell.mirror:hover { transform: translateY(-2px); } .cell.mirror.hinted { box-shadow: 0 0 0 4px var(--butter), 0 0 18px var(--butter); background: #FFF3C4; }
.mirror-line { stroke: var(--sky-d); stroke-width: 6; stroke-linecap: round; } .mirror-dot { fill: var(--coral); }
.cell.target { color: #8d79d9; } .cell.target.lit { background: radial-gradient(circle, rgba(255, 217, 120, .95), transparent 72%); animation: beat 1.2s infinite; }
.cell-tag { position: absolute; right: 3px; top: 3px; width: 16px; height: 16px; color: var(--indigo); } .cell-tag .ico { width: 16px; height: 16px; }
.beam-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.beam-line { fill: none; stroke: #fff; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; opacity: .95; filter: drop-shadow(0 0 7px var(--butter)) drop-shadow(0 0 3px var(--coral)); }
.beam-line.hit { stroke: #FFF3C4; filter: drop-shadow(0 0 12px var(--coral)) drop-shadow(0 0 6px var(--butter)); }

/* Garden */
.garden-grid { position: relative; display: grid; grid-template-columns: repeat(var(--cols), 1fr); width: min(100%, 450px); margin: 12px auto; border: 6px solid #fff; border-radius: 20px; overflow: hidden; background: #8fd49a; touch-action: none; box-shadow: 0 8px 0 #4fa36a, 0 16px 22px rgba(41, 39, 70, .3); transform: perspective(900px) rotateX(calc(4deg + var(--py) * -2deg)) rotateY(calc(var(--px) * 3deg)); transition: transform .25s ease-out; }
.g-cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: #9BDDA6; border: 1px solid rgba(255, 255, 255, .25); }
.g-cell:nth-child(2n) { background: #8fd49a; } .g-cell.bramble { background: #D5C6F7; } .g-cell.trail { background: #FFF1B8; } .g-cell.hinted { background: #FFD3E4; }
.g-art { display: block; width: 88%; height: 88%; } .g-art .glyph { width: 100%; height: 100%; display: block; }
.flower { filter: drop-shadow(0 0 6px var(--butter)); animation: float 2.4s ease-in-out infinite alternate; }
.petal { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--pink); border: 2px solid #fff; box-shadow: 0 0 10px var(--pink); opacity: 0; } .g-cell.hinted .petal { opacity: 1; animation: nextpulse 1.2s infinite; }
.player { position: absolute; left: calc(var(--x, 0) * 100% / var(--cols)); top: calc(var(--y, 0) * 100% / var(--cols)); width: calc(100% / var(--cols)); aspect-ratio: 1; display: grid; place-items: center; transition: left .14s, top .14s; pointer-events: none; filter: drop-shadow(0 4px 0 rgba(41, 39, 70, .25)); z-index: 2; }
.garden-grid.celebrate .g-cell.trail { animation: bloomglow 1.2s ease-out; } @keyframes bloomglow { 50% { background: #FF9EC4; } }
.dpad { display: grid; grid-template-columns: repeat(3, 62px); grid-template-areas: '. up .' 'left down right'; gap: 10px; justify-content: center; margin: 14px auto; }
.dpad-btn { width: 62px; height: 62px; padding: 0; border-radius: 18px; } .dp-up { grid-area: up; } .dp-left { grid-area: left; } .dp-down { grid-area: down; } .dp-right { grid-area: right; }
.dpad-btn .ico { width: 30px; height: 30px; }

/* Heart */
.seals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; list-style: none; padding: 0; margin: 0 0 12px; }
.seal { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 10px 4px; border-radius: 16px; border: 3px dashed var(--lavender); font-size: .85rem; font-weight: 700; background: #fff; }
.seal.active { border: 3px solid var(--butter-d); background: #FFF6D6; box-shadow: 0 4px 0 var(--butter-d); } .seal.broken { border: 3px solid var(--mint-d); background: #EAF9EF; box-shadow: 0 4px 0 var(--mint-d); }
.seal-gem { width: 18px; height: 18px; margin: 4px 0; } .seal-gem.sealed { background: transparent; border: 2px solid var(--lavender); box-shadow: none; } .seal-gem.broken { background: linear-gradient(135deg, #DDF6E6, var(--mint-d)); box-shadow: 0 0 10px var(--mint); } .stage { margin-top: 8px; }

/* ---------- Dialogs, toasts, journal ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 14px; background: rgba(41, 39, 70, .55); backdrop-filter: blur(4px); animation: fadein .25s; }
.dialog { position: relative; width: min(500px, 100%); max-height: 92vh; overflow: auto; animation: dialogin .35s cubic-bezier(.2, 1.4, .4, 1); } .dialog.wide { width: min(640px, 100%); }
@keyframes dialogin { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.dialog-x { position: absolute; right: 8px; top: 8px; z-index: 2; } .dialog-x .ico { width: 18px; height: 18px; }
.dialog-title { padding-right: 48px; color: var(--indigo); } .dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 14px; padding-bottom: 6px; } .dialog-actions .btn { flex: 1 1 150px; }
.story { font-style: italic; } .howto { padding-left: 1.2em; } .howto li { margin-bottom: 8px; } .howto li::marker { color: var(--coral-d); }
.field { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; margin: 12px 0; } .field label, .field-label { grid-column: 1 / -1; font-weight: 700; } .field small { display: block; font-weight: 400; color: var(--ink-soft); }
.field input[type='range'] { width: 100%; min-height: 46px; accent-color: var(--coral-d); } .field output { min-width: 3.2em; text-align: right; font-weight: 700; }
.field select { font: inherit; min-height: 46px; background: #fff; color: var(--ink); border: 3px solid var(--lavender); border-radius: 12px; padding: 4px 8px; grid-column: 1 / -1; }
.field .toggle { grid-column: 2; grid-row: 1; min-width: 84px; } .field .field-label { grid-column: 1; grid-row: 1; } .toggle[aria-checked='true'] { background: linear-gradient(180deg, #DDF6E6, var(--mint)); box-shadow: 0 5px 0 var(--mint-d), 0 9px 14px rgba(41, 39, 70, .25); }
.victory-stars { display: flex; justify-content: center; gap: 10px; margin: 6px 0 14px; }
.vstar .star { width: 64px; height: 64px; color: #D9D2EE; } .vstar.earned .star { color: var(--butter); filter: drop-shadow(0 3px 0 var(--butter-d)) drop-shadow(0 0 12px var(--butter)); }
.vstar { opacity: 0; transform: scale(.2) rotate(-40deg); animation: starpop .7s cubic-bezier(.2, 1.5, .4, 1) forwards; animation-delay: calc(var(--i) * .26s); } @keyframes starpop { to { opacity: 1; transform: none; } }
.reward { font-size: 1.25rem; text-align: center; color: #b8860b; font-weight: 700; } .unlock, .ach { text-align: center; }
.dialog.victory { background: linear-gradient(180deg, #fff, #FFF3C4); }
.toasts { position: fixed; z-index: 70; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--indigo); color: #fff; border: 3px solid var(--butter); border-radius: 16px; padding: 10px 16px; box-shadow: var(--shadow); animation: fadein .25s; font-weight: 700; }
.journal-body { display: grid; gap: 16px; margin-top: 12px; }
.ledger { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; margin: 0; } .ledger dt { color: var(--ink-soft); } .ledger dd { margin: 0; text-align: right; font-weight: 700; color: var(--berry-d); }
.ledger.center { text-align: center; max-width: 340px; margin: 16px auto; background: rgba(255, 250, 240, .94); padding: 12px 16px; border-radius: 18px; border: 3px solid #fff; box-shadow: 0 5px 0 rgba(141, 121, 217, .45); }
ul.ach-list, ul.story-list, ul.lore-list, ul.cos-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ach-item, .cos-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; border: 3px solid #E9E0FF; background: #fff; } .ach-item.got { border-color: var(--butter-d); background: #FFF6D6; }
.ach-item .badge { margin-left: auto; flex: none; } .ach-item small { display: block; color: var(--ink-soft); }
.lore-item { padding: 10px 12px; border: 3px solid #E9E0FF; border-radius: 14px; background: #fff; } .stars-inline { white-space: nowrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--lavender); flex: none; } .cos-name { flex: 1; font-weight: 700; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  body { font-size: 16px; } .screen { padding: 10px 10px 26px; }
  .stats { grid-template-columns: repeat(2, 1fr); } .room-name { font-size: .8rem; } .room-status { font-size: .68rem; } .room-info { padding: 4px 6px 7px; } .room-icon { width: 22px; height: 22px; }
  .mansion-grid { gap: 7px; padding: 8px; } .room-num { width: 22px; height: 22px; font-size: .7rem; } .star { width: 14px; height: 14px; } .room-card { border-width: 3px; }
  .book { width: 58px; min-height: 100px; } .shelf { gap: 5px; } .slot { width: 50px; } .dial-btn { width: 46px; height: 46px; } .ingredients { grid-template-columns: repeat(2, 1fr); } .tile-grid { gap: 9px; }
  .dial { border-width: 8px; }
}
@media (min-width: 900px) { .banner { aspect-ratio: 240 / 100; } .room-name { font-size: 1.05rem; } .room-status { font-size: .86rem; } }

/* ---------- Reduced motion (OS preference or in-game toggle) ---------- */
html[data-motion='reduced'] *, html[data-motion='reduced'] *::before, html[data-motion='reduced'] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}
html[data-motion='reduced'] { --px: 0 !important; --py: 0 !important; }
html[data-motion='reduced'] .vstar { opacity: 1; transform: none; }
html[data-motion='reduced'] .restoring::after, html[data-motion='reduced'] .burst, html[data-motion='reduced'] .confetti-layer { display: none; }
html[data-motion='reduced'] .mansion-grid, html[data-motion='reduced'] .banner, html[data-motion='reduced'] .dial, html[data-motion='reduced'] .mirror-board, html[data-motion='reduced'] .garden-grid { transform: none; }
@media (prefers-reduced-motion: reduce) { .restoring::after, .burst, .confetti-layer { display: none; } }
