/* Last Isle: composition, the island stage, the drop bench, the match HUD and the pages, on the Toybox kit. */

:root { --stage-h: calc(100dvh - var(--topbar-h)); --storm: oklch(from var(--accent) l c h); }
body { overflow-x: hidden; }
canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* ---------- Play ---------- */
.play { position: relative; }
.play__stage { height: min(var(--stage-h), 62rem); min-height: 34rem; margin-top: calc(-1 * var(--topbar-h)); background: var(--ground-deep); }
.k-topbar .k-coin__price { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-topbar .k-coin { min-width: 0; max-width: 22rem; }
.k-topbar .k-coin__sym { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-footer.k-inverse { background: var(--inverse); color: var(--on-inverse); margin-top: var(--s-7); }
body[data-route="play"] .k-footer.k-inverse { margin-top: var(--s-6); }
.split > *, .matches__grid > * { min-width: 0; }
.play__still { position: absolute; inset: 0; background: radial-gradient(60% 34% at 50% 62%, #f2dca8 0 40%, #8fcb5f 41% 70%, transparent 71%), linear-gradient(#7fd3e6, #cdeeee 55%, #2bb5ab 56%); }
.play__over {
  position: absolute; inset: calc(var(--topbar-h) + var(--s-5)) 0 auto 0; z-index: 2; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-5);
  padding-inline: max(var(--gutter), (100% - var(--page-max)) / 2 + var(--gutter));
}
.play__over > * { pointer-events: auto; }
.play__rule { max-width: 36rem; }
.play__title { font-size: clamp(2rem, 1.2rem + 2.6vw, 3.6rem); margin: 0; }
.play__sub { margin: var(--s-3) 0 0; font-size: var(--t-lg); font-weight: var(--text-weight-strong); color: var(--ink-1); }
.steps { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.steps li { display: flex; align-items: center; gap: var(--s-2); min-height: var(--control-h-sm); padding: 0 var(--s-3) 0 4px; background: oklch(from var(--surface-1) l c h / 0.72); border: 0; border-radius: var(--r-1); font-size: var(--t-sm); font-weight: var(--text-weight-heavy); line-height: 1.35; white-space: nowrap; }
.play__sub { display: inline-block; padding: 8px 12px; background: oklch(from var(--surface-1) l c h / 0.82); border-radius: var(--r-1); }
.steps li b { flex: none; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--highlight); border: var(--outline-w-sm) solid var(--outline); font-family: var(--font-display); font-weight: 400; }
.steps .steps__more { padding: 0; border: 0; background: none; }
.steps[data-first] li:not(.steps__more) { animation: step-in var(--d-4, 600ms) var(--ease-out) both; }
.steps[data-first] li:nth-child(2) { animation-delay: 80ms; }
.steps[data-first] li:nth-child(3) { animation-delay: 160ms; }
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } }

.pot {
  flex: none; display: grid; justify-items: center; gap: 2px; padding: var(--s-4) var(--s-5) var(--s-3);
  background: var(--highlight); color: var(--on-highlight); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3);
  min-width: 13rem; text-align: center;
}
.pot__label { font-weight: var(--text-weight-heavy); font-size: var(--t-sm); letter-spacing: 0.04em; }
.pot__val { font-size: clamp(2rem, 1.4rem + 1.6vw, 3rem); }
.pot__note { font-size: var(--t-sm); font-weight: var(--text-weight-strong); }

/* the drop bench: overlaps the bottom of the island */
.bench { position: relative; z-index: 3; margin-top: calc(-1 * clamp(11rem, 22vh, 15rem)); }
.bench__panel { padding: var(--s-5); }
.bench__head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); margin-bottom: var(--s-4); flex-wrap: wrap; }
.bench__title { font-size: var(--t-xl); margin: 0; }
.bench__status { margin: var(--s-1) 0 0; font-weight: var(--text-weight-strong); color: var(--ink-2); }
.bench__clock { display: flex; align-items: baseline; gap: var(--s-2); padding: var(--s-2) var(--s-4); background: var(--inverse); color: var(--on-inverse); border-radius: var(--r-2); border: var(--outline-w-sm) solid var(--outline); }
.bench__clock .k-muted { color: var(--on-inverse-2); font-weight: var(--text-weight-strong); }
.bench__clock b { font-size: var(--t-xl); }
.bench__clock[data-low="true"] b { color: var(--accent); }
.seats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: var(--s-3); }
.seat {
  position: relative; display: grid; justify-items: center; gap: var(--s-1); padding: var(--s-3) var(--s-2) var(--s-2);
  background: var(--surface-2); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); min-width: 0;
}
.seat::before { content: ""; position: absolute; left: 50%; top: -1px; width: 1.4rem; height: 0.7rem; translate: -50% 0; background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-top: 0; border-radius: 0 0 1rem 1rem; }
.seat__no { position: absolute; top: var(--s-1); left: var(--s-2); font-family: var(--font-display); font-size: var(--t-sm); color: var(--ink-2); }
.seat__art, .seat__ghost { width: 100%; max-width: 5.5rem; aspect-ratio: 1; display: block; }
.seat__art { background: var(--surface-1); border-radius: 50%; border: var(--outline-w-sm) solid var(--outline); overflow: hidden; }
.seat__art svg, .seat__ghost svg { width: 100%; height: 100%; display: block; }
.seat__ghost { color: var(--ink-3); opacity: 0.7; }
.seat__who { font-size: var(--t-xs); font-weight: var(--text-weight-heavy); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat[data-empty] { background: transparent; border-style: dashed; }
.seat[data-empty] .seat__who { color: var(--ink-3); }
.seat__stamp { font-size: 0.6875rem; font-weight: var(--text-weight-heavy); text-transform: uppercase; letter-spacing: 0.06em; color: var(--good-ink); border: 2px solid currentColor; border-radius: 4px; padding: 0 4px; rotate: -6deg; }
.seat[data-me] { background: var(--highlight); }
.seat[data-me] .seat__stamp { color: var(--ink-1); }
.seat[data-new] .seat__art { animation: drop-in 520ms var(--ease-out) both; }
.seat[data-new] .seat__stamp { animation: stamp 420ms 300ms var(--ease-out) both; }
@keyframes drop-in { from { transform: translateY(-40px) scale(1.15); opacity: 0; } }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } }
.bench__end { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.bench__actions { flex-wrap: wrap; }
.bench__enter { min-width: 15rem; }
.money__row p, .side__lede, .bench__status, .bench__proof, .shop__rule, .play__sub { overflow-wrap: anywhere; }
.money__row > *, .tiles > *, .tile__btn > * { min-width: 0; }
.tile__name { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.burnstat { max-width: 100%; min-width: 0; }
.burnstat__val { overflow-wrap: anywhere; }
.bench__proof { margin: var(--s-4) 0 0; color: var(--ink-2); font-size: var(--t-sm); font-weight: var(--text-weight-strong); }
.bench__proof b { color: var(--ink-1); }
/* matches on the island now, each with Watch */
.live { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-top: var(--s-4); padding-top: var(--s-4); border-top: var(--line-w) dashed var(--line); min-width: 0; }
.live__label { font-family: var(--font-display); font-size: var(--t-md); color: var(--ink-1); }
.live__none { font-size: var(--t-sm); overflow-wrap: anywhere; min-width: 0; }
.live__watch { gap: var(--s-2); }
.live__watch::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--outline); }
.live__ago { font-weight: var(--text-weight); color: var(--ink-2); }

