/* The shell and the shared parts of every screen. Colours, fonts and radii are CSS variables set from the
   active pack's tokens (app/main.js applyTokens), so a pack restyles everything here without touching it.
   Screens keep their own rules in app/screens/<name>.css under their own class prefix. */
:root {
  --bg: #14161b; --surface: #1e2128; --surface2: #282c35; --line: #3a3f4b; --ink: #eef0f4; --ink2: #a4abb8;
  --accent: #4cc2ff; --accent-ink: #06202e; --good: #6fd38b; --warn: #f2c14e; --bad: #ff5d73; --common: #f2c14e; --rare: #b48cff;
  --q1: #b9c0cc; --q2: #6fd38b; --q3: #4cc2ff; --q4: #b48cff; --q5: #ffb347;
  --radius: 12px; --radius-s: 8px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --font-display: var(--font); --font-mono: ui-monospace, Consolas, monospace;
  --display-weight: 700; --display-case: none; --display-spacing: 0;
  --safe-t: env(safe-area-inset-top, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px);
  --tap: 44px; --gap: 12px; --nav: 64px;
  --fast: 120ms; --base: 200ms; --slow: 360ms; --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
* { 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); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { height: 100dvh; touch-action: none; user-select: none; -webkit-user-select: none; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: var(--display-weight); text-transform: var(--display-case); letter-spacing: var(--display-spacing); margin: 0; line-height: 1.15; }
h1 { font-size: clamp(28px, 6vw, 52px); } h2 { font-size: 20px; } h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--ink2); } .num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#stage { position: fixed; inset: 0; background: #000; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#stage::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgb(0 0 0 / var(--vignette, 0)) 115%); }
#stage canvas.view { z-index: 0; } #stage canvas.incoming { visibility: hidden; } #overlay { z-index: 2; pointer-events: none; }
#ui { position: fixed; inset: 0; z-index: 3; pointer-events: none; display: flex; }
#ui > * { pointer-events: auto; }
#boot { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: var(--bg); color: var(--ink2); transition: opacity var(--slow); }
#boot.gone { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------ the shell (app/shell.js): rail, top bar, phone bar, sheet, screen header
   Desktop: a rail of the three groups on the left, the top bar across. Narrow desktop: the rail keeps only icons.
   Phone portrait: no rail; a bottom bar of the groups with a raised Deploy, and a group opens a sheet of its screens.
   Phone landscape: the icon rail, no bottom bar. Each look restyles every part through its tokens and its ui.css. */
