/* Ember Moth styles - adapted from the Lantern Drift / Glow Sort UI kit (same panel/button art pipeline).
 * Palette: deep indigo, warm amber, muted forest greens, cream paper. */
* { 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 has no ads / no real-money 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; }

/* ---------- Ember Moth ---------- */
html, body { background: #0d0c2a; }
.panel { background: linear-gradient(180deg, rgba(32,30,78,.86), rgba(16,18,46,.92)); }
.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-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-settings-i { background-image: url('../assets/ui/ic_settings.webp'); }
.btn .bi.ic-sky-i { background-image: url('../assets/ui/ic_sky.webp'); }
.btn .bi.ic-shield-i { background-image: url('../assets/ui/ic_shield.webp'); }
.ti.ic-missions-i { background-image: url('../assets/ui/ic_missions.webp'), radial-gradient(circle, #ffb347 60%, transparent 62%); }
.ti.ic-moths-i { background-image: url('../assets/ui/ic_moths.webp'), radial-gradient(circle, #8fbf7a 60%, transparent 62%); }
.ti.ic-skins-i { background-image: url('../assets/ui/ic_skins.webp'), radial-gradient(circle, #ff9ab0 60%, transparent 62%); }
.ti.ic-records-i { background-image: url('../assets/ui/ic_records.webp'), radial-gradient(circle, #ffd447 60%, transparent 62%); }
.ti.ic-calendar-i { background-image: url('../assets/ui/ic_calendar.webp'), radial-gradient(circle, #78b2ff 60%, transparent 62%); }
.ti.ic-settings-i { background-image: url('../assets/ui/ic_settings.webp'), radial-gradient(circle, #7b68c8 60%, transparent 62%); }
.mini { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; background: center / contain no-repeat; }
.mini.ic-ember-i { background-image: url('../assets/ui/ic_ember.webp'), radial-gradient(circle, #ff9a3c 45%, transparent 50%); }
.mini.ic-moth-i { background-image: url('../assets/ui/ic_moth.webp'), radial-gradient(circle, #ffd890 45%, transparent 50%); }
.logo-img { max-width: 290px; }
.group-label { font-size: 13px; text-align: left; color: #cfe3b8; opacity: .85; margin: 2px 0 -6px 4px; letter-spacing: .5px; }
.rank-chip { background: rgba(143,191,122,.22); border: 1px solid rgba(160,210,140,.45); border-radius: 999px; padding: 1px 10px; font-size: 13px; color: #dff3cc; }
.sky-btn { align-self: center; padding: 6px 14px; min-height: 36px; }
.sky-btn b { color: #ffe2a8; font-weight: normal; }
.meta-line.center { justify-content: center; }
#btn-shield { font-size: 13px; line-height: 1.15; }
#btn-shield.on { background: rgba(160,220,255,.18); border-color: #bfe8ff; }

/* 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: left; flex: 1; min-width: 0; padding-left: 4px; }
.hud-height { font-size: 26px; color: #ffe2a8; text-shadow: 0 0 12px rgba(255,190,90,.7), 0 2px 0 rgba(0,0,0,.4); line-height: 1; }
.hud-height b { font-weight: normal; }
.hud-zone { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #dff3cc; }
.hud-moths { display: flex; align-items: center; gap: 4px; font-size: 24px; color: #fff1cf; background: rgba(16,14,50,.55); border: 1px solid rgba(255,220,170,.3); border-radius: 999px; padding: 3px 12px 3px 8px; }
.hud-moths .mini { width: 24px; height: 24px; }
.hud-moths b { font-weight: normal; min-width: 1.2em; text-align: center; }
.wind-row { display: flex; align-items: center; gap: 6px; margin: 6px auto 0; max-width: 340px; font-size: 12px; font-family: "Trebuchet MS", system-ui, sans-serif; }
.wind-row .wl { opacity: .8; }
.wind-bar { flex: 1; height: 9px; background: rgba(255,255,255,.12); border-radius: 5px; position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.15); }
#wind-fill { height: 100%; width: 10%; background: linear-gradient(90deg, #9fd1ff, #c9d8ff); border-radius: 5px; transition: width .25s; }
#wind-fill.warn { background: linear-gradient(90deg, #ffd27a, #ff9a6a); }
#wind-mark { position: absolute; right: 0; top: -2px; bottom: -2px; width: 3px; background: #ffe2a8; }
.wt { min-width: 92px; text-align: right; opacity: .9; }
.hud-msg { margin: 8px auto 0; max-width: 330px; text-align: center; font-size: 15px; background: rgba(20,18,60,.82); border: 1px solid rgba(255,210,140,.5); border-radius: 12px; padding: 6px 10px; }
.hud-msg.cold { border-color: #9fd1ff; }
.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; }
#glow-wrap { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 6px; pointer-events: none; font-size: 13px; opacity: .9; }
.glow-bar { width: 120px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; border: 1px solid rgba(255,230,180,.25); }
#glow-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ffb347, #ffe2a8); }

/* lists */
.pick-list, .card-list, .mission-list { display: flex; flex-direction: column; gap: 7px; }
.pick { font: inherit; color: #fdf3d8; text-align: left; background: rgba(255,255,255,.07); border: 1px solid rgba(255,220,170,.25); border-radius: 14px; padding: 9px 12px; cursor: pointer; touch-action: manipulation; }
.pick small { display: block; font-size: 12px; opacity: .8; font-family: "Trebuchet MS", system-ui, sans-serif; }
.pick.sel { border: 2px solid #ffcf6e; background: rgba(255,200,110,.16); }
.pick.locked { opacity: .5; }
.mission { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 10px; text-align: left; display: flex; flex-direction: column; gap: 5px; }
.mission .mt { font-size: 15px; }
.mission .mr { font-size: 12px; opacity: .85; font-family: "Trebuchet MS", system-ui, sans-serif; }
.mission.done { background: rgba(143,191,122,.22); }
.mini-missions .mission { padding: 5px 8px; } .mini-missions .mt { font-size: 13px; }
.rank-box { background: rgba(143,191,122,.14); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.rank-box b { color: #dff3cc; font-weight: normal; }
.meter { height: 10px; background: rgba(255,255,255,.12); border-radius: 5px; overflow: hidden; }
.meter div { height: 100%; background: linear-gradient(90deg, #ffe27a, #ffb347); }
.sp-card { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.06); border-radius: 14px; padding: 8px; text-align: left; border: 1px solid transparent; }
.sp-card.lead { border-color: #ffcf6e; background: rgba(255,200,110,.14); }
.sp-card.locked .sp-img { filter: brightness(.35) saturate(.2); }
.sp-img { width: 68px; height: 56px; flex: none; object-fit: contain; }
.sp-txt { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sp-txt b { font-weight: normal; color: #ffe2a8; font-size: 16px; }
.sp-txt .bonus { font-size: 13px; color: #dff3cc; font-family: "Trebuchet MS", system-ui, sans-serif; }
.sp-txt small { font-size: 12px; opacity: .8; font-family: "Trebuchet MS", system-ui, sans-serif; }
.sp-card .btn { flex: none; min-width: 64px; }
.skin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sk { font: inherit; color: #fdf3d8; background: rgba(255,255,255,.07); border: 1px solid rgba(255,220,170,.22); border-radius: 12px; padding: 4px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; touch-action: manipulation; position: relative; }
.sk canvas { width: 100%; height: auto; }
.sk span { font-size: 11px; line-height: 1.1; }
.sk.sel { outline: 2px dashed #ffe2a8; outline-offset: 1px; }
.sk.eq { border: 2px solid #ffcf6e; }
.sk.locked canvas { filter: brightness(.45) saturate(.4); }
.skin-info { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 84px; }
.sk-name { font-size: 20px; color: #ffd890; }
.sk-name small { font-size: 13px; color: #bfffcf; }
.rec-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; font-size: 13px; font-family: "Trebuchet MS", system-ui, sans-serif; text-align: left; }
.rec-totals div { background: rgba(255,255,255,.05); border-radius: 9px; padding: 5px 8px; } .rec-totals b { color: #ffe2a8; font-family: 'Lilita', sans-serif; font-weight: normal; }
.ach-list { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.ach { background: rgba(255,255,255,.05); border-radius: 10px; padding: 6px; text-align: left; font-size: 13px; opacity: .55; }
.ach.got { opacity: 1; background: rgba(255,200,110,.16); }
.ach small { display: block; font-size: 11px; font-family: "Trebuchet MS", system-ui, sans-serif; opacity: .85; }
.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: 58px; 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%); }
.score-big { display: flex; flex-direction: column; align-items: center; }
.score-big b { font-size: 54px; line-height: 1; color: #ffe2a8; font-weight: normal; text-shadow: 0 0 20px rgba(255,180,80,.7); }
.score-big span { font-size: 13px; opacity: .75; }
.over-reason { font-size: 15px; color: #dff3cc; font-family: "Trebuchet MS", system-ui, sans-serif; }
.ember-line { font-size: 20px; color: #ffcf8a; } .ember-line b { font-weight: normal; }
.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; }
.panel.wide { width: min(440px, 100%); }
.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%; }
#screen-over, #screen-continue { background: radial-gradient(ellipse at center, rgba(8,8,30,.2), rgba(8,8,30,.7)); }
#screen-pause { background: rgba(8,8,30,.55); }
body.big-ui .hud-height { font-size: 32px; } body.big-ui .hud-moths { font-size: 30px; } body.big-ui .hud-zone, body.big-ui .wind-row { font-size: 15px; }
body.big-ui .hud-msg, body.big-ui .tip { font-size: 18px; } body.big-ui .pick, body.big-ui .sp-txt .bonus { font-size: 16px; } body.big-ui .sk span { font-size: 13px; }
body.big-ui .glow-bar { width: 160px; height: 12px; }
body.hi-contrast .hud-moths, body.hi-contrast .hud-msg, body.hi-contrast .tip, body.hi-contrast .pick, body.hi-contrast .sp-card, body.hi-contrast .mission, body.hi-contrast .sk { background: #000; border: 2px solid #fff; color: #fff; }
body.hi-contrast .hud-height { text-shadow: 0 0 4px #000, 0 0 2px #000; }
body.hi-contrast .wind-bar { border: 2px solid #fff; }
@media (max-height: 700px) { .group-label { display: none; } .tile { min-height: 56px; } }
@media (max-height: 640px) { .hud-height { font-size: 22px; } .score-big b { font-size: 44px; } }

/* 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 {max-width:480px;margin:auto;}
.flight-goal {position:absolute;bottom:max(42px,calc(30px + env(safe-area-inset-bottom)));left:50%;transform:translateX(-50%);width:min(280px,74%);text-align:center;pointer-events:none;font:13px/1.5 "Trebuchet MS",system-ui,sans-serif;color:#e3eed8;text-shadow:0 1px 3px #000;}
.journey-track{height:4px;border-radius:8px;background:#ffffff24;margin-top:4px;overflow:hidden;}
#journey-fill{height:100%;background:#c9e5b7;transition:width .25s;}
#flight-guide {display:none;position:absolute;inset:0;pointer-events:none;align-items:center;justify-content:space-between;padding:34px;}
.flight-card {width:200px;max-width:calc(var(--field-left) - 50px);color:#c9d8d5;}
.flight-card small {font:11px/2 "Trebuchet MS",system-ui,sans-serif;letter-spacing:2px;color:#c7ac7b;}
.flight-card h2 {font-size:27px;line-height:1.1;text-shadow:none;color:#f4e3be;margin:10px 0 14px;}
.flight-card p {font:14px/1.8 "Trebuchet MS",system-ui,sans-serif;color:#aebfc0;}
@media(min-width:780px){body.in-flight #flight-guide{display:flex;}#hud{max-width:460px;} .tip{max-width:380px;}}
@media(orientation:landscape) and (pointer:coarse){#rotate{display:none!important;}}