/* spectating: no controls of a player, a plate at the bottom naming who the camera follows */
.hud[data-spectate] .hud__bl, .hud[data-spectate] .hud__br, .hud[data-spectate] .hud-emote, .hud[data-spectate] .hud-plate--sm { display: none; }
.hud-watch { position: absolute; left: 50%; bottom: max(var(--s-4), env(safe-area-inset-bottom)); translate: -50% 0; display: flex; align-items: center; gap: var(--s-2); max-width: calc(100% - 2 * var(--s-3)); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); box-shadow: 0 5px 0 0 var(--outline); }
.hud-watch__tag { padding: 2px var(--s-2); background: var(--accent); color: var(--on-accent); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-1); font-size: var(--t-xs); font-weight: var(--text-weight-heavy); white-space: nowrap; }
.hud-watch__who { display: grid; gap: 4px; min-width: 7.5rem; padding-inline: var(--s-1); }
.hud-watch__who > b { font-family: var(--font-display); font-size: var(--t-md); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 12rem; }
.hud-watch__bars { display: grid; gap: 2px; }
.hud-watch__bar { position: relative; display: block; height: 7px; background: var(--surface-3); border: 1.5px solid var(--outline); border-radius: 4px; overflow: hidden; }
.hud-watch__bar i { position: absolute; inset: 0; transform-origin: left; background: var(--good); transition: transform var(--d-2) var(--ease-out); }
.hud-watch__bar--ar { height: 5px; }
.hud-watch__bar--ar i { background: #5aa9ff; }
.hud-watch__step { touch-action: manipulation; }
@media (max-width: 480px) { .hud-watch__tag { display: none; } .hud-watch__who { min-width: 6rem; } .hud-watch__who > b { max-width: 8rem; font-size: var(--t-sm); } }

.money { margin-top: var(--s-6); }
.money__row { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)) auto; gap: var(--s-5); align-items: start; padding: var(--s-5); background: var(--inverse); color: var(--on-inverse); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); box-shadow: 0 var(--tile-depth) 0 0 var(--shade); }
.money__title { font-size: var(--t-xl); margin: 0; max-width: 9rem; }
.money__row p { margin: 0; font-size: var(--t-sm); color: var(--on-inverse-2); }
.money__row p b { color: var(--on-inverse); }
.money__row .k-num { color: var(--highlight); }
@media (max-width: 1180px) { .money__row { grid-template-columns: 1fr 1fr; } .money__title { max-width: none; grid-column: 1 / -1; } }

/* Last Isle on X: posts read by the server with the owner's key */
.xfeed { margin-top: var(--s-6); }
.xfeed__head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); flex-wrap: wrap; }
.xfeed__title { margin: 0; font-size: var(--t-xl); }
.xfeed__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--s-3); margin: 0; padding: 0; list-style: none; }
.xpost { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; padding: var(--s-4); background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); box-shadow: 0 3px 0 0 var(--outline); }
.xpost__who { display: flex; align-items: center; gap: var(--s-2); min-width: 0; color: var(--ink-1); text-decoration: none; font-size: var(--t-sm); }
.xpost__who b, .xpost__who span:not(.xpost__img) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.xpost__who b { flex: 0 1 auto; } .xpost__who .k-muted { flex: 1 1 0; }
.xpost__img { flex: none; width: 32px; height: 32px; border-radius: 50%; border: var(--outline-w-sm) solid var(--outline); background: var(--accent); object-fit: cover; }
.xpost__text { margin: 0; font-size: var(--t-sm); line-height: var(--leading-body); color: var(--ink-1); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.xpost__at { margin-top: auto; font-size: var(--t-xs); }
.xfeed__note { margin: 0; max-width: 40rem; padding: var(--s-4) var(--s-5); background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); box-shadow: 0 3px 0 0 var(--outline); font-size: var(--t-sm); line-height: var(--leading-body); overflow-wrap: anywhere; }
.xfeed__list + .xfeed__note { margin-top: var(--s-3); }
@media (max-width: 767px) { .money__row { grid-template-columns: 1fr; gap: var(--s-3); } }

/* ---------- the match: the stage takes the whole window ---------- */
body[data-mode="game"] { overflow: hidden; padding-bottom: 0 !important; }
body[data-mode="game"] .k-topbar, body[data-mode="game"] .k-footer, body[data-mode="game"] .k-tabbar, body[data-mode="game"] .bench, body[data-mode="game"] .play__over { display: none; }
body[data-mode="game"] .play__stage { position: fixed; inset: 0; height: 100dvh; min-height: 0; margin: 0; z-index: 50; }
.hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; color: var(--ink-1); font-family: var(--font-text); user-select: none; -webkit-user-select: none; }
.hud > * { pointer-events: auto; }
.hud__tl, .hud__t, .hud__tr, .hud__bl, .hud__br { position: absolute; display: flex; gap: var(--s-2); }
.hud__tl { top: max(var(--s-3), env(safe-area-inset-top)); left: max(var(--s-3), env(safe-area-inset-left)); }
.hud__t { top: max(var(--s-3), env(safe-area-inset-top)); left: 50%; translate: -50% 0; }
.hud__tr { top: max(var(--s-3), env(safe-area-inset-top)); right: max(var(--s-3), env(safe-area-inset-right)); flex-direction: column; align-items: flex-end; }
.hud__bl { bottom: max(var(--s-4), env(safe-area-inset-bottom)); left: max(var(--s-3), env(safe-area-inset-left)); }
.hud__br { bottom: max(var(--s-4), env(safe-area-inset-bottom)); right: max(var(--s-3), env(safe-area-inset-right)); }
.hud-plate { display: grid; justify-items: center; min-width: 4.25rem; padding: var(--s-1) var(--s-3) var(--s-2); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-2); box-shadow: 0 4px 0 0 var(--outline); }
.hud-plate--sm { min-width: 3.5rem; }
.hud-big { font-size: var(--t-2xl); }
.hud-small { font-size: var(--t-xs); font-weight: var(--text-weight-heavy); color: var(--ink-2); }
.hud-storm { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); background: var(--inverse); color: var(--on-inverse); border: var(--outline-w) solid var(--outline); border-radius: var(--r-2); font-weight: var(--text-weight-heavy); white-space: nowrap; }
.hud-storm b { font-family: var(--font-display); font-weight: 400; font-size: var(--t-lg); min-width: 3ch; }
.hud-storm__dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--on-inverse); }
.hud-storm[data-phase="shrink"] { background: var(--accent); color: var(--ink-1); }
.hud-storm[data-phase="shrink"] .hud-storm__dot { background: var(--ink-1); }
.hud-map { width: 8rem; height: 8rem; border-radius: 50%; border: var(--outline-w) solid var(--outline); background: #2bb5ab; box-shadow: 0 4px 0 0 var(--outline); }
.hud-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; justify-items: end; max-width: 20rem; }
.hud-feed__row { display: flex; gap: 6px; align-items: baseline; padding: 3px 8px; background: oklch(from var(--inverse) l c h / 0.82); color: var(--on-inverse); border-radius: var(--r-1); font-size: var(--t-xs); font-weight: var(--text-weight-strong); animation: step-in 240ms var(--ease-out); max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hud-feed__row span { color: var(--on-inverse-2); }
.hud-feed__row[data-me] { background: var(--highlight); color: var(--ink-1); }
.hud-feed__row[data-me] span { color: var(--ink-2); }
.hud-vitals { display: grid; gap: 6px; width: min(17rem, 42vw); }
.hud-bar { position: relative; height: 1.6rem; background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-1); overflow: hidden; }
.hud-bar i { position: absolute; inset: 0; transform-origin: left; transition: transform var(--d-2) var(--ease-out); }
.hud-bar--hp i { background: var(--good); background-image: var(--meter-texture); }
.hud-bar--ar i { background: #7cc6ff; background-image: var(--meter-texture); }
.hud-bar span { position: relative; display: flex; justify-content: space-between; padding: 0 8px; line-height: 1.45rem; font-size: var(--t-xs); font-weight: var(--text-weight-heavy); }
.hud-vitals[data-low="true"] .hud-bar--hp i { background-color: var(--bad); }
.hud-weapons { display: flex; align-items: stretch; gap: 6px; }
.hud-slots { display: flex; gap: 4px; }
.hud-slot { position: relative; display: grid; align-content: center; gap: 2px; min-width: 4.9rem; min-height: 3.25rem; padding: 4px 8px 6px; background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); font: inherit; font-size: var(--t-sm); color: var(--ink-1); text-align: left; cursor: pointer; overflow: hidden; transition: transform var(--d-1) var(--ease-out); }
.hud-slot b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-slot__key { font-size: 0.625rem; font-weight: var(--text-weight-heavy); color: var(--ink-3); }
.hud-slot[data-empty="true"] b { color: var(--ink-3); font-weight: var(--text-weight); }
/* the rarity stripe along the bottom of a slot that holds a gun */
.hud-slot::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: transparent; }
.hud-slot[data-tier="common"]::after { background: oklch(0.86 0.02 170); }
.hud-slot[data-tier="rare"]::after { background: oklch(0.68 0.15 255); }
.hud-slot[data-tier="epic"]::after { background: oklch(0.66 0.19 305); }
.hud-slot[data-tier="legendary"]::after { background: var(--highlight); }
.hud-slot[aria-pressed="true"] { background: var(--highlight); box-shadow: 0 4px 0 0 var(--outline); transform: translateY(-3px); }
.hud-slot[aria-pressed="true"][data-tier="legendary"]::after { background: var(--accent); }
/* the barricade: wood count, F, and a ring that empties while it cools down */
/* desktop: the words on the left, the cooldown in its own ring on the right (its space kept while ready, so nothing
   shifts and nothing ever lies over the words) */
