* { 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; }

/* HUD */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0 14px; pointer-events: none; }
.hud-score { font-size: 34px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 0 12px rgba(255,190,90,.8), 0 2px 0 rgba(0,0,0,.4); }
.hud-sub { font-size: 16px; display: flex; align-items: center; gap: 6px; opacity: .9; }
.fly-dot { width: 10px; height: 10px; border-radius: 50%; background: #d9ff7a; box-shadow: 0 0 8px 3px rgba(200,255,110,.7); display: inline-block; }
.hud-shield { margin-left: 8px; filter: drop-shadow(0 0 6px #7fd8ff); }
.hud-right { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255,220,160,.5); background: rgba(10,14,45,.55);
  color: #ffe9bf; font-size: 16px; font-weight: 800; cursor: pointer; backdrop-filter: blur(4px); }
.icon-btn.off { opacity: .45; text-decoration: line-through; }

/* 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; }
/* Translucent title paint reveals the sky without moving controls. */
#screen-title { background: radial-gradient(ellipse at center, rgba(5,7,26,.12), rgba(5,7,26,.45)); }
body:not(.hi-contrast) #screen-title .panel { border-image: none; border-color: rgba(255,220,160,.28);
  background: linear-gradient(180deg, rgba(30,26,80,.48), rgba(12,18,40,.56)); }
.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'); }
.btn .bi.ic-shield-i { background-image: url('../assets/ui/ic_shield.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; }
}

/* ---------- v1.1 ---------- */
.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; }
.jar-i { display: inline-block; width: 18px; height: 22px; vertical-align: -5px; margin-right: 4px; background: url('../assets/ui/jar.webp') center / contain no-repeat, radial-gradient(circle, #d9ff7a 30%, transparent 32%); }
.jar-chip { background: rgba(255,255,255,.08); border-radius: 999px; padding: 2px 10px; }
.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; }
.jar-line { font-size: 16px; color: #e8ffc0; }
.big-jar { font-size: 20px; }
.big-jar b { color: #e8ffc0; font-size: 24px; }
.mission-list { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.mission { background: rgba(255,255,255,.07); border-radius: 12px; padding: 9px 11px; }
.mission.done { background: rgba(140,255,170,.12); }
.mission .mt { font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.mission .mr { font-size: 13px; color: #e8ffc0; white-space: nowrap; }
.mission .bar { height: 7px; background: rgba(255,255,255,.12); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.mission .bar div { height: 100%; background: linear-gradient(90deg, #ffcf6e, #ff9a3c); }
.mission .mp { font-size: 12px; opacity: .75; margin-top: 3px; font-family: "Trebuchet MS", system-ui, sans-serif; }
.mission-list.compact .mission { padding: 6px 9px; }
.mission-done { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #bfffcf; }
.rank-box { background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px; }
.rank-box b { color: #ffd890; }
.meter { height: 10px; background: rgba(255,255,255,.12); border-radius: 5px; overflow: hidden; margin: 6px 0; }
#m-meter { height: 100%; width: 0; background: linear-gradient(90deg, #ffe27a, #ffb347); }
.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; }
.skin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skin { background: rgba(255,255,255,.07); border-radius: 12px; padding: 6px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px solid transparent; }
.skin.equipped { border-color: #ffcf6e; box-shadow: 0 0 12px rgba(255,190,90,.4); }
.skin img { height: 54px; width: 54px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(255,180,80,.45)); }
.skin.locked img { filter: brightness(.55) saturate(.6); }
.skin .sn { font-size: 12px; text-align: center; line-height: 1.1; min-height: 2.2em; display: flex; align-items: center; }
.skin .btn { font-size: 12px; padding: 6px 8px; min-height: 32px; width: 100%; }
.skin .need { font-size: 10px; opacity: .75; 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; } }

/* ---------- v1.2 ---------- */
.credits { margin: 0; font-size: 11px; opacity: .6; font-family: "Trebuchet MS", system-ui, sans-serif; }
.play-row .btn.big { flex: 2; }
.boost-btn { flex: 1; font-size: 15px; position: relative; }
.row.three .btn { font-size: 15px; padding: 9px 6px; }
.btn .bi.ic-boost-i { background-image: url('../assets/ui/ic_boost.webp'); }
.btn .bi.ic-drift-i { background-image: url('../assets/ui/ic_drift.webp'); }
.btn .bi.ic-camera-i { background-image: url('../assets/ui/ic_camera.webp'); }
.btn .bi.ic-settings-i { background-image: url('../assets/ui/ic_settings.webp'); }
.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; }
.ti.ic-calendar-i { background-image: url('../assets/ui/ic_calendar.webp'), radial-gradient(circle, #ffb347 60%, transparent 62%); }
.ti.ic-album-i { background-image: url('../assets/ui/ic_album.webp'), radial-gradient(circle, #7b68c8 60%, transparent 62%); }
.ti.ic-records-i { background-image: url('../assets/ui/ic_records.webp'), radial-gradient(circle, #ffb347 60%, transparent 62%); }
.ti.ic-settings-i { background-image: url('../assets/ui/ic_settings.webp'), radial-gradient(circle, #7b68c8 60%, transparent 62%); }
.tile .dot { position: absolute; top: 6px; right: 14%; width: 10px; height: 10px; border-radius: 50%; background: #ffcf3a; box-shadow: 0 0 6px #ffcf3a; }
.fest-banner { font: inherit; color: #fff1dc; display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 10px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(90deg, rgba(255,140,50,.28), rgba(255,200,120,.12)); border: 1px solid rgba(255,180,100,.5); }
.fest-banner img { width: 30px; height: 30px; object-fit: contain; }
.fest-banner b { color: #ffd890; font-weight: normal; display: block; font-size: 15px; }
.fest-banner small { display: block; font-size: 11px; opacity: .85; font-family: "Trebuchet MS", system-ui, sans-serif; }
.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; }
.boost-card .bt .bi { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.28em; margin-right: .3em; background: center / contain no-repeat; }
.boost-card .bt .bi.ic-shield-i { background-image: url('../assets/ui/ic_shield.webp'); }
.boost-card .bt .bi.ic-boost-i { background-image: url('../assets/ui/ic_boost.webp'); }
.badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 0; }
.badges span { font-size: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,220,170,.3); border-radius: 999px; padding: 2px 9px; font-family: "Trebuchet MS", system-ui, sans-serif; }
.small-stats b { font-size: 22px; }
.cal-string { display: flex; justify-content: space-between; align-items: flex-start; position: relative; padding: 14px 4px 4px; }
.cal-string::before { content: ''; position: absolute; left: 6px; right: 6px; top: 12px; height: 2px; background: rgba(255,220,170,.4); border-radius: 2px; transform: rotate(-1deg); }
.cal-l { width: 12%; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; position: relative; font-family: "Trebuchet MS", system-ui, sans-serif; }
.cal-l i { width: 30px; height: 40px; background: url('../assets/lantern.webp') center / contain no-repeat; filter: grayscale(1) brightness(.45); }
.cal-l.lit i { filter: drop-shadow(0 0 8px rgba(255,170,60,.9)); }
.cal-l.rest i { background-image: radial-gradient(circle at 60% 40%, transparent 40%, #dfe8ff 42%, #dfe8ff 58%, transparent 60%); filter: drop-shadow(0 0 6px #b8c8ff); }
.cal-l.today i { animation: floaty 1.6s ease-in-out infinite alternate; }
.cal-rewards { font-size: 12px; opacity: .85; font-family: "Trebuchet MS", system-ui, sans-serif; }
.cal-charm { font-size: 14px; }
.album-list { display: flex; flex-direction: column; gap: 8px; }
.const { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.06); border-radius: 12px; padding: 7px; text-align: left; }
.const canvas { width: 120px; height: 84px; border-radius: 8px; background: #0b0d2e; flex: none; }
.const .cn { font-size: 15px; color: #ffd890; }
.const .cp { font-size: 12px; opacity: .8; font-family: "Trebuchet MS", system-ui, sans-serif; }
.const .cv { font-size: 12px; font-style: italic; color: #dfe8ff; font-family: Georgia, serif; margin-top: 2px; }
.trail-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.trail-list .btn { font-size: 13px; padding: 7px 10px; min-height: 36px; }
.trail-list .btn.on { outline: 2px solid #ffcf6e; }
.rec-bests { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rec-bests div { background: rgba(255,255,255,.06); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; }
.rec-bests span { font-size: 12px; opacity: .75; }
.rec-bests b { font-size: 20px; color: #ffd890; font-weight: normal; }
.rec-flights { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-family: "Trebuchet MS", system-ui, sans-serif; text-align: left; }
.rec-flights .fl { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; background: rgba(255,255,255,.05); border-radius: 8px; padding: 4px 7px; align-items: center; }
.rec-flights .fl b { color: #ffd890; font-size: 14px; }
.rec-ach { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; text-align: left; }
.rec-ach div { font-size: 12px; background: rgba(255,255,255,.05); border-radius: 8px; padding: 5px 7px; opacity: .55; font-family: "Trebuchet MS", system-ui, sans-serif; }
.rec-ach div.got { opacity: 1; background: rgba(255,210,120,.14); }
.rec-ach div b { display: block; font-family: 'Lilita', sans-serif; font-weight: normal; font-size: 13px; color: #ffd890; }
.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; }
.tok-i { width: 26px; height: 26px; object-fit: contain; vertical-align: -6px; margin-right: 4px; }
.fest-list { display: flex; flex-direction: column; gap: 4px; font-size: 13px; text-align: left; font-family: "Trebuchet MS", system-ui, sans-serif; }
.fest-list div { background: rgba(255,255,255,.05); border-radius: 8px; padding: 5px 8px; }
.fest-list div.on { background: rgba(255,170,80,.18); }
.skin .tok-price { font-size: 11px; }
#pc-frames .btn.on { outline: 2px solid #ffcf6e; }

/* accessibility body classes */
body.left-hand .hud-right { position: absolute; left: max(14px, env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); }
body.left-hand .hud-left { margin-left: auto; text-align: right; }
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 .icon-btn { width: 60px; height: 60px; }
body.big-ui .hud-score { font-size: 42px; }
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.hi-contrast .hud-score { text-shadow: 0 0 4px #000, 0 0 2px #000; }
body.hi-contrast .icon-btn { border: 3px solid #fff; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }
#hud.drift .hud-sub { display: none; }
/* 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(.ads-real) .ads-real:not(.ads-web) { display: none !important; }
body:not(.ads-real):not(.release) .ads-web { display: none !important; }
body:not(.ads-demo) .ads-demo { display: none !important; }
/* 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; }
/* v1.3 Music Box */
.mb-list { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.mb-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,220,170,.18); border-radius: 12px; padding: 7px 8px; }
.mb-row.sel { background: rgba(255,210,120,.18); border-color: rgba(255,210,120,.7); }
.mb-row.locked { opacity: .8; background: rgba(255,255,255,.03); }
.mb-pick { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 1px; min-height: 40px; justify-content: center; overflow-wrap: anywhere; }
.mb-pick b { font-size: 15px; color: #ffe2a8; font-weight: normal; }
.mb-pick span, .mb-goal span { font-size: 12px; opacity: .8; font-family: "Trebuchet MS", system-ui, sans-serif; }
.mb-pick:focus-visible, .mb-play:focus-visible { outline: 2px solid #ffd890; outline-offset: 2px; border-radius: 8px; }
.mb-play { min-width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid rgba(255,220,170,.4); background: rgba(255,255,255,.08); color: #ffe2a8; font-size: 16px; cursor: pointer; }
.mb-play.on { background: #ffcf3a; color: #3a1a00; }
.mb-goal { display: flex; flex-direction: column; gap: 3px; }
.mb-goal b { font-size: 15px; color: #cfc8ee; font-weight: normal; }
.mb-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.mb-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, #ffe08a); }

/* Very narrow phones (320px): keep postcard frame names ('Storybook') on one line. */
@media (max-width: 359px) { #screen-postcard .row .btn.small { padding-left: 6px; padding-right: 6px; font-size: 12px; overflow-wrap: normal; hyphens: none; } }
