:root {
  --ink: #10152d;
  --panel: #1a2142;
  --cell: #29335b;
  --empty: #222b50;
  --cream: #fff8e5;
  --pink: #ff5a83;
  --yellow: #ffce4b;
}

* { box-sizing: border-box; }
.menu-card {max-height:90dvh;overflow:auto}
.mode-picker {min-width:0;border:0;padding:0;margin:8px 0}
.mode-picker legend {font-weight:900;margin:0 auto 8px}
.mode-picker button + button {margin-top:8px}
.avatar-type {display:block;margin:6px auto;padding:7px;border-radius:8px}
.junior-map-card {position:relative;width:min(94vw,620px);max-height:90dvh;overflow:auto;padding:18px 22px 92px;border-radius:24px;color:#263e49;background:#fff5d7;text-align:center}
.junior-map-card #mapHome {width:auto;display:block}
#mapStops {display:grid;justify-content:center;gap:0;margin:10px 0}
.map-stop {position:relative;display:grid;grid-template-columns:44px 1fr;gap:14px;align-items:center;text-align:left;min-height:55px;color:#263e49;background:transparent;font-weight:900}
.map-stop:not(:last-child)::after {content:"";position:absolute;left:26px;top:50%;height:55px;width:3px;background:#758d71}
.map-stop span {position:relative;z-index:1;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#ffd773;border:2px solid #766038}
.map-stop:disabled {opacity:.55;cursor:default}
.map-corner {position:absolute;right:14px;bottom:14px;display:flex;gap:6px}
.map-corner button {border-radius:12px;padding:6px 9px;background:#28473e;color:#fff}
body.ruby-snow {--scene:radial-gradient(ellipse at top,#60132f,#170e22)}
body.ruby-snow::after {content:"";position:fixed;inset:0;pointer-events:none;z-index:4;background-image:radial-gradient(circle at 24% 18%,#ff638c 1px,transparent 2.5px),radial-gradient(circle at 78% 62%,#e52f64 1px,transparent 3px),radial-gradient(circle at 47% 81%,#ffc2cf .7px,transparent 2px);background-size:91px 137px,173px 193px,59px 83px;animation:drifting-snow 10s linear infinite}
#wardrobe {width:min(92vw,380px);max-height:90dvh;overflow:auto;background:#202c51;color:#fff7dd;border:1px solid #899bd5;border-radius:20px;padding:20px}
#wardrobe label {display:block;margin:10px 0}
#wardrobe input,#wardrobe select,#wardrobe button {padding:8px;border-radius:8px}
.avatar-icon {display:inline-block;width:44px;height:44px;border-radius:50%;background-size:500% 300%;vertical-align:middle}
#portrait {display:block;width:140px;height:140px;border-radius:14px;margin:auto}
#juniorTrail:not([hidden]) {display:flex;align-items:center;justify-content:space-between;width:min(94vw,440px);margin:12px auto;background:linear-gradient(#ecc659,#ecc659) center / 95% 3px no-repeat}
#juniorTrail span {background:#35466e;border-radius:15px;padding:6px}
#juniorTrail .here {background:#ffe191;color:#262f50}
#maker { width:min(92vw,400px); background:#232e56; color:#fff8e5; border:1px solid #8399d4; border-radius:18px; padding:22px; }
#maker::backdrop { background:#090d23c9; }
#maker button { border-radius:7px; padding:8px; }
#shapeEditor { display:grid; grid-template-columns:repeat(4,44px); gap:4px; margin:14px 0; }
#shapeEditor button { height:44px; background:#39466b; border:1px dashed #acb7d5; }
#shapeEditor button[aria-pressed=true] { background:linear-gradient(145deg,#ffffff35,transparent 55%,#0005),var(--paint); border:2px solid white; }
#designer { width:min(92vw,400px); border:1px solid #8399d4; border-radius:20px; background:#232e56; color:#fff8e5; padding:20px; }
#designer::backdrop { background:#090d23c9; }
#designer label,#designer input { display:block; width:100%; margin:8px 0; }
#designer input,#designer button { padding:10px; border-radius:8px; }
#designer p { font-size:13px; }
#designPreview { display:grid; place-items:center; height:110px; margin:12px 0; border-radius:10px; background:#162044; }
#sampleTile { width:44px; height:44px; border-radius:6px; background:#ffa6ce; box-shadow:0 2px 6px #1118; }
body {
  margin: 0; min-height: 100vh; color: var(--cream); display: grid; place-items: center;
  background: radial-gradient(circle at 18% 12%, #39487c 0 2px, transparent 3px),
    radial-gradient(circle at 84% 76%, #34436f 0 3px, transparent 4px),
    linear-gradient(150deg, #192142 0%, #0d1127 70%);
  background-size: 54px 54px, 72px 72px, auto;
  font-family: "Nunito", sans-serif;
}
button { font: inherit; cursor: pointer; border: 0; }
.game-shell { width: min(94vw, 500px); padding: 22px 0 28px; text-align: center; }
header { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.header-actions { display: flex; gap: 8px; }.system-button { color: var(--yellow); }
.brand { font: 800 25px/1 "Baloo 2", sans-serif; letter-spacing: 1.4px; }
.brand-dot { display: inline-block; height: 14px; width: 14px; margin: 0 7px 1px 0; vertical-align: middle; border-radius: 5px; background: var(--yellow); box-shadow: 0 3px #d79e28; transform: rotate(12deg); }
.icon-button { color: var(--cream); background: #29345c; border-radius: 11px; width: 40px; height: 40px; font-size: 21px; box-shadow: inset 0 -3px #151d3d; }
.scoreboard { display: flex; justify-content: center; gap: 13px; margin: 20px 0 12px; }
.score-card { min-width: 112px; padding: 7px 12px 9px; border-radius: 15px; background: var(--panel); box-shadow: inset 0 -3px rgba(0,0,0,.2); }
.score-card span, .final-score span { display: block; color: #aebce7; font-size: 11px; font-weight: 900; letter-spacing: 1.7px; }
.score-card strong { display: block; color: var(--yellow); font-size: 29px; line-height: 1; }
.systems-launch { display:flex; align-items:center; justify-content:space-between; width:min(94vw,440px); margin:0 auto 12px; padding:10px 14px; border:2px solid #7d91cb; border-radius:13px; color:#fff8e5; background:linear-gradient(120deg,#495d99,#303f70); font-size:13px; font-weight:900; letter-spacing:.5px; box-shadow:inset 0 -3px rgba(0,0,0,.2); }.systems-launch span { color:#d6e1ff; font-size:9px; letter-spacing:0; }
.potion-launch { display:flex; align-items:center; justify-content:space-between; width:min(94vw,440px); margin:-5px auto 12px; padding:10px 14px; border:2px solid #b58bff; border-radius:13px; color:#fff8e5; background:linear-gradient(120deg,#5b3d8b,#394d83); font-size:13px; font-weight:900; letter-spacing:.5px; box-shadow:inset 0 -3px rgba(0,0,0,.2); }.potion-launch span { color:#e2d5ff; font-size:9px; letter-spacing:0; }.potion-menu { border-color:#b58bff; background:#593c87; }
.best strong { color: #8ce5d2; }
.level-card strong { color: #c8a4ff; }.level-card small { display:block; color:#aebce7; font-size:8px; font-weight:900; white-space:nowrap; }
.message { margin: 10px 0 15px; min-height: 22px; color: #d8e0ff; font-weight: 800; }
.board { width: min(94vw, 440px); aspect-ratio: 1; margin: auto; padding: 8px; display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(10, 1fr); gap: 4px; border-radius: 19px; background: #151c3d; box-shadow: 0 8px 0 #080c1d, 0 14px 32px rgba(0,0,0,.35); touch-action: none; }
.cell { background: var(--empty); border-radius: 5px; transition: background .12s, transform .12s, opacity .12s; }
.cell.preview { background: color-mix(in srgb, var(--preview) 54%, #30385d); }
.cell.invalid { background: #7f3e5d; }
.cell.filled { background: var(--block); box-shadow: inset 0 3px rgba(255,255,255,.28), inset 0 -4px rgba(0,0,0,.17); }
.cell.clearing { animation: pop .3s ease-in forwards; }
@keyframes pop { 50% { transform: scale(1.16); } 100% { opacity: 0; transform: scale(.4); } }
.blast { position:fixed; z-index:8; left:50%; top:43%; width:1px; height:1px; pointer-events:none; }.blast i { position:absolute; width:10px; height:10px; border-radius:3px; background:var(--blast-color,#ffce4b); animation:blast .7s cubic-bezier(.12,.75,.25,1) forwards; transform:rotate(var(--spin)); }.blast.rainbow i { background:hsl(var(--hue),90%,65%); box-shadow:0 0 12px hsl(var(--hue),90%,65%); }.blast::after { content:'✦'; position:absolute; left:-24px; top:-27px; font-size:55px; color:var(--blast-color,#ffce4b); text-shadow:0 0 16px currentColor; animation:flash .55s ease-out forwards; }.blast.rainbow::after { color:#fff; text-shadow:0 0 9px #ff5a83,0 0 20px #5fcbf4; }@keyframes blast { from{opacity:1;transform:translate(0,0) rotate(0) scale(1)} to{opacity:0;transform:translate(var(--x),var(--y)) rotate(var(--spin)) scale(.2)} }@keyframes flash { from{opacity:1;transform:scale(.4)} to{opacity:0;transform:scale(1.8)} }
.tray-label { margin: 28px 0 5px; color: #d8e1ff; font-size: 12px; letter-spacing: 1.5px; font-weight: 900; }
.tray { min-height: 116px; display: flex; align-items: center; justify-content: space-around; gap: 8px; padding: 0 5px; }
.piece { --block-size: 22px; position: relative; min-width: 106px; min-height: 102px; display: grid; place-items: center; user-select: none; touch-action: none; transition: opacity .2s, transform .2s; }
.piece::after { content: 'DRAG'; position: absolute; bottom: 1px; color: #8494c8; font-size: 9px; font-weight: 900; letter-spacing: 1.3px; }
.piece.used { opacity: 0; pointer-events: none; transform: scale(.7); }
.piece.selected { transform: translateY(-7px) scale(1.05); filter: drop-shadow(0 6px 5px rgba(255,206,75,.35)); }
.piece.selected::after { color: var(--yellow); content: 'TAP A SQUARE'; }
.piece-grid { display: grid; grid-template-columns: repeat(var(--w), var(--block-size)); grid-template-rows: repeat(var(--h), var(--block-size)); gap: 2px; pointer-events: none; }
.piece-cell { height: var(--block-size); width: var(--block-size); border-radius: 4px; background: var(--piece-color); box-shadow: inset 0 3px rgba(255,255,255,.3), inset 0 -3px rgba(0,0,0,.17); }
.new-game { padding: 11px 27px; border-radius: 13px; color: #18203e; background: var(--yellow); font-weight: 900; letter-spacing: 1px; box-shadow: inset 0 -3px #df9d24, 0 4px 0 #0a0e20; transition: transform .1s; }
.new-game:active { transform: translateY(3px); box-shadow: inset 0 -3px #df9d24, 0 1px 0 #0a0e20; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(6,8,23,.72); backdrop-filter: blur(5px); z-index: 5; }
.menu-overlay { position:fixed; inset:0; z-index:4; display:grid; place-items:center; padding:24px; background:radial-gradient(circle at 18% 14%,#566aa7 0 2px,transparent 3px),radial-gradient(circle at 84% 76%,#485b98 0 3px,transparent 4px),linear-gradient(150deg,#293b72,#111a41); background-size:50px 50px,70px 70px,auto; }.menu-card{width:min(92vw,400px);padding:28px 25px 27px;text-align:center;border:2px solid #6e82be;border-radius:28px;background:linear-gradient(#344979,#1c2754);box-shadow:0 20px 45px rgba(0,0,0,.42)}.room-sparkles{color:var(--yellow);font-size:24px;letter-spacing:8px}.menu-card .eyebrow{margin:10px 0 0}.menu-card h1{margin:0;font:800 54px/.95 "Baloo 2",sans-serif;letter-spacing:-1px}.menu-subtitle{margin:9px 0 18px;color:#d7e1ff;font-weight:800}.menu-preview{display:grid;gap:8px;text-align:left;margin-bottom:17px}.menu-preview div{padding:10px 12px;border-radius:12px;background:#162044}.menu-preview span{display:block;color:#aebce7;font-size:9px;font-weight:900;letter-spacing:1.3px}.menu-preview strong{display:block;margin-top:2px;font-size:17px;white-space:nowrap}.menu-customize,.menu-play{width:100%;padding:12px;border-radius:13px;font-weight:900;letter-spacing:.6px}.menu-customize{margin-bottom:9px;color:#edf2ff;background:#49619c;border:1px solid #8196d1}.menu-play{color:#1d2649;background:var(--yellow);font-size:15px;box-shadow:inset 0 -3px #df9d24}.menu-play span{float:right}
.hidden { display: none; }
.game-over-card { width: min(92vw, 360px); padding: 25px 28px 30px; border: 2px solid #596897; border-radius: 25px; background: linear-gradient(#2e3a68, #192148); box-shadow: 0 20px 45px rgba(0,0,0,.5); }
.burst { color: var(--yellow); font-size: 49px; line-height: 1; text-shadow: 0 4px #cf8f25; }
.eyebrow { margin: 8px 0 0; font-size: 11px; font-weight: 900; letter-spacing: 2px; color: #b8c5ec; }
.game-over-card h1 { margin: 1px 0 19px; font: 800 38px/1 "Baloo 2", sans-serif; }
.final-score { margin: 0 auto 24px; padding: 9px; width: 160px; background: #131a39; border-radius: 13px; }
.final-score strong { color: var(--yellow); font-size: 33px; line-height: 1; }
.cell.skinned, .piece-cell.skinned { display:grid; place-items:center; font-size:clamp(12px,2.4vw,20px); line-height:1; overflow:hidden; }
.cell.image-skin, .piece-cell.image-skin { background-color:var(--block); background-image:var(--skin-image); background-repeat:no-repeat; background-position:center; background-size:cover; box-shadow:inset 0 2px rgba(255,255,255,.2), inset 0 -3px rgba(0,0,0,.17); }
.cell.filled.duck-pattern, .piece-cell.duck-pattern { display:block; padding-top:1px; background:#ffe774; box-shadow:inset 0 1px rgba(255,255,255,.55); font-size:12px; letter-spacing:-4px; line-height:1.15; white-space:pre; overflow:hidden; filter:drop-shadow(0 1px 0 rgba(117,80,20,.18)); }
.piece-cell.duck-pattern { padding-top:1px; font-size:6px; letter-spacing:-3px; line-height:1.12; }
.systems-card { width:min(94vw,440px); max-height:90vh; overflow:auto; padding:20px; text-align:left; border:2px solid #596897; border-radius:24px; background:linear-gradient(#2d3966,#172047); box-shadow:0 20px 45px rgba(0,0,0,.5); }.systems-heading{display:flex;justify-content:space-between;align-items:center}.systems-heading h2{margin:-2px 0 8px;font:800 33px/1 "Baloo 2",sans-serif}.systems-heading .eyebrow{margin:0}.close-button{width:36px;height:36px;color:#dce5ff;background:#1c254d;border-radius:10px;font-size:28px;line-height:1}.level-strip{display:grid;grid-template-columns:auto auto auto auto;gap:5px 9px;align-items:baseline;padding:11px 13px;border-radius:13px;background:#121a39}.level-strip span,.level-strip small{font-size:10px;font-weight:900;letter-spacing:1px;color:#aebce7}.level-strip strong{color:var(--yellow);font-size:24px}.level-strip small{grid-column:1/-1;text-align:left;letter-spacing:.2px}.systems-card h3{margin:20px 0 9px;color:#cbd6fb;font-size:11px;letter-spacing:1.5px}.skin-list,.music-list{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.skin-option,.music-option{border:2px solid transparent;color:var(--cream);background:#202a54;border-radius:13px;font-family:inherit;font-weight:900}.skin-option{min-height:86px;padding:8px 4px}.skin-option.selected,.music-option.selected{border-color:var(--yellow);background:#34416e}.skin-option.locked,.music-option.locked{opacity:.55}.skin-icon{display:block;margin-bottom:4px;font-size:30px}.skin-option small{display:block;color:#aebce7;font-size:9px}.music-option{padding:10px 3px;font-size:12px}.music-option.selected{color:#172044;background:#8ce5d2}.volume-control{display:flex;align-items:center;justify-content:space-between;margin-top:18px;color:#cbd6fb;font-size:11px;font-weight:900;letter-spacing:1.5px}.volume-control input{accent-color:var(--yellow);width:65%}.daily-card{display:flex;gap:11px;align-items:center;margin-top:22px;padding:12px;border:1px solid #a576ff;border-radius:15px;background:linear-gradient(120deg,#473675,#24345d)}.daily-icon{color:var(--yellow);font-size:30px}.daily-card div:nth-child(2){flex:1}.daily-card p,.daily-card small{display:block;margin:0;color:#d7c8ff;font-size:9px;font-weight:900;letter-spacing:1px}.daily-card strong{display:block;font-size:13px}.daily-card button{padding:8px;border-radius:9px;background:var(--yellow);color:#1a2041;font-size:9px;font-weight:900}.daily-card button:disabled{background:#59658e;color:#d5dcf2}
@media (max-width: 390px) { .game-shell { padding-top: 13px; } .board { gap: 3px; padding: 6px; } .piece { --block-size: 18px; min-width: 84px; } .tray { gap: 0; } .scoreboard { margin-top: 13px; gap:6px; } .score-card { min-width:96px; padding-inline:7px; } }
.potion-list { display:grid; gap:8px; }.potion-option { display:grid; grid-template-columns:1fr auto; align-items:center; padding:10px 12px; color:#fff8e5; background:linear-gradient(120deg,#4b387b,#28365f); border:1px solid #ad8aff; border-radius:12px; }.potion-option b { font-size:13px; }.potion-option small { grid-column:1; color:#ddd0ff; font-size:9px; }.potion-option em { grid-column:2; grid-row:1/3; color:#ffdc74; font-size:9px; font-style:normal; font-weight:900; }.potion-actions { grid-column:1/-1; display:flex; gap:7px; margin-top:8px; }.potion-actions button { flex:1; padding:7px; border-radius:8px; color:#1a2041; background:#ffce4b; font-size:9px; font-weight:900; }.potion-actions button:last-child { background:#8ce5d2; }.potion-actions button:disabled { color:#d5dcf2; background:#59658e; }
.reset-progress { width:100%; margin-top:16px; padding:10px; color:#ffc4cf; background:transparent; border:1px solid #a75c72; border-radius:10px; font-size:10px; font-weight:900; letter-spacing:1px; }
body[data-scene],body[data-scene] #mainMenu {background:var(--scene,#141a32)}
body[data-scene="snow"] {--scene:linear-gradient(#739cb7,#d9edf2)}
body[data-scene="night"] {--scene:linear-gradient(#0d1635,#394d72)}
body[data-scene="sunset"] {--scene:linear-gradient(#4f4787,#db7892,#fec190)}
body:is([data-scene="snow"],[data-scene="night"])::after {content:"";position:fixed;inset:0;pointer-events:none;z-index:4;background-image:radial-gradient(circle,#fff 1.6px,transparent 2px),radial-gradient(circle,#fffb 1px,transparent 2px);background-size:69px 87px,101px 116px;animation:room-snow 8s linear infinite}
@keyframes room-snow {to{background-position:69px 348px,-101px 348px}}
body[data-scene="christmas"] {--scene:url("assets/skins/christmas.jpg?v=seasonal") center/cover no-repeat fixed}
body[data-scene="winter"],body[data-scene="night"] {--scene:url("assets/skins/winter.jpg") center/cover fixed}
body[data-scene="halloween"] {--scene:url("assets/skins/halloween.jpg") center/cover fixed}
body[data-scene="newyear"] {--scene:url("assets/skins/newyear.jpg") center/cover fixed}
body:is([data-scene="snow"],[data-scene="night"],[data-scene="winter"])::after {
  content:""; position:fixed; inset:0; pointer-events:none; z-index:4;
  background-image:radial-gradient(ellipse at 24% 18%,#fffd 1px,transparent 3px),radial-gradient(circle at 78% 62%,#fff9 1px,transparent 4px),radial-gradient(circle at 47% 81%,#fffc 0.8px,transparent 1.8px);
  background-size:91px 137px,173px 193px,59px 83px;
  animation: drifting-snow 10s linear infinite;
}
@keyframes drifting-snow {to{background-position:91px 685px,-173px 1158px,59px 332px}}
@media(prefers-reduced-motion:reduce){body[data-scene]::after{animation:none}}