.hud-build { position: relative; isolation: isolate; display: grid; grid-template-columns: auto 2.25rem; column-gap: 8px; align-content: center; align-items: center; justify-items: start; row-gap: 2px; padding: 4px 8px 6px 10px; background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); font: inherit; font-size: var(--t-sm); color: var(--ink-1); cursor: pointer; overflow: hidden; --cd: 0; }
.hud-build__t { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 5px; font-weight: var(--text-weight-heavy); white-space: nowrap; }
.hud-build__wood { grid-column: 1; grid-row: 2; white-space: nowrap; }
.hud-build__key { display: inline-grid; place-items: center; min-width: 1.2rem; height: 1.15rem; padding: 0 3px; background: var(--highlight); color: var(--on-highlight); border: var(--outline-w-sm) solid var(--outline); border-radius: 4px; font: inherit; font-size: var(--t-xs); }
.hud-build__wood { font-size: var(--t-xs); color: var(--ink-2); }
.hud-build__wood b { font-size: var(--t-sm); color: var(--ink-1); }
.hud-build__ring { display: none; }
.hud-build__cd { position: relative; grid-column: 2; grid-row: 1 / span 2; justify-self: center; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; font-size: var(--t-xs); font-weight: var(--text-weight-heavy); color: var(--ink-1); }
.hud-build__cd::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--cd) * 1turn), oklch(from var(--outline) l c h / 0.14) 0); -webkit-mask: radial-gradient(closest-side, transparent 72%, var(--outline) 74%); mask: radial-gradient(closest-side, transparent 72%, var(--outline) 74%); }
.hud-build__cd[hidden] { display: grid; visibility: hidden; }
.hud-build[data-state="cooling"] .hud-build__t, .hud-build[data-state="cooling"] .hud-build__wood { opacity: 0.6; }
.hud-build[data-state="nowood"] .hud-build__wood b { color: var(--bad-ink); }
.hud-build[data-state="ready"] .hud-build__key { box-shadow: 0 2px 0 0 var(--outline); }
.hud-ammo { position: relative; display: grid; justify-items: center; align-content: center; min-width: 6rem; padding: 4px 12px; background: var(--inverse); color: var(--on-inverse); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); overflow: hidden; }
.hud-ammo__count { position: relative; display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.hud-ammo__count > b { font-size: var(--t-xl); }
.hud-ammo__res { font-size: var(--t-sm); font-weight: var(--text-weight-heavy); color: var(--on-inverse-2); }
.hud-ammo__res b { color: var(--on-inverse); }
.hud-ammo__label { position: relative; font-size: var(--t-xs); font-weight: var(--text-weight-heavy); color: var(--on-inverse-2); white-space: nowrap; }
/* red when the clip runs low; a ring that fills while reloading; "No ammo" when both are empty */
.hud-ammo[data-low="true"] .hud-ammo__count > b { color: #ff7a66; }
.hud-ammo[data-state="none"] .hud-ammo__count > b, .hud-ammo[data-state="none"] .hud-ammo__label { color: #ff7a66; }
.hud-ammo__ring { position: absolute; inset: 0; background: conic-gradient(from 0deg, oklch(from var(--highlight) l c h / 0.42) calc(var(--p, 0) * 360deg), transparent 0); opacity: 0; transition: opacity var(--d-1); }
.hud-ammo[data-state="reloading"] .hud-ammo__ring { opacity: 1; }
.hud-ammo[data-state="reloading"] .hud-ammo__label { color: var(--highlight); }
.hud-slot__clip { position: absolute; top: 3px; right: 6px; font-style: normal; font-size: 0.625rem; font-weight: var(--text-weight-heavy); color: var(--ink-2); }
.hud-slot[data-low="true"] .hud-slot__clip { color: var(--bad-ink); }
/* the part of the health a medkit is still adding */
.hud-bar--hp .hud-bar__heal { background: oklch(from var(--good) calc(l + 0.12) c h / 0.6); background-image: repeating-linear-gradient(-45deg, transparent 0 6px, oklch(1 0 0 / 0.35) 6px 9px); }
.hud-vitals[data-heal="true"] .hud-bar__heal { animation: heal-glow 1s ease-in-out infinite alternate; }
@keyframes heal-glow { from { opacity: 0.7; } to { opacity: 1; } }
.hud-bar__plus { margin-left: 6px; font-style: normal; color: var(--good-ink); }
.hud-sound { position: absolute; top: calc(max(var(--s-3), env(safe-area-inset-top)) + 7.2rem); left: max(var(--s-3), env(safe-area-inset-left)); }
.hud-sound[aria-pressed="false"] { opacity: 0.8; }
.hud-reload { position: absolute; display: grid; place-items: center; right: calc(max(var(--s-5), env(safe-area-inset-right)) + 6.6rem); bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 4.8rem); width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--highlight); border: var(--outline-w) solid var(--outline); box-shadow: 0 4px 0 0 var(--outline); font: inherit; font-size: 0.6875rem; font-weight: var(--text-weight-heavy); color: var(--ink-1); touch-action: none; }
.hud-reload:active { transform: translateY(3px); box-shadow: 0 1px 0 0 var(--outline); }
/* the crosshair opens with the gun's spread */
.hud-cross i:nth-child(1) { transform: translateY(calc(-0.5rem - var(--gap, 5px))); }
.hud-cross i:nth-child(2) { transform: translateY(calc(0.5rem + var(--gap, 5px))); }
.hud-cross i:nth-child(3) { transform: translateX(calc(-0.5rem - var(--gap, 5px))) rotate(90deg); }
.hud-cross i:nth-child(4) { transform: translateX(calc(0.5rem + var(--gap, 5px))) rotate(90deg); }
.hud-cross i { transition: transform 90ms var(--ease-out); }
/* name tags over the other players: armour over health, the name above */
.ptags { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.ptag { position: absolute; left: 0; top: 0; visibility: hidden; transform-origin: 0 0; will-change: transform, opacity; }
.ptag__in { display: grid; justify-items: center; gap: 2px; width: 5.5rem; translate: -50% -100%; }
.ptag__name { max-width: 100%; padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.6875rem; font-weight: var(--text-weight-heavy); color: var(--ink-1); background: oklch(from var(--surface-1) l c h / 0.9); border: 1.5px solid var(--outline); border-radius: 4px; line-height: 1.25; }
.ptag__bar { position: relative; width: 100%; height: 6px; background: oklch(from var(--inverse) l c h / 0.7); border: 1.5px solid var(--outline); border-radius: 3px; overflow: hidden; box-sizing: content-box; }
.ptag__bar i { position: absolute; inset: 0; transform-origin: left; background: #3fcf7f; transition: transform 160ms var(--ease-out); }
.ptag__bar--ar { height: 4px; }
.ptag__bar--ar i { background: #5fb4ff; }
.ptag[data-ar="none"] .ptag__bar--ar { opacity: 0.45; }
.ptag[data-hp="mid"] .ptag__bar--hp i { background: #ffd23f; }
.ptag[data-hp="low"] .ptag__bar--hp i { background: #ff5d47; }
.ptag.is-hit .ptag__in { animation: tag-shake 300ms var(--ease-out); }
.ptag.is-hit .ptag__bar--hp { animation: tag-flash 300ms var(--ease-out); }
.ptag.is-armour .ptag__bar--ar { animation: tag-flash-ar 300ms var(--ease-out); }
@keyframes tag-shake { 0% { transform: translateX(0); } 20% { transform: translateX(-4px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } 100% { transform: none; } }
@keyframes tag-flash { from { background: oklch(0.98 0.01 90); box-shadow: 0 0 6px oklch(0.98 0.05 90); } to { background: oklch(from var(--inverse) l c h / 0.7); box-shadow: none; } }
@keyframes tag-flash-ar { from { background: #d6eeff; box-shadow: 0 0 6px #7cc6ff; } to { background: oklch(from var(--inverse) l c h / 0.7); box-shadow: none; } }
/* damage numbers float up and fade on the clock */
.dmgnum { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; }
.dmgnum span { display: block; translate: -50% -50%; font-family: var(--font-display); font-size: 1.25rem; color: oklch(0.98 0.03 95); -webkit-text-stroke: 1.5px var(--outline); paint-order: stroke fill; animation: dmg-rise 900ms var(--ease-out) forwards; }
.dmgnum[data-kind="armour"] span { color: #7cc6ff; }
.dmgnum[data-kind="big"] span { color: var(--highlight); font-size: 1.6rem; }
@keyframes dmg-rise { 0% { transform: translateY(6px) scale(0.6); opacity: 0; } 15% { transform: translateY(0) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-34px) scale(0.95); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ptag.is-hit .ptag__in { animation: none; } .dmgnum span { animation-duration: 600ms; } }
@media (pointer: coarse) { .ptag__in { width: 4.5rem; } .ptag__name { font-size: 0.625rem; } }
.hud-center { position: absolute; left: 50%; top: 32%; translate: -50% 0; padding: var(--s-3) var(--s-5); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); font-family: var(--font-display); font-size: clamp(1.4rem, 1rem + 1.6vw, 2.4rem); text-align: center; opacity: 0; transform: translateY(8px); transition: opacity var(--d-3) var(--ease-out), transform var(--d-3) var(--ease-out); pointer-events: none; white-space: nowrap; box-shadow: 0 6px 0 0 var(--outline); }
.hud-center[data-show] { opacity: 1; transform: none; }
.hud-prompt { position: absolute; left: 50%; bottom: 28%; translate: -50% 0; padding: var(--s-2) var(--s-4); background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); font-weight: var(--text-weight-strong); }
.hud-wheel { position: absolute; left: 50%; top: 50%; translate: -50% -50%; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); padding: var(--s-3); background: oklch(from var(--surface-1) l c h / 0.94); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); }
.hud-wheel__btn { display: flex; align-items: center; gap: 6px; min-width: 7rem; min-height: 3rem; padding: 0 var(--s-3); background: var(--surface-2); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); font: inherit; font-weight: var(--text-weight-heavy); color: var(--ink-1); cursor: pointer; }
.hud-wheel__btn span { display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 4px; background: var(--highlight); font-size: var(--t-xs); }
.hud-wheel[hidden] { display: none; }
.hud-wheel__btn[aria-selected="true"] { background: var(--highlight); color: var(--on-highlight); }
/* desktop: a ring around the crosshair, picked with the mouse while B is held (the view stays still) */
.hud[data-desk] .hud-wheel { display: block; width: 19rem; height: 19rem; padding: 0; border-radius: 50%; background: radial-gradient(circle, oklch(from var(--surface-1) l c h / 0.96) 0 32%, oklch(from var(--surface-1) l c h / 0.82) 33% 100%); }
.hud[data-desk] .hud-wheel[hidden] { display: none; }
.hud[data-desk] .hud-wheel__btn { position: absolute; left: 50%; top: 50%; min-width: 6.5rem; min-height: 2.6rem; justify-content: center; transform: translate(-50%, -50%) rotate(var(--a)) translateY(-6.6rem) rotate(calc(var(--a) * -1)); transition: background var(--d-1) var(--ease-out), scale var(--d-1) var(--ease-out); }
.hud[data-desk] .hud-wheel__btn[aria-selected="true"] { scale: 1.08; box-shadow: 0 3px 0 0 var(--outline); }
.hud-wheel__hub { position: absolute; left: 50%; top: 50%; width: 6.4rem; translate: -50% -50%; display: grid; justify-items: center; gap: 4px; text-align: center; font-size: var(--t-xs); font-weight: var(--text-weight-strong); color: var(--ink-2); line-height: 1.2; pointer-events: none; }
.hud-wheel__hub i { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--accent); border: var(--outline-w-sm) solid var(--outline); }
.hud-emote__key { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.2rem; margin-left: 6px; padding: 0 4px; background: var(--highlight); color: var(--on-highlight); border: var(--outline-w-sm) solid var(--outline); border-radius: 4px; font: inherit; font-size: var(--t-xs); font-weight: var(--text-weight-heavy); }
.hud-leave { position: absolute; top: calc(max(var(--s-3), env(safe-area-inset-top)) + 4.4rem); left: max(var(--s-3), env(safe-area-inset-left)); }
.hud-emote { position: absolute; bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 4.5rem); right: max(var(--s-3), env(safe-area-inset-right)); }
/* desktop aiming: the note while the mouse is free, the crosshair, the mouse speed slider */
.hud-aimnote { position: absolute; left: 50%; top: calc(50% + 3rem); translate: -50% 0; display: grid; justify-items: center; gap: 4px; max-width: min(34rem, 90vw); padding: var(--s-3) var(--s-5); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); box-shadow: 0 5px 0 0 var(--outline); text-align: center; pointer-events: none; }
.hud-aimnote strong { font-family: var(--font-display); font-weight: 400; font-size: var(--t-xl); line-height: 1.1; text-wrap: balance; }
.hud-aimnote > span { font-size: var(--t-sm); color: var(--ink-2); font-weight: var(--text-weight-strong); }
.hud-aimnote[data-state="error"], .hud-aimnote[data-state="none"] { background: var(--highlight); border-color: var(--outline); }
.hud-aimnote[data-state="error"] > span, .hud-aimnote[data-state="none"] > span { color: var(--ink-1); }
.hud-aimnote__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-2); pointer-events: auto; }
.hud-aimnote__acts[hidden], .hud-aimnote__acts [hidden] { display: none; }
/* once read, the free-aim note shrinks to a strip under the storm timer, its buttons still in reach */
.hud-aimnote[data-compact] { top: calc(max(var(--s-3), env(safe-area-inset-top)) + 3.6rem); padding: var(--s-2) var(--s-4); gap: 2px; box-shadow: 0 3px 0 0 var(--outline); }
.hud-aimnote[data-compact] strong { font-size: var(--t-md); }
.hud-aimnote[data-compact] > span:not(.hud-aimnote__acts) { display: none; }
.hud-aimnote[data-compact] .hud-aimnote__acts { margin-top: 2px; }
/* the note's ×: hides it for good (H too); Controls, by the switches, brings it back */
.hud-aimnote { padding-right: calc(var(--s-5) + 1.5rem); padding-left: calc(var(--s-5) + 1.5rem); }
.hud-aimnote__hide { position: absolute; top: var(--s-1); right: var(--s-1); pointer-events: auto; }
.hud-aimnote[data-compact] { padding-right: calc(var(--s-4) + 1.75rem); padding-left: calc(var(--s-4) + 1.75rem); }
.hud-aimnote[data-compact] .hud-aimnote__hide { top: 50%; translate: 0 -50%; }
.hud-helpbtn { align-self: flex-start; pointer-events: auto; gap: var(--s-2); }
.hud-helpbtn kbd { display: inline-grid; place-items: center; min-width: 1.3rem; height: 1.2rem; padding: 0 4px; background: var(--surface-2); border: var(--outline-w-sm) solid var(--outline); border-radius: 4px; font: inherit; font-size: var(--t-xs); font-weight: var(--text-weight-heavy); color: var(--ink-1); }
/* free aim (the browser kept the mouse): the crosshair is the cursor, so the system one hides over the island */
[data-aim="free"] canvas.gl { cursor: none; }
/* the crosshair sits where the shot will land (placed every frame); in free aim a small ring marks the cursor itself */
.hud-ptr { display: none; position: absolute; z-index: 1; left: 50%; top: 50%; width: 0.75rem; height: 0.75rem; translate: calc(-50% + var(--px, 0px)) calc(-50% + var(--py, 0px)); border-radius: 50%; border: 2px solid var(--surface-1); box-shadow: 0 0 0 1.5px var(--outline), inset 0 0 0 1.5px var(--outline); opacity: 0.85; pointer-events: none; }
[data-aim="free"] .hud-ptr { display: block; }
.hud:has(.hud-wheel:not([hidden])) .hud-ptr { opacity: 0.25; }
/* the side zones that turn the view in free aim, lit while the cursor is in one */
.hud-turn { position: absolute; top: 18%; bottom: 18%; width: 3px; border-radius: 2px; background: var(--surface-1); box-shadow: 0 0 0 1.5px var(--outline); opacity: 0; transition: opacity var(--d-2) var(--ease-out); pointer-events: none; }
.hud-turn--l { left: max(var(--s-3), env(safe-area-inset-left)); } .hud-turn--r { right: max(var(--s-3), env(safe-area-inset-right)); }
.hud-turn[data-on] { opacity: 0.9; }
/* the arrow keys' switch: aim or move */
.hud-arrows { display: flex; align-items: center; gap: var(--s-2); pointer-events: auto; }
.hud-arrows .k-seg { padding: 2px; }
.hud-arrows .k-seg label { min-height: 1.6rem; padding: 0 var(--s-3); font-size: var(--t-xs); }
.hud-aimnote[data-state="wait"] { background: var(--highlight); }
.hud-aimnote .hud-keys { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px; margin-top: 4px; font-size: var(--t-xs); color: var(--ink-2); }
.hud-keys kbd { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.4rem; padding: 0 5px; background: var(--surface-2); border: var(--outline-w-sm) solid var(--outline); border-radius: 5px; box-shadow: 0 2px 0 0 var(--outline); font: inherit; font-weight: var(--text-weight-heavy); color: var(--ink-1); }
.hud-keys kbd + kbd { margin-left: -2px; }
.hud-cross { position: absolute; z-index: 1; left: 50%; top: 50%; width: 2.75rem; height: 2.75rem; translate: calc(-50% + var(--cx, 0px)) calc(-50% + var(--cy, 0px)); pointer-events: none; transition: opacity var(--d-1) var(--ease-out); }
/* the emote wheel sits over the crosshair, which steps back while it is open */
.hud-wheel { z-index: 4; }
.hud:has(.hud-wheel:not([hidden])) .hud-cross { opacity: 0.25; }
.hud-cross i { position: absolute; left: 50%; top: 50%; width: 3px; height: 0.7rem; margin: -0.35rem 0 0 -1.5px; border-radius: 2px; background: var(--surface-1); box-shadow: 0 0 0 1.5px var(--outline); }
.hud-cross i:nth-child(1) { transform: translateY(-0.85rem); }
.hud-cross i:nth-child(2) { transform: translateY(0.85rem); }
.hud-cross i:nth-child(3) { transform: translateX(-0.85rem) rotate(90deg); }
.hud-cross i:nth-child(4) { transform: translateX(0.85rem) rotate(90deg); }
.hud-cross b { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--surface-1); box-shadow: 0 0 0 1.5px var(--outline); }
.hud.is-hit .hud-cross { animation: cross-hit 280ms var(--ease-out); }
.hud.is-hit .hud-cross i, .hud.is-hit .hud-cross b { animation: cross-ink 280ms var(--ease-out); }
@keyframes cross-hit { from { transform: rotate(45deg) scale(1.35); } to { transform: none; } }
@keyframes cross-ink { from { background: var(--accent); } to { background: var(--surface-1); } }
.hud-sens { display: flex; align-items: center; gap: var(--s-2); padding: 4px 10px; background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); font-size: var(--t-xs); font-weight: var(--text-weight-heavy); color: var(--ink-1); cursor: pointer; }
.hud-sens b { min-width: 3.2rem; text-align: right; font-size: var(--t-sm); }
.hud-sens__range { -webkit-appearance: none; appearance: none; width: 7.5rem; height: 1.5rem; margin: 0; background: transparent; cursor: pointer; }
.hud-sens__range::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--surface-3); border: 2px solid var(--outline); }
.hud-sens__range::-moz-range-track { height: 8px; border-radius: 4px; background: var(--surface-3); border: 2px solid var(--outline); }
.hud-sens__range::-webkit-slider-thumb { -webkit-appearance: none; width: 1.1rem; height: 1.1rem; margin-top: -7px; border-radius: 50%; background: var(--highlight); border: 2px solid var(--outline); box-shadow: 0 2px 0 0 var(--outline); }
.hud-sens__range::-moz-range-thumb { width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--highlight); border: 2px solid var(--outline); }
.hud-sens__range:focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.hud[data-desk] .hud__bl { flex-direction: column; align-items: flex-start; }
.hud-hurt { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; box-shadow: inset 0 0 0 0.6rem var(--bad), inset 0 0 8rem oklch(from var(--bad) l c h / 0.6); }
.hud-hurt.is-on { animation: hurt 420ms var(--ease-out); }
@keyframes hurt { from { opacity: 1; } to { opacity: 0; } }
.hud.is-storm::after { content: "The tsunami has you. Get back inside the circle."; position: absolute; left: 50%; top: 4.6rem; translate: -50% 0; padding: 6px 12px; background: #1f76c4; color: oklch(0.98 0.01 230); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-1); font-weight: var(--text-weight-heavy); font-size: var(--t-sm); white-space: nowrap; }
/* caught by the tsunami: the screen's edges go blue and wavy */
.hud.is-storm .hud-hurt { opacity: 1; box-shadow: inset 0 0 5rem oklch(0.55 0.13 235 / 0.75), inset 0 0 1.4rem oklch(0.75 0.1 210 / 0.8); }
.hud.is-storm .hud-hurt::before, .hud.is-storm .hud-hurt::after { content: ""; position: absolute; inset: -2rem; pointer-events: none;
  background: radial-gradient(1.6rem 1.1rem at 50% 0, oklch(0.62 0.12 225 / 0.7) 60%, transparent 62%) 0 0 / 3.2rem 2.4rem repeat-x,
    radial-gradient(1.6rem 1.1rem at 50% 100%, oklch(0.62 0.12 225 / 0.7) 60%, transparent 62%) 0 100% / 3.2rem 2.4rem repeat-x,
    radial-gradient(1.1rem 1.6rem at 0 50%, oklch(0.62 0.12 225 / 0.7) 60%, transparent 62%) 0 0 / 2.4rem 3.2rem repeat-y,
    radial-gradient(1.1rem 1.6rem at 100% 50%, oklch(0.62 0.12 225 / 0.7) 60%, transparent 62%) 100% 0 / 2.4rem 3.2rem repeat-y;
  animation: wavy 1.6s linear infinite; }
.hud.is-storm .hud-hurt::after { inset: -1.2rem; opacity: 0.55; animation-duration: 2.3s; animation-direction: reverse; filter: hue-rotate(-15deg); }
@keyframes wavy { from { transform: translate(0, 0); } 50% { transform: translate(1.6rem, 0.4rem); } to { transform: translate(3.2rem, 0); } }
@media (prefers-reduced-motion: reduce) { .hud.is-storm .hud-hurt::before, .hud.is-storm .hud-hurt::after { animation: none; } }
.hud:not([data-desk]).is-hit::before { content: ""; position: absolute; left: 50%; top: 50%; width: 1.6rem; height: 1.6rem; translate: -50% -50%; border: 3px solid var(--highlight); border-radius: 50%; animation: hurt 260ms var(--ease-out) both; }
.hud:not([data-desk])::before { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; translate: -50% -50%; border-radius: 50%; background: var(--surface-1); box-shadow: 0 0 0 2px var(--outline); }
/* phone sticks */
.hud-stick { position: absolute; left: max(var(--s-5), env(safe-area-inset-left)); bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 4.5rem); width: 8.5rem; height: 8.5rem; border-radius: 50%; background: oklch(from var(--surface-1) l c h / 0.35); border: var(--outline-w) solid oklch(from var(--outline) l c h / 0.5); touch-action: none; display: grid; place-items: center; }
.hud-stick__knob { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--surface-1); border: var(--outline-w) solid var(--outline); box-shadow: 0 4px 0 0 var(--outline); }
.hud-aim { position: absolute; right: 0; top: 18%; bottom: 0; width: 50%; touch-action: none; z-index: -1; }
.hud-fire, .hud-swap { position: absolute; display: grid; place-items: center; border-radius: 50%; border: var(--outline-w) solid var(--outline); font: inherit; font-weight: var(--text-weight-heavy); color: var(--ink-1); touch-action: none; }
.hud-fire { right: max(var(--s-5), env(safe-area-inset-right)); bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 8.5rem); width: 5.5rem; height: 5.5rem; background: var(--accent); box-shadow: 0 6px 0 0 var(--outline); font-size: var(--t-lg); }
.hud-fire[data-on] { transform: translateY(5px); box-shadow: 0 1px 0 0 var(--outline); }
.hud-swap { right: calc(max(var(--s-5), env(safe-area-inset-right)) + 6.5rem); bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 9rem); width: 3.5rem; height: 3.5rem; background: var(--surface-1); box-shadow: 0 4px 0 0 var(--outline); font-size: var(--t-xs); }
@media (pointer: coarse) {
  .hud__br { bottom: max(var(--s-3), env(safe-area-inset-bottom)); }
  /* phones: the ammo plate sits over a row of five compact slots */
  .hud-weapons { flex-direction: column; align-items: flex-end; gap: 4px; }
  .hud-slot { min-width: 2.5rem; width: 2.5rem; min-height: 2.75rem; padding: 2px 3px 6px; justify-items: center; text-align: center; font-size: 0.6875rem; }
  .hud-ammo { order: -1; min-width: 0; padding: 2px 10px; grid-auto-flow: column; gap: 6px; align-items: baseline; }
  .hud-ammo b { font-size: var(--t-lg); }
  .hud-vitals { width: 8.5rem; }
  /* phones: a round button; the cooldown fills it from the bottom behind the words, and its seconds take the wood's line */
  .hud-build { position: absolute; right: calc(max(var(--s-5), env(safe-area-inset-right)) + 6.5rem); bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 13rem); width: 3.75rem; height: 3.75rem; min-width: 0; padding: 0; border-radius: 50%; border-width: var(--outline-w); grid-template-columns: none; justify-items: center; align-content: center; gap: 0; box-shadow: 0 4px 0 0 var(--outline); }
  .hud-build__t, .hud-build__wood, .hud-build__cd { grid-column: auto; grid-row: auto; }
  .hud-build__t { font-size: var(--t-xs); }
  .hud-build__wood { font-size: 0.625rem; }
  .hud-build__wood b { font-size: var(--t-xs); }
  .hud-build__ring { display: block; position: absolute; inset: 0; z-index: -1; background: oklch(from var(--outline) l c h / 0.2); transform-origin: bottom; transform: scaleY(var(--cd)); pointer-events: none; }
  .hud-build__cd { width: auto; height: auto; border-radius: 0; line-height: 1.2; }
  .hud-build__cd::before { display: none; }
  .hud-build__cd[hidden] { display: none; }
  .hud-build:has(.hud-build__cd:not([hidden])) .hud-build__wood { display: none; }
  .hud__bl { bottom: max(var(--s-3), env(safe-area-inset-bottom)); }
  .hud-emote { bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 15rem); }
  .hud-map { width: 6rem; height: 6rem; }
  .hud-feed { max-width: 14rem; }
  /* the wave pill gets its own row under the counters, clear of the map */
  .hud__t { top: calc(max(var(--s-3), env(safe-area-inset-top)) + 4.4rem); }
  .hud-storm { padding: 4px 10px; font-size: var(--t-sm); gap: 6px; max-width: 10.5rem; }
  .hud-storm > span:not(.hud-storm__dot) { overflow: hidden; text-overflow: ellipsis; }
  .hud-storm b { font-size: var(--t-md); }
}
@media (pointer: coarse) and (max-width: 767px) { .hud.is-storm::after { top: 7.6rem; } }