.shell { position: absolute; inset: 0; display: grid; grid-template: "rail top" auto "rail main" 1fr / auto 1fr; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); touch-action: pan-y; }
.shell[hidden] { display: none; }
.topbar { grid-area: top; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 10px 18px; border-bottom: 1px solid var(--line); min-height: 60px; }
.topbar .grow { flex: 1; }
.brand { display: none; align-items: center; gap: 8px; border: 0; background: none; color: var(--ink); font: var(--display-weight) 18px var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-spacing); cursor: pointer; padding: 4px; min-height: 44px; }
.where { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.where-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.where-name { font: var(--display-weight) 18px var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-spacing); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.where { display: none; }   /* the screen's own header names it; the rail or the phone bar shows where you are */
.wallet { display: flex; gap: 14px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip img { width: 20px; height: 20px; } .chip.common { color: var(--common); } .chip.rare { color: var(--rare); }
.chip.short { color: var(--bad); } .chip.short .need { opacity: .9; }
.deploy { min-height: 44px; padding: 8px 20px; font-family: var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-spacing); }
.util { width: 44px; height: 44px; padding: 0; font-size: 20px; } .util img { width: 24px; height: 24px; }

.rail { grid-area: rail; display: flex; flex-direction: column; gap: 18px; width: 232px; padding: calc(14px + var(--safe-t)) 12px calc(14px + var(--safe-b)) calc(12px + var(--safe-l)); border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; }
.rail-group { display: grid; gap: 4px; }
.rail-head { margin: 0 0 2px 10px; font: 700 11px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.rail-item, .sheet-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 6px 10px; border: 1px solid transparent; border-radius: var(--radius-s); background: none; color: var(--ink); text-align: left; cursor: pointer; transition: background var(--fast), border-color var(--fast), transform var(--fast) var(--ease); }
.rail-item[aria-current="page"], .sheet-item[aria-current="page"] { background: var(--surface2); border-color: var(--line); }
@media (hover: hover) { .rail-item:hover, .sheet-item:hover { background: color-mix(in srgb, var(--surface2) 70%, transparent); } }
.rail-item:active, .sheet-item:active { transform: scale(.98); }
.sh-icon { position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; }
.sh-icon > img { width: 28px; height: 28px; grid-area: 1 / 1; }
.sh-ring { grid-area: 1 / 1; width: 40px; height: 40px; }
.sh-ring-ticks { fill: none; stroke: none; }   /* a look may draw a dial scale here */
.sh-ring-back { fill: none; stroke: color-mix(in srgb, var(--line) 70%, transparent); stroke-width: 2.5; }
.sh-ring-fill { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; transition: stroke-dashoffset var(--slow) var(--ease); }
.tone-busy .sh-ring-fill { stroke: var(--warn); } .tone-done .sh-ring-fill { stroke: var(--good); }
.sh-text { display: flex; flex-direction: column; min-width: 0; }
.sh-name { font-weight: 700; }
.sh-line { font-size: 12px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tone-ready .sh-line { color: var(--accent); } .tone-busy .sh-line { color: var(--warn); font-variant-numeric: tabular-nums; }
.badge { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--font); text-align: center; }
.main { grid-area: main; overflow-y: auto; overflow-x: hidden; padding: 18px calc(18px + var(--safe-r)) calc(28px + var(--safe-b)) 22px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.main > .screen, .main > .screen-head { max-width: 1100px; margin-left: auto; margin-right: auto; }
.main > .screen { display: grid; gap: 16px; align-content: start; }
.screen-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.screen-head .icon.l { width: 56px; height: 56px; }
.screen-group { font: 700 11px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.screen-head h1 { font-size: clamp(24px, 3.4vw, 34px); }
.screen-head p { max-width: 64ch; margin-top: 2px; }
.main.entering > .screen-head, .main.entering > .screen > * { animation: sh-arrive var(--slow) var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes sh-arrive { from { opacity: 0; transform: translateY(10px); } }

.phonebar { display: none; }
.sheet { position: fixed; z-index: 6; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); bottom: calc(86px + var(--safe-b)); padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 40px rgb(0 0 0 / .45); animation: sh-arrive var(--base) var(--ease); }
.sheet[hidden] { display: none; }
.sheet-head { margin: 2px 8px 8px; font: 700 12px var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.sheet-list { display: grid; gap: 4px; }

/* narrow desktop, tablets and phones on their side: the rail keeps only its icons */
@media (max-width: 1100px) and (min-width: 721px), (max-height: 500px) and (orientation: landscape) {
  .rail { width: 84px; padding-left: calc(8px + var(--safe-l)); padding-right: 8px; gap: 12px; }
  .rail-head { margin: 0; text-align: center; font-size: 9px; }
  .rail-item { flex-direction: column; justify-content: center; gap: 2px; padding: 6px 2px; min-height: 60px; text-align: center; }
  .rail-item .sh-line { display: none; } .rail-item .sh-name { font-size: 11px; font-weight: 600; }
}
@media (min-width: 1101px) { .shell.is-home .brand { display: inline-flex; } }
@media (max-height: 500px) and (orientation: landscape) { .topbar { min-height: 52px; padding-top: calc(6px + var(--safe-t)); padding-bottom: 6px; } .screen-head .icon.l { width: 40px; height: 40px; } .screen-head p { display: none; } }

/* phone portrait: the groups at the bottom, Deploy raised in the middle */
@media (orientation: portrait) and (max-width: 720px) {
  .shell { grid-template: "top" auto "main" 1fr "bar" auto / 1fr; }
  .rail { display: none; }
  .topbar { padding-left: calc(16px + var(--safe-l)); gap: 8px; min-height: 56px; }
  .topbar .deploy, .topbar .util-looks { display: none; }
  .shell.is-home .brand { display: inline-flex; }
  .wallet { gap: 10px; font-size: 14px; }
  .main { padding: 14px calc(14px + var(--safe-r)) calc(18px + var(--safe-b)) calc(14px + var(--safe-l)); }
  .screen-head { gap: 12px; } .screen-head .icon.l { width: 44px; height: 44px; } .screen-head p { font-size: 13px; }
  .phonebar { grid-area: bar; display: grid; grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr; align-items: end; padding: 4px calc(6px + var(--safe-r)) calc(6px + var(--safe-b)) calc(6px + var(--safe-l)); border-top: 1px solid var(--line); background: var(--surface); }
  .bar-btn { display: grid; justify-items: center; gap: 2px; min-height: 56px; padding: 6px 0 4px; border: 0; border-radius: var(--radius-s); background: none; color: var(--ink2); font: 600 11px var(--font); cursor: pointer; }
  .bar-btn[aria-current] { color: var(--ink); } .bar-btn[aria-current] .sh-icon img { opacity: 1; }
  .bar-btn .sh-icon { width: 30px; height: 30px; } .bar-btn .sh-icon img { width: 26px; height: 26px; opacity: .75; }
  .bar-deploy { display: grid; justify-items: center; align-content: center; gap: 2px; justify-self: center; width: 72px; height: 72px; margin-top: -24px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 800 12px var(--font-display); text-transform: var(--display-case); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); cursor: pointer; }
  .bar-deploy img { width: 30px; height: 30px; }
  .bar-deploy:active { transform: scale(.95); }
}

/* ------------------------------------------------------------------ parts every screen uses */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
[data-panel="outline"] .panel { background: transparent; border-width: 2px; }
[data-panel="paper"] .panel { border: 0; box-shadow: 0 1px 0 var(--line), 0 6px 18px rgb(0 0 0 / .08); }
[data-panel="plate"] .panel { border-width: 2px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .04), 0 2px 0 rgb(0 0 0 / .5); }
[data-panel="carved"] .panel { border-radius: var(--radius-s); border-color: var(--line); box-shadow: inset 0 1px 0 rgb(255 255 255 / .05), inset 0 -2px 6px rgb(0 0 0 / .5); }
.row { display: flex; align-items: center; gap: var(--gap); min-width: 0; } .row > .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 8px; min-width: 0; } .grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface2); color: var(--ink); font-weight: 600; cursor: pointer; transition: transform var(--fast) var(--ease), background var(--fast), opacity var(--fast); touch-action: manipulation; }
.btn:active:not(:disabled) { transform: scale(.97); } .btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; } .btn.big { min-height: 56px; padding: 12px 28px; font-size: 18px; }
.btn.quiet { background: none; } .btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); } .btn.small { min-height: 36px; padding: 4px 12px; font-size: 13px; }
@media (hover: hover) { .btn:hover:not(:disabled) { background: color-mix(in srgb, var(--surface2) 80%, var(--ink)); } .btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #fff); } }
.icon { width: 40px; height: 40px; flex: none; border-radius: var(--radius-s); } .icon.s { width: 24px; height: 24px; } .icon.l { width: 64px; height: 64px; } .icon.xl { width: 96px; height: 96px; }
.bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; } .bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: inherit; transition: width var(--base) linear; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface2); color: var(--ink2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.good { color: var(--good); } .tag.warn { color: var(--warn); } .tag.bad { color: var(--bad); } .tag.accent { color: var(--accent); }
.q1 { --q: var(--q1); } .q2 { --q: var(--q2); } .q3 { --q: var(--q3); } .q4 { --q: var(--q4); } .q5 { --q: var(--q5); } .qcol { color: var(--q); } .qline { border-color: var(--q) !important; }
.costs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink2); border: 1px dashed var(--line); border-radius: var(--radius); }
.toasts { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 8; pointer-events: none; width: min(92vw, 420px); }
.toast { padding: 10px 14px; border-radius: var(--radius-s); background: var(--surface2); border: 1px solid var(--line); box-shadow: 0 8px 24px rgb(0 0 0 / .4); animation: rise var(--base) var(--ease); display: flex; gap: 10px; align-items: center; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
dialog.modal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 20px; width: min(92vw, 460px); max-height: 86dvh; overflow: auto; }
dialog.modal::backdrop { background: rgb(0 0 0 / .6); backdrop-filter: blur(3px); }
dialog.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
dialog.reveal { text-align: center; display: grid; gap: 10px; justify-items: center; } dialog.reveal[open] { animation: pop var(--slow) var(--ease); } dialog.reveal:not([open]) { display: none; }
dialog.reveal .icon.xl { animation: glow 1.6s ease-in-out infinite alternate; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } } @keyframes glow { from { filter: drop-shadow(0 0 0 var(--accent)); } to { filter: drop-shadow(0 0 14px var(--accent)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }

/* ------------------------------------------------------------------ the run: HUD, buttons, cards, summaries */
.hud { position: absolute; inset: 0; pointer-events: none !important; font-weight: 600; }
.hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: calc(12px + var(--safe-t)); left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud { color: var(--hud-ink, #fff); --hud-shadow: 0 1px 3px rgb(0 0 0 / .9); }
[data-light] .hud { --hud-ink: var(--ink); --hud-shadow: 0 0 4px var(--bg), 0 0 2px var(--bg); }
.hud-level { display: grid; gap: 2px; text-shadow: var(--hud-shadow); } .hud-level b { font-size: 20px; font-family: var(--font-display); } .hud-level span { font-size: 12px; opacity: .8; }
.hud-stats { display: flex; gap: 12px; align-items: center; text-shadow: var(--hud-shadow); font-size: 13px; }
.hud-build { position: absolute; left: calc(12px + var(--safe-l)); top: calc(64px + var(--safe-t)); display: grid; gap: 4px; pointer-events: none; }
.hud-build .slot { display: flex; align-items: center; gap: 4px; font-size: 11px; text-shadow: var(--hud-shadow); } .hud-build img { width: 26px; height: 26px; }
.hud-build .passives { display: flex; gap: 2px; flex-wrap: wrap; max-width: 120px; } .hud-build .passives img { width: 18px; height: 18px; }
.hud-pause { width: var(--tap); height: var(--tap); border-radius: 50%; padding: 0; background: color-mix(in srgb, var(--surface) 75%, transparent); border-color: color-mix(in srgb, var(--ink) 25%, transparent); color: var(--ink); }
.actions-pad { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); display: grid; grid-template-columns: repeat(2, 68px); gap: 12px; justify-items: center; align-items: end; direction: rtl; }
.act { position: relative; width: 68px; height: 68px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ink) 40%, transparent); background: color-mix(in srgb, var(--surface) 60%, transparent); color: var(--ink); display: grid; place-items: center; padding: 0; touch-action: none; cursor: pointer; direction: ltr; }
.act img { width: 36px; height: 36px; pointer-events: none; } .act.off { opacity: .4; } .act:active { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.act .n { position: absolute; right: -2px; bottom: -2px; min-width: 22px; height: 22px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; line-height: 20px; text-align: center; }
.act .key { position: absolute; left: -2px; top: -2px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--ink2); font-size: 11px; line-height: 18px; text-align: center; }
.act .cd { position: absolute; inset: -2px; border-radius: 50%; background: conic-gradient(rgb(0 0 0 / .6) var(--cd, 0%), transparent 0); pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .actions-pad { grid-template-columns: repeat(5, 52px); gap: 8px; } .act { width: 52px; height: 52px; } .act img { width: 28px; height: 28px; } }
@media (hover: none) { .act .key { display: none; } }
.veil { color: var(--ink); position: absolute; inset: 0; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); background: color-mix(in srgb, var(--bg) 80%, transparent); overflow-y: auto; touch-action: pan-y; animation: fade var(--base); }
@keyframes fade { from { opacity: 0; } }
.veil > .box { width: min(100%, 880px); display: grid; gap: 16px; justify-items: center; text-align: center; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); width: 100%; }
.card { position: relative; display: grid; gap: 8px; justify-items: center; align-content: start; padding: 16px 12px; min-height: 190px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; text-align: center; transition: transform var(--fast) var(--ease), border-color var(--fast); animation: rise var(--base) var(--ease) backwards; }
.card:nth-child(2) { animation-delay: 50ms; } .card:nth-child(3) { animation-delay: 100ms; } .card:nth-child(4) { animation-delay: 150ms; }
.card:active { transform: scale(.98); } .card.evo { border-color: var(--warn); } .card.synergy { border-color: var(--rare); }
@media (hover: hover) { .card:hover { border-color: var(--accent); transform: translateY(-3px); } }
.card .text { font-weight: 400; font-size: 13px; color: var(--ink2); } .card .key { position: absolute; top: 8px; left: 10px; color: var(--ink2); font-size: 12px; }
.card .x { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--ink2); cursor: pointer; font-size: 16px; }
@media (orientation: portrait) and (max-width: 560px) { .cards { grid-template-columns: 1fr; } .card { grid-template-columns: 56px 1fr; min-height: 0; text-align: left; justify-items: start; align-items: center; padding: 12px 40px 12px 12px; } .card .icon { grid-row: span 3; } }
.summary { width: min(100%, 520px); text-align: left; } .summary dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; } .summary dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); padding: 8px 20px; border-radius: var(--radius-s); background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--ink); font-family: var(--font-display); font-size: 22px; text-align: center; pointer-events: none !important; animation: banner 2.4s var(--ease) forwards; white-space: nowrap; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 10px); } 12%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.hint { position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); font-size: 13px; font-weight: 500; color: var(--ink2); pointer-events: none !important; white-space: nowrap; transition: opacity var(--slow); }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface2); color: var(--ink); font: 600 12px var(--font); text-align: center; }

