/* =====================================================================
   LanceyPants — app styles. Vanilla CSS, no framework.
   ===================================================================== */

* { box-sizing: border-box; }
/* The `hidden` attribute must always win. Author `display` rules (e.g.
   .auth-form{display:grid}, .presence{display:inline-flex}) otherwise override
   the UA `[hidden]{display:none}`, which is why the register/forgot forms and the
   presence pill were all showing at once. */
[hidden] { display: none !important; }
/* Monochrome icons rendered as a mask filled with currentColor — so they follow
   the theme text colour instead of resolving to black inside an <img>. */
.ico { display: inline-block; flex: 0 0 auto; vertical-align: middle; background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100svh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
a { color: inherit; }
img { max-width: 100%; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 28px); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ---- Buttons & icons ---- */
.btn {
  --b: var(--accent);
  display: inline-flex; align-items: center; gap: .5em;
  border: var(--stroke) solid transparent; border-radius: 999px;
  padding: .6em 1.1em; font: inherit; font-weight: 650; cursor: pointer;
  text-decoration: none; transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--b); color: var(--on-accent); box-shadow: 0 6px 20px color-mix(in srgb, var(--b) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover, .btn-secondary:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: var(--stroke) solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn img { display: block; }
.icon-btn:active { transform: scale(.94); }

/* ---- Header / footer ---- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(140%) blur(10px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }
/* Plain-text wordmark (teal L, pink P) — most robust: always renders and is
   theme-aware, with no SVG/inline-image quirks. Core styles are also inlined on
   the element so it shows correctly even with a stale cached stylesheet. */
.brand-text { font-weight: 800; font-size: 1.4rem; letter-spacing: -.02em; line-height: 1; color: var(--text); white-space: nowrap; }
.main-nav { display: flex; gap: 6px; margin-left: 6px; }
.main-nav a { text-decoration: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.is-active { color: var(--text); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.presence { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; }
.presence-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-valid); box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-valid) 60%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-valid) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.site-footer { border-top: 1px solid var(--border); margin-top: 56px; padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); color: var(--muted); }
.site-footer p { margin: .2em 0; }

#app { display: block; padding: clamp(20px, 4vw, 40px) 0 0; min-height: 60svh; }
#app > * { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 28px); }
#app.is-loading { opacity: .6; }

/* ---- Hero + home grid ---- */
.hero { text-align: center; padding: 24px 0 8px; }
.hero-title { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 800; letter-spacing: -.02em; }
.grad { background: linear-gradient(90deg, var(--c-teal), var(--c-pink) 60%, var(--c-amber)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--muted); font-size: 1.05rem; max-width: 52ch; margin-inline: auto; }