/* ---------- results ---------- */
.results__show { position: relative; height: 18rem; border-radius: var(--r-3); overflow: hidden; border: var(--outline-w) solid var(--outline); background: linear-gradient(#64c9c3, #e4f7ee); margin-bottom: var(--s-4); }
.results__show svg { width: 100%; height: 100%; }
.results__winner { display: flex; align-items: center; gap: var(--s-3); font-size: var(--t-xl); margin-bottom: var(--s-3); }
.results__winner b { font-family: var(--font-display); font-weight: 400; overflow-wrap: anywhere; }
.results__stamp { padding: 2px 8px; border: 3px solid var(--good-ink); color: var(--good-ink); border-radius: 6px; font-size: var(--t-sm); font-weight: var(--text-weight-heavy); text-transform: uppercase; rotate: -5deg; animation: stamp 420ms 200ms var(--ease-out) both; }
.results__line { font-size: var(--t-lg); }

/* ---------- pages ---------- */
.page { padding-block: var(--s-5) var(--s-8); }
.page__title { font-size: var(--t-h1); margin: 0; }
.side__lede { margin: var(--s-2) 0 var(--s-4); max-width: 60ch; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s-6); align-items: start; }
.show { position: sticky; top: calc(var(--topbar-h) + var(--s-4)); height: min(40rem, calc(100dvh - var(--topbar-h) - var(--s-7))); min-height: 24rem; background: linear-gradient(#64c9c3, #e4f7ee); cursor: grab; }
.show:active { cursor: grabbing; }
.show__still { position: absolute; inset: 15%; }
.show__still svg { width: 100%; height: 100%; }
.show__badge { position: absolute; z-index: 2; top: var(--s-4); left: var(--s-4); padding: 4px 12px; background: var(--surface-1); border-radius: var(--r-1); font-weight: var(--text-weight-heavy); font-size: var(--t-sm); max-width: calc(100% - 2rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.show__emotes { position: absolute; z-index: 2; left: var(--s-4); right: var(--s-4); bottom: var(--s-4); display: flex; flex-wrap: wrap; gap: var(--s-2); }
.side__head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4); flex-wrap: wrap; }
.save { margin: 0; font-weight: var(--text-weight-heavy); font-size: var(--t-sm); min-height: 1.4em; }
.save[data-state="saved"] { color: var(--good-ink); }
.save[data-state="error"] { color: var(--bad-ink); }
.save[data-state="saving"] { color: var(--ink-2); }
.gate { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-4); padding: var(--s-4) var(--s-5); }
.gate p { margin: 0; }
@media (max-width: 600px) {
  /* one compact row on phones, so the first items show under the turntable */
  .gate { flex-wrap: nowrap; gap: var(--s-3); padding: var(--s-3) var(--s-4); }
  .gate p { font-size: var(--t-sm); line-height: 1.35; min-width: 0; }
  .gate .k-btn { flex: none; min-height: var(--control-h-sm); padding-inline: var(--s-3); font-size: var(--t-sm); }
}
.side .k-tabs { margin-bottom: var(--s-4); }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: var(--s-3); }
.tile { display: grid; gap: var(--s-2); align-content: start; min-width: 0; }
.tile__btn { display: grid; justify-items: center; gap: 4px; width: 100%; padding: var(--s-3) var(--s-2); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); font: inherit; color: var(--ink-1); cursor: pointer; box-shadow: 0 var(--tile-depth) 0 0 var(--tile-side); transition: transform var(--d-1) var(--ease-out), box-shadow var(--d-1) var(--ease-out), background-color var(--d-2) var(--ease-out); }
@media (hover: hover) { .tile__btn:hover { transform: translateY(-2px); box-shadow: 0 calc(var(--tile-depth) + 2px) 0 0 var(--tile-side); } }
.tile__btn:active { transform: translateY(3px); box-shadow: 0 2px 0 0 var(--tile-side); }
.tile__btn[aria-pressed="true"] { background: var(--highlight); }
.tile__btn[aria-disabled="true"] { cursor: default; }
/* locked items keep their full colours (the detail is the point); a small padlock sticker says they're locked */
.tile[data-locked] .tile__btn { position: relative; }
.tile[data-locked] .tile__btn::before { content: ""; position: absolute; top: 6px; right: 6px; width: 1.5rem; height: 1.5rem; border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-1); background: var(--highlight) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 7V5a3 3 0 0 1 6 0v2' fill='none' stroke='%23173634' stroke-width='2'/%3E%3Crect x='3' y='7' width='10' height='7' rx='1.5' fill='%23173634'/%3E%3C/svg%3E") center / 0.95rem no-repeat; box-shadow: 0 2px 0 0 var(--outline); }
.side > .shop__rule { margin-top: var(--s-5); }
.tile__art { width: 100%; max-width: 8rem; aspect-ratio: 1; }
.tile__art svg { width: 100%; height: 100%; display: block; }
.tile__name { font-weight: var(--text-weight-heavy); font-size: var(--t-sm); text-align: center; line-height: 1.2; }
.tile__price { font-size: var(--t-xs); font-weight: var(--text-weight-strong); color: var(--ink-2); }
.tile__shop { font-size: var(--t-xs); text-align: center; color: var(--ink-1); }
.tile--skel { padding: var(--s-3); background: var(--surface-1); border-radius: var(--r-3); }
.tile[data-owned] .tile__btn { background: var(--surface-2); }
/* an owned item: "Owned" and a compact Wear it button share one row under the art, each sized to its words */
.tile__owned { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--s-1) var(--s-2); margin: 0 var(--s-2); min-width: 0; }
.tile__own { display: inline-flex; align-items: center; gap: 3px; font-size: var(--t-xs); font-weight: var(--text-weight-heavy); color: var(--good-ink); white-space: nowrap; }
.tile__own .k-icon { width: 0.95rem; height: 0.95rem; }
.tile__wear.k-btn { --btn-h: 1.9rem; width: auto; flex: none; padding: 0 var(--s-3); font-size: var(--t-xs); white-space: nowrap; }
.k-tabbar { z-index: 60; pointer-events: auto; }
.k-tabbar a { touch-action: manipulation; }
.tile__price { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiles--shop { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.tiles--shop .tile { gap: 0; padding-bottom: var(--s-3); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); box-shadow: 0 var(--tile-depth) 0 0 var(--tile-side); overflow: clip; }
.tiles--shop .tile > .k-btn { width: auto; margin: 0 var(--s-3); }
.tiles--shop .tile__btn { border: 0; box-shadow: none; border-radius: 0; background: transparent; }
.tiles--shop .tile__btn:hover, .tiles--shop .tile__btn:active { transform: none; box-shadow: none; }
.tiles--shop .tile[aria-current="true"] { background: var(--highlight); }
.tiles--shop .tile[data-owned] .tile__btn { background: transparent; }
.shop__rule { margin-top: var(--s-5); }
.tile--skel { border: 0 !important; }
.shop__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-5); margin-bottom: var(--s-5); flex-wrap: wrap; }
.burnstat { display: grid; gap: 2px; padding: var(--s-3) var(--s-5); background: var(--inverse); color: var(--on-inverse); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); min-width: 15rem; }
.burnstat__label { font-weight: var(--text-weight-heavy); font-size: var(--t-sm); color: var(--on-inverse-2); }
.burnstat__val { font-size: var(--t-2xl); color: var(--highlight); }
.burnstat__sub { font-size: var(--t-xs); font-weight: var(--text-weight-strong); color: var(--on-inverse-2); }
.shop__rule { margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4); background: var(--surface-1); border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); font-size: var(--t-sm); font-weight: var(--text-weight-strong); }