@media (hover: none) { .hint { bottom: auto; top: calc(58px + var(--safe-t)); } }
.hud-notice { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink); font-size: 14px; pointer-events: none !important; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ the run: feel (answers, weight, timing) */
.hud-stats .num { font-variant-numeric: tabular-nums; }
.hud-level b { display: inline-block; transform-origin: left center; }
.hud-level b.bump { animation: bump 420ms var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 25% { transform: scale(1.28); color: var(--accent); } 100% { transform: scale(1); } }
.hud-level span.urgent { color: var(--warn); opacity: 1; font-weight: 800; }
.hud-level span.tick { animation: tick 900ms ease-out; }
@keyframes tick { 0% { transform: scale(1.35); text-shadow: 0 0 10px var(--warn), var(--hud-shadow); } 100% { transform: scale(1); } }
.hud-level span { display: inline-block; transform-origin: left center; }
/* a press shows on the frame of the touch; a button blinks when it is ready again */
.act.press { transform: scale(.9); background: color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); transition: none; }
.act { transition: transform 120ms var(--ease), background 120ms; }
.act.ready { animation: ready 360ms var(--ease); }
@keyframes ready { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 80%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
/* the boss arrives */
.banner small { display: block; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--bad); font-family: var(--font); font-weight: 800; }
.banner.boss { top: 18%; padding: 10px 28px; font-size: 30px; border: 2px solid var(--bad); box-shadow: 0 0 40px color-mix(in srgb, var(--bad) 45%, transparent); animation: boss-banner 3.1s var(--ease) forwards; max-width: calc(100% - 32px); white-space: normal; }
@keyframes boss-banner { 0% { opacity: 0; transform: translate(-50%, 0) scale(1.6); letter-spacing: .3em; } 10% { opacity: 1; transform: translate(-50%, 0) scale(1); letter-spacing: normal; } 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -12px); } }
/* the cards deal in with a flip; for a moment after they land they cannot be picked */
.cards { perspective: 900px; }
.cards .card { animation: deal 380ms cubic-bezier(.2, .9, .3, 1.15) backwards; animation-delay: calc(var(--i, 0) * 70ms); transform-origin: 50% 80%; }
@keyframes deal { 0% { opacity: 0; transform: translateY(40px) rotateY(-95deg) scale(.85); } 60% { opacity: 1; } 100% { transform: none; } }
.cards.locked .card { pointer-events: none; }
.card.press { transform: scale(.96); border-color: var(--accent); transition: none; }
.card .change { display: grid; gap: 2px; color: var(--ink); font-variant-numeric: tabular-nums; }
.card .change span { white-space: nowrap; }
.card.evo { box-shadow: 0 0 0 1px var(--warn), 0 0 28px color-mix(in srgb, var(--warn) 40%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--warn) 16%, var(--surface)), var(--surface) 55%); }
.card.evo .icon { animation: evo-glow 1.6s ease-in-out infinite; }
@keyframes evo-glow { 50% { filter: drop-shadow(0 0 10px var(--warn)); transform: scale(1.06); } }
.summary-veil.bad > .box > .tag:first-child, .summary-veil.good > .box > .tag:first-child { animation: bump 500ms var(--ease); }
.pause-build:empty { display: none; }
.pause-build { width: min(100%, 520px); }
@media (prefers-reduced-motion: reduce) {
  .cards .card, .banner.boss, .hud-level b.bump, .hud-level span.tick, .act.ready, .card.evo .icon { animation: none; }
}
.deploy[hidden] { display: none; }