.card-grid { display: grid; gap: clamp(14px, 2.5vw, 22px); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 26px; }
.game-card {
  --accent: var(--c-teal);
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  position: relative;
}
.game-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 16px 40px color-mix(in srgb, var(--accent) 22%, transparent); }
.game-card-thumb { aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.game-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-card-body { padding: 16px 18px 4px; }
.game-card-body h2 { font-size: 1.2rem; }
.game-card-body p { color: var(--muted); margin: 0; font-size: .94rem; }
.game-card-cta { padding: 14px 18px; font-weight: 700; color: var(--accent); }

/* ---- Page heads + prose ---- */
.page-head { padding: 10px 0 18px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
.prose { max-width: 70ch; }
.prose p { color: var(--text); }
.prose h2 { margin-top: 1.4em; }

/* ---- Game page ---- */
.game-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; max-width: 1000px; margin-inline: auto; }
.game-main { min-width: 0; }
.game-chrome { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.game-title { font-size: 1.5rem; margin: 0; flex: 0 1 auto; }
.game-chrome-stats { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.stat { color: var(--muted); font-size: .95rem; }
.stat strong { color: var(--text); font-variant-numeric: tabular-nums; }
.btn-back img { filter: none; }

.game-surface {
  position: relative; background: #06080f; border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; aspect-ratio: 16 / 10; width: 100%;
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none;
}
.game-surface canvas { display: block; max-width: 100%; height: auto; }
.game-loading { display: grid; place-items: center; gap: 12px; color: var(--muted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.game-over { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, #06080f 78%, transparent); backdrop-filter: blur(4px); z-index: 5; }
.game-over[hidden] { display: none; }
.game-over-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px 28px; text-align: center; box-shadow: var(--shadow); max-width: 90%; }
.final-score strong { font-size: 1.6rem; color: var(--accent); }
.game-over-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.submit-status { min-height: 1.2em; color: var(--muted); }
.submit-status.is-ok { color: var(--c-valid); }
.submit-status.is-err { color: var(--c-invalid); }

/* ---- Leaderboard ---- */
.game-board { position: sticky; top: 80px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.board-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 10px; }
.leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-row { display: grid; grid-template-columns: 2.4em 1fr auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; }
.lb-row:nth-child(odd) { background: var(--surface-2); }
.lb-row.lb-new { animation: flash 1.2s var(--ease); }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 40%, transparent); } }
.lb-rank { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-variant-numeric: tabular-nums; font-weight: 700; }
.lb-verified { color: var(--c-valid); }
.lb-empty { color: var(--muted); padding: 14px 6px; }
.lb-row:nth-child(1) .lb-rank { color: var(--c-gold); }
.lb-row:nth-child(2) .lb-rank { color: var(--c-silver); }
.lb-row:nth-child(3) .lb-rank { color: var(--c-bronze); }

.board-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.board-card-head h2 { font-size: 1.1rem; } .board-card-head a { text-decoration: none; }

/* ---- Account ---- */
.account { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.account-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; }
.account-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 12px; }
.account-dl dt { color: var(--muted); }
.account-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.save-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.save-list li { padding: 8px 10px; background: var(--surface-2); border-radius: 10px; display: flex; justify-content: space-between; gap: 10px; }
.account-name-form label, .account label { display: grid; gap: 4px; margin-bottom: 10px; }
input[type=text], input[type=email], input[type=password] {
  font: inherit; padding: 10px 12px; border-radius: 10px; border: var(--stroke) solid var(--border);
  background: var(--surface-2); color: var(--text); width: 100%;
}
input:focus { border-color: var(--accent); }

/* ---- Auth modal ---- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,6,12,.6); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow); max-height: 92svh; overflow: auto; }
.modal-close { position: absolute; top: 12px; right: 12px; font-size: 1.4rem; line-height: 1; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin: 12px 0 16px; }
.auth-tab { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 9px; font: inherit; font-weight: 650; cursor: pointer; }
.auth-tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 5px; font-size: .9rem; color: var(--muted); }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 4px; }
.turnstile { min-height: 0; display: flex; justify-content: center; }
.auth-msg { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--c-invalid) 18%, var(--surface)); color: var(--text); font-size: .9rem; }
.auth-msg.is-ok { background: color-mix(in srgb, var(--c-valid) 18%, var(--surface)); }
.auth-foot { text-align: center; margin: 14px 0 0; }

/* ---- Toast ---- */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity var(--t), transform var(--t); z-index: 80; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Touch controls (games) ---- */
.touch-controls { position: absolute; inset: auto 0 0 0; display: none; justify-content: space-between; padding: 14px; pointer-events: none; z-index: 4; }
body.is-touch .touch-controls { display: flex; }
.touch-pad { pointer-events: auto; display: grid; gap: 8px; }
.touch-btn { pointer-events: auto; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 70%, transparent); border: var(--stroke) solid var(--border); color: var(--text); font-size: 1.4rem; display: grid; place-items: center; touch-action: none; user-select: none; }
.touch-btn:active { background: var(--accent); color: var(--on-accent); }

