/* FANTACITY - storybook violet and starlight gold on glass, over the 3D realms */
:root {
  --ink: #fbf6ff; --mute: #c4b6dc; --bg: #160e2a; --glass: rgba(28, 18, 52, 0.84); --line: rgba(255, 255, 255, 0.14);
  --gold: #ffd56a; --gold2: #ff9fd0; --violet: #9a6aff; --mint: #8affd0; --red: #ff7a8a;
  --title: 'Cinzel Decorative', Georgia, serif; --font: Fredoka, 'Trebuchet MS', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
#buildTag { position: fixed; right: 6px; bottom: calc(4px + var(--safe-b)); font: 10px system-ui, sans-serif; color: rgba(255, 255, 255, 0.35); z-index: 90; pointer-events: none; }
.cur { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.dot { display: inline-block; min-width: 9px; height: 9px; border-radius: 9px; background: var(--red); font-style: normal; font-size: 10px; line-height: 9px; vertical-align: 2px; }
.palTabs .dot { min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; color: #fff; font-weight: 700; }

/* --- loading */
#loading { position: fixed; inset: 0; background: radial-gradient(circle at 50% 40%, #3a2470, var(--bg) 70%); display: grid; place-items: center; z-index: 80; transition: opacity 0.5s; }
#loading.gone { opacity: 0; pointer-events: none; }
.ld { text-align: center; width: 260px; }
.ld b { display: block; font: 900 38px var(--title); background: linear-gradient(180deg, #fff6d8, var(--gold) 55%, #ff9a5a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld .bar { height: 5px; background: rgba(255, 255, 255, 0.12); border-radius: 3px; margin: 14px 0 9px; overflow: hidden; }
.ld .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--gold2), var(--gold)); transition: width 0.3s; }
.ld span { color: var(--mute); font-size: 14px; }

/* --- screens, cards, buttons */
.screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b)); background: rgba(10, 6, 22, 0.5); }
#sheet.see { background: linear-gradient(180deg, rgba(10, 6, 22, 0), rgba(10, 6, 22, 0.35)); }
.card { width: min(470px, 100%); max-height: 100%; overflow-y: auto; background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5); touch-action: pan-y; }
.card.wide { width: min(680px, 100%); }
.card h2 { margin: 0 0 10px; font: 900 26px/1.15 var(--title); color: #fff6dc; }
.card h3 { margin: 18px 0 6px; font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); }
.card p { margin: 6px 0 10px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.kick { display: inline-block; font-weight: 700; font-size: 12.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--acc, var(--gold)); margin-bottom: 4px; }
.btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn { flex: 1; min-height: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.09); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn.gold { background: linear-gradient(180deg, #ffe08a, #ffb84a); border-color: #ffd56a; color: #3a2008; }
.btn.big { min-height: 54px; font-size: 18px; }
.btn.sm { flex: none; min-height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.55; }
.btn .cost { color: inherit; }
.link, .linkBtn { background: none; border: 0; color: var(--gold2); padding: 8px 0; font-weight: 600; }
.err { color: var(--red); min-height: 18px; font-size: 13px; margin: 4px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.row > span { font-weight: 600; }
.seg { display: flex; background: rgba(255, 255, 255, 0.07); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--mute); }
.seg button.on { background: var(--ink); color: #241640; }
input[type=range] { accent-color: var(--gold); width: 160px; }
.card input:not([type=range]) { width: 100%; height: 46px; border-radius: 13px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--ink); padding: 0 14px; font: inherit; margin-bottom: 8px; }
form { margin: 0; }
.cost { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; margin-right: 6px; }
.cost:last-child { margin-right: 0; }
.cost.short { color: var(--red); }
.cost.free { color: var(--mint); }
.curPill { display: inline-flex; align-items: center; gap: 5px; background: rgba(0, 0, 0, 0.32); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px 4px 7px; font-weight: 700; }
.curBox, .curRow { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- the menu */
#menu { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); background: linear-gradient(90deg, rgba(18, 10, 40, 0.88) 0, rgba(18, 10, 40, 0.62) 400px, rgba(18, 10, 40, 0) 680px); overflow-y: auto; }
.menuTop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mdt-back { color: var(--mute); text-decoration: none; font-weight: 600; font-size: 14px; }
.acct { display: inline-flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 600; }
.acct .mxc { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); }
.menuBody { margin: auto 0; width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 20px 0; }
.logo { display: flex; flex-direction: column; }
.logo .l1 { font: 900 clamp(40px, 11vw, 58px)/1 var(--title); background: linear-gradient(180deg, #fffbe8 10%, var(--gold) 55%, #ff9a5a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 rgba(60, 20, 90, 0.6)) drop-shadow(0 0 22px rgba(255, 190, 120, 0.35)); }
.logo .l2 { color: #e8dcff; font-weight: 500; letter-spacing: 2px; text-transform: uppercase; font-size: 12.5px; margin-top: 6px; }
.startBtn { --acc: var(--gold2); text-align: left; border: 0; border-radius: 20px; padding: 18px 20px; background: linear-gradient(135deg, #ffe08a, #ffb84a 55%, var(--acc)); color: #2a1206; box-shadow: 0 10px 30px rgba(255, 170, 80, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.12); display: flex; flex-direction: column; animation: glow 2.6s ease-in-out infinite; }
.startBtn b { font-size: 24px; }
.startBtn span { font-weight: 500; opacity: 0.8; }
@keyframes glow { 50% { box-shadow: 0 10px 40px rgba(255, 190, 110, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.12); } }
.progress { color: var(--mute); font-size: 13.5px; margin-top: -6px; }
.menuGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mBtn { text-align: left; border: 1px solid var(--line); background: rgba(30, 18, 60, 0.72); border-radius: 16px; padding: 13px 14px; display: flex; flex-direction: column; gap: 2px; }
.mBtn b { font-size: 16.5px; }
.mBtn span { color: var(--mute); font-size: 12.5px; }
.mBtn.town { background: linear-gradient(135deg, rgba(120, 80, 220, 0.75), rgba(60, 30, 120, 0.8)); }
.linkBtn { align-self: flex-start; }

/* --- the level HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hudTop { position: absolute; top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.hudTop > * { pointer-events: auto; }
.timer { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 7px 12px 8px; min-width: 128px; }
.timer b { font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.timer.low b { color: var(--red); animation: pulse 0.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.tTrack { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); margin: 6px 0 4px; overflow: hidden; }
.tTrack i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--violet), var(--gold)); border-radius: 3px; }
.tTrack em { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0, 0, 0, 0.5); }
.tStars i { font-style: normal; color: rgba(255, 255, 255, 0.22); font-size: 15px; margin-right: 2px; }
.tStars i.on { color: var(--gold); text-shadow: 0 0 8px rgba(255, 200, 80, 0.7); }
.hudMid { flex: 1; text-align: center; display: flex; flex-direction: column; align-items: center; pointer-events: none; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
.hudMid span { font-size: 13px; opacity: 0.9; }
.hudMid b { font-size: 22px; }
.ibtn { width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); display: grid; place-items: center; font-size: 22px; flex: none; }
.ibtn svg { width: 22px; height: 22px; fill: currentColor; }
.ibtn.sm { width: 38px; height: 38px; font-size: 19px; border-radius: 11px; }
#hintArrow { position: absolute; top: calc(80px + var(--safe-t)); left: 50%; width: 46px; height: 46px; display: none; pointer-events: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6)); }
#hintArrow svg { width: 100%; height: 100%; fill: var(--gold); }
.findList { position: absolute; right: calc(10px + var(--safe-r)); top: calc(70px + var(--safe-t)); display: flex; flex-direction: column; gap: 5px; max-height: calc(100% - 200px); overflow-y: auto; }
.fi { display: flex; align-items: center; gap: 7px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 3px 11px 3px 3px; font-size: 13.5px; font-weight: 500; transition: opacity 0.4s; }
.fi img { width: 36px; height: 36px; border-radius: 9px; background: rgba(255, 255, 255, 0.08); }
.fi.got { opacity: 0.5; }
.fi.got span { text-decoration: line-through; }
.fi.got img { background: rgba(138, 255, 208, 0.25); }
.fi.pop { animation: popIn 0.6s; }
@keyframes popIn { 30% { transform: scale(1.15); background: rgba(255, 213, 106, 0.4); } }
.listBtn { display: none; }
.hintBtn { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); height: 54px; padding: 0 16px 0 12px; border-radius: 27px; border: 1px solid rgba(255, 213, 106, 0.5); background: linear-gradient(180deg, rgba(90, 60, 30, 0.85), rgba(50, 30, 20, 0.85)); color: var(--gold); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.hintBtn svg { width: 24px; height: 24px; }
.hintBtn i { font-style: normal; background: var(--gold); color: #3a2008; border-radius: 10px; min-width: 20px; height: 20px; line-height: 20px; font-size: 12.5px; text-align: center; }
.hintBtn.off { opacity: 0.45; }
body.touch .hintBtn { bottom: calc(104px + var(--safe-b)); }

/* the touch stick and jump */
#controls { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
body:not(.touch) #controls { display: none; }
#stickZone { position: absolute; left: 0; bottom: 0; width: 45%; height: 55%; pointer-events: auto; touch-action: none; }
#stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(20, 10, 40, 0.25); left: 90px; top: calc(100% - 110px - var(--safe-b)); pointer-events: none; opacity: 0.55; transition: opacity 0.2s; }
#stick.on { opacity: 1; }
#stick i { position: absolute; left: 34px; top: 34px; width: 52px; height: 52px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
#jumpBtn { position: absolute; right: calc(18px + var(--safe-r)); bottom: calc(24px + var(--safe-b)); width: 68px; height: 68px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); background: rgba(40, 20, 80, 0.55); pointer-events: auto; touch-action: none; display: grid; place-items: center; }
#jumpBtn svg { width: 30px; height: 30px; fill: #fff; }
body[data-phase=town] .hintBtn { display: none; }

/* --- the town HUD */
#townHud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#townHud > * { pointer-events: auto; }
.tTop { position: absolute; top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.tTop > * { pointer-events: auto; }
.tName { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px 8px; min-width: 0; }
.tName button { background: none; border: 0; padding: 0; font: 700 18px var(--title); color: #fff6dc; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tLvl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mute); }
.lvlTrack { flex: 1; min-width: 60px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.lvlTrack i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--gold)); }
.tInfo { margin-left: auto; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tStats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tStats span { background: rgba(0, 0, 0, 0.38); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.tSide { position: absolute; right: calc(10px + var(--safe-r)); top: calc(96px + var(--safe-t)); display: flex; flex-direction: column; gap: 8px; }
.sbtn { position: relative; width: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.sbtn b { font-size: 21px; line-height: 1.1; }
.sbtn span { font-size: 11px; font-weight: 600; color: var(--mute); text-align: center; line-height: 1.15; }
.sbtn .dot { position: absolute; top: 5px; right: 8px; }
.sbtn.gold { background: linear-gradient(180deg, #ffe08a, #ffb84a); color: #3a2008; animation: glow 2s infinite; }
.sbtn.gold span { color: #3a2008; }
.viewBtns { position: absolute; left: calc(10px + var(--safe-l)); top: calc(96px + var(--safe-t)); display: flex; gap: 6px; }
body[data-town=walk] .viewBtns, body[data-town=walk] #palette, body[data-town=walk] #inspector { display: none; }
#palette { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l)); background: linear-gradient(180deg, rgba(22, 12, 44, 0), rgba(22, 12, 44, 0.9) 22%); }
.palHead { display: flex; align-items: center; gap: 8px; }
.palTabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; touch-action: pan-x; }
.palTabs::-webkit-scrollbar, .palCards::-webkit-scrollbar { display: none; }
.palTabs button { border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--mute); }
.palTabs button.on { background: var(--ink); color: #241640; }
.palCards { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; touch-action: pan-x; }
.pc { position: relative; flex: none; width: 104px; border-radius: 14px; border: 2px solid var(--line); background: rgba(30, 18, 60, 0.88); padding: 4px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; }
.pc img { width: 72px; height: 72px; }
.pc b { font-size: 12.5px; font-weight: 600; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; }
.pc .costs { font-size: 12px; display: flex; flex-wrap: wrap; justify-content: center; }
.pc em { position: absolute; top: 4px; left: 5px; font-style: normal; font-size: 10.5px; color: var(--mute); display: flex; align-items: center; gap: 2px; }
.pc.on { border-color: var(--gold); background: rgba(90, 60, 30, 0.9); box-shadow: 0 0 16px rgba(255, 210, 100, 0.4); }
.pc.poor img { opacity: 0.6; }
.pc.placed { opacity: 0.5; }
.palEmpty { color: var(--mute); padding: 18px 6px; font-size: 14px; }
.palHint { color: var(--mute); font-size: 12px; text-align: center; }
#inspector { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); width: min(520px, calc(100% - 20px)); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 20px; padding: 12px 14px; }
.insTop { display: flex; align-items: center; gap: 10px; }
.insTop b { font-size: 18px; }
.insTop .lv { background: rgba(255, 213, 106, 0.18); color: var(--gold); border-radius: 999px; padding: 2px 9px; font-size: 12.5px; font-weight: 600; }
.insTop .x { margin-left: auto; background: none; border: 0; font-size: 18px; color: var(--mute); padding: 4px 6px; }
.insStats { color: var(--mute); font-size: 13.5px; margin: 2px 0 4px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.insRow { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.insRow > span { width: 46px; font-size: 13px; color: var(--mute); flex: none; }
.swatches { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.swatches button { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); padding: 0; }
.swatches button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.insBtns { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.insBtns .btn { min-height: 40px; font-size: 14px; padding: 0 12px; }

/* --- toast */
#toast { position: fixed; left: 50%; top: calc(128px + var(--safe-t)); transform: translate(-50%, -10px); z-index: 60; background: rgba(30, 18, 60, 0.92); border: 1px solid rgba(255, 213, 106, 0.45); color: #fff6dc; padding: 9px 18px; border-radius: 999px; font-weight: 600; opacity: 0; transition: opacity 0.25s, transform 0.25s; pointer-events: none; max-width: calc(100% - 30px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* --- level intro, results */
.introList { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 12px 0; }
.introList.small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.introItem { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; background: rgba(255, 255, 255, 0.07); border-radius: 14px; padding: 8px 6px; font-size: 13px; font-weight: 500; }
.introItem img { width: 64px; height: 64px; }
.introItem.miss { opacity: 0.45; }
.introMeta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13.5px; font-weight: 600; }
.introMeta span { background: rgba(0, 0, 0, 0.3); border-radius: 999px; padding: 4px 11px; }
.introMeta .stars3 { color: var(--gold); }
.introMeta .stars2 { color: #ffe8b0; }
.treasureNote { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(255, 213, 106, 0.16), rgba(255, 159, 208, 0.1)); border: 1px solid rgba(255, 213, 106, 0.35); border-radius: 14px; padding: 6px 12px 6px 6px; font-size: 14px; margin-top: 10px; }
.treasureNote img { width: 56px; height: 56px; flex: none; }
.treasureNote.got { animation: popIn 0.8s 1.2s both; }
.bigStars { font-size: 46px; letter-spacing: 6px; margin: 2px 0 6px; }
.bigStars i { font-style: normal; color: rgba(255, 255, 255, 0.18); display: inline-block; }
.bigStars i.on { color: var(--gold); text-shadow: 0 0 18px rgba(255, 200, 80, 0.8); animation: starIn 0.5s both; }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } 70% { transform: scale(1.3); } }
.rewards { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.rw { flex: 1; min-width: 100px; background: rgba(0, 0, 0, 0.3); border-radius: 14px; padding: 9px 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; }
.rw .cur { grid-row: span 2; width: 30px; height: 30px; }
.rw b { font-size: 20px; }
.rw span { font-size: 12px; color: var(--mute); }

/* --- realms */
.realms { display: grid; gap: 10px; }
.realm { border-radius: 16px; padding: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--a) 70%, #000), color-mix(in srgb, var(--b) 45%, #000)); border: 1px solid var(--line); }
.realm.locked { filter: grayscale(0.7) brightness(0.65); }
.rTop b { font: 700 17px var(--title); display: block; }
.rTop span { font-size: 13px; opacity: 0.85; }
.lvRow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 9px; }
.lvb { border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.35); border-radius: 12px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; }
.lvb b { font-size: 17px; }
.lvb span { font-size: 12.5px; color: var(--gold); }
.lvb span i { font-style: normal; color: rgba(255, 255, 255, 0.25); }
.lvb.done { background: rgba(0, 0, 0, 0.5); }
.lvb.locked { opacity: 0.6; }

/* --- achievements, upgrades */
.townSum { display: flex; gap: 8px; margin: 6px 0 10px; }
.townSum span { background: rgba(0, 0, 0, 0.3); border-radius: 999px; padding: 4px 11px; font-weight: 600; font-size: 13.5px; }
.achList, .upList { display: grid; gap: 7px; margin-top: 8px; }
.ach, .upg { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255, 255, 255, 0.06); border-radius: 13px; padding: 9px 12px; }
.ach > div, .upg > div { display: flex; flex-direction: column; min-width: 0; }
.ach span, .upg > div > span:last-child { font-size: 12.5px; color: var(--mute); }
.ach em, .upg em { font-style: normal; font-size: 13px; color: var(--mute); white-space: nowrap; }
.ach.ready { background: rgba(255, 213, 106, 0.14); border: 1px solid rgba(255, 213, 106, 0.4); }
.ach.claimed em { color: var(--mint); }
.ach.todo { opacity: 0.75; }
.pips { display: inline-flex; gap: 3px; margin-left: 4px; }
.pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
.pips i.on { background: var(--gold); }

/* --- phones */
@media (max-width: 640px) {
  #menu { background: linear-gradient(180deg, rgba(18, 10, 40, 0.15), rgba(18, 10, 40, 0.88) 42%); }
  .menuBody { margin: auto 0 0; }
  .findList { top: calc(76px + var(--safe-t)); right: calc(8px + var(--safe-r)); left: calc(8px + var(--safe-l)); flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px; max-height: none; overflow: visible; }
  .fi { padding: 2px; border-radius: 10px; }
  .fi img { width: 34px; height: 34px; }
  .fi span { display: none; }
  .fi.got span { text-decoration: none; }
  body.listOpen .findList { flex-direction: column; align-items: flex-end; left: auto; }
  body.listOpen .fi { padding: 2px 10px 2px 2px; }
  body.listOpen .fi span { display: inline; }
  body.listOpen .fi.got span { text-decoration: line-through; }
  .listBtn { display: block; position: absolute; left: calc(8px + var(--safe-l)); top: calc(124px + var(--safe-t)); border: 1px solid var(--line); background: var(--glass); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 13px; }
  #hintArrow { top: calc(150px + var(--safe-t)); }
  #toast { top: calc(170px + var(--safe-t)); }
  .timer { min-width: 108px; }
  .timer b { font-size: 22px; }
  .tSide { top: auto; bottom: calc(196px + var(--safe-b)); }
  body[data-town=walk] .tSide { bottom: calc(110px + var(--safe-b)); }
  .tStats span { font-size: 12px; padding: 2px 8px; }
  .tName { flex: 1; padding: 5px 10px 7px; }
  .tName button { font-size: 15px; max-width: 100%; }
  .tLvl { white-space: nowrap; }
  .tInfo { position: absolute; right: 0; top: 54px; }
  .tTop .curPill { padding: 2px 8px 2px 5px; font-size: 13px; }
  .tTop .curBox { flex-wrap: nowrap; }
  .viewBtns { top: calc(112px + var(--safe-t)); }
  .tTop .ibtn { width: 42px; height: 42px; }
  .pc { width: 92px; }
  .pc img { width: 62px; height: 62px; }
}
