/* Starforms. Dark space theme: near-black and charcoal neutrals, color only for meaning.
   Phone: HUD, arena, skills, panel, bottom nav stacked. Desktop: arena left, panel + nav right. */
:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --bg-2: #131417;
  --bg-3: #1b1d21;
  --bg-4: #272a2f;
  --line: #2c2f35;
  --fg: #eceef1;
  --muted: #989ca5;
  --dim: #5f636b;
  --ally: #5fe3cf;
  --foe: #ff6a5c;
  --gold: #ffc94a;
  --gem: #d48cff;
  --shard: #7fb2ff;
  --quanta: #ff9de2;
  --good: #7be38a;
  --on-ally: #05221d;
  --on-foe: #1b0606;
  --on-gold: #2a1d00;
  --on-gem: #260635;
  --on-shard: #06152e;
  --on-quanta: #300823;
  --on-good: #06240b;
  --arena-bg: #030304;
  --scrim: #000000d4;
  --overlay: #000000c8;
  --pip: #ffffff1f;
  --bevel-hi: #ffffff66;
  --bevel-hi-soft: #ffffff26;
  --bevel-lo: #00000066;
  --bevel-top: 2px;
  --bevel-bottom: 4px;
  --r-sm: 8px;
  --r-lg: 14px;
  --r-pill: 999px;
  --display: "Audiowide", "Impact", "Arial Black", sans-serif;
  --ui: "Chakra Petch", "Trebuchet MS", system-ui, sans-serif;
  --r: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --hud-h: 8px;
  --skills-h: 0px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--ui); font-size: 15px;
  -webkit-tap-highlight-color: transparent; overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; font-size: inherit; }
button:focus-visible { outline: 2px solid var(--ally); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; width: 100%; min-height: 90px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; -webkit-user-select: text; user-select: text; }

.app {
  height: 100dvh; display: grid; max-width: 1200px; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(330px, 50%) minmax(0, 1fr) auto;
  row-gap: 8px; padding: 0 12px;
  --hud-h: calc(var(--safe-t) + 58px);   /* space the floating HUD takes at the top of the star field */
  --skills-h: 0px;                        /* space the floating skill row takes at the bottom (set when skills unlock) */
}
.app.has-skills { --skills-h: 50px; }
/* The star field runs edge to edge from the top of the screen down to the panel.
   HUD and skills share its grid cell and float over it. */
.arena { grid-area: 1 / 1; margin: 0 -12px; }
/* Space is the whole screen: the canvas is a fixed backdrop behind everything (under the status bar,
   behind the gutters around the panel). The arena is a transparent play field on top of it. */
body { background: var(--arena-bg); }
.app > .arena { background: transparent; border: 0; border-radius: 0; overflow: visible; }
.app > .arena > canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.app > .panel, .app > .nav { position: relative; z-index: 2; }
.hud { grid-area: 1 / 1; align-self: start; z-index: 3; padding-top: calc(var(--safe-t) + 8px); pointer-events: none; }
.hud > * { pointer-events: auto; }
.skillbar { grid-area: 1 / 1; align-self: end; z-index: 3; padding-bottom: 4px; pointer-events: none; }
.skillbar > * { pointer-events: auto; }
.panel { grid-row: 2; }
.nav { grid-row: 3; }
@media (min-width: 900px) {
  .app { grid-template-columns: minmax(0, 1.3fr) minmax(380px, 1fr); grid-template-rows: minmax(0, 1fr) auto; column-gap: 16px; padding: 12px; --hud-h: 64px; }
  .arena { grid-area: 1 / 1 / 3 / 2; margin: 0; }
  .hud { grid-area: 1 / 1; padding: 10px 12px 0; }
  .skillbar { grid-area: 1 / 1 / 3 / 2; }
  .panel { grid-column: 2; grid-row: 1; }
  .nav { grid-column: 2; grid-row: 2; border-radius: var(--r-lg); margin: 0; padding-bottom: 4px !important; }
}