/* ---- Tic-Tac-Toe (DOM board) ---- */
/* The board is sized against the GAME SURFACE (a size container), never the
   viewport — so it always fits the square and stays centred, on every layout. */
.ttt-surface { background: #06080f; container-type: size; }
.ttt {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(6px, 2.5cqh, 16px); padding: clamp(8px, 3cqmin, 20px); width: 100%;
}
.ttt-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.ttt-diff { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.ttt-diff button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 650; cursor: pointer; }
.ttt-diff button.is-active { background: var(--accent); color: var(--on-accent); }
.ttt-status { color: var(--muted); min-height: 1.4em; font-weight: 600; text-align: center; }
/* min(width-bound, height-bound, hard cap) keeps the 3x3 square inside the
   surface no matter its aspect ratio; cq units track the surface, not the page. */
.ttt-grid {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 0;
  width: min(86cqw, 62cqh, 420px); height: min(86cqw, 62cqh, 420px);
}
.ttt-cell { position: relative; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; padding: 0; min-width: 0; min-height: 0; overflow: hidden; }
/* Marks render as <img>, so size THEM (the old rule only matched inline <svg>,
   which let the 100x100 art overflow small cells). object-fit keeps them square. */
.ttt-cell svg, .ttt-cell .ttt-mark { width: 60%; height: 60%; object-fit: contain; }
.ttt-cell:disabled { cursor: default; }
.ttt-mark-enter { animation: pop var(--t) var(--ease); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.ttt-gridlines { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; z-index: 0; }
.ttt-winline { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; z-index: 2; }
.ttt-mark { display: block; position: relative; z-index: 1; }
@keyframes ttt-draw { to { stroke-dashoffset: 0; } }

/* ---- 3D games (three.js) — DOM HUD over the WebGL canvas ---- */
.z3d-surface { cursor: crosshair; background: #0a1018; }
.z3d-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; color: #fff; --z-accent: #84cc16; }
.z3d-crosshair {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%, -50%);
  background:
    linear-gradient(var(--z-accent), var(--z-accent)) center/2px 22px no-repeat,
    linear-gradient(var(--z-accent), var(--z-accent)) center/22px 2px no-repeat;
  opacity: .85; transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.z3d-crosshair.is-fire { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
.z3d-stats { position: absolute; left: 14px; top: 12px; right: 14px; display: flex; flex-direction: column; gap: 8px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.z3d-hpwrap { width: min(260px, 50%); height: 14px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; overflow: hidden; }
.z3d-hp { display: block; height: 100%; width: 100%; background: var(--z-accent); transition: width var(--t) var(--ease), background var(--t) var(--ease); }
.z3d-hp[data-low="true"] { background: #ef4444; }
.z3d-meta { display: flex; gap: 16px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; align-items: center; }
.z3d-coin { color: var(--c-gold, #fcd34d); }
.z3d-weapon { position: absolute; right: 16px; bottom: 14px; padding: 6px 12px; border-radius: 10px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2); font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.z3d-damage { position: absolute; inset: 0; box-shadow: inset 0 0 120px 30px rgba(220,38,38,.0); transition: box-shadow .12s ease; }
.z3d-damage.is-on { box-shadow: inset 0 0 120px 40px rgba(220,38,38,.55); }
/* overlay: menu / pause / shop */
.z3d-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; background: color-mix(in srgb, #06080f 62%, transparent); backdrop-filter: blur(2px); padding: 16px; }
.z3d-overlay[hidden] { display: none; }
.z3d-card { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 26px; max-width: min(440px, 92%); max-height: 90%; overflow: auto; box-shadow: var(--shadow); }
.z3d-card h3 { font-size: 1.4rem; margin: 0 0 .3em; }
.z3d-card p { color: var(--muted); margin: 0 0 12px; }
.z3d-card .z3d-hint { font-size: .85rem; }
.z3d-card .btn { color: var(--on-accent); }
.z3d-shop-coins { color: var(--c-gold, #fcd34d); font-weight: 700; }
.z3d-shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 16px; text-align: left; }
.z3d-buy { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; transition: border-color var(--t) var(--ease), transform var(--t-fast) var(--ease); }
.z3d-buy:hover:not(:disabled) { border-color: var(--accent); }
.z3d-buy:active:not(:disabled) { transform: scale(.97); }
.z3d-buy:disabled { opacity: .45; cursor: not-allowed; }
.z3d-buy-name { font-weight: 650; font-size: .92rem; }
.z3d-buy-price { color: var(--c-gold, #fcd34d); font-weight: 700; font-size: .85rem; }
.z3d-next { width: 100%; justify-content: center; }
/* touch controls */
.z3d-touch { position: absolute; inset: 0; pointer-events: none; }
.z3d-stick { position: absolute; left: 18px; bottom: 18px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
.z3d-stick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: color-mix(in srgb, var(--z-accent) 70%, #000); border: 2px solid rgba(255,255,255,.5); }
.z3d-fire { position: absolute; right: 22px; bottom: 34px; width: 86px; height: 86px; border-radius: 50%; pointer-events: auto; touch-action: none; font-weight: 800; letter-spacing: .05em; color: #fff; background: color-mix(in srgb, #ef4444 80%, transparent); border: 2px solid rgba(255,255,255,.5); }
.z3d-fire:active { background: #ef4444; }
.z3d-weapons { position: absolute; right: 18px; bottom: 132px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.z3d-wbtn { pointer-events: auto; touch-action: none; min-width: 64px; padding: 7px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.5); color: #fff; font: inherit; font-weight: 700; font-size: .8rem; }
.z3d-wbtn.is-active { background: color-mix(in srgb, var(--z-accent) 75%, #000); border-color: #fff; }
/* While the menu/shop/pause overlay is up, hide the in-play HUD bits. */
.z3d-hud:has([data-overlay]:not([hidden])) .z3d-crosshair,
.z3d-hud:has([data-overlay]:not([hidden])) .z3d-weapon,
.z3d-hud:has([data-overlay]:not([hidden])) .z3d-touch { display: none; }

/* ---- Lancey Blocks (voxel) HUD ---- */
/* Fill the screen in fullscreen (the 16/10 aspect-ratio would letterbox). */
.game-surface:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0; }
.vox-surface { cursor: crosshair; background: #9fc7ef; }
.vox-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; color: #fff; font-variant-numeric: tabular-nums; }
.vox-cross { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%);
  background: linear-gradient(#fff, #fff) center/2px 18px no-repeat, linear-gradient(#fff, #fff) center/18px 2px no-repeat; mix-blend-mode: difference; }
.vox-top { position: absolute; left: 12px; top: 10px; display: flex; gap: 14px; font-weight: 700; font-size: .9rem; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.vox-online { color: #4ade80; }
.vox-hearts { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); display: flex; gap: 1px; font-size: 18px; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.vox-hearts[hidden] { display: none; }
.vox-heart { color: #3a1414; }
.vox-heart.on, .vox-heart.half { color: #ef4444; }
.vox-hud.vox-dmg::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 110px 36px rgba(220,38,38,.55); pointer-events: none; }
.vox-hotbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 4px; padding: 5px; background: rgba(0,0,0,.4); border-radius: 12px; pointer-events: auto; max-width: 96%; justify-content: center; }
.vox-slot { position: relative; width: 40px; height: 40px; border-radius: 8px; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.3); padding: 3px; cursor: pointer; }
.vox-slot.is-active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.45); transform: scale(1.08); }
.vox-swatch { display: block; width: 100%; height: 100%; border-radius: 4px; }
.vox-num { position: absolute; right: 2px; bottom: 0; font-size: .72rem; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; }
/* inventory / crafting overlay */
.vox-inv { text-align: left; max-width: min(560px, 96%); }
.vox-inv-head { display: flex; align-items: center; gap: 12px; }
.vox-inv-head h3 { margin: 0; flex: 1; }
.vox-held { width: 38px; height: 38px; border-radius: 8px; border: 1px dashed var(--border); position: relative; display: grid; place-items: center; }
.vox-inv-sec { margin-top: 12px; }
.vox-inv-sec h4 { margin: 0 0 6px; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.vox-inv-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.vox-icell { position: relative; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; padding: 4px; }
.vox-icell.sel { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.vox-isw { display: block; width: 100%; height: 100%; border-radius: 5px; }
.vox-inum { position: absolute; right: 3px; bottom: 1px; font-size: .72rem; font-weight: 800; color: var(--text); }
.vox-craft { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 168px; overflow: auto; }
.vox-recipe { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.vox-recipe .vox-isw { width: 26px; height: 26px; flex: 0 0 auto; }
.vox-recipe.off { opacity: .45; cursor: not-allowed; }
.vox-rtxt { font-size: .82rem; font-weight: 650; display: flex; flex-direction: column; }
.vox-rtxt small { color: var(--muted); font-weight: 500; }
.vox-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; background: color-mix(in srgb, #06080f 55%, transparent); backdrop-filter: blur(2px); padding: 16px; }
.vox-overlay[hidden] { display: none; }
.vox-card { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 26px; max-width: min(440px, 94%); max-height: 90%; overflow: auto; box-shadow: var(--shadow); }
.vox-card h3 { font-size: 1.5rem; margin: 0 0 .3em; }
.vox-card p { color: var(--muted); margin: 0 0 14px; }
.vox-menu-btns { display: grid; gap: 8px; margin-top: 8px; }
.vox-menu-btns .btn { width: 100%; justify-content: center; }
.vox-set { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin: 8px 0; color: var(--text); font-size: .92rem; text-align: left; }
.vox-set input[type=range] { flex: 1; }
.vox-saves { display: grid; gap: 6px; margin: 8px 0; }
.vox-save { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.vox-save small { display: block; color: var(--muted); font-size: .78rem; }
.vox-save:hover { border-color: var(--accent); }
/* voxel touch */
.vox-touch { position: absolute; inset: 0; pointer-events: none; }
.vox-touch[hidden] { display: none; }
.vox-stick { position: absolute; left: 16px; bottom: 16px; width: 116px; height: 116px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
.vox-knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(0,0,0,.4); border: 2px solid rgba(255,255,255,.5); }
.vox-toprow { position: absolute; right: 12px; top: 10px; display: flex; gap: 8px; }
.vox-actions { position: absolute; right: 12px; bottom: 74px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vox-tbtn { width: 60px; height: 60px; border-radius: 14px; pointer-events: auto; touch-action: none; font-size: 1.4rem; color: #fff; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.4); }
.vox-tbtn.sm { width: 44px; height: 44px; font-size: 1.1rem; border-radius: 11px; }
.vox-tbtn.vox-break { background: color-mix(in srgb, #ef4444 70%, transparent); }
.vox-tbtn.vox-place { background: color-mix(in srgb, #4ade80 65%, transparent); }
.vox-tbtn:active { filter: brightness(1.3); }
.vox-hud:has([data-overlay]:not([hidden])) .vox-cross,
.vox-hud:has([data-overlay]:not([hidden])) .vox-hearts,
.vox-hud:has([data-overlay]:not([hidden])) .vox-hotbar,
.vox-hud:has([data-overlay]:not([hidden])) .vox-touch { display: none; }

/* ---- Lancey Space (rocket sim) HUD ---- */
.spc-surface { cursor: grab; background: #05070f; }
.spc-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; color: #dfe8f5; font-variant-numeric: tabular-nums; }
.spc-top { position: absolute; left: 0; right: 0; top: 8px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-weight: 700; font-size: .85rem; text-shadow: 0 1px 3px #000; }
.spc-top[hidden], .spc-left[hidden], .spc-touch[hidden] { display: none; }
.spc-left { position: absolute; left: 12px; top: 46px; display: grid; gap: 8px; width: 150px; }
.spc-gauge { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 6px; font-size: .7rem; font-weight: 700; }
.spc-bar { height: 12px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.25); border-radius: 6px; overflow: hidden; }
.spc-bar i { display: block; height: 100%; width: 0; background: #5eead4; transition: width .1s linear; }
.spc-bar.spc-heat i { background: linear-gradient(90deg, #fcd34d, #ef4444); }
.spc-stage { font-size: .8rem; font-weight: 700; }
.spc-msg { position: absolute; left: 50%; top: 64%; transform: translateX(-50%); font-weight: 700; text-shadow: 0 1px 4px #000; color: #fff; }
.spc-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; background: color-mix(in srgb, #05070f 70%, transparent); backdrop-filter: blur(2px); padding: 16px; }
.spc-overlay[hidden] { display: none; }
.spc-card { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 26px; max-width: min(640px, 96%); max-height: 92%; overflow: auto; box-shadow: var(--shadow); }
.spc-card h3 { font-size: 1.5rem; margin: 0 0 .3em; } .spc-card p { color: var(--muted); margin: 0 0 14px; }
.spc-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.spc-vehicles { display: grid; gap: 8px; }
.spc-veh { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.spc-veh:hover { border-color: var(--accent); }
.spc-veh small { display: block; color: var(--muted); font-size: .8rem; } .spc-veh .spc-stat { color: var(--accent); }
.spc-veh-art, .spc-veh-stack { display: flex; flex-direction: column; align-items: center; }
.spc-veh-art { width: 56px; }
.spc-veh-stack svg, .spc-stack svg, .spc-ppart svg { display: block; }
.spc-veh-stack svg { margin: -1px 0; }
/* builder */
.spc-build { max-width: min(680px, 97%); }
.spc-build-cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 14px; text-align: left; }
.spc-build h4 { margin: 4px 0; color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.spc-stack { display: flex; flex-direction: column-reverse; align-items: center; min-height: 120px; max-height: 280px; overflow: auto; background: var(--surface-2); border-radius: 10px; padding: 8px; }
.spc-spart { background: none; border: 0; cursor: pointer; padding: 0; margin: -1px 0; }
.spc-spart:hover { filter: brightness(1.2) drop-shadow(0 0 3px #ef4444); }
.spc-palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.spc-ppart { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: .66rem; }
.spc-ppart:hover { border-color: var(--accent); }
.spc-build-stat { text-align: center; color: var(--accent); font-weight: 700; margin: 10px 0 0; }
/* touch */
.spc-touch { position: absolute; inset: 0; pointer-events: none; }
.spc-stick { position: absolute; left: 16px; bottom: 70px; width: 116px; height: 116px; border-radius: 50%; background: rgba(255,255,255,.07); border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
.spc-knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; background: rgba(0,0,0,.4); border: 2px solid rgba(255,255,255,.5); }
.spc-tcol { position: absolute; right: 14px; bottom: 70px; display: grid; gap: 8px; }
.spc-trow { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; gap: 6px; justify-content: center; }
.spc-tbtn { pointer-events: auto; touch-action: none; padding: 10px 12px; border-radius: 12px; color: #fff; background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.4); font-weight: 700; font-size: .8rem; }
.spc-tbtn:active { filter: brightness(1.3); }
.spc-hud:has([data-overlay]:not([hidden])) .spc-top,
.spc-hud:has([data-overlay]:not([hidden])) .spc-left,
.spc-hud:has([data-overlay]:not([hidden])) .spc-msg,
.spc-hud:has([data-overlay]:not([hidden])) .spc-touch { display: none; }

@media (max-width: 820px) {
  .game-page { grid-template-columns: 1fr; }
  .game-board { position: static; }
  .main-nav { display: none; }
}
@media (max-width: 480px) {
  .header-actions .btn span { display: none; }
}
