:root {
  --bg: #0d0b1a; --panel: #18142e; --line: #2e2757; --ink: #ece9ff; --dim: #9b94c9;
  --neon: #5cf2d6; --hot: #ff5fa2; --gold: #ffd166;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg) radial-gradient(ellipse at top, #1f1846, transparent 60%) no-repeat;
  color: var(--ink); font: 15px/1.5 system-ui, sans-serif; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--neon); outline-offset: 3px; }

header { display: flex; align-items: center; gap: 20px; padding: 12px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #0d0b1aee; backdrop-filter: blur(6px); z-index: 2; flex-wrap: wrap; }
.logo { font: 700 20px/1 var(--mono); color: var(--neon); text-decoration: none; letter-spacing: 2px;
  text-shadow: 0 0 12px #5cf2d688; }
.logo small { font-size: 9px; margin: 0 6px; color: var(--hot); vertical-align: middle; }
nav { display: flex; gap: 4px; }
nav a { font: 13px var(--mono); color: var(--dim); text-decoration: none; padding: 6px 12px; border-radius: 4px; letter-spacing: 1px; }
nav a[aria-current] { color: var(--bg); background: var(--neon); }
#search { flex: 1; min-width: 140px; max-width: 320px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 6px 10px; }
#account { margin-left: auto; display: flex; gap: 10px; align-items: center; font: 13px var(--mono); }
#account button, .bar button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; }
#account .points { color: var(--gold); border-color: var(--gold); }

main { max-width: 1240px; margin: 0 auto; padding: 20px 24px 80px; }
h1 { font: 14px var(--mono); letter-spacing: 3px; color: var(--dim); margin: 18px 0; }
#platforms { display: flex; gap: 6px; flex-wrap: wrap; }
#platforms button { font: 12px var(--mono); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 12px; color: var(--dim); }
#platforms button[aria-pressed="true"] { color: var(--bg); background: var(--hot); border-color: var(--hot); }
#empty { color: var(--dim); }

#grid { display: grid; grid-template-columns: repeat(auto-fill, 140px); gap: 22px; justify-content: space-between; }
#grid button { background: none; border: 0; padding: 0; text-align: left; }
#grid .price { display: block; font: 12px var(--mono); color: var(--gold); margin-top: 6px; }
#grid .price.owned { color: var(--neon); }

/* Generated box art until listings carry real covers. */
.cover { width: 140px; height: 190px; border-radius: 3px 6px 6px 3px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 10px 12px 16px;
  background: linear-gradient(160deg, #a8324a, #3a1030);
  box-shadow: inset 6px 0 0 #0005, inset 7px 0 0 #fff2, 0 6px 14px #0008; transition: transform .12s; }
/* Literal colours, not a hue variable: dark-mode extensions mangle inline custom properties. */
.cover.c1, .face.c1 { background: linear-gradient(160deg, #2f6fb5, #101c4a); }
.cover.c2, .face.c2 { background: linear-gradient(160deg, #2e9c7a, #0c3340); }
.cover.c3, .face.c3 { background: linear-gradient(160deg, #c9782c, #4a1616); }
.cover.c4, .face.c4 { background: linear-gradient(160deg, #7a48c4, #1d1050); }
.cover.c5, .face.c5 { background: linear-gradient(160deg, #b8a02e, #3d3a10); }
.cover.c6, .face.c6 { background: linear-gradient(160deg, #c4487f, #2a1050); }
.cover.c7, .face.c7 { background: linear-gradient(160deg, #4c8f2f, #10361c); }
/* Collector's Edition: gold spine, edge and number plate. */
.cover.gold { box-shadow: inset 6px 0 0 #b8860b, inset 0 0 0 2px #ffd166, 0 0 16px #ffd16666; }
.cover .num { position: absolute; right: 6px; top: 22px; background: #ffd166; color: #2a1c00; padding: 1px 6px;
  border-radius: 2px; font: 700 10px var(--mono); }
#d-collector h3 { font: 12px var(--mono); letter-spacing: 2px; color: var(--gold); margin: 22px 0 8px;
  border-top: 1px solid var(--line); padding-top: 16px; }
#d-collector .meta { letter-spacing: 0; line-height: 1.5; }
.variants label { color: var(--ink); font-size: 14px; margin-bottom: 6px; }
.variants input { display: inline; width: auto; margin: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; font-size: 14px; }
.row span:first-child { flex: 1; }
.row .primary { margin: 0; padding: 6px 12px; font-size: 12px; }
:where(.row button:not(.primary)) { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; font: 12px var(--mono); }
.row input { width: 90px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .sys { position: absolute; top: 0; left: 6px; right: 0; padding: 3px 8px; background: #000a;
  font: 9px var(--mono); letter-spacing: 1px; color: #fff; }
.cover .name { font: 800 14px/1.15 var(--mono); color: #fff; text-shadow: 0 2px 0 #0008; overflow-wrap: anywhere; }
button:hover .cover, button:focus-visible .cover { transform: translateY(-6px) scale(1.03); }
@media (prefers-reduced-motion: reduce) { .cover { transition: none; } }

/* Library: the same boxes, standing on planks. Row pitch = 190 cover + 14 plank + 26 air. */
#grid.shelf { row-gap: 40px; grid-auto-rows: 190px; padding: 0 16px 40px; min-height: 230px; justify-content: start;
  background: linear-gradient(to bottom, transparent 190px, #6b4a2b 190px, #3d2916 204px, transparent 204px) 0 0 / 100% 230px; }
#grid.shelf .price { display: none; }

/* ---- Store browser: emulator-frontend style. List left, preview right, blurred snap behind. */
#browse { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(240px, 34%) 1fr; gap: 28px;
  margin-top: 8px; padding: 16px; border-radius: 10px; overflow: clip; }
.b-bg { position: absolute; inset: 0; z-index: -1; background: center / cover no-repeat; filter: blur(30px) saturate(1.4);
  opacity: .25; transform: scale(1.15); pointer-events: none; }
#b-list { max-height: calc(100vh - 250px); min-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  padding: 4px; scrollbar-width: thin; }
.b-item { display: flex; gap: 10px; align-items: baseline; text-align: left; background: none; border: 0; border-radius: 4px;
  padding: 7px 10px; font: 14px var(--mono); color: var(--dim); flex: none; }
.b-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-item small { font-size: 11px; color: var(--gold); }
.b-item small.owned { color: var(--neon); }
.b-item:hover { color: var(--ink); background: #ffffff10; }
.b-item[aria-current="true"] { background: var(--neon); color: #06251f; }
.b-item[aria-current="true"] small { color: #06251f; }
#b-preview { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
/* The snap: a CRT-ish screen that fades between screenshots. */
.snap { position: relative; aspect-ratio: 16 / 10; max-height: 50vh; border-radius: 12px; overflow: hidden; background: #000;
  border: 4px solid #000; box-shadow: 0 0 0 1px var(--line), 0 18px 50px #000a; }
.snap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated;
  opacity: 0; transition: opacity .9s; }
.snap img.on { opacity: 1; }
.snap::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, #0003 2px 3px), radial-gradient(ellipse, transparent 60%, #0006); }
.b-info { display: flex; gap: 26px; align-items: flex-start; }
.b-info h2 { font: 700 22px/1.2 var(--mono); margin: 0 0 8px; }
.b-desc { color: #cfcaf0; max-height: 7.5em; overflow: auto; margin: 0 0 6px; }
.b-box { background: none; border: 0; padding: 0 0 0 14px; perspective: 700px; flex: none; }
.b-box .box3d { transform: rotateY(22deg); }
.b-box:hover .box3d, .b-box:focus-visible .box3d { transform: rotateY(48deg) rotateX(6deg); }
a.primary { display: inline-block; text-decoration: none; }
@media (max-width: 760px) {
  #browse { grid-template-columns: 1fr; padding: 8px; }
  #b-preview { order: -1; }
  #b-list { max-height: 45vh; min-height: 0; }
  .b-info { flex-direction: column; }
}

/* ---- A game box built in 3D from its listing: front = cover, spine = title, back = screenshots. */
.box3d { --w: 120px; --h: 160px; --d: 24px; position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.box3d.big { --w: 270px; --h: 360px; --d: 52px; }
.box3d.dragging { transition: none; }
.box3d .face { position: absolute; backface-visibility: hidden; overflow: hidden; }
.face.c0 { background: linear-gradient(160deg, #a8324a, #3a1030); }
.box3d .front, .box3d .back { inset: 0; }
.box3d .front { transform: translateZ(calc(var(--d) / 2)); }
.box3d .back { transform: rotateY(180deg) translateZ(calc(var(--d) / 2)); background: #f1ece0; color: #1b1630;
  display: flex; flex-direction: column; gap: 7px; padding: 12px; text-align: left; }
.box3d .spine, .box3d .side { width: var(--d); height: var(--h); left: calc(50% - var(--d) / 2); }
.box3d .spine { transform: rotateY(-90deg) translateZ(calc(var(--w) / 2)); display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding-bottom: 6px; box-shadow: inset 0 0 0 1px #0006; }
.box3d .side { transform: rotateY(90deg) translateZ(calc(var(--w) / 2)); filter: brightness(.7); }
.box3d .top, .box3d .bottom { width: var(--w); height: var(--d); top: calc(50% - var(--d) / 2); filter: brightness(.8); }
.box3d .top { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); }
.box3d .bottom { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); }
.box3d .front .cover { width: 100%; height: 100%; border-radius: 0; transform: none !important; }
.box3d .spine .sys { width: 100%; padding: 3px 0; background: #000a; color: #fff; font: 6px/1 var(--mono); text-align: center; overflow: hidden; }
.box3d .spine b { flex: 1; min-height: 0; writing-mode: vertical-rl; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: 800 11px/1 var(--mono); color: #fff; text-shadow: 0 1px 0 #0008; }
.box3d .spine .num { writing-mode: vertical-rl; background: #ffd166; color: #2a1c00; font: 700 8px var(--mono); padding: 3px 1px; }
.box3d.big .spine .sys { font-size: 11px; }
.box3d.big .spine b { font-size: 22px; }
.box3d.big .spine .num { font-size: 13px; }
.box3d.gold .spine, .box3d.gold .top { box-shadow: inset 0 0 0 2px #ffd166; }
.bk-title { font: 800 15px/1.15 var(--mono); }
.bk-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bk-shots img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; image-rendering: pixelated; border: 2px solid #1b1630; background: #000; }
.bk-shots img:first-child { grid-column: span 2; aspect-ratio: 16 / 9; }
.bk-desc { flex: 1 1 0; min-height: 0; overflow: hidden; margin: 0; font-size: 11px; line-height: 1.35; }
.bk-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font: 9px var(--mono); }
.barcode { flex: none; width: 56px; height: 26px; border: 3px solid #fff; background: #fff repeating-linear-gradient(90deg,
  #000 0 2px, #fff 2px 3px, #000 3px 4px, #fff 4px 6px, #000 6px 9px, #fff 9px 10px, #000 10px 11px, #fff 11px 13px); }

/* Picked up: the box on a stage you drag to turn. */
#inspect { text-align: center; max-width: min(1000px, 96vw); }
#i-stage { width: min(900px, 88vw); height: min(68vh, 620px); overflow: hidden; display: grid; place-items: center; perspective: 1200px; cursor: grab; touch-action: none; user-select: none; }
#i-stage:active { cursor: grabbing; }
#inspect .row { justify-content: center; }

/* The Library: boxes standing spine-out on planks. Hover pulls one out; clicking picks it up. */
/* Row pitch 200px = 16 air + 160 box + 14 plank + 10 air; literal, not a variable: dark-mode extensions break var() in backgrounds. */
.shelf3d { display: flex; flex-wrap: wrap; padding: 0 30px; margin: 10px 0 16px; min-height: 200px;
  perspective: 1500px; border-radius: 6px;
  background: linear-gradient(to bottom, transparent 176px, #6b4a2b 176px, #3d2916 190px, transparent 190px) 0 0 / 100% 200px,
    linear-gradient(#21183d, #120d26); }
.shelf3d .slot { position: relative; width: 26px; height: 200px; background: none !important; border: 0 !important;
  padding: 0 !important; transform-style: preserve-3d; }
.shelf3d .slot .box3d { position: absolute; left: calc(50% - 60px); top: 16px; transform: rotateY(90deg); transition-duration: .25s; }
.shelf3d .slot:hover .box3d, .shelf3d .slot:focus-visible .box3d { transform: translateZ(30px) translateY(-8px) rotateY(90deg); }
@media (prefers-reduced-motion: reduce) { .box3d, .snap img { transition: none; } }

dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  padding: 28px; max-width: min(720px, 92vw); box-shadow: 0 20px 80px #000c; }
dialog::backdrop { background: #06041099; backdrop-filter: blur(3px); }
dialog h2 { font: 700 20px/1.2 var(--mono); margin: 0 0 12px; }
.x { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 24px; color: var(--dim); }
.detail { display: flex; gap: 24px; }
.detail .cover { flex: none; }
#d-desc { max-height: 40vh; overflow: auto; color: #cfcaf0; }
.meta { font: 12px var(--mono); color: var(--dim); letter-spacing: 1px; margin: 0 0 8px; }
.primary { background: var(--neon); color: #06251f; border: 0; border-radius: 4px; padding: 10px 18px;
  font: 700 14px var(--mono); letter-spacing: 1px; margin-top: 8px; }
.primary.confirm { background: var(--gold); }
.primary:disabled { opacity: .5; cursor: wait; }
.link { background: none; border: 0; color: var(--neon); text-decoration: underline; padding: 0; display: block; margin-top: 14px; }
form label { display: block; margin-bottom: 12px; font: 12px var(--mono); color: var(--dim); }
form input { display: block; width: 280px; max-width: 100%; margin-top: 4px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; }
.error { color: var(--hot); min-height: 1.5em; margin: 0; }
table { border-collapse: collapse; min-width: 360px; }
td { padding: 6px 10px; border-top: 1px solid var(--line); font-size: 13px; }
td.num { text-align: right; font-family: var(--mono); }
td.plus { color: var(--neon); } td.minus { color: var(--hot); }

#player { position: fixed; inset: 0; background: #000; z-index: 10; display: flex; flex-direction: column; }
#player[hidden] { display: none; }
.bar { display: flex; gap: 10px; align-items: center; padding: 6px 12px; background: var(--panel); font: 12px var(--mono); }
.bar span { flex: 1; color: var(--dim); }
/* filter: dark-mode extensions put an inline invert() on iframes, which turns every game negative. */
#p-frame { flex: 1; border: 0; width: 100%; filter: none !important; }
#player:fullscreen .bar { display: none; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 4px; font: 13px var(--mono); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
#toast.show { opacity: 1; }
@media (max-width: 560px) { .detail { flex-direction: column; } main, header { padding-inline: 14px; } }

/* ---- rooms ---- */
#room-view a { color: var(--neon); }
/* :where keeps this at zero specificity so palette classes (.s0, .p3) can colour swatch buttons. */
:where(#room-view button:not(.primary):not(.tile)) { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; font: 12px var(--mono); }
.room-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.room-head h1 { flex: 1; margin: 0; color: var(--ink); }
.room { height: 440px; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; display: grid;
  place-items: center; margin: 14px 0 8px; }
.wall-plain { background: repeating-linear-gradient(90deg, #3b3370 0 24px, #382f6a 24px 26px); }
.wall-neon { background: repeating-linear-gradient(0deg, #3d1466 0 30px, #ff5fa2 30px 33px, #3d1466 33px 40px, #5cf2d6 40px 42px); }
.wall-wood { background: repeating-linear-gradient(90deg, #5a3d22 0 38px, #4a3019 38px 40px); }
.wall-stars { background: radial-gradient(#fff 1px, transparent 1.5px) 0 0 / 34px 34px, radial-gradient(#ffd166 1px, transparent 1.5px) 17px 11px / 46px 46px, #0b0a24; }
/* Isometric floor from a plain grid; furniture is billboarded back upright. */
.floor { display: grid; grid-auto-rows: 52px; transform: rotateX(60deg) rotateZ(45deg); transform-style: preserve-3d; }
.tile { background: #4a4088; border: 1px solid #2f2863; padding: 0; transform-style: preserve-3d; cursor: pointer; }
.tile:nth-child(odd) { background: #443a7e; }
.tile:hover, .tile:focus-visible { background: #6a5fc0; }
.tile.held { background: var(--gold); }
.obj { display: block; font-size: 40px; line-height: 1; pointer-events: none;
  transform: rotateZ(-45deg) rotateX(-60deg) translateY(-18px); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 28px; }
.panels h3, details summary { font: 12px var(--mono); letter-spacing: 2px; color: var(--gold); margin: 20px 0 8px; }
.panels select, .panels input, details input { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
.row input { flex: 1; width: auto; }
.tray { display: flex; gap: 6px; flex-wrap: wrap; }
.tray button { font-size: 26px !important; padding: 4px 8px !important; }
#room-view .held { border-color: var(--gold) !important; box-shadow: 0 0 0 2px var(--gold); }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; padding: 0 !important; }
.swatches .on { box-shadow: 0 0 0 2px var(--neon); }
.swatch { display: inline-block; width: 22px; height: 16px; border-radius: 3px; vertical-align: middle; border: 1px solid var(--line); }
details { border-top: 1px solid var(--line); }
details summary { cursor: pointer; padding: 4px 0; }
.mini { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 0 16px; }
.note { border-top: 1px dashed var(--line); }
.doors { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.door { width: 110px; height: 130px; border: 1px solid var(--line); border-radius: 60px 60px 4px 4px; background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  font: 12px var(--mono); overflow-wrap: anywhere; text-align: center; font-size: 12px; }
.door.mine { border-color: var(--neon); font-size: 30px; }
.door b { font-size: 12px; }

/* Avatars. A costume (.char) is one sprite; the paper doll (.parts) is a body plus pieces, all on one canvas.
   The canvas is the body's box plus padding (tools/artpack.py DOLL_PAD): 20% above, 8% below, so 128% of the
   64px body, sunk by the bottom 8%. A piece's mask (doll() in room.js) cuts it out of the pieces beneath. */
.doll { position: relative; width: 36px; height: 64px; display: inline-block; flex: none; }
.doll.parts .spr { position: absolute; bottom: -5px; left: 50%; translate: -50% 0; height: 82px; width: auto; max-width: none; margin: 0;
  mask-size: 100% 100%; mask-repeat: no-repeat; }

/* ---- the Mall: directory console, doors, hubs, presence + chat ---- */
.console { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.console button[aria-pressed="true"] { color: var(--bg); background: var(--hot); border-color: var(--hot); }
.console select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; font: 12px var(--mono); max-width: 260px; }
.door { position: relative; }
.door.hub { border-radius: 4px; border-color: var(--gold); padding: 26px 8px 8px; }
.door .sign { position: absolute; top: 0; left: 0; right: 0; background: var(--gold); color: #2a1c00; font: 700 9px var(--mono); padding: 3px; letter-spacing: 1px; }
.live { color: var(--neon); font: 10px var(--mono); }
.hub-head { display: flex; gap: 20px; margin: 14px 0; flex-wrap: wrap; }
h3.sub, .place h3 { font: 12px var(--mono); letter-spacing: 2px; color: var(--gold); margin: 18px 0 8px; }
.here { display: flex; gap: 12px; flex-wrap: wrap; min-height: 30px; }
.who { display: flex; flex-direction: column; align-items: center; font: 11px var(--mono); text-decoration: none; }
.place { position: relative; }
.log { position: absolute; bottom: 100%; left: 0; right: 0; z-index: 5; max-height: 170px; overflow-y: auto; background: #0d0b1a99;
  border-radius: 6px; padding: 8px 10px; font-size: 14px; text-shadow: 0 1px 2px #000; }
.log.shut, .log:empty { clip-path: inset(50%); height: 1px; padding: 0; overflow: hidden; pointer-events: none; }
.say { position: absolute; bottom: 100%; margin-bottom: 6px; width: max-content; max-width: 170px; padding: 4px 8px; border-radius: 9px;
  background: #fff; color: #14112b; font: 12px/1.25 var(--mono); text-align: center; overflow-wrap: anywhere; }
.say.emote { font-size: 26px; padding: 2px 8px; }
.place .emo { padding: 2px 6px; font-size: 18px; }
.walker[data-pose="sit"] .doll { translate: 0 -12px; }
/* Asleep: the bed's sprite is drawn over the walker, so only the head shows on the pillow, tucked in. */
.walker[data-pose="sleep"] .doll { rotate: 62deg; translate: 8px 2px; }
.walker[data-pose="sleep"] .bb::before { content: "💤"; position: absolute; bottom: 62%; left: 85%; font-size: 18px; }
.say::after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff; }
.line { padding: 2px 0; overflow-wrap: anywhere; }
.line b { color: var(--neon); }
.line button { float: right; padding: 0 6px !important; border: 0 !important; color: var(--dim); }
.place input { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }

/* ---- walking: avatars on the floor, door mats, hallway doors ---- */
.floor { position: relative; }
.void { visibility: hidden; }
.tile.mat { background: #2c7a6b; border-color: var(--neon); }
.tile.doorway { background: #2a2357; border-color: var(--gold); }
.walker { position: absolute; width: 52px; height: 52px; pointer-events: none; transform-style: preserve-3d;
  transition: left .19s linear, top .19s linear; }
/* Billboards: centred on the tile, turned to face the screen, then lifted by half their own height
   so their feet (not their middle) meet the floor and nothing sinks behind the tiles in front. */
.tile { position: relative; }
.walker .bb, .tile .obj { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -50%) rotateZ(-45deg) rotateX(-60deg) translateY(-50%) translateZ(300px); }
/* translateZ: after the turn, Z points straight at the viewer. Pushing every billboard the same distance
   forward changes nothing on screen but keeps wide sprites from being sliced by the walls behind them. */
.walker .tag, .dn > b, .dn > i { font: 10px var(--mono); font-style: normal; color: var(--ink); background: #0d0b1acc; padding: 0 4px;
  border-radius: 3px; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.walker .who-btn { pointer-events: auto; cursor: pointer; border: 0; }
.walker .who-btn:hover, .walker .who-btn:focus-visible { background: var(--hot); color: #fff; }
.line .who-btn { float: none; padding: 0 !important; color: var(--neon); font-weight: 700; background: none; border: 0 !important; cursor: pointer; }
#pc-body .room-head { margin-bottom: 8px; }
#pc-body h2 { margin: 0; }
.walker.you .tag { color: #06251f; background: var(--neon); }
.walker.left .doll { transform: scaleX(-1); }
.walker.walking .doll { animation: bob .19s linear infinite alternate; }
@keyframes bob { to { translate: 0 -3px; } }
.dn { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 34px; line-height: 1; }
.dn > i { color: var(--neon); }
.hubdoor b { color: #2a1c00; background: var(--gold); }
.room.hall { height: 400px; }
@media (prefers-reduced-motion: reduce) { .walker { transition: none; } .walker.walking .doll { animation: none; } }


/* ---- hub: stream wall and tables ---- */
#hub-live code { background: var(--panel); padding: 2px 8px; border-radius: 3px; color: var(--gold); }
#hub-live input { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
#hub-live button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 5px 10px; font: 12px var(--mono); }
#hub-live button:disabled { opacity: .5; cursor: default; }
.crts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.crt { display: flex; flex-direction: column; gap: 4px; padding: 14px; text-decoration: none; background: #0b0a24; border: 2px solid #3a3470;
  border-radius: 10px; box-shadow: inset 0 0 18px #5cf2d622; color: var(--ink); }
.crt:hover, .crt:focus-visible { border-color: var(--neon); }
.crt i { align-self: flex-start; font: 700 10px var(--mono); font-style: normal; background: var(--hot); color: #fff; padding: 1px 6px; border-radius: 3px; }
.crt span { font: 11px var(--mono); color: var(--dim); }
.tbl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.tbl .seats { display: flex; gap: 6px; }
.tbl .seats i { font: 11px var(--mono); font-style: normal; border: 1px dashed var(--line); border-radius: 12px; padding: 2px 10px; color: var(--dim); }
.tbl .seats i.taken { border: 1px solid var(--neon); color: var(--neon); }

.board { max-width: 360px; margin: 8px 0 14px; }
.board ol { margin: 6px 0; padding-left: 2.2em; font: 13px var(--mono); }
.board li { padding: 2px 0; }
.board li span:last-child { float: right; color: var(--gold); }
.board li.me { color: var(--neon); }

/* Generated furniture sprites (web/art). Sized against a 52px tile and a 64px-tall avatar. */
.spr { display: block; width: var(--w, 72px); image-rendering: pixelated;
  /* A 2:1 iso box is footprint-centred a quarter of its width above its lowest pixel: sink the sprite by that
     much so the footprint, not the bottom edge, sits on the middle of the tile. */
  margin-bottom: calc(var(--w, 72px) / -4); }
/* On-screen width per prop: the tuning knob. A tile's diamond is 74px wide, an avatar 64px tall. */
.spr-bed { --w: 100px; } .spr-desk { --w: 84px; } .spr-crt { --w: 70px; } .spr-shelf { --w: 62px; } .spr-guestbook { --w: 56px; }
.spr-plant { --w: 50px; } .spr-lamp { --w: 34px; } .spr-sofa { --w: 78px; } .spr-cabinet { --w: 58px; } .spr-case { --w: 70px; }
.spr-wall { --w: 100px; } .spr-table { --w: 92px; } .spr-board { --w: 52px; } .spr-door { --w: 56px; } .spr-trophy { --w: 62px; }
/* Two tiles long: three half-tiles wide on screen, and slid half a tile back from the near tile it stands on. */
.obj.wide-y .spr { --w: 110px; translate: 18px -9px; }
.obj.wide-x .spr { --w: 110px; translate: -18px -9px; }
/* Wing arrows are painted flat on the floor, so they point along the hallway. */
.tile.arrow .obj { transform: translate(-50%, -50%); color: var(--neon); font-size: 34px; }
.tray .spr, .item .spr { width: auto; height: 34px; margin: 0; }
.item { display: flex; align-items: center; gap: 8px; }
.obj.flip .spr { transform: scaleX(-1); }  /* against the left wall: face into the room */
.dn .spr { width: auto; margin: 0; max-height: 64px; }
.doll.char .spr { position: absolute; bottom: 0; left: 50%; translate: -50% 0; height: 64px; width: auto; margin: 0; }
.swatches.looks button { width: 46px; height: 74px; }
.swatches .locked { opacity: .3; filter: grayscale(1); cursor: not-allowed; }

/* ---- real walls and textured floors ---- */
.room { background: radial-gradient(ellipse at 50% 40%, #1c1740, #0b0920 75%); }
.wall-mall { background: repeating-linear-gradient(90deg, #cfc6ee 0 100px, #b9aee0 100px 104px); }
/* Walls lie flat just outside the floor's far edges, then hinge up 90 degrees on the edge they share with it. */
.wallp { position: absolute; pointer-events: none; }
.wallp.back { left: 0; top: -120px; height: 120px; transform-origin: bottom; transform: rotateX(-90deg); }
.wallp.left { top: 0; left: -120px; width: 120px; transform-origin: right; transform: rotateY(90deg); filter: brightness(.78); }
.fl-wood .tile:not(.mat):not(.held) { background: url(art/floor_wood.png) center / cover; border-color: #0003; }
.fl-mall .tile:not(.mat) { background: url(art/floor_mall.png) 0 0 / 400%; border-color: #0002; }
.fl-carpet .tile:not(.mat) { background: url(art/floor_carpet.png) center / cover; border-color: #0003; }
.floor[class*="fl-"] .tile:hover, .floor[class*="fl-"] .tile:focus-visible { box-shadow: inset 0 0 0 3px var(--neon); }

/* Covers with real art: the still fills the box, a scrim keeps the title readable on top of it. */
.cover img:not(.spr) { z-index: 0; }
.cover img[src^="covers/"] { image-rendering: pixelated; }  /* gameplay stills stay crisp; paintings scale smoothly */
.cover:has(img)::after { content: ""; position: absolute; inset: 45% 0 0 0; background: linear-gradient(transparent, #000e 70%); z-index: 1; }
.cover .sys, .cover .num { z-index: 2; }
.cover .name { position: relative; z-index: 2; }

/* ---- first visit, the closet, and the start hint ---- */
.welcome { padding-left: 1.2em; color: #cfcaf0; }
.welcome li { margin-bottom: 8px; }
#welcome .row button:not(.primary), #closet .console button { background: none; border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; font: 12px var(--mono); }
#closet { width: min(760px, 94vw); }
#closet h3 { font: 12px var(--mono); letter-spacing: 2px; color: var(--gold); margin: 18px 0 6px; }
/* The mirror stays in view while you go through the options. */
.closet { display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: start; }
.mirror { position: sticky; top: 0; height: 250px; display: grid; place-items: end center; padding-bottom: 20px; border-radius: 8px;
  background: radial-gradient(ellipse at 50% 85%, #3b3370, #18142e 70%); border: 4px solid #6b4a2b; }
.mirror .doll { transform: scale(3); transform-origin: bottom center; }
#closet .swatches button { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.me-btn { background: none !important; border: 0 !important; padding: 0 !important; cursor: pointer; }
@media (max-width: 560px) { .closet { grid-template-columns: 1fr; } .mirror { height: 200px; z-index: 1; } .mirror .doll { transform: scale(2.4); } }
#p-hint { position: absolute; left: 50%; top: 55%; translate: -50% -50%; pointer-events: none; padding: 14px 26px; border-radius: 6px;
  background: #0d0b1add; border: 2px solid var(--neon); color: var(--neon); font: 700 18px var(--mono); letter-spacing: 3px;
  animation: hint 1.2s ease-in-out infinite alternate; }
@keyframes hint { from { opacity: .55; } }
a.primary.ghost { background: none; border: 1px solid var(--neon); color: var(--neon); }
#empty .primary { margin-top: 10px; }
#r-shelf a.primary { margin-bottom: 14px; }

/* ---- Store: sort, sound, the system flash, video snaps ---- */
#platforms { align-items: center; }
#platforms .spacer { flex: 1; }
#platforms select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font: 12px var(--mono); }
.b-flash { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3;
  font: 800 clamp(32px, 7vw, 76px) var(--mono); letter-spacing: 6px; color: #fff; text-shadow: 0 0 30px var(--hot), 0 4px 0 #000;
  animation: flash 1.1s ease-out forwards; }
@keyframes flash { from { opacity: 0; scale: 1.3; } 15% { opacity: 1; scale: 1; } 70% { opacity: 1; } to { opacity: 0; } }
.snap video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; opacity: 0; transition: opacity .9s; }
.snap video.on { opacity: 1; }
.bk-shots video { display: block; width: 100%; grid-column: span 2; aspect-ratio: 16 / 9; object-fit: cover; image-rendering: pixelated; border: 2px solid #1b1630; background: #000; }
#b-preview .row a { color: var(--neon); font: 13px var(--mono); }
.spr-closet { --w: 60px; }

/* ---- phones: a header that doesn't eat the screen ---- */
@media (max-width: 560px) {
  header { position: static; gap: 8px 12px; padding-block: 8px; }
  .logo { font-size: 16px; }
  nav { order: 3; width: 100%; justify-content: space-between; }
  nav a { padding: 6px 8px; }
  #search { order: 4; max-width: none; }
  .room { height: 340px; }
  .room.hall { height: 320px; }
}
