/* Glow Sort styles - adapted from the Lantern Drift UI kit (same panel/button art pipeline). */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #05071a; overflow: hidden; overscroll-behavior: none; }
body { font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; color: #fdf3d8; user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* Screens */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(5,7,26,.25), rgba(5,7,26,.7)); }
.panel { width: min(360px, 100%); text-align: center; padding: 26px 22px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(30,26,80,.82), rgba(14,14,46,.88)); border: 1px solid rgba(255,210,140,.28);
  box-shadow: 0 0 40px rgba(255,170,70,.18), inset 0 0 30px rgba(255,180,90,.06); display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.logo { margin: 0; font-size: 46px; line-height: .95; font-weight: 900; letter-spacing: 2px; color: #ffd890;
  text-shadow: 0 0 18px rgba(255,170,60,.9), 0 0 40px rgba(255,120,40,.5); }
.logo span { color: #fff2cf; font-size: 54px; }
h2 { margin: 0; font-size: 32px; color: #ffd890; text-shadow: 0 0 14px rgba(255,170,60,.8); }
p { margin: 0; line-height: 1.35; }
.tagline { opacity: .9; font-size: 15px; }
.best-line { font-size: 17px; }
.best-line b { color: #ffd890; }
.btn { font: inherit; font-weight: 700; border-radius: 14px; border: 1px solid rgba(255,220,170,.35); background: rgba(255,255,255,.08);
  color: #fdf3d8; padding: 10px 14px; cursor: pointer; transition: transform .08s, background .2s; }
.btn:active { transform: scale(.97); }
.btn:hover { background: rgba(255,255,255,.14); }
.btn.primary { background: linear-gradient(180deg, #ffc35c, #ff8a3c); color: #2a1300; border: none; box-shadow: 0 4px 18px rgba(255,140,50,.45); }
.btn.big { font-size: 20px; padding: 14px; }
.btn.small { font-size: 14px; padding: 9px 12px; }
.btn.ghost { background: rgba(120,200,255,.08); border-color: rgba(140,210,255,.35); font-size: 14px; }
.btn.ghost small { display: block; font-weight: 400; opacity: .75; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: default; }
.no-thanks { background: rgba(255,255,255,.16); border: 2px solid rgba(255,255,255,.6); color: #fff; }
.row { display: flex; gap: 8px; justify-content: center; }
.row .btn { flex: 1; }
.hint { font-size: 13px; opacity: .7; }
.fine { font-size: 11px; opacity: .55; }
.note { font-size: 14px; color: #9fe3ff; }
.stats { display: flex; gap: 10px; }
.stats div { flex: 1; background: rgba(255,255,255,.06); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; }
.stats span { font-size: 13px; opacity: .7; }
.stats b { font-size: 30px; color: #ffd890; }
.breakdown { font-size: 13px; opacity: .75; }
.new-best { color: #ffe27a; font-weight: 800; animation: pulse 1s infinite alternate; }
.revive-score b { color: #ffd890; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* Ad overlay */
.ad-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.86); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.ad-box { width: min(360px, 100%); background: #f4f1ea; color: #222; border-radius: 16px; padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; position: relative; }
.ad-label { align-self: flex-start; background: #ffcf3a; color: #222; font-weight: 900; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; padding: 3px 10px; border-radius: 6px; }
.ad-art { height: 140px; border-radius: 12px; background: linear-gradient(135deg, #6a5cff, #ff7aa8); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ad-orb { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #ffe08a 40%, #ff9a3c); animation: bob 1.4s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(-14px); } to { transform: translateY(14px); } }
.ad-title { font-weight: 800; font-size: 18px; }
.ad-text { font-size: 14px; color: #444; }
.ad-bar { height: 8px; background: #ddd; border-radius: 4px; overflow: hidden; }
#ad-progress { height: 100%; width: 0; background: #ff8a3c; }
.ad-count { font-size: 13px; color: #555; min-height: 1em; }
.ad-box .btn { color: #222; border-color: #bbb; background: #fff; }
.ad-box .btn.primary { background: linear-gradient(180deg, #ffc35c, #ff8a3c); }

.toast { position: absolute; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(20,20,60,.9);
  border: 1px solid rgba(255,210,140,.4); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; }

/* ---------- Art-based UI (images layered over CSS fallbacks) ---------- */
@font-face { font-family: 'Lilita'; src: url('../assets/fonts/LilitaOne-Regular.ttf') format('truetype'); font-display: swap; }
body { font-family: 'Lilita', "Trebuchet MS", "Segoe UI", system-ui, sans-serif; letter-spacing: .3px; }
.fine, .ad-text, .ad-count, .tagline, .breakdown, .btn.ghost small, .hint { font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; }
.logo-wrap { margin: -8px 0 0; line-height: 0; }
.logo-img { width: 100%; max-width: 300px; height: auto; filter: drop-shadow(0 0 18px rgba(255,160,60,.55)); animation: floaty 3.2s ease-in-out infinite alternate; }
@keyframes floaty { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
.panel { border: 18px solid transparent; border-image: url('../assets/ui/panel.webp') 70 fill / 18px / 0 stretch;
  background-clip: padding-box; padding: 14px 10px; }
.btn.primary { background: url('../assets/ui/btn_primary.webp') center / 100% 100% no-repeat, linear-gradient(180deg, #ffc35c, #ff8a3c);
  border-radius: 999px; color: #4a1d00; text-shadow: 0 1px 0 rgba(255,240,200,.6); }
.btn.secondary, .no-thanks { background: url('../assets/ui/btn_secondary.webp') center / 100% 100% no-repeat, linear-gradient(180deg, #8270c8, #4e3e96);
  border-radius: 999px; border: none; color: #fff6e6; }
.no-thanks { font-size: 20px; }
.btn .bi { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.28em; margin-right: .4em; background: center / contain no-repeat; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.btn .bi.ic-play-i { background-image: url('../assets/ui/ic_play.webp'); }
.icon-btn { background: center / 100% 100% no-repeat, rgba(10,14,45,.55); border: none; }
.icon-btn.ic-pause { background-image: url('../assets/ui/ic_pause.webp'); }
.icon-btn.ic-sound { background-image: url('../assets/ui/ic_sound.webp'); }
.icon-btn span { opacity: 0; }               /* glyph only visible if images fail (see .noart) */
.noart .icon-btn span { opacity: 1; }
.noart .icon-btn { border: 2px solid rgba(255,220,160,.5); }

/* ---------- Mobile-first: portrait, safe areas, small screens ---------- */
.screen { padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
#hud { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.btn { min-height: 44px; touch-action: manipulation; }
@media (max-height: 640px) { .logo-img { max-width: 220px; } .panel { gap: 8px; } .btn.big { padding: 10px; font-size: 18px; } }
#rotate { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #rotate { display: flex; position: absolute; inset: 0; z-index: 100; background: #0b1033; align-items: center; justify-content: center; text-align: center; padding: 20px; font-size: 20px; }
}

/* ---------- panels & menus ---------- */
.panel { max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.screen { touch-action: pan-y; }
.meta-line { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 15px; flex-wrap: wrap; }
.meta-line b { color: #ffd890; }
.star { color: #ffe27a; }
.daily-btn { font-size: 18px; line-height: 1.1; }
.daily-btn small { display: block; font-size: 12px; opacity: .85; font-family: "Trebuchet MS", system-ui, sans-serif; margin-top: 3px; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #ffcf3a; color: #3a1a00; font-size: 12px; margin-left: 4px; }
.fine-plain { font-size: 12px; opacity: .75; font-family: "Trebuchet MS", system-ui, sans-serif; }
.shop-note { font-size: 12px; opacity: .8; font-family: "Trebuchet MS", system-ui, sans-serif; }
.grownups { margin: 6px 0 0; font-size: 15px; color: #ffd890; border-top: 1px solid rgba(255,220,160,.25); padding-top: 8px; }
.price-real { color: #fff; background: #3c7a3a; border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.share-preview canvas, .share-preview img { width: 100%; height: auto; border-radius: 12px; display: block; box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.about-text { text-align: left; font-size: 14px; line-height: 1.4; display: flex; flex-direction: column; gap: 8px; font-family: "Trebuchet MS", system-ui, sans-serif; }
.about-text b { font-family: 'Lilita', sans-serif; font-weight: normal; color: #ffd890; }
.gate-q { font-size: 34px; font-weight: 900; }
.gate-a { font-size: 26px; text-align: center; padding: 8px; border-radius: 10px; border: 2px solid #bbb; width: 60%; align-self: center; }
@media (max-height: 700px) { .panel { gap: 7px; padding-top: 8px; } .logo-img { max-width: 210px; } .hint { display: none; } }


.credits { margin: 0; font-size: 11px; opacity: .6; font-family: "Trebuchet MS", system-ui, sans-serif; }
.tile-row { display: flex; gap: 6px; justify-content: space-between; }
.tile { flex: 1; font: inherit; color: #fdf3d8; background: rgba(255,255,255,.07); border: 1px solid rgba(255,220,170,.2); border-radius: 14px; padding: 6px 2px 5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; position: relative; min-height: 64px; touch-action: manipulation; }
.tile:active { transform: scale(.96); }
.tile .ti { width: 34px; height: 34px; background: center / contain no-repeat; display: block; }
.tile span { font-size: 12px; }
.tile .dot { position: absolute; top: 6px; right: 14%; width: 10px; height: 10px; border-radius: 50%; background: #ffcf3a; box-shadow: 0 0 6px #ffcf3a; }
.boost-card { background: rgba(255,255,255,.06); border-radius: 14px; padding: 9px; display: flex; flex-direction: column; gap: 7px; }
.boost-card .bt { font-size: 17px; text-align: left; }
.boost-card .bt small { font-size: 12px; opacity: .75; font-family: "Trebuchet MS", system-ui, sans-serif; margin-left: 4px; }
.small-stats b { font-size: 22px; }
.set-group { display: flex; flex-direction: column; gap: 6px; }
.set-row { display: flex; gap: 8px; align-items: center; }
.set-row .tog { flex: 0 0 48%; }
.set-row input[type=range] { flex: 1; accent-color: #ffb347; touch-action: pan-x; height: 28px; }
.tog { font: inherit; color: #fdf3d8; text-align: left; background: rgba(255,255,255,.07); border: 1px solid rgba(255,220,170,.25); border-radius: 12px; padding: 8px 10px 8px 44px;
  position: relative; cursor: pointer; min-height: 42px; touch-action: manipulation; }
.tog::before { content: ''; position: absolute; left: 9px; top: 50%; width: 28px; height: 16px; margin-top: -8px; border-radius: 9px; background: rgba(255,255,255,.2); transition: background .2s; }
.tog::after { content: ''; position: absolute; left: 11px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #fff; transition: left .2s; }
.tog[aria-pressed=true]::before { background: #ff9a3c; }
.tog[aria-pressed=true]::after { left: 23px; }
.tog small { display: block; font-size: 11px; opacity: .75; font-family: "Trebuchet MS", system-ui, sans-serif; }
/* accessibility body classes */
body.big-ui .btn { font-size: 19px; min-height: 54px; }
body.big-ui .btn.small { font-size: 17px; }
body.big-ui .btn.big { font-size: 24px; }
body.big-ui .tile { min-height: 78px; }
body.big-ui .tile span, body.big-ui .fine-plain, body.big-ui .hint, body.big-ui .tog small { font-size: 15px; }
body.big-ui .tog { font-size: 18px; min-height: 52px; }
body.big-ui .about-text, body.big-ui .mission .mt { font-size: 17px; }
body.hi-contrast .panel { background: #05051a; border-image: none; border: 3px solid #fff; padding: 16px 12px; }
body.hi-contrast .btn.secondary, body.hi-contrast .no-thanks, body.hi-contrast .btn, body.hi-contrast .tile, body.hi-contrast .tog { background: #000; color: #fff; border: 2px solid #fff; }
body.hi-contrast .btn.primary { background: #ffd23f; color: #000; border: 2px solid #fff; text-shadow: none; }
body.hi-contrast .fine-plain, body.hi-contrast .hint, body.hi-contrast .credits, body.hi-contrast .breakdown { opacity: 1; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }
/* build modes: release = AdMob ads (Android), no real-money purchases; dev = demo ads + mock purchases */
body.no-iap .iap-only { display: none !important; }
body.no-ads .ads-on { display: none !important; }
body:not(.no-ads) .ads-off { display: none !important; }
body:not(.no-iap) .iap-off { display: none !important; }
body:not(.ads-admob) .ads-real { display: none !important; }
body:not(.ads-mock) .ads-demo { display: none !important; }
.nowrap { white-space: nowrap; }
/* long labels never overflow narrow phones */
.btn, .tog, .tile span, .skin .sn { overflow-wrap: anywhere; hyphens: auto; }
.btn small { white-space: normal; }
/* tall panels (long game-over lists on small phones) scroll instead of squashing rows on top of each other */
.panel > * { flex-shrink: 0; }

/* ---------- Glow Sort ---------- */
.icon-btn { width: 46px; height: 46px; border-radius: 50%; border: none; background: center / 100% 100% no-repeat, rgba(10,14,45,.55);
  color: #ffe9bf; font-size: 16px; font-weight: 800; cursor: pointer; backdrop-filter: blur(4px); touch-action: manipulation; }
.icon-btn.ic-pause { background-image: url('../assets/ui/ic_pause.webp'); }
.icon-btn.ic-sound { background-image: url('../assets/ui/ic_sound.webp'); }
.icon-btn.off { opacity: .45; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn .bi.ic-map-i { background-image: url('../assets/ui/ic_map.webp'); }
.btn .bi.ic-daily-i { background-image: url('../assets/ui/ic_daily.webp'); }
.btn .bi.ic-info-i { background-image: url('../assets/ui/ic_info.webp'); }
.btn .bi.ic-restart-i { background-image: url('../assets/ui/ic_restart.webp'); }
.btn .bi.ic-settings-i { background-image: url('../assets/ui/ic_settings.webp'); }
.ti.ic-tree-i { background-image: url('../assets/ui/ic_tree.webp'), radial-gradient(circle, #79d98a 60%, transparent 62%); }
.ti.ic-shop-i { background-image: url('../assets/ui/ic_shop.webp'), radial-gradient(circle, #ffb347 60%, transparent 62%); }
.ti.ic-star-i { background-image: url('../assets/ui/ic_star.webp'), radial-gradient(circle, #ffd447 60%, transparent 62%); }
.ti.ic-settings-i { background-image: url('../assets/ui/ic_settings.webp'), radial-gradient(circle, #7b68c8 60%, transparent 62%); }
.ti.ic-undo-i { background-image: url('../assets/ui/ic_undo.webp'), radial-gradient(circle, #78b2ff 60%, transparent 62%); }
.ti.ic-restart-i { background-image: url('../assets/ui/ic_restart.webp'), radial-gradient(circle, #ff7fa8 60%, transparent 62%); }
.ti.ic-hint-i { background-image: url('../assets/ui/ic_hint.webp'), radial-gradient(circle, #ffd447 60%, transparent 62%); }
.ti.ic-boost-i { background-image: url('../assets/ui/ic_boost.webp'), radial-gradient(circle, #79d98a 60%, transparent 62%); }
.mini { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; background: center / contain no-repeat; }
.mini.ic-boost-i { background-image: url('../assets/ui/ic_boost.webp'); }
.logo-img { max-width: 280px; }

/* HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; padding: calc(8px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
.hud-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-top .icon-btn { pointer-events: auto; flex: none; }
.hud-mid { text-align: center; flex: 1; min-width: 0; }
.hud-level { font-size: 15px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-moves { font-size: 26px; color: #ffe2a8; text-shadow: 0 0 12px rgba(255,190,90,.7), 0 2px 0 rgba(0,0,0,.4); }
.hud-moves.low { color: #ffb0a0; animation: pulse .6s infinite alternate; }
.hud-stars { font-size: 15px; color: #ffe27a; letter-spacing: 2px; }
.hud-stars s, .lv i s { text-decoration: none; color: rgba(255,255,255,.25); }
.tip { pointer-events: auto; margin: 8px auto 0; max-width: 420px; background: rgba(20,18,60,.92); border: 1px solid rgba(255,210,140,.5); border-radius: 14px;
  padding: 8px 10px; font-size: 14px; display: flex; gap: 8px; align-items: center; font-family: "Trebuchet MS", system-ui, sans-serif; box-shadow: 0 0 20px rgba(255,170,70,.25); }
.tip span { flex: 1; line-height: 1.3; }
.tip .btn { flex: none; min-height: 36px; padding: 6px 10px; font-family: 'Lilita', sans-serif; }
#toolbar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px;
  padding: 6px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.tool { font: inherit; color: #fdf3d8; flex: 1; max-width: 96px; min-height: 64px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: rgba(16,14,50,.72); border: 1px solid rgba(255,220,170,.28); border-radius: 16px; cursor: pointer; touch-action: manipulation; }
.tool:active { transform: scale(.95); }
.tool .ti { width: 32px; height: 32px; background-position: center; background-size: contain; background-repeat: no-repeat; }
.tool span { font-size: 13px; }
.tool em { position: absolute; top: 4px; right: 8px; font-style: normal; font-size: 12px; background: #ffcf3a; color: #3a1a00; border-radius: 9px; min-width: 18px; padding: 0 4px; }
.tool.disabled { opacity: .45; }
.boost-tray { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); width: min(340px, 92%); z-index: 20;
  background: rgba(22,18,64,.96); border: 1px solid rgba(255,210,140,.5); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 7px; box-shadow: 0 0 30px rgba(0,0,0,.5); }
.boost-tray small { opacity: .8; margin-left: 4px; }
.cp-title { text-align: center; font-size: 18px; color: #ffd890; }
.cp-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cp { font: inherit; color: #fdf3d8; background: rgba(255,255,255,.07); border: 1px solid rgba(255,220,170,.3); border-radius: 12px; padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 13px; min-height: 56px; }
.cp i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }

/* map */
.panel.wide { width: min(440px, 100%); }
.map-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 58vh; overflow-y: auto; padding: 4px; touch-action: pan-y; }
.lv { font: inherit; color: #fdf3d8; background: rgba(255,255,255,.08); border: 1px solid rgba(255,220,170,.25); border-radius: 12px; min-height: 52px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px; }
.lv b { font-size: 18px; font-weight: normal; }
.lv i { font-style: normal; font-size: 11px; color: #ffe27a; letter-spacing: 1px; }
.lv.done { background: rgba(255,200,110,.16); }
.lv.fest { border: 2px solid #ffd447; }
.lv.chal b { color: #ffb0a0; }
.lv.cur { box-shadow: 0 0 0 2px #ffcf6e, 0 0 14px rgba(255,190,90,.6); }
.lv.locked { opacity: .35; cursor: default; }

/* win / fail */
.win-stars { display: flex; justify-content: center; gap: 6px; font-size: 52px; line-height: 1; }
.win-stars .ws { color: rgba(255,255,255,.18); }
.win-stars .ws.on { color: #ffe27a; text-shadow: 0 0 18px rgba(255,200,80,.9); animation: starpop .45s both; }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); opacity: 0; } 70% { transform: scale(1.3); } to { transform: scale(1); opacity: 1; } }
.win-notes { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #e8ffc0; font-family: "Trebuchet MS", system-ui, sans-serif; }
.win-notes b { font-family: 'Lilita', sans-serif; font-weight: normal; color: #ffd890; }
#screen-win, #screen-fail { background: radial-gradient(ellipse at center, rgba(5,7,26,.15), rgba(5,7,26,.6)); }

/* calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-d { background: rgba(255,255,255,.06); border-radius: 10px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; min-height: 64px; font-family: "Trebuchet MS", system-ui, sans-serif; }
.cal-d b { font-family: 'Lilita', sans-serif; font-weight: normal; font-size: 15px; color: #cfc8ee; }
.cal-d span { font-size: 9px; line-height: 1.1; opacity: .85; text-align: center; overflow-wrap: anywhere; }
.cal-d.got { background: rgba(255,200,110,.25); }
.cal-d.got b { color: #ffe27a; }
.cal-d.got b::after { content: ' ✓'; }
.cal-d.next { box-shadow: 0 0 0 2px #ffcf6e; }
.cal-d.skin { background-image: radial-gradient(circle at 50% 30%, rgba(255,210,120,.25), transparent 70%); }

/* tree */
.tree-wrap { position: relative; width: 100%; aspect-ratio: 720 / 760; border-radius: 14px; overflow: hidden; background: #0b0f33; }
.tree-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(1.15); }
#tree-hooks { position: absolute; inset: 0; }
.hang { all: unset; position: absolute; width: 18%; transform: translate(-50%, 0); cursor: pointer; display: flex; flex-direction: column; align-items: center; transform-origin: 50% 0; animation: sway 3.6s ease-in-out infinite alternate; }
.hang:nth-child(2n) { animation-duration: 4.2s; animation-delay: -1s; }
.hang .string { width: 2px; height: 14px; background: rgba(255,230,190,.7); }
.hang canvas { width: 100%; height: auto; filter: drop-shadow(0 0 8px rgba(255,190,90,.6)); }
.hang.locked canvas { filter: brightness(.35) saturate(.3); }
.hang.locked::after { content: '🔒'; position: absolute; top: 46%; font-size: 14px; }
.hang.eq canvas { filter: drop-shadow(0 0 14px rgba(255,230,140,1)); }
.hang.sel { outline: 2px dashed #ffe2a8; outline-offset: 2px; border-radius: 8px; }
.hang:focus-visible { outline: 2px solid #ffd890; }
@keyframes sway { from { transform: translate(-50%, 0) rotate(-4deg); } to { transform: translate(-50%, 0) rotate(4deg); } }
.skin-info { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 92px; }
.sk-name { font-size: 20px; color: #ffd890; }
.sk-name small { font-size: 13px; color: #bfffcf; }
.sk-goal { font-size: 14px; font-family: "Trebuchet MS", system-ui, sans-serif; }
.meter { height: 10px; background: rgba(255,255,255,.12); border-radius: 5px; overflow: hidden; }
.meter div { height: 100%; background: linear-gradient(90deg, #ffe27a, #ffb347); }
@media (max-height: 720px) { .tree-wrap { max-height: 46vh; aspect-ratio: auto; height: 46vh; } }

/* shop */
.booster-inv { display: flex; gap: 6px; }
.booster-inv div { flex: 1; background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; }
.booster-inv b { font-size: 24px; color: #ffd890; font-weight: normal; }
.booster-inv span { font-size: 12px; opacity: .8; }
.boost-card .row .btn { font-size: 13px; padding: 6px 4px; }
.iap-list { display: flex; flex-direction: column; gap: 6px; }
.iap { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.06); border-radius: 12px; padding: 7px 8px; text-align: left; }
.iap .it { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.iap .it b { font-weight: normal; color: #ffe2a8; font-size: 15px; }
.iap .it small { font-size: 11px; opacity: .8; font-family: "Trebuchet MS", system-ui, sans-serif; }
.iap .btn { flex: none; min-width: 74px; }
.tog.wide { width: 100%; }

body.big-ui .tool { min-height: 78px; max-width: 110px; }
body.big-ui .tool span { font-size: 16px; }
body.big-ui .hud-moves { font-size: 32px; }
body.big-ui .lv { min-height: 64px; }
body.big-ui .tip { font-size: 17px; }
body.hi-contrast .tool, body.hi-contrast .lv, body.hi-contrast .boost-tray, body.hi-contrast .tip { background: #000; border: 2px solid #fff; color: #fff; }
body.hi-contrast .hud-moves { text-shadow: 0 0 4px #000, 0 0 2px #000; }
@media (max-height: 640px) { .tool { min-height: 54px; } .tool .ti { width: 26px; height: 26px; } .hud-moves { font-size: 22px; } }

/* Quality update 1.2: readable UI in portal embeds, consistent spacing and focus. */
.quality-tagline { font: 15px/1.4 "Trebuchet MS",system-ui,sans-serif; color:#d2e4e4; margin:0; }
.quality-goal { font: 14px/1.4 "Trebuchet MS",system-ui,sans-serif; color:#c3e7d4; margin-top:4px; }
.hud-top { background:linear-gradient(180deg,rgba(11,19,38,.92),rgba(11,19,38,.78)); border:1px solid rgba(224,211,170,.18); border-radius:18px; padding:8px; }
.btn:focus-visible,.tool:focus-visible,.tile:focus-visible,.icon-btn:focus-visible { outline:3px solid #c7f2d9;outline-offset:3px; }
.tip { border-color:rgba(188,232,211,.5); background:rgba(13,28,43,.96); color:#eaf5e8; font:14px/1.45 "Trebuchet MS",system-ui,sans-serif;box-shadow:0 6px 20px #0004; }
.tip .btn { min-height:40px;min-width:72px; }
.hud-mid { text-shadow:none; }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important;transition:none!important; } }
@media (min-width:760px) and (max-height:760px) {
  #screen-title .panel { width:640px;display:grid;grid-template-columns:240px 1fr;gap:10px 20px;align-items:center;padding:22px;max-height:calc(100% - 24px); }
  #screen-title .logo-wrap { grid-column:1;grid-row:1 / span 5;margin:0; }
  #screen-title .quality-tagline {grid-column:1;grid-row:6;}
  #screen-title .panel > :not(.logo-wrap):not(.quality-tagline) {grid-column:2;}
  #screen-title .logo-img {max-width:240px;}
  #screen-title .credits {font-size:11px;}
  #screen-title .group-label {display:none;}
  #screen-title .btn.big {min-height:48px;}
}
@media (max-height:520px) { .screen {padding:12px;} #hud {padding-top:6px;} .hud-top{padding:4px;} }

#hud {padding-top:max(8px,env(safe-area-inset-top));}
.hud-top {max-width:560px;margin:auto;}
#toolbar {gap:8px;}
.tool {background:rgba(15,26,43,.94);border-color:rgba(187,218,216,.3);}
.hud-moves {font-size:20px;}
@media (min-width:760px) {#screen-title .logo-wrap{grid-row:1 / span 4;}#screen-title .quality-tagline{grid-row:5;}}
@media (orientation:landscape) and (pointer:coarse) {#rotate {display:none!important;}}

/* Very narrow phones (320px): keep tile labels like 'Calendar' on one line instead of splitting mid-word. */
@media (max-width: 359px) { .tile span { font-size: 10px; letter-spacing: -.02em; overflow-wrap: normal; hyphens: none; } }

/* Music menu (1.5.4) */
.music-menu-btn { width: 100%; text-align: left; }
.music-sub { font-size: 13px; opacity: .8; margin: 4px 0 8px; }
.music-h { margin: 14px 0 2px; }
.music-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.music-opt { font: inherit; color: #fdf3d8; text-align: left; background: rgba(255,255,255,.07); border: 1px solid rgba(255,220,170,.25); border-radius: 12px; padding: 9px 10px 9px 34px; position: relative; cursor: pointer; min-height: 44px; }
.music-opt::before { content: ''; position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; margin-top: -8px; border-radius: 50%; border: 2px solid rgba(255,220,170,.6); }
.music-opt[aria-checked=true] { background: rgba(255,154,60,.22); border-color: #ff9a3c; }
.music-opt[aria-checked=true]::before { background: #ff9a3c; border-color: #ffd29a; box-shadow: inset 0 0 0 2px #3a2410; }
body.big-ui .music-list { grid-template-columns: 1fr; }