/* HUD */
.hud { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cur { display: flex; align-items: center; gap: 5px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 5px 10px 5px 6px; font-weight: 700; font-size: 15px; min-width: 0; white-space: nowrap; }
.cur svg { width: 16px; height: 16px; flex: none; }
.cur.gold { color: var(--gold); flex: 1 1 auto; }
.cur.gem { color: var(--gem); flex: 1 1 auto; }
.cur.dps { color: var(--ally); flex: 1 1 auto; }
.cur span { overflow: hidden; text-overflow: ellipsis; }
.cur small { font-size: 9px; font-weight: 700; letter-spacing: .06em; color: var(--muted); margin-left: -1px; }
button.cur { cursor: pointer; }
button.cur:active { background: var(--bg-3); }
.view { position: relative; }
/* breakdown sheets (tap DPS or gold in the HUD) */
.brk { display: flex; flex-direction: column; gap: 2px; }
.brk-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); align-items: baseline; }
.brk-row:last-child { border-bottom: 0; }
.brk-row .k { font-weight: 600; font-size: 14px; }
.brk-row .v { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
.brk-row .bi { display: grid; place-items: center; width: 22px; height: 22px; align-self: center; }
.brk-row .bi svg, .brk-row .bi img { display: block; }
.brk-row .h { grid-column: 2 / -1; font-size: 11px; color: var(--muted); }
.brk-row.off { opacity: .45; }
.brk-row.tot .k, .brk-row.tot .v { font-size: 16px; font-weight: 800; }
.brk-row .tag { margin-left: 6px; vertical-align: 1px; }
.brk-bar { height: 4px; border-radius: 2px; background: var(--bg); overflow: hidden; grid-column: 2 / -1; }
.brk-bar i { display: block; height: 100%; background: var(--ally); }
.menu-btn { position: relative; width: 38px; height: 34px; flex: none; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; color: var(--fg); }
.menu-btn svg { width: 18px; height: 18px; }
.dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--foe); }

