:root { --ink:#eff4ff; --muted:#98a5bb; --navy:#101522; --panel:#192133; --edge:#2b3852; --cyan:#52e1dd; --violet:#9b7bff; --money:#a7f46d; --danger:#ff8c91;
  --bg:radial-gradient(circle at 12% -10%,#26395d 0,transparent 38%),radial-gradient(circle at 95% 10%,#33265f 0,transparent 36%),var(--navy);
  --panel-rgb:23 32 51; --card:#202b41; --card-edge:#30405d; --divider:#283650; --inset:#101724; --inset-deep:#0d1424; --input:#182238; --input-edge:#3d4d6d;
  --btn:#2e3c59; --btn-soft:#2c3955; --btn-soft-2:#273552; --tab:#192133; --btn-teal:#176e70; --btn-violet:#423576; --btn-owned:#234e47;
  --card-active:linear-gradient(100deg,#203946,var(--card));
  --hero-gradient:linear-gradient(115deg,#18233aee,#172035aa); --cta-gradient:linear-gradient(100deg,#167f80,#3569a3);
  --accent-soft:#52e1dd66; --accent-border:#52e1dd66; --pill-bg:#17343b; --header-bg:#1a2334; --backdrop:#050810cc; --text-dim:#63718a; }
html[data-theme="blossom"] {
  --navy:#191320; --muted:#b39ab0; --edge:#4a3757;
  --bg:radial-gradient(circle at 12% -10%,#3d2337 0,transparent 38%),radial-gradient(circle at 95% 10%,#2b1e33 0,transparent 36%),var(--navy);
  --panel-rgb:43 30 51; --card:#2b2135; --card-edge:#453252; --divider:#3a2c44; --inset:#221a2b; --inset-deep:#1a1421; --input:#2b2135; --input-edge:#4a3757;
  --btn:#3a2c46; --btn-soft:#332640; --btn-soft-2:#2c2036; --tab:#231a2c; --btn-teal:#8a3a5c; --btn-violet:#52325c; --btn-owned:#5c3a4a;
  --card-active:linear-gradient(100deg,#3d2337,var(--card));
  --hero-gradient:linear-gradient(115deg,#2b1e33ee,#241a2caa); --cta-gradient:linear-gradient(100deg,#b8527a,#7a4a9a);
  --accent-soft:#ff8c9166; --accent-border:#ff8c9155; --pill-bg:#3a2230; --header-bg:#2b2135; --backdrop:#0c0610cc; --text-dim:#9a8296; }
html[data-theme="slate"] {
  --navy:#1a1f26; --muted:#9aa5b1; --edge:#3a4552;
  --bg:radial-gradient(circle at 12% -10%,#2c343e 0,transparent 38%),radial-gradient(circle at 95% 10%,#232a33 0,transparent 36%),var(--navy);
  --panel-rgb:35 43 54; --card:#2a3340; --card-edge:#3a4552; --divider:#333d4a; --inset:#1e252e; --inset-deep:#171d24; --input:#262f3a; --input-edge:#45505f;
  --btn:#36404d; --btn-soft:#303945; --btn-soft-2:#2a3340; --tab:#232b36; --btn-teal:#3e5875; --btn-violet:#4a5470; --btn-owned:#3c5a50;
  --card-active:linear-gradient(100deg,#2c3a4a,var(--card));
  --hero-gradient:linear-gradient(115deg,#242c36ee,#20262faa); --cta-gradient:linear-gradient(100deg,#4a6d8c,#5a6d9a);
  --accent-soft:#8fb8d866; --accent-border:#8fb8d855; --pill-bg:#2e3a4a; --header-bg:#262f3a; --backdrop:#060910cc; --text-dim:#8a97a5; }
* { box-sizing:border-box; }
body { margin:0; min-width:320px; color:var(--ink); background:var(--bg); font:15px/1.45 Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
button { border:0; font:inherit; font-weight:750; color:var(--ink); cursor:pointer; transition:.18s transform,.18s filter,.18s opacity; }
button:hover { filter:brightness(1.12); transform:translateY(-1px); }
button:disabled { cursor:not-allowed; opacity:.45; transform:none; filter:none; }
header { max-width:1240px; margin:auto; padding:26px 28px 18px; display:flex; align-items:center; justify-content:space-between; gap:18px; }
.brand { display:flex; align-items:center; gap:12px; font-weight:900; letter-spacing:-.04em; font-size:22px; }
.logo { width:38px; height:38px; border-radius:11px; background:linear-gradient(135deg,var(--cyan),var(--violet)); display:grid; place-items:center; color:#111627; box-shadow:0 8px 25px #5ae9e044; }
.logo svg { width:23px; fill:currentColor; }
.tag { color:var(--muted); font-size:12px; letter-spacing:.12em; text-transform:uppercase; font-weight:800; }
.account { padding:10px 14px; border:1px solid var(--edge); border-radius:10px; background:var(--header-bg); font-size:13px; }
.account span { color:var(--cyan); }
main { max-width:1240px; margin:auto; padding:0 28px 40px; display:grid; gap:18px; }
.hero { display:flex; justify-content:space-between; align-items:flex-end; gap:20px; padding:23px 26px; border:1px solid var(--edge); border-radius:18px; background:var(--hero-gradient); overflow:hidden; position:relative; }
.hero::after { content:""; position:absolute; right:-50px; bottom:-110px; width:300px; height:210px; background:repeating-linear-gradient(90deg,transparent 0 13px,#52e1dd11 14px 16px); transform:perspective(260px) rotateX(53deg) rotateZ(-12deg); }
h1 { margin:3px 0 7px; font-size:clamp(26px,4vw,42px); letter-spacing:-.055em; }
.hero p { margin:0; color:var(--muted); max-width:630px; }
.hero-copy, .statbar { position:relative; z-index:1; }
.statbar { display:flex; gap:10px; }
.money { min-width:155px; padding:12px 16px; border-radius:12px; background:#162a25; border:1px solid #315c4b; }
.money strong { color:var(--money); font-size:22px; display:block; }
.money small { color:#89ae9b; font-weight:700; text-transform:uppercase; letter-spacing:.09em; font-size:10px; }
.grid { display:grid; grid-template-columns:1.25fr .75fr; gap:18px; }
.view-tabs { display:flex; gap:8px; flex-wrap:wrap; }
.view-tabs button { padding:8px 12px; border:1px solid var(--edge); border-radius:9px; background:var(--tab); color:var(--muted); font-size:12px; }
.view-tabs button.active { background:var(--btn-teal); border-color:var(--accent-border); color:var(--ink); }
.hidden { display:none; }
.panel { border:1px solid var(--edge); border-radius:18px; background:rgb(var(--panel-rgb) / .86); box-shadow:0 14px 40px #02040b25; }
.panel-head { display:flex; justify-content:space-between; align-items:center; padding:17px 19px; border-bottom:1px solid var(--edge); }
.panel h2 { font-size:14px; text-transform:uppercase; letter-spacing:.1em; margin:0; }
.pill { color:var(--cyan); background:var(--pill-bg); padding:5px 9px; border-radius:999px; font-size:11px; font-weight:800; }
#marketTimer { font-variant-numeric: tabular-nums; }
.shop { padding:12px; display:grid; gap:10px; }
.shop-pager { display:flex; align-items:center; justify-content:center; gap:12px; padding:4px 0 2px; color:var(--muted); font-size:12px; font-weight:700; }
.shop-pager button { padding:7px 14px; border-radius:8px; background:var(--btn); font-size:11px; }
.product { display:grid; grid-template-columns:50px 1fr auto; gap:13px; align-items:center; padding:12px; border-radius:13px; background:var(--card); border:1px solid transparent; }
.product.active { border-color:var(--accent-border); background:var(--card-active); }
.product-icon { display:grid; place-items:center; }
.product-sprite { position:relative; display:inline-block; width:31px; height:28px; image-rendering:pixelated; }
.product-sprite.small { width:16px; height:15px; margin-right:4px; vertical-align:-3px; transform:scale(.55); transform-origin:left center; }
.product-sprite.slug { background:linear-gradient(90deg,transparent 0 18%,#9b7bff 18% 35%,#c7b7ff 35% 57%,#9b7bff 57% 75%,transparent 75%) 0 14px/100% 8px no-repeat; }
.product-sprite.slug::before { content:""; position:absolute; left:3px; top:8px; width:9px; height:9px; background:#c7b7ff; box-shadow:8px 4px #9b7bff,16px 4px #9b7bff,24px 8px #7655ca; }
.product-sprite.slug i { position:absolute; left:7px; top:10px; width:3px; height:3px; background:#101522; }
.product-sprite.keycaps { background:linear-gradient(90deg,#52e1dd 0 27%,transparent 27% 36%,#ff8c91 36% 63%,transparent 63% 72%,#a7f46d 72%) 3px 7px/25px 10px no-repeat,linear-gradient(90deg,#a7f46d 0 38%,transparent 38% 46%,#52e1dd 46% 100%) 3px 19px/25px 7px no-repeat; box-shadow:inset 0 -3px #34415d; }
.product-sprite.planter { background:linear-gradient(90deg,transparent 0 23%,#d9915e 23% 77%,transparent 77%) 6px 17px/19px 9px no-repeat; }
.product-sprite.planter::before { content:""; position:absolute; left:13px; top:2px; width:7px; height:18px; background:#a7f46d; box-shadow:-7px 6px #52e1dd,7px 4px #73c955; }
.product-sprite.planter i { position:absolute; left:8px; top:17px; width:17px; height:3px; background:#f4c76f; }
/* Endgame designs: distinct color identities on the shared sprite frame. */
.product-sprite.multi-tool-frame { background:linear-gradient(135deg,#8ea2c9 0 45%,#5d6f96 45% 100%) 4px 6px/23px 16px no-repeat; }
.product-sprite.multi-tool-frame::before { content:""; position:absolute; left:11px; top:9px; width:10px; height:10px; background:#dfe7f5; box-shadow:-6px 2px #52e1dd,6px 2px #f4c76f; }
.product-sprite.scale-locomotive { background:linear-gradient(90deg,#34415d 0 78%,transparent 78%) 2px 18px/27px 7px no-repeat; }
.product-sprite.scale-locomotive::before { content:""; position:absolute; left:4px; top:6px; width:12px; height:12px; background:#ff8c91; box-shadow:14px 0 #f4c76f,0 0 0 3px #874956 inset; }
.product-sprite.scale-locomotive i { position:absolute; left:20px; top:2px; width:7px; height:5px; background:#dfe7f5; }
.product-sprite.architectural-city { background:linear-gradient(90deg,#3b4a6b 0 25%,transparent 25% 33%,#465574 33% 58%,transparent 58% 66%,#3b4a6b 66%) 3px 12px/25px 12px no-repeat; }
.product-sprite.architectural-city::before { content:""; position:absolute; left:6px; top:3px; width:6px; height:10px; background:#52e1dd; box-shadow:8px 4px #9b7bff,17px 0 #a7f46d; }
.product-sprite.prosthetic-hand { background:linear-gradient(100deg,transparent 0 20%,#dfe7f5 20% 80%,transparent 80%) 6px 8px/19px 14px no-repeat; }
.product-sprite.prosthetic-hand::before { content:""; position:absolute; left:8px; top:6px; width:4px; height:12px; background:#f4c76f; box-shadow:6px 0 #f4c76f,12px 0 #f4c76f; }
.product-sprite.orbit-telescope { background:radial-gradient(circle at 14px 12px,#202b41 0 5px,transparent 5px) no-repeat,linear-gradient(115deg,transparent 0 40%,#aab7d3 40% 52%,transparent 52%) 0 0/100% 100% no-repeat; }
.product-sprite.orbit-telescope::before { content:""; position:absolute; left:9px; top:7px; width:10px; height:10px; border-radius:50%; background:#9b7bff; box-shadow:0 0 0 3px #594687; }
.product-sprite.orbit-telescope i { position:absolute; left:20px; top:14px; width:9px; height:3px; background:#52e1dd; transform:rotate(-38deg); }
.product h3, .upgrade h3 { margin:0; font-size:15px; }
.product p, .upgrade p { margin:2px 0 0; color:var(--muted); font-size:12px; }
.product button, .upgrade button { padding:9px 11px; border-radius:9px; background:var(--btn); font-size:12px; }
.product.active button { background:var(--btn-teal); }
.machines { padding:16px; display:grid; gap:12px; }
.machine { padding:15px; border-radius:13px; background:var(--card); border:1px solid var(--card-edge); }
.machine.selected { border-color:var(--cyan); box-shadow:0 0 0 1px #52e1dd55, 0 0 20px #52e1dd18; }
.machine-top, .machine-foot { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.printer-state { width:14px; height:14px; flex:0 0 14px; image-rendering:pixelated; }
.printer-state.printing { background:#52e1dd; box-shadow:4px 0 #1b5d68,-4px 0 #1b5d68,0 4px #f4c76f,0 -4px #f4c76f; }
.printer-state.sleeping { background:radial-gradient(circle at 10px 4px, #202b4100 0 5px, transparent 5px), radial-gradient(circle at 7px 7px, #5d6b8a 0 6px, transparent 6px); }
.printer-state.failed { background:linear-gradient(#ff8c91 0 7px, transparent 7px 9px, #ff8c91 9px 11px, transparent 11px) 5px 1px/4px 12px no-repeat; animation:alert-blink 1.2s steps(2) infinite; }
@keyframes alert-blink { 50% { opacity:.5; } }
.machine-identity { display:flex; align-items:center; gap:10px; min-width:0; }
.pixel-printer { position:relative; width:58px; height:46px; flex:0 0 58px; overflow:hidden; background:linear-gradient(#293752 0 22%,#182238 22%); image-rendering:pixelated; }
.pixel-printer::before { content:""; position:absolute; left:8px; top:7px; width:40px; height:30px; border:5px solid #aab7d3; border-bottom:0; box-shadow:inset 0 0 0 3px #465574; }
.pixel-printer::after { content:""; position:absolute; left:4px; bottom:4px; width:50px; height:8px; background:#4d5a76; border-top:3px solid #c9d5e8; }
.pixel-printer i { position:absolute; z-index:1; left:25px; top:18px; width:8px; height:13px; background:#f4c76f; box-shadow:inset 3px 0 #ff8c91; }
.pixel-printer i::after { content:""; position:absolute; left:2px; top:12px; width:4px; height:7px; background:#202a42; }
.pixel-printer b { position:absolute; z-index:1; left:9px; top:17px; width:39px; height:4px; background:#52e1dd; box-shadow:0 2px #1b5d68; }
.pixel-printer.sidewinder-mk1 { background:linear-gradient(#322856 0 22%,#201b35 22%); }
.pixel-printer.sidewinder-mk1::before { border-color:#b792ff; box-shadow:inset 0 0 0 3px #594687; }
.pixel-printer.sidewinder-mk1::after { background:#51426f; border-top-color:#d8c7ff; }
.pixel-printer.sidewinder-mk1 b { background:#ff8c91; box-shadow:0 2px #874956; }
/* The 2026 fleet: same base art, one recolor per model. */
.pixel-printer.workhorse-i3 { background:linear-gradient(#24402f 0 22%,#16281d 22%); }
.pixel-printer.workhorse-i3::before { border-color:#a7f46d; box-shadow:inset 0 0 0 3px #3d5c46; }
.pixel-printer.workhorse-i3::after { background:#2e4a38; border-top-color:#c9f0b8; }
.pixel-printer.workhorse-i3 b { background:#a7f46d; box-shadow:0 2px #2c4a34; }
.pixel-printer.enclosed-x1 { background:linear-gradient(#3a2b20 0 22%,#241a12 22%); }
.pixel-printer.enclosed-x1::before { border-color:#f4c76f; box-shadow:inset 0 0 0 3px #6b5417; }
.pixel-printer.enclosed-x1::after { background:#57431f; border-top-color:#ffd98a; }
.pixel-printer.enclosed-x1 b { background:#ffcf6b; box-shadow:0 2px #6b5417; }
.pixel-printer.garage-farm-xl { background:linear-gradient(#41324e 0 22%,#2a2036 22%); }
.pixel-printer.garage-farm-xl::before { border-color:#ff8c91; box-shadow:inset 0 0 0 3px #594687; }
.pixel-printer.garage-farm-xl::after { background:#51426f; border-top-color:#ffc7c9; }
.pixel-printer.garage-farm-xl b { background:#ff8c91; box-shadow:0 2px #874956; }
.pixel-printer.industrial-gantry { background:linear-gradient(#1e3d4a 0 22%,#122730 22%); }
.pixel-printer.industrial-gantry::before { border-color:#52e1dd; box-shadow:inset 0 0 0 3px #1b5d68; }
.pixel-printer.industrial-gantry::after { background:#1f4a56; border-top-color:#a9f2ef; }
.pixel-printer.industrial-gantry b { background:#52e1dd; box-shadow:0 2px #1b5d68; }
.machine-name { font-weight:850; }
.machine-model, .machine-foot { color:var(--muted); font-size:12px; }
.machine-capabilities { margin-top:7px; color:#9aa9c8; font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.filament-assignment { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:10px; color:var(--muted); font-size:11px; }
.filament-assignment select { min-width:145px; padding:6px 8px; border:1px solid var(--input-edge); border-radius:7px; color:var(--ink); background:var(--input); font:inherit; }
.print-area { height:13px; margin-top:12px; border-radius:99px; background:var(--inset); overflow:hidden; }
.print-area i { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--cyan),#89f1e8); box-shadow:0 0 12px var(--cyan); transition:width .45s linear; }
.machine-foot { margin-top:7px; }
.machine-foot b { color:var(--money); }
.machine-alert { margin-top:10px; padding:7px 9px; border-radius:7px; color:#ffd0d2; background:#552c39; border:1px solid #914451; font-size:11px; line-height:1.35; }
.machine-actions { display:flex; gap:8px; margin-top:12px; }
.machine-queue { flex:1; padding:8px; border-radius:8px; background:var(--btn-teal); font-size:11px; }
.machine-upgrades { padding:8px 12px; border-radius:8px; background:var(--btn-violet); font-size:11px; white-space:nowrap; }
.machine-sell { padding:8px 12px; border-radius:8px; background:var(--btn-soft); font-size:11px; white-space:nowrap; }
.machine-sell:disabled { opacity:.45; }
.machine-sell.armed { background:#552c39; color:#ffd0d2; border:1px solid #914451; }
.machine-auto { width:100%; margin-top:8px; padding:8px; border-radius:8px; background:var(--btn-soft); font-size:11px; }
.machine-auto.active { background:#275d53; color:var(--cyan); }
.machine-auto.purchase, .upgrade button { background:var(--btn-violet); }
.market-up { color:var(--money); }
.market-down { color:var(--danger); }
.market-loss { color:var(--danger); font-weight:700; }
.pulse-loss-head { margin:0; padding:10px 18px 0; color:var(--danger); font-size:11px; font-weight:700; }
.right { display:grid; gap:18px; align-content:start; }
.actions { padding:16px; display:grid; gap:10px; }
.primary { padding:13px; border-radius:11px; background:linear-gradient(100deg,#167f80,#3569a3); font-size:14px; }
.pile-list { display:grid; gap:6px; }
.pile-row { display:grid; grid-template-columns:auto 1fr auto auto; gap:8px; align-items:center; font-size:12px; }
.pile-row span { color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pile-row b { color:var(--muted); font-size:11px; white-space:nowrap; }
.pile-row button { padding:5px 10px; border-radius:7px; background:var(--btn); font-size:11px; }
.secondary { padding:11px; border-radius:11px; background:var(--btn-soft-2); }
.sell-note { color:var(--muted); font-size:12px; text-align:center; margin:0; }
.upgrade { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; padding:12px; background:var(--card); border-radius:12px; }
.upgrade h3 { font-size:13px; }
.upgrade p { font-size:11px; }
.upgrade button.owned { background:var(--btn-owned); color:var(--cyan); }
.ledger { padding:14px 18px; color:var(--muted); font-size:12px; }
.ledger div { display:flex; justify-content:space-between; padding:7px 0; border-bottom:1px solid var(--divider); }
.ledger div:last-child { border:0; }
.ledger b { color:var(--ink); }
.market-list { padding:8px 18px; }
.market-list div { display:grid; grid-template-columns:1fr auto; column-gap:10px; padding:7px 0; border-bottom:1px solid var(--divider); font-size:12px; }
.market-list div:last-child { border:0; }
.market-more { margin:0; padding:8px 18px 10px; color:var(--muted); font-size:11px; }
.market-list small { grid-column:1; color:var(--muted); }
.filament-list { padding:10px 12px; display:grid; gap:8px; }
.filament-stock { padding:10px 14px; display:grid; gap:10px; }
.filament-stock-row { display:grid; grid-template-columns:1fr auto; gap:4px 10px; align-items:end; font-size:12px; }
.filament-stock-row span { color:var(--ink); font-weight:700; }
.filament-stock-row b { color:var(--muted); font-size:11px; }
.filament-meter { grid-column:1 / -1; height:7px; overflow:hidden; border-radius:99px; background:var(--inset); }
.filament-meter i { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#f4c76f,#a7f46d); transition:width .3s ease; }
.filament { padding:10px; border:1px solid transparent; border-radius:10px; background:var(--card); }
.filament.active { border-color:#52e1dd66; }
.filament h3 { margin:0; font-size:13px; }
.filament p { margin:2px 0 8px; color:var(--muted); font-size:11px; }
.filament div:last-child { display:flex; gap:7px; }
.filament button { flex:1; padding:7px; border-radius:7px; background:var(--btn); font-size:11px; }
.filament button[data-filament] { background:var(--btn-teal); }
.inventory-view { min-height:430px; }
.spool-grid { padding:16px; display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; }
.spool-card { padding:15px; border:1px solid var(--card-edge); border-radius:12px; background:var(--card); }
.spool-card h3 { margin:0; font-size:14px; }
.spool-card strong { display:block; margin:10px 0 2px; color:var(--cyan); font-size:24px; }
.spool-card p { margin:0; color:var(--muted); font-size:12px; }
.printer-market { padding:16px; display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px; }
.market-printer { padding:15px; border:1px solid var(--card-edge); border-radius:13px; background:var(--card); }
.market-printer-head { display:flex; align-items:center; gap:12px; }
.market-printer h3 { margin:0; font-size:15px; }
.market-printer p { margin:4px 0 12px; color:var(--muted); font-size:12px; }
.market-printer button { width:100%; padding:9px; border-radius:8px; background:var(--btn-violet); font-size:12px; }
.market-printer button.owned { background:var(--btn-owned); color:var(--cyan); }
.filament-store { padding:16px; display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.filament-store .filament { padding:15px; }
.filament-store .filament button { width:100%; }
/* Buy options sit in a 2×2 grid (single spool + bulk); out-specifies the legacy flex rule above. */
.filament-store .filament > div:last-child { display:grid; grid-template-columns:1fr 1fr; gap:7px; }

/* ---- Furniture shop (finite workshop space) ---- */
.panel-pills { display:flex; gap:6px; }
.panel-pills .pill { white-space:nowrap; }
.furniture-note { margin:0; padding:12px 18px 0; color:var(--muted); font-size:12px; }
.furniture-grid { padding:16px; display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px; }
.furniture-card { padding:15px; border:1px solid var(--card-edge); border-radius:13px; background:var(--card); }
.furniture-card h3 { margin:0; font-size:15px; }
.furniture-card p { margin:6px 0 10px; color:var(--muted); font-size:12px; min-height:29px; }
.furniture-card strong { display:block; margin:0 0 10px; color:var(--cyan); font-size:11px; }
.furniture-card button { width:100%; padding:9px; border-radius:8px; background:var(--btn-violet); font-size:12px; }
.furniture-card button.owned { background:var(--btn-owned); color:var(--cyan); }
.furniture-head { display:flex; align-items:center; gap:12px; }
.furniture-head .pill { margin-top:3px; }
.furniture-icon { position:relative; width:36px; height:34px; flex:0 0 36px; image-rendering:pixelated; }
.furniture-icon::before { content:""; position:absolute; left:0; right:0; top:6px; height:7px; background:#8fa1c4; }
.furniture-icon::after { content:""; position:absolute; left:3px; right:3px; top:13px; bottom:2px; background:linear-gradient(90deg,#4d5a76 0 6px,transparent 6px calc(100% - 6px),#4d5a76 calc(100% - 6px)); }
.furniture-icon.starter-workbench::before { background:#aab7d3; box-shadow:0 3px #34415d; }
.furniture-icon.folding-table::before { background:#d9915e; }
.furniture-icon.steel-workbench::before { background:#98a5bb; box-shadow:0 3px 0 #5c6a86; }
.furniture-icon.assembly-table::before { background:#52e1dd; }
.furniture-icon.heavy-duty-rack::before { background:#9b7bff; box-shadow:0 5px 0 #6a4fd0, 0 10px 0 #9b7bff; }
.furniture-icon.heavy-duty-rack::after { background:linear-gradient(90deg,#4d5a76 0 4px,transparent 4px calc(100% - 4px),#4d5a76 calc(100% - 4px)); }
.furniture-icon.mezzanine-platform::before { background:#f4c76f; box-shadow:0 10px 0 #c79b45; }
.furniture-icon.mezzanine-platform::after { background:#3d4d6d; }

/* ---- STL Market (purchasable designs) ---- */
.stl-grid { padding:16px; display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:14px; }
.stl-card { padding:15px; border:1px solid var(--card-edge); border-radius:13px; background:var(--card); display:flex; flex-direction:column; gap:8px; }
.stl-card.owned { border-color:#2e6055; }
.stl-card h3 { margin:0; font-size:15px; }
.stl-card > p { margin:0; color:var(--muted); font-size:12px; flex:1; }
.stl-card .stl-specs { flex:0; }
.stl-card .stl-specs > span { color:var(--money); font-weight:700; }
.stl-card button { width:100%; padding:9px; border-radius:8px; background:var(--btn-violet); font-size:12px; }
.stl-card button.owned { background:var(--btn-owned); color:var(--cyan); }
.stl-head { display:flex; align-items:center; gap:12px; }
.stl-head .pill { margin-top:2px; white-space:nowrap; }

/* Pixel-art sprites for the marketable designs (31×28 canvas, shared base). */
.product-sprite.phone-stand { background:linear-gradient(45deg,transparent 0 42%,#4d5a76 42% 58%,transparent 58%) 4px 9px/23px 13px no-repeat; }
.product-sprite.phone-stand::before { content:""; position:absolute; left:12px; top:2px; width:9px; height:17px; background:#52e1dd; box-shadow:inset 2px 0 #2ea7a4; transform:rotate(-18deg); }
.product-sprite.phone-stand::after { content:""; position:absolute; left:6px; bottom:4px; width:19px; height:5px; background:#8fa1c4; }
.product-sprite.geometric-vase { background:linear-gradient(115deg,#d9915e 0 34%,#b96f3f 34% 66%,#8f5530 66%) 8px 8px/15px 16px no-repeat,linear-gradient(90deg,#d9915e,#d9915e) 12px 4px/7px 4px no-repeat; }
.product-sprite.articulated-dragon { background:linear-gradient(90deg,transparent 0 14%,#52e1dd 14% 30%,#7ee8e5 30% 48%,#52e1dd 48% 64%,#3ec4c1 64% 82%,transparent 82%) 0 13px/100% 9px no-repeat; }
.product-sprite.articulated-dragon::before { content:""; position:absolute; left:2px; top:6px; width:10px; height:10px; background:#7ee8e5; box-shadow:10px 2px #52e1dd,19px 5px #3ec4c1; }
.product-sprite.articulated-dragon::after { content:""; position:absolute; left:13px; top:0; width:0; height:0; border-left:5px solid transparent; border-right:5px solid transparent; border-bottom:9px solid #9b7bff; }
.product-sprite.headphone-stand { background:linear-gradient(90deg,#8fa1c4 0 5px,transparent 5px) 14px 8px/5px 16px no-repeat; }
.product-sprite.headphone-stand::before { content:""; position:absolute; left:8px; top:2px; width:17px; height:5px; background:#aab7d3; border-radius:3px 3px 0 0; }
.product-sprite.headphone-stand::after { content:""; position:absolute; left:6px; top:8px; width:6px; height:8px; background:#9b7bff; box-shadow:13px 0 #9b7bff; }
.product-sprite.chess-set { background:#d8c7ff 10px 3px/11px 6px no-repeat; }
.product-sprite.chess-set::before { content:""; position:absolute; left:13px; top:9px; width:5px; height:10px; background:#b792ff; }
.product-sprite.chess-set::after { content:""; position:absolute; left:8px; bottom:4px; width:15px; height:4px; background:#8f6fe0; }
.product-sprite.rc-car-body { background:linear-gradient(135deg,transparent 0 30%,#ff8c91 30% 100%) 3px 7px/25px 10px no-repeat; }
.product-sprite.rc-car-body::before { content:""; position:absolute; left:8px; top:2px; width:12px; height:5px; background:#ffb3b6; }
.product-sprite.rc-car-body::after { content:""; position:absolute; left:5px; bottom:4px; width:6px; height:6px; background:#202a42; box-shadow:15px 0 #202a42; }
.product-sprite.cosplay-helmet { background:linear-gradient(180deg,#aab7d3 0 60%,#8fa1c4 60%) 7px 3px/17px 16px no-repeat; }
.product-sprite.cosplay-helmet::before { content:""; position:absolute; left:9px; top:10px; width:13px; height:5px; background:#52e1dd; box-shadow:inset 0 -2px #2ea7a4; }
.product-sprite.cosplay-helmet::after { content:""; position:absolute; left:9px; bottom:3px; width:13px; height:3px; background:#66738e; }
.product-sprite.drone-frame { background:linear-gradient(45deg,transparent 0 42%,#8fa1c4 42% 58%,transparent 58%) 0 0/100% 100% no-repeat,linear-gradient(-45deg,transparent 0 42%,#8fa1c4 42% 58%,transparent 58%) 0 0/100% 100% no-repeat; }
.product-sprite.drone-frame::before { content:""; position:absolute; left:1px; top:1px; width:8px; height:3px; background:#52e1dd; box-shadow:20px 0 #52e1dd,0 22px #52e1dd,20px 22px #52e1dd; }
.product-sprite.drone-frame::after { content:""; position:absolute; left:12px; top:11px; width:7px; height:6px; background:#f4c76f; }
.product-sprite.designer-lamp { background:linear-gradient(180deg,#f4c76f 0 75%,#c79b45 75%) 6px 2px/19px 8px no-repeat; }
.product-sprite.designer-lamp::before { content:""; position:absolute; left:14px; top:10px; width:3px; height:12px; background:#98a5bb; }
.product-sprite.designer-lamp::after { content:""; position:absolute; left:9px; bottom:3px; width:13px; height:3px; background:#66738e; }
footer { text-align:center; color:var(--text-dim); font-size:12px; padding:0 0 20px; }
@media (max-width:820px) { header { padding:18px; } .hero { align-items:flex-start; flex-direction:column; } .grid { grid-template-columns:1fr; } main { padding:0 16px 25px; } .statbar { width:100%; } .money { flex:1; } header .tag { display:none; } }
@media (max-width:450px) { .product { grid-template-columns:39px 1fr; } .product button { grid-column:2; } .account { padding:8px; } .brand { font-size:18px; } }

.machine-select { padding:4px; border-radius:5px; background:transparent; text-align:left; }
button:focus-visible, select:focus-visible { outline:3px solid var(--cyan); outline-offset:3px; }
#saveStatus:empty { display:none; }
#saveStatus { color:var(--danger); margin:0; }

footer a { color:var(--cyan); }

/* Sign-in gate + account popover */
body.signed-out header, body.signed-out main, body.signed-out footer { display:none; }
#authGate { max-width:520px; margin:8vh auto 0; padding:0 16px; }
.gate-card { padding:26px; border:1px solid var(--edge); border-radius:18px; background:rgb(var(--panel-rgb) / .91); box-shadow:0 14px 40px #02040b40; }
.gate-brand { display:flex; gap:14px; align-items:center; margin-bottom:18px; }
.gate-brand h1 { margin:0; font-size:22px; }
.gate-brand p { margin:2px 0 0; color:var(--muted); font-size:13px; }
.gate-logo { width:38px; height:38px; flex:0 0 38px; border-radius:11px; background:linear-gradient(135deg,var(--cyan),var(--violet)); display:grid; place-items:center; color:#111627; }
.gate-logo svg { width:22px; fill:currentColor; }
.gate-tabs { display:flex; gap:8px; margin-bottom:14px; }
.gate-tabs button { padding:8px 12px; border:1px solid var(--edge); border-radius:9px; background:var(--tab); color:var(--muted); font-size:12px; }
.gate-tabs button.active { background:var(--btn-teal); border-color:#52e1dd66; color:var(--ink); }
#gateForm { display:grid; gap:12px; }
#gateForm label { display:grid; gap:5px; font-size:12px; color:var(--muted); font-weight:700; }
/* Mode toggles add .hidden to labels — this must outrank #gateForm label's
   display:grid, or every field shows in every mode. */
#gateForm label.hidden, #gateForm small.hidden { display:none; }
#gateForm input:not([type="checkbox"]) { padding:10px 12px; border:1px solid var(--input-edge); border-radius:9px; color:var(--ink); background:var(--input); font:inherit; }
#gateForm small { color:var(--text-dim); font-weight:500; }
/* Checkbox and caption on one line, outranking #gateForm label's grid. */
#gateForm .gate-import { display:flex; align-items:center; gap:8px; }
#gateForm .gate-import input { width:14px; height:14px; accent-color:#52e1dd; }
.gate-error { color:var(--danger); font-size:12px; margin:0; min-height:1em; }
.gate-loading { color:var(--muted); font-size:13px; margin:0; }
.gate-guest { margin-top:14px; padding:10px 12px; width:100%; border:1px solid var(--edge); border-radius:9px; background:var(--tab); color:var(--ink); }
.gate-guest-note { display:block; margin-top:6px; color:var(--text-dim); font-size:11px; text-align:center; }
.gate-presence { margin:10px 0 0; color:var(--cyan); font-size:11px; font-weight:800; text-align:center; }
#accountMenu { position:fixed; top:64px; right:24px; z-index:30; }
.chat-fab { position:fixed; left:16px; bottom:16px; z-index:31; padding:9px 16px; border:1px solid var(--edge); border-radius:999px; background:var(--pill-bg); color:var(--cyan); font-size:12px; font-weight:800; cursor:pointer; }
.chat-fab:hover { border-color:#52e1dd66; }
#chatPanel { position:fixed; left:16px; bottom:64px; z-index:30; }
.chat-card { display:grid; grid-template-rows:auto 1fr auto; width:420px; max-height:min(560px, 72vh); overflow:hidden; border:1px solid var(--edge); border-radius:14px; background:rgb(var(--panel-rgb) / .95); box-shadow:0 14px 40px #02040b60; }
.chat-card .panel-head { padding:12px 16px; }
.chat-card .panel-head button { background:none; border:0; color:var(--muted); font-size:13px; cursor:pointer; padding:2px 6px; }
.chat-messages { display:grid; gap:6px; align-content:start; overflow-y:auto; min-height:140px; max-height:420px; padding:10px 16px; font-size:12px; }
.chat-messages div { display:flex; gap:6px; align-items:baseline; flex-wrap:wrap; }
.chat-messages b { color:var(--cyan); }
.chat-tag { color:#ffcf6b; background:#33290e; border:1px solid #6b5417; border-radius:999px; padding:1px 7px; font-size:10px; font-weight:800; text-transform:uppercase; }
/* Scoped under .chat-messages: the bare `.chat-messages b` rule above would
   otherwise out-specify these single-class rules and paint every badge cyan. */
.chat-messages .chat-tag { color:#ffcf6b; }
.chat-messages .chat-tag-admin { color:#0e1a2b; background:var(--cyan); border-color:var(--cyan); }
.chat-messages .chat-tag-beta { color:#e2d9ff; background:#3d2f6b; border-color:#6b56b8; }
.header-actions { display:flex; align-items:center; gap:10px; flex:none; }
.settings-fab { width:38px; height:38px; padding:0; border:1px solid var(--edge); border-radius:10px; background:var(--header-bg); color:var(--muted); display:grid; place-items:center; line-height:0; flex:none; }
.settings-fab:hover { color:var(--cyan); border-color:#52e1dd66; }
.settings-fab svg { display:block; }
#settingsPanel { position:fixed; right:16px; top:64px; z-index:30; }
.settings-card { width:300px; border:1px solid var(--edge); border-radius:14px; background:rgb(var(--panel-rgb) / .98); box-shadow:0 14px 40px #02040b60; }
.settings-card .panel-head { padding:12px 16px; }
.settings-card .panel-head button { background:none; border:0; color:var(--muted); font-size:13px; cursor:pointer; padding:2px 6px; }
.settings-body { padding:14px 16px; display:grid; gap:10px; }
.settings-row { display:flex; flex-direction:column; gap:6px; color:var(--muted); font-size:12px; }
.settings-row select { padding:8px 10px; border-radius:8px; border:1px solid var(--edge); background:var(--inset); color:inherit; font-size:12px; }
.settings-row small { color:var(--text-dim); font-size:11px; }
#feedbackPanel { position:fixed; right:16px; top:64px; z-index:30; }
#feedbackForm textarea { padding:8px 10px; border-radius:8px; border:1px solid var(--edge); background:var(--inset-deep); color:inherit; font-size:12px; resize:vertical; min-height:96px; font-family:inherit; }
#feedbackForm button { padding:9px; border-radius:8px; }
footer a.hidden { display:none; }
@media (max-width:820px) { #feedbackPanel { right:12px; left:12px; } .settings-card, #feedbackPanel .settings-card { width:auto; } }
.chat-messages span { color:var(--ink, #dfe7f5); overflow-wrap:anywhere; }
.chat-card form { display:flex; gap:8px; padding:10px 12px; border-top:1px solid var(--edge); }
.chat-card form input { flex:1; min-width:0; padding:8px 10px; border-radius:8px; border:1px solid var(--edge); background:var(--inset-deep); color:inherit; font-size:12px; }
.chat-empty { color:var(--text-dim); font-size:12px; padding:14px 12px; text-align:center; font-style:italic; }
/* Level & prestige */
.market-printer.locked, .stl-card.locked { opacity:.72; }
.locked-pill { color:var(--text-dim); border-color:var(--divider); }
#prestigeBody { display:grid; gap:12px; padding:14px 16px; }
.prestige-progress p { color:var(--muted); font-size:12px; margin:6px 0 0; }
#prestigeBody button { padding:10px; border-radius:8px; border:1px solid var(--edge); background:var(--btn-violet); color:inherit; cursor:pointer; font-size:13px; }
#prestigeBody button.armed { background:var(--btn-teal); }
#prestigeBody button:disabled { opacity:.55; cursor:not-allowed; }
#prestigeBody .furniture-note b { color:inherit; }
.account-card { display:grid; gap:4px; padding:14px 16px; border:1px solid var(--edge); border-radius:12px; background:var(--header-bg); box-shadow:0 14px 40px #02040b60; font-size:13px; }
.account-card small { color:var(--text-dim); }
.account-card button { margin-top:8px; padding:8px; border-radius:8px; background:var(--btn-soft); }

/* Per-printer upgrade modal. Deliberately no `display` on the ID: an
   ID-level display rule would outrank `.hidden` (display:none) and leave
   the modal stuck open over the whole page. Centering uses margins,
   same as the sign-in gate. */
#upgradeModal { position:fixed; inset:0; z-index:40; padding:16px; overflow:hidden; }
.modal-backdrop { position:absolute; inset:0; background:#050810cc; }
.modal-card { position:relative; width:100%; max-width:560px; max-height:76vh; overflow:auto; margin:12vh auto 0; padding:22px; border:1px solid var(--edge); border-radius:18px; background:rgb(var(--panel-rgb) / .98); box-shadow:0 18px 50px #02040bd0; }
.modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.modal-head h2 { margin:0; font-size:18px; }
.modal-close { padding:4px 11px; border-radius:8px; background:var(--btn-soft); font-size:16px; line-height:1.2; }
.modal-cash { margin:4px 0 14px; color:var(--muted); font-size:12px; }
.modal-upgrades { display:grid; gap:10px; }

/* Purchase feedback toasts (always-on container; never toggled with .hidden) */
#toasts { position:fixed; right:18px; bottom:18px; z-index:50; display:grid; gap:8px; max-width:min(84vw,340px); }
.toast { padding:10px 13px; border-radius:10px; border:1px solid #52e1dd55; background:rgb(var(--panel-rgb) / .96); box-shadow:0 10px 30px #02040b80; font-size:12px; line-height:1.35; animation:toast-in .18s ease-out; }
.toast.error { border-color:#914451; color:#ffd0d2; background:#2b1826f5; }
@keyframes toast-in { from { transform:translateY(6px); opacity:0; } to { transform:none; opacity:1; } }
@media (max-width:820px) { #accountMenu { right:12px; top:58px; } #chatPanel { left:12px; right:12px; } #settingsPanel { right:12px; left:12px; } .chat-fab { left:12px; bottom:12px; } }

/* Leaderboard */
.board { padding:10px 18px 16px; }
.board-head { display:flex; gap:8px; align-items:center; padding:8px 0 12px; }
.board-head button { padding:6px 12px; border:1px solid var(--edge); border-radius:9px; background:#192133; color:var(--muted); font-size:12px; }
.board-head button.active { background:var(--btn-teal); border-color:#52e1dd66; color:var(--ink); }
.board-refresh { margin-left:auto; font-size:15px; }
.board-row { display:grid; grid-template-columns:44px 1fr auto; gap:10px; align-items:center; padding:9px 4px; border-bottom:1px solid var(--divider); font-size:13px; }
.board-row:last-of-type { border-bottom:0; }
.board-row.me { background:#17343b66; border-radius:8px; }
.board-row.me .board-name { color:var(--cyan); }
.board-rank { color:var(--muted); font-weight:800; }
.board-name { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.board-row b { color:var(--money); }
.board-empty { color:var(--muted); font-size:13px; padding:8px 0; }