/* ------------------------------------------------------------------ the deeper cards (docs/NEVERENDING.md)
   mutation: the other road at the top (warn, a split edge). overdrive: past the top (warn, stacked bars).
   relic: a rule bent (accent, a halo). pact: a curse for pay (bad, a dark seal). mutator: endless depth (bad, hatched). */
.card.mutation { border-color: var(--warn); background: linear-gradient(200deg, color-mix(in srgb, var(--warn) 14%, var(--surface)), var(--surface) 55%); box-shadow: inset 4px 0 0 var(--warn), inset -4px 0 0 color-mix(in srgb, var(--warn) 45%, transparent); }
.card.overdrive { border-color: color-mix(in srgb, var(--warn) 70%, var(--line)); background: repeating-linear-gradient(0deg, color-mix(in srgb, var(--warn) 7%, transparent) 0 6px, transparent 6px 12px), var(--surface); }
.card.overdrive .icon { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--warn) 70%, transparent)); }
.card.relic { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 30px color-mix(in srgb, var(--accent) 35%, transparent); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 18%, var(--surface)), var(--surface) 60%); }
.card.relic .icon { animation: evo-glow 2s ease-in-out infinite; }
.card.pact { border-color: var(--bad); background: radial-gradient(circle at 50% 120%, color-mix(in srgb, var(--bad) 22%, var(--surface)), var(--surface) 70%); box-shadow: 0 0 24px color-mix(in srgb, var(--bad) 25%, transparent); }
.card.mutator { border-color: color-mix(in srgb, var(--bad) 75%, var(--line)); background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bad) 9%, transparent) 0 8px, transparent 8px 16px), var(--surface); }
.banner.event { top: 16%; border: 2px solid var(--accent); box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 35%, transparent); }
.banner.event small { color: var(--accent); }
.home-roads { justify-content: center; gap: 10px; }
.home-daily-mut { gap: 4px; }
@media (prefers-reduced-motion: reduce) { .card.relic .icon { animation: none; } }
/* a weapon slot opening: the slot kind's sign, drawn as large as an icon */
.reveal-gl { display: grid; place-items: center; width: 96px; height: 96px; color: var(--accent); } .reveal-gl .gl { width: 72px; height: 72px; }
.gl { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gl .solid { fill: currentColor; stroke: none; }
/* touch: dash owns the corner, the charge and the consumables sit on an arc round it (radius ~126 px from the dash's
   centre), so a thumb finds each by direction and a dash is never a misplaced throw. Desktop keeps the row. */
@media (hover: none) and (pointer: coarse) {
  .actions-pad { display: block; width: 76px; height: 76px; }
  .actions-pad .act { position: absolute; }
  .actions-pad .act:nth-child(1) { right: 0; bottom: 0; width: 76px; height: 76px; }
  .actions-pad .act:nth-child(1) img { width: 40px; height: 40px; }
  .actions-pad .act:nth-child(2) { right: 126px; bottom: 37px; }
  .actions-pad .act:nth-child(3) { right: 80px; bottom: 105px; }
  .actions-pad .act:nth-child(4) { right: 8px; bottom: 130px; }
  .actions-pad .act:nth-child(5) { right: 72px; bottom: 192px; }
}

/* ------------------------------------------------------------------ controllers and prompts (app/prompts.js, app/pad.js)
   A prompt is the control for an action on the device in use: key caps, pad glyphs drawn in SVG, or a touch sign
   with a few words. The glyphs draw in the look's tokens (--ink on --surface2, the dot in --accent); a look may set
   --pr-ink and --pr-face. The pad's focus ring shows only while a pad is the device (html[data-device="pad"]), so a
   mouse or a finger never sees it; the keyboard keeps :focus-visible. */
.pr { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; line-height: 1; white-space: nowrap; }
.pr-g { width: 1.65em; height: 1.65em; flex: none; overflow: visible; }
.pr-g.pr-wide { width: 1.95em; }
.pr-face { fill: var(--pr-face, var(--surface2)); stroke: var(--pr-ink, var(--ink)); stroke-width: 1.6; }
.pr-ring { fill: none; stroke: var(--pr-ink, var(--ink)); stroke-width: 1.8; }
.pr-knob, .pr-fill { fill: var(--pr-ink, var(--ink)); }
.pr-line { fill: none; stroke: var(--pr-ink, var(--ink)); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pr-dot { fill: var(--accent); }
.pr-t { fill: var(--pr-ink, var(--ink)); font-family: var(--font); font-weight: 800; }
.pr-t.pr-t-cut { fill: var(--pr-face, var(--surface2)); }
.pr-or { color: var(--ink2); font-size: .85em; }
.pr kbd, kbd.pr-key { line-height: 1.5; }
.pr-words { font-weight: 600; color: var(--ink); }
span.pr-sentence { display: inline; }
p.pr-help { line-height: 2; text-wrap: balance; max-width: 62ch; }
.hint:has(.pr-sentence) { white-space: normal; text-align: center; max-width: calc(100vw - 32px - var(--safe-l) - var(--safe-r)); width: max-content; line-height: 1.9; }
/* the action buttons' labels: a glyph instead of a key cap while a pad is in use, shown on touch screens too */
.act .key .pr { gap: 1px; } .act .key .pr-g { width: 16px; height: 16px; } .act .key .pr-or { display: none; } .act .key .pr-g ~ .pr-g { display: none; }
.act .key .pr-pad, .act .key .pr-touch { display: contents; }
.act .key .pr-key { all: unset; }
.act .key:has(.pr-pad) { padding: 1px; min-width: 0; height: auto; border-radius: 50%; }
.act .key:has(.pr-touch) { display: none; }
:root[data-device="pad"] .act .key { display: block; }
.act.pad-sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
/* the pad's focus ring: wider than the keyboard's, with a halo, so it reads from a sofa in every look */
:root[data-device="pad"] :is(button, a, input, select, textarea, summary, [role], [tabindex]):focus, :root[data-device="pad"] .pad-focus.pad-focus { outline: 3px solid var(--accent); outline-offset: 3px; box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 30%, transparent); }
:root[data-device="pad"] :is(button, a, label, input, select, textarea, summary, [role], [tabindex], [data-pad-row]) { scroll-margin: 28px 12px 56px; }   /* 56: clear of the raised Deploy on a phone */
/* a switch or a segment hides its input: the ring goes round the row or the segment instead */
:root[data-device="pad"] :is(.set-row, .set-seg):has(input:focus), :root[data-device="pad"] :is(.set-row, .set-seg).pad-focus, :root[data-device="pad"] [data-pad-row].pad-focus { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 30%, transparent); border-radius: var(--radius-s); }
:root[data-device="pad"] :is(.set-row, .set-seg, [data-pad-row]) input:focus { outline: 0; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) { :root[data-device="pad"] :focus { transition: outline-offset var(--fast) var(--ease), box-shadow var(--fast) var(--ease); } }
/* on a phone the hint narrows to stay clear of the build down the left edge (a pad's line is the longest) */
@media (hover: none) { .hint:has(.pr-sentence) { max-width: calc(100vw - 2 * (64px + var(--safe-l))); } }