/* Arena */
.arena { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--arena-bg); border: 1px solid var(--line); min-height: 0; touch-action: none; }
.arena canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stagebox { position: absolute; top: var(--hud-h); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; pointer-events: none; gap: 3px; }
.st { font-family: var(--display); font-size: 21px; line-height: 1; letter-spacing: .03em; text-shadow: 0 2px 0 #0008; }
.st em { font-style: normal; color: var(--foe); }
.st small { font-size: 12px; color: var(--quanta); margin-left: 6px; vertical-align: 3px; font-family: var(--ui); font-weight: 700; letter-spacing: .05em; }
.pips { display: flex; gap: 4px; }
.pips span { width: 8px; height: 8px; border-radius: 2px; background: var(--pip); transform: rotate(45deg); }
.pips span.on { background: var(--foe); }
.sub { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.badges { position: absolute; top: calc(var(--hud-h) + 66px); left: 8px; right: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; pointer-events: none; }
.badge { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: #000000a0; border: 1px solid var(--line); }
.badge.od { color: var(--gold); } .badge.fz { color: var(--ally); } .badge.sk { color: var(--shard); } .badge.ch { color: var(--foe); }
.arena-ctl { position: absolute; left: 8px; right: 8px; bottom: calc(var(--skills-h) + 10px); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; pointer-events: none; }
.arena-ctl > * { pointer-events: auto; }
.chip-btn { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 8px 14px; font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.chip-btn.boss { background: var(--foe); color: var(--on-foe); border-color: transparent; animation: pulse 1.2s ease-in-out infinite; }
.chip-btn.ad { color: var(--gem); border-color: color-mix(in srgb, var(--gem) 40%, var(--line)); }
.hint { position: absolute; left: 50%; bottom: calc(var(--skills-h) + 56px); transform: translateX(-50%); font-family: var(--display); font-size: 15px; pointer-events: none; animation: bob 1.4s ease-in-out infinite; text-align: center; background: #000000a8; padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); white-space: nowrap; }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
.toasts { position: absolute; left: 50%; top: calc(var(--hud-h) + 92px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 5px; align-items: center; pointer-events: none; width: max-content; max-width: 92%; }
.toast { background: var(--overlay); border: 1px solid var(--line); padding: 5px 11px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; animation: tin .25s ease-out; text-align: center; }
.toast.gold { color: var(--gold); } .toast.gem { color: var(--gem); } .toast.ally { color: var(--ally); } .toast.foe { color: var(--foe); } .toast.shard { color: var(--shard); } .toast.quanta { color: var(--quanta); } .toast.ach { color: var(--good); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* Skills */
.skillbar { display: flex; justify-content: center; gap: 8px; }
.skill { position: relative; width: 60px; height: 44px; flex: none; border-radius: 12px; background: var(--bg-2); border: 2px solid var(--line); overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.skill svg { width: 22px; height: 22px; position: relative; z-index: 1; margin-top: -4px; }
.skill .lbl { display: none; }
/* cooldown: a dark sweep that unwinds clockwise; --cd is the remaining fraction as an angle */
.skill .cd { position: absolute; inset: 0; background: conic-gradient(#000000c4 var(--cd, 0deg), transparent 0); pointer-events: none; }
.skill .t { position: absolute; left: 0; right: 0; bottom: 3px; z-index: 2; font-size: 10px; font-weight: 700; color: var(--fg); text-align: center; line-height: 1; text-shadow: 0 1px 0 #000; }
.skill.ready { border-color: var(--ally); color: var(--ally); }
.skill.on { background: color-mix(in srgb, var(--ally) 30%, var(--bg-2)); border-color: var(--ally); color: var(--fg); }
.skill.locked { opacity: .45; }
.skill.locked .t { color: var(--muted); }

/* Panel */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.view { flex: 1; overflow-y: auto; min-height: 0; padding: 10px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--bg-2); border-top: 1px solid var(--line); margin: 0 -12px; padding: 4px 6px calc(var(--safe-b) + 4px); }
.nav button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 11px; transition: color .2s; color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-radius: 10px; }
.nav button svg { width: 22px; height: 22px; fill: currentColor; }
.nav button[aria-selected="true"] { color: var(--fg); }
.nav button[aria-selected="true"] svg { fill: var(--ally); }
.nav button .dot { top: 4px; right: calc(50% - 16px); }
.nav button.locked { opacity: .3; }

.bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bar .lbl { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-right: auto; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.seg button { padding: 6px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--bg-4); color: var(--fg); }
.seg.wide { width: 100%; } .seg.wide button { flex: 1; }

.row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--bg-3); border: 1px solid transparent; border-radius: var(--r); padding: 8px; }
.row.best { border-color: color-mix(in srgb, var(--ally) 55%, transparent); }
.row.locked { opacity: .5; }
.row.pulse { animation: rowpulse 1.2s ease-in-out infinite; }
@keyframes rowpulse { 50% { border-color: var(--gold); } }
.ico { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.ico canvas { width: 44px; height: 44px; }
.meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nm { font-weight: 700; font-size: 15px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.nm small { color: var(--muted); font-weight: 600; font-size: 12px; }
.ds { font-size: 12px; color: var(--muted); line-height: 1.35; }
.ds b { color: var(--ally); font-weight: 600; }
.ds.one { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--on-ally); background: var(--ally); padding: 1px 6px; border-radius: 4px; }
.tag.foe { background: var(--foe); color: var(--on-foe); }
.ms { height: 4px; border-radius: 2px; background: var(--bg); overflow: hidden; margin-top: 3px; }
.ms i { display: block; height: 100%; background: var(--ally); width: 0; }
.ms.lab i { background: var(--shard); }
.buy { min-width: 88px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--gold); color: var(--on-gold); font-weight: 700; display: flex; flex-direction: column; align-items: center; line-height: 1.15; font-size: 15px; }
.buy small { font-size: 11px; font-weight: 600; opacity: .8; }
.buy.gem { background: var(--gem); color: var(--on-gem); }
.buy.shard { background: var(--shard); color: var(--on-shard); }
.buy.quanta { background: var(--quanta); color: var(--on-quanta); }
.buy.cash { background: var(--good); color: var(--on-good); }
.buy.ally { background: var(--ally); color: var(--on-ally); }
.buy.ad { background: transparent; border: 1px solid var(--gem); color: var(--gem); }
.buy.owned { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.buy:disabled { background: var(--bg); color: var(--dim); border-color: transparent; cursor: default; }
.buy.ad:disabled, .buy.owned:disabled { background: transparent; border: 1px solid var(--line); color: var(--dim); }

.sect { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 6px 2px 0; }
.card { background: var(--bg-3); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; max-width: 62ch; }
.card .big { font-family: var(--display); font-size: 26px; line-height: 1; }
.card .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.statgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.stat { background: var(--bg); border-radius: var(--r-sm); padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wide-btn { width: 100%; padding: 12px; border-radius: 10px; font-weight: 700; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }
.wide-btn.shard { background: var(--shard); color: var(--on-shard); }
.wide-btn.quanta { background: var(--quanta); color: var(--on-quanta); }
.wide-btn.foe { background: var(--foe); color: var(--on-foe); }
.wide-btn:disabled { background: var(--bg); color: var(--dim); }
.wide-btn.ghost { border: 1px solid var(--gem); color: var(--gem); background: transparent; }
.wide-btn.line { border: 1px solid var(--line); color: var(--fg); background: transparent; }
.offer { background: var(--bg-3); border: 1px solid color-mix(in srgb, var(--gem) 55%, transparent); }
.note { font-size: 11px; color: var(--dim); text-align: center; padding: 4px 0 10px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 12px; line-height: 1.5; }
.slot { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); }
.slot .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.slot .acts { display: flex; gap: 6px; }
.slot .acts button { flex: 1; padding: 8px; border-radius: var(--r-sm); font-weight: 700; font-size: 12px; }
.lockcard { border: 1px dashed var(--line); background: transparent; }

/* Modal + sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px); z-index: 10; }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; max-width: 400px; width: 100%; max-height: 100%; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.modal.sheet { max-width: 560px; height: 100%; padding: 0; gap: 0; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sheet-head .seg { flex: 1; }
.sheet-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.x-btn { width: 34px; height: 34px; border-radius: 9px; background: var(--bg-3); font-size: 18px; font-weight: 700; flex: none; }
.modal h2 { font-family: var(--display); font-weight: 400; font-size: 21px; margin: 0; line-height: 1.15; text-wrap: balance; }
.modal p { margin: 0; color: var(--muted); line-height: 1.45; font-size: 14px; }
.modal .reward { font-family: var(--display); font-size: 30px; text-align: center; padding: 4px 0; }
.modal .acts { display: flex; flex-direction: column; gap: 8px; }
.adbar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.adbar i { display: block; height: 100%; width: 0; background: var(--gem); transition: width .1s linear; }
.adscreen { height: 150px; border-radius: 10px; background: var(--bg); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--display); color: var(--muted); font-size: 18px; }
.mbtn { padding: 13px; border-radius: 10px; font-weight: 700; font-size: 15px; letter-spacing: .03em; background: var(--bg-3); border: 1px solid var(--line); }
.mbtn.primary { background: var(--ally); color: var(--on-ally); border-color: transparent; }
.mbtn.gem { background: transparent; color: var(--gem); border-color: var(--gem); }
.mbtn.danger { background: var(--foe); color: var(--on-foe); border-color: transparent; }
.mbtn.cash { background: var(--good); color: var(--on-good); border-color: transparent; }
.mbtn.shard { background: var(--shard); color: var(--on-shard); border-color: transparent; }
.mbtn.quanta { background: var(--quanta); color: var(--on-quanta); border-color: transparent; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.days div { background: var(--bg); border-radius: 6px; padding: 6px 0; text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; }
.days div b { display: block; color: var(--gem); font-size: 13px; }
.days div.done { opacity: .45; }
.days div.today { outline: 2px solid var(--gem); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-3); border-radius: 10px; padding: 10px 12px; }
.toggle .meta { gap: 1px; }
.sw { width: 46px; height: 28px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--line); position: relative; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: transform .15s; }
.sw[aria-checked="true"] { background: color-mix(in srgb, var(--ally) 35%, var(--bg)); }
.sw[aria-checked="true"]::after { transform: translateX(18px); background: var(--ally); }
.achrow { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-3); }
.achrow.no { opacity: .45; }
.achrow .m { width: 22px; height: 22px; border-radius: 6px; background: var(--bg); display: grid; place-items: center; font-size: 13px; color: var(--good); font-weight: 700; }
.achrow .r { font-size: 11px; color: var(--muted); text-align: right; }
.qrow { background: var(--bg-3); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; }
.qrow .ms { grid-column: 1 / -1; margin: 0; height: 6px; }
@media (prefers-reduced-motion: reduce) { .chip-btn.boss, .hint, .row.pulse { animation: none; } }

/* Raised buttons: filled buttons only. Two hard inset shadows, light on top and dark on the bottom, no blur, no drop.
   Skill buttons and outline-style buttons (ad, owned, ghost, line, default modal, chips, menu) stay flat with their border. */
.buy:not(.ad):not(.owned), .wide-btn.shard, .wide-btn.quanta, .wide-btn.foe,
.mbtn.primary, .mbtn.danger, .mbtn.cash, .mbtn.shard, .mbtn.quanta, .chip-btn.boss, .x-btn,
.seg button[aria-pressed="true"], .nav button[aria-selected="true"] {
  --hi: var(--bevel-hi);
  border: 0;
  box-shadow: inset 0 var(--bevel-top) 0 var(--hi), inset 0 calc(-1 * var(--bevel-bottom)) 0 var(--bevel-lo);
}
.x-btn, .seg button[aria-pressed="true"], .nav button[aria-selected="true"] { --hi: var(--bevel-hi-soft); }
/* pressed: the light edge goes away and the dark edge moves to the top */
.buy:not(.ad):not(.owned):active:not(:disabled), .wide-btn.shard:active:not(:disabled), .wide-btn.quanta:active:not(:disabled), .wide-btn.foe:active:not(:disabled),
.mbtn.primary:active, .mbtn.danger:active, .mbtn.cash:active, .mbtn.shard:active, .mbtn.quanta:active, .chip-btn.boss:active, .x-btn:active {
  box-shadow: inset 0 var(--bevel-bottom) 0 var(--bevel-lo);
}
.buy:not(.ad):not(.owned):disabled, .wide-btn.shard:disabled, .wide-btn.quanta:disabled, .wide-btn.foe:disabled { box-shadow: inset 0 var(--bevel-top) 0 var(--bevel-lo); }

/* Inline currency mark next to amounts on buttons; takes the text color */
.amt { display: inline-flex; align-items: center; gap: .28em; white-space: nowrap; }
.ci { display: inline-flex; width: 1em; height: 1em; flex: none; }
.ci svg { width: 100%; height: 100%; display: block; }
.ci-slot { display: inline-flex; }
.buy { min-height: 46px; justify-content: center; }

/* Bottom nav: one highlight pill slides between tabs with a springy overshoot; the new icon pops. */
.nav { position: relative; }
.nav-pill { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 0; border-radius: 10px; background: var(--bg-3); pointer-events: none;
  box-shadow: inset 0 var(--bevel-top) 0 var(--bevel-hi-soft), inset 0 calc(-1 * var(--bevel-bottom)) 0 var(--bevel-lo); }
.nav-pill.anim { transition: transform .42s cubic-bezier(.34, 1.56, .64, 1), width .42s cubic-bezier(.34, 1.56, .64, 1); }
.nav button[aria-selected="true"] { box-shadow: none; }
.nav button.pop svg { animation: navpop .38s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes navpop { 0% { transform: scale(1); } 35% { transform: scale(1.25) translateY(-3px); } 70% { transform: scale(.94); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .nav-pill.anim { transition: none; } .nav button.pop svg { animation: none; } }

/* Leaderboard */
.globe-btn { color: var(--fg); }
input[type="text"] { font: 600 15px var(--ui); width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; -webkit-user-select: text; user-select: text; }
input[type="text"]:focus { outline: 2px solid var(--ally); outline-offset: 1px; }
.lb-me { display: flex; flex-direction: column; gap: 8px; }
.lb-name { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-weight: 700; font-size: 17px; color: var(--fg); padding: 6px 0; }
.lb-name svg { color: var(--muted); }
.lb-name-input { font-size: 17px !important; }
.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 9px 10px; border-radius: var(--r); background: var(--bg-3); }
.lb-row.you { box-shadow: inset 0 0 0 2px var(--ally); }
.lb-row .rk { font-family: var(--display); font-size: 16px; text-align: center; color: var(--muted); grid-row: span 2; }
.lb-row .rk.r1 { color: #ffd257; } .lb-row .rk.r2 { color: #d6dbe3; } .lb-row .rk.r3 { color: #e09a5f; }
.lb-row .nm { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .stg { font-family: var(--display); font-size: 15px; text-align: right; }
.lb-row .lb-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-row .lb-sub2 { font-size: 12px; color: var(--muted); text-align: right; }
.lb-gap { text-align: center; color: var(--dim); font-size: 12px; letter-spacing: .3em; }

/* tight top bar on phones: three currency pills plus the globe and menu buttons */
@media (max-width: 480px) {
  .hud { gap: 5px; }
  .cur { padding: 5px 8px 5px 6px; gap: 4px; font-size: 14px; }
  .menu-btn { width: 34px; }
}
@media (max-width: 340px) { .cur small { display: none; } .cur { padding: 5px 6px; font-size: 13px; } }

/* leaderboard as a table: frozen header, compact rows, your row pinned to the bottom */
.lb-table { display: flex; flex-direction: column; gap: 4px; }
.lb-head { position: sticky; top: -12px; z-index: 2; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; padding: 8px 10px; margin: 0 -12px; padding-left: 22px; padding-right: 22px;
  background: var(--bg-2); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lb-head span:last-child { text-align: right; }
.lb-table .lb-row, .lb-pin .lb-row { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 7px 10px; }
.lb-gap { padding: 8px 0; text-align: center; color: var(--dim); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.lb-foot { flex: none; padding: 8px 12px calc(12px + var(--safe-b)); background: var(--bg-2); border-top: 1px solid var(--line); }
.lb-foot .lb-row { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 7px 10px; }

/* Shop tiles: three tall cards per row */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; padding-top: 6px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 12px 8px 8px; background: var(--bg-3); border-radius: var(--r); min-width: 0; }
.tile-ico { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: var(--bg); margin-bottom: 2px; }
.tile-nm { font-weight: 700; font-size: 13px; line-height: 1.2; }
.tile-ds { font-size: 11px; line-height: 1.3; color: var(--muted); min-height: 2.6em; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; overflow-wrap: anywhere; }
.tile .buy { width: 100%; min-width: 0; min-height: 38px; margin-top: auto; padding: 7px 4px; font-size: 14px; }
.tile .buy small { font-size: 10px; }
.tile .rib { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 1; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 5px; border-radius: 4px; background: var(--gem); color: var(--on-gem); }
.tile .rib.good { background: var(--good); color: var(--on-good); }
.pips-row { display: flex; gap: 3px; justify-content: center; margin-top: 4px; }
.pips-row i { width: 10px; height: 4px; border-radius: 2px; background: var(--bg-4); }
.pips-row i.on { background: var(--gem); }

/* number guide */
.num-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; padding: 4px 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.num-head span:last-child { text-align: right; }
.num-list { display: flex; flex-direction: column; gap: 4px; }
.num-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-3); }
.num-row.you { box-shadow: inset 0 0 0 2px var(--ally); }
.num-suf { font-family: var(--ui); font-weight: 800; font-size: 18px; color: var(--fg); }
.num-val { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.num-val sup { font-size: 9px; }
.num-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.num-tags:empty { display: none; }
.num-st { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.num-more { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 6px; }
/* five tabs in the menu sheet header */
.sheet-head .seg button { padding: 6px 8px; }
@media (max-width: 420px) { .sheet-head .seg button { padding: 6px 5px; font-size: 11.5px; } }
/* narrower phones: drop the DPS word and tighten pills so full numbers fit */
@media (max-width: 380px) { .cur small { display: none; } .hud { gap: 4px; } .cur { padding: 5px 7px 5px 5px; font-size: 13.5px; gap: 3px; } .menu-btn { width: 32px; } }

/* volume sliders in settings */
.vol-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 44px; align-items: center; gap: 10px; padding: 2px 12px 8px; }
.vol-row span { font-size: 12px; color: var(--muted); font-weight: 600; }
.vol-row b { font-size: 13px; text-align: right; }
.vol-row.off { opacity: .4; }
.vol-row input[type=range] { width: 100%; accent-color: var(--ally); }
/* the bevel darkens the bottom 4px, so lift the x to sit in the middle of the lit face */
.x-btn { display: grid; place-items: center; line-height: 1; padding-bottom: 3px; }

/* currency chips inside modal text */
.money { font-weight: 700; vertical-align: -1px; }
.money.gold { color: var(--gold); } .money.gem { color: var(--gem); } .money.shard { color: var(--shard); } .money.quanta { color: var(--quanta); }
.modal .reward .money { gap: .2em; }
.days div b .money { justify-content: center; font-size: 12px; gap: 2px; }
/* big reward numbers keep real suffix case (Qa, aa): the display face is all caps */
.modal .reward { font-family: var(--ui); font-weight: 800; font-size: 32px; letter-spacing: .01em; }

/* daily reward streak: stacked day cells (label, icon, amount) */
.days { gap: 5px; }
.days div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 7px; border-radius: var(--r-sm); background: var(--bg-3); outline: none; }
.days .dl { font-size: 8.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.days .dg { display: grid; place-items: center; width: 22px; height: 22px; color: var(--gem); }
.days .dg .ci { width: 18px; height: 18px; }
.days .dg svg { width: 100%; height: 100%; display: block; }
.days div b { color: var(--fg); font-size: 14px; font-weight: 800; }
.days div.done { opacity: 1; background: var(--bg); }
.days div.done .dg { color: var(--good); }
.days div.done b { color: var(--dim); }
.days div.today { background: color-mix(in srgb, var(--gem) 20%, var(--bg-3)); box-shadow: inset 0 0 0 2px var(--gem); outline: none; }
.days div.today .dl { color: var(--gem); }
.days div.big .dg .ci { width: 22px; height: 22px; }

/* disabled buttons pass taps through so the page can answer with a can't-afford blip */
.buy:disabled, .wide-btn:disabled { pointer-events: none; }

/* friends card */
.ally-pips { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 3px; }
.ally-pips i { height: 6px; border-radius: 2px; background: var(--bg-4); }
.ally-pips i.on { background: var(--ally); }

/* tutorial coach mark: a pulsing gold outline on the element a tip points at (survives panel redraws) */
[data-coach="core-tab"] #nav [data-tab="core"], [data-coach="core-buy"] [data-act="core"], [data-coach="skill"] .bst.ready,
[data-coach="rank"] #lbBtn, [data-coach="dps"] #hDpsBtn, [data-coach="boost"] #aCtl .chip-btn.ad {
  outline: 3px solid transparent; outline-offset: 3px; animation: coach 1.1s ease-in-out infinite; position: relative; z-index: 4;
}
@keyframes coach { 0%, 100% { outline-color: transparent; } 50% { outline-color: var(--gold); } }
@media (prefers-reduced-motion: reduce) { [data-coach="core-tab"] #nav [data-tab="core"], [data-coach="core-buy"] [data-act="core"], [data-coach="skill"] .bst.ready, [data-coach="rank"] #lbBtn, [data-coach="dps"] #hDpsBtn, [data-coach="boost"] #aCtl .chip-btn.ad { animation: none; outline-color: var(--gold); } }

/* hints wrap on narrow phones instead of running off the edges */
.hint { white-space: normal; width: max-content; max-width: calc(100% - 40px); font-size: 14px; line-height: 1.3; background: var(--bg-2); z-index: 2; }

/* next award tracker: top-left of the play area, under the DPS counter */
.ach-track { position: absolute; left: 12px; top: var(--hud-h); width: 108px; z-index: 2; pointer-events: none; display: flex; flex-direction: column; gap: 3px;
  padding: 7px 8px 7px; gap: 5px; background: color-mix(in srgb, var(--bg-2) 88%, transparent); border: 1px solid var(--line); border-radius: var(--r-sm); }
.ach-track .at-lbl { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ach-track .at-nm { font-size: 12px; font-weight: 700; line-height: 1.2; color: var(--fg); }
.ach-track .at-bar { height: 4px; border-radius: 2px; background: var(--bg-4); overflow: hidden; margin-top: 1px; }
.ach-track .at-bar i { display: block; height: 100%; background: var(--good); width: 0; transition: width .3s; }
.ach-track .at-ct { font-size: 10px; color: var(--muted); font-weight: 600; }
.ach-track.done { border-color: var(--good); }
.ach-track.done .at-lbl, .ach-track.done .at-nm { color: var(--good); }
.ach-track.in { animation: trackin .35s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes trackin { from { opacity: 0; transform: translateX(-14px); } }
@media (min-width: 900px) { .ach-track { width: 150px; } }
@media (prefers-reduced-motion: reduce) { .ach-track.in { animation: none; } }