.board__head { margin-bottom: var(--s-4); }
.board__panel { margin-top: var(--s-4); }
.board__face { display: inline-block; width: 2.25rem; height: 2.25rem; border-radius: 50%; overflow: hidden; background: var(--surface-2); border: var(--outline-w-sm) solid var(--outline); flex: none; }
.board__face svg { width: 100%; height: 100%; display: block; }
.board__foot { padding: var(--s-4) var(--s-5); margin: 0; }

/* the money flow: pipes between ink nodes */
.flow { display: grid; gap: var(--s-4); margin-bottom: var(--s-6); grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.fcard { padding: var(--s-4) var(--s-4) var(--s-5); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); box-shadow: 0 var(--tile-depth) 0 0 var(--tile-side); text-align: center; min-width: 0; }
.fcard .flow__title { text-align: left; }
.fnode { display: inline-grid; justify-items: center; gap: 2px; max-width: 100%; padding: 8px 10px; border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); background: var(--surface-2); font-weight: var(--text-weight-heavy); font-size: var(--t-sm); line-height: 1.25; overflow-wrap: anywhere; position: relative; z-index: 1; }
.fnode b { font-family: var(--font-display); font-weight: 400; font-size: var(--t-lg); }
.fnode__val { font-size: var(--t-xs); color: var(--ink-2); }
.fnode__val:empty { display: none; }
#match-list > .k-empty { margin: 0 var(--pad-panel) var(--pad-panel); }
.fnode .fnode__val { display: block; white-space: normal; overflow-wrap: anywhere; text-wrap: balance; }
.fcols > .fnode, .fsub > .fnode { width: 100%; }
.fnode--in { background: var(--inverse); color: var(--on-inverse); padding-inline: var(--s-4); }
.fnode--in .fnode__val { color: var(--on-inverse-2); }
.fnode--burn { background: var(--accent); }
.fnode--vault { background: var(--ground); }
.fnode--prize { background: var(--highlight); }
.fcols { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--s-2); align-items: start; }
.fcols > * { min-width: 0; }
.fsub { display: grid; justify-items: center; }
.fork { display: block; width: 100%; height: 2.75rem; margin: -2px 0; overflow: visible; }
.fcard .flow__note { text-align: left; }
@media (max-width: 1100px) { .flow { grid-template-columns: minmax(0, 1fr); } .fcard { max-width: 36rem; } }
.flow__row { padding: var(--s-4) var(--s-5); background: var(--surface-1); border: var(--outline-w) solid var(--outline); border-radius: var(--r-3); box-shadow: 0 var(--tile-depth) 0 0 var(--tile-side); }
.flow__title { font-size: var(--t-lg); margin: 0 0 var(--s-3); }
.flow__pipe { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.node { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: var(--outline-w-sm) solid var(--outline); border-radius: var(--r-2); background: var(--surface-2); font-weight: var(--text-weight-heavy); font-size: var(--t-sm); }
.node b { font-weight: var(--text-weight-heavy); color: var(--ink-2); }
.node--in { background: var(--inverse); color: var(--on-inverse); }
.node--in b { color: var(--on-inverse-2); }
.node--burn { background: var(--accent); }
.node--vault { background: var(--ground); }
.node--prize { background: var(--highlight); }
.pipe { flex: none; width: 2.5rem; height: 0.5rem; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--ink-1) 0 8px, transparent 8px 13px); background-size: 13px 100%; animation: flow 900ms linear infinite; }
@keyframes flow { to { background-position: 13px 0; } }
.flow__note { margin: var(--s-3) 0 0; font-size: var(--t-sm); color: var(--ink-2); }
.matches__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--s-5); align-items: start; }
.log { max-height: 34rem; overflow: auto; padding: 0 var(--s-5) var(--s-3); }
.log .k-list__item { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.log__note { font-size: var(--t-xs); color: var(--ink-2); overflow-wrap: anywhere; }
.matches__owner { margin-top: var(--s-4); }
.k-panel--flush .k-empty { padding: var(--s-6) var(--s-5); }

/* ---------- sheets ---------- */
.how-steps { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: grid; gap: var(--s-4); }
.how-steps li { display: grid; grid-template-columns: 4rem 1fr; gap: var(--s-3); align-items: start; }
.how-steps svg { width: 4rem; height: 4rem; }
.how-sub { font-size: var(--t-lg); margin: var(--s-5) 0 var(--s-2); }
.k-stats dd { max-width: 65%; }
.spark { width: 100%; height: 4rem; display: block; margin-bottom: var(--s-3); }
.coin-note { font-size: var(--t-sm); }
.coin-actions { display: grid; gap: var(--s-3); justify-items: center; margin-top: var(--s-4); }
#coin-body .k-seg { width: 100%; }
#coin-body .k-seg label { flex: 1; }

/* ---------- footer ---------- */
.foot { display: grid; grid-template-columns: 1.3fr 1fr 1.5fr; gap: var(--s-6); }
.foot__brand { display: flex; gap: var(--s-3); align-items: flex-start; }
.foot__brand p { margin: 0; color: var(--ink-2); }
.foot__brand b { color: var(--ink-1); }
.foot__nav { display: grid; gap: var(--s-2); align-content: start; }
.foot__how { background: none; border: 0; padding: 0; font: inherit; font-weight: var(--text-weight-strong); text-align: left; cursor: pointer; color: inherit; }
.foot__facts p { margin: 0 0 var(--s-2); color: var(--ink-2); font-size: var(--t-sm); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .seats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bench { margin-top: calc(-1 * clamp(7rem, 14vh, 10rem)); }
}
@media (max-width: 1023px) {
  .split, .matches__grid { grid-template-columns: minmax(0, 1fr); }
  .show { position: relative; top: 0; height: 22rem; min-height: 0; }
  .foot { grid-template-columns: 1fr; gap: var(--s-4); }
}
@media (max-width: 767px) {
  .play__stage { height: 27rem; min-height: 0; }
  .play__over { inset: calc(var(--topbar-h) + var(--s-3)) 0 auto 0; flex-direction: column; gap: var(--s-3); }
  .play__title { font-size: 1.75rem; }
  .play__sub { font-size: var(--t-md); }
  .steps { display: none; }
  .pot { position: absolute; right: var(--gutter); top: 11.5rem; min-width: 0; padding: var(--s-2) var(--s-4); }
  .bench__end { width: 100%; }
  .bench__clock { margin-left: auto; }
  .pot__val { font-size: 1.6rem; }
  .bench { margin-top: calc(-1 * var(--s-6)); }
  .bench__panel { padding: var(--s-4); }
  .seats { gap: var(--s-2); }
  .seat { padding: var(--s-2) 4px 6px; }
  .seat__stamp { display: none; }
  .bench__actions { margin-top: 0; flex-wrap: nowrap; }
  .bench__actions .k-btn { flex: 1; min-width: 0; font-size: var(--t-sm); }
  .bench__actions .bench__enter { flex: 1.4; }
  .bench__enter { min-width: 0; }
  .bench__head { align-items: flex-start; }
  .show { height: 17rem; }
  .shop__head { margin-bottom: var(--s-3); gap: var(--s-3); }
  .burnstat { padding: var(--s-2) var(--s-4); rotate: 0deg; width: 100%; }
  .shop .show { height: 13rem; }
  .shop .side__lede, .burnstat__sub { display: none; }
  .burnstat__val { font-size: var(--t-xl); }
  .play__sub { padding-block: 6px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow__row { padding: var(--s-4); }
  .pipe { width: 1.5rem; }
  .hud-center { white-space: normal; width: max-content; max-width: 88vw; }
  .hud.is-storm::after { top: 4rem; white-space: normal; width: max-content; max-width: 70vw; text-align: center; }
  .hud-hint { display: none; }
}
@media (min-width: 1700px) {
  .play__stage { height: min(var(--stage-h), 68rem); }
  .seat__art, .seat__ghost { max-width: 7rem; }
}
@media (prefers-reduced-motion: reduce) { .pipe { animation: none; } }
