@property --tint {
  syntax: '<color>';
  inherits: true;
  initial-value: #7a7cf0;
}

:root {
  --wall: #e4e3ec;
  --floor: #cfcfdc;
  --ink: #1e1f2e;
  --ink-2: #555770;
  --line: #b9bacb;
  --focus: #3d3df5;
  --white: #ffffff;
  --tint: #7a7cf0;
  --display: 'Unbounded', 'Arial Black', sans-serif;
  --ui: 'Onest', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.3, 1.5, .5, 1);
  transition: --tint .9s var(--ease);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--wall); }
body { min-height: 100vh; overflow-x: hidden; color: var(--ink); font: 400 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* The studio sweep: wall curves into floor, lit by the selected game's colour. */
.studio {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 45% at 30% 18%, color-mix(in oklab, var(--tint) 30%, transparent), transparent 70%),
    radial-gradient(50% 40% at 85% 0%, rgba(255, 255, 255, .9), transparent 70%),
    linear-gradient(180deg, #ecebf2 0%, var(--wall) 45%, var(--floor) 78%, #c4c4d3 100%);
}
.studio::after {
  content: ''; position: absolute; inset: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .6 0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- physical controls ---------- */
.keycap {
  --cap: var(--white);
  position: relative; border: 0; border-radius: 12px; padding: 9px 15px 10px;
  background: linear-gradient(180deg, var(--cap), color-mix(in oklab, var(--cap) 88%, #8a8ca8));
  box-shadow: 0 4px 0 color-mix(in oklab, var(--cap) 62%, #3a3b55), 0 6px 14px rgba(40, 40, 70, .16), inset 0 1px 0 rgba(255, 255, 255, .9);
  font-weight: 500; font-size: 14px; line-height: 1.2; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .2s;
}
.keycap:hover { transform: translateY(-1px); box-shadow: 0 5px 0 color-mix(in oklab, var(--cap) 62%, #3a3b55), 0 9px 18px rgba(40, 40, 70, .2), inset 0 1px 0 rgba(255, 255, 255, .9); }
.keycap:active, .keycap[aria-pressed='true'] {
  transform: translateY(3px);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--cap) 62%, #3a3b55), 0 2px 5px rgba(40, 40, 70, .18), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.keycap[aria-pressed='true'] { --cap: var(--ink); color: var(--white); }
.keycap.small { padding: 6px 11px 7px; font-size: 13px; }
.keycap.icon { padding: 8px; width: 40px; height: 38px; display: grid; place-items: center; }
.keycap.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.keycap.icon .cross { display: none; }
#mute[aria-pressed='true'] .wave { display: none; }
#mute[aria-pressed='true'] .cross { display: block; }
.keycap.primary { --cap: var(--tint); color: var(--white); font-family: var(--display); font-weight: 600; font-size: 16px; padding: 14px 24px 15px; border-radius: 16px; text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.keycap.primary:active { transform: translateY(4px); }

.key-well {
  display: flex; align-items: center; gap: 8px; border-radius: 14px; padding: 6px 8px 6px 12px;
  background: rgba(255, 255, 255, .55);
  box-shadow: inset 0 2px 4px rgba(40, 40, 70, .18), inset 0 -1px 0 rgba(255, 255, 255, .8), 0 1px 0 rgba(255, 255, 255, .7);
}
.key-well input, .key-well select { border: 0; background: transparent; outline: none; min-width: 0; }
.key-well:focus-within { box-shadow: inset 0 2px 4px rgba(40, 40, 70, .18), 0 0 0 3px var(--focus); }

/* ---------- header ---------- */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px clamp(16px, 4vw, 48px); backdrop-filter: blur(14px) saturate(1.2); background: color-mix(in oklab, var(--wall) 70%, transparent); border-bottom: 1px solid rgba(255, 255, 255, .6); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand-name { font: 800 19px var(--display); letter-spacing: -.02em; }
.search { flex: 0 1 280px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; padding: 4px 0; }
kbd { font: 500 12px var(--ui); border-radius: 6px; padding: 1px 7px; background: var(--white); box-shadow: 0 2px 0 var(--line); color: var(--ink-2); }
.join { position: relative; }
.join label { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.join input { width: 64px; font: 600 15px var(--display); letter-spacing: .12em; text-transform: uppercase; }
.join-err { position: absolute; right: 0; top: calc(100% + 6px); font-size: 12px; font-weight: 500; color: #c22d4f; white-space: nowrap; }
.me { display: flex; gap: 10px; align-items: center; }
.callsign input { width: 108px; font-weight: 500; }
.avatar { width: 24px; height: 24px; border-radius: 8px; flex: none; display: grid; place-items: center; font: 700 12px var(--display); color: var(--white); background: linear-gradient(135deg, var(--tint), #ff5aa8); }

main { padding: 0 clamp(16px, 4vw, 48px) 80px; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: center; padding: clamp(20px, 4vw, 44px) 0 clamp(28px, 4vw, 44px); }
.screen { position: relative; }
.bezel {
  position: relative; aspect-ratio: 16 / 9; max-width: calc(54vh * 16 / 9); margin-inline: auto; border-radius: 26px; padding: 12px;
  background: linear-gradient(160deg, #2c2d40, #17182a 60%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 40px 60px -30px rgba(30, 30, 60, .55), 0 18px 30px -12px color-mix(in oklab, var(--tint) 55%, transparent);
  transform: perspective(1600px) rotateY(4deg) rotateX(2deg);
  transition: transform .8s var(--ease);
}
.screen:hover .bezel { transform: perspective(1600px) rotateY(0) rotateX(0); }
.bezel canvas, .placeholder { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); border-radius: 16px; display: block; }
.bezel canvas { background: #0f1020; }
.glass { position: absolute; inset: 12px; border-radius: 16px; pointer-events: none; background: linear-gradient(115deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, 0) 32%), radial-gradient(120% 80% at 50% 120%, rgba(0, 0, 0, .3), transparent 60%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.stand { height: 26px; margin: 0 auto; width: 46%; border-radius: 0 0 50% 50% / 0 0 100% 100%; background: radial-gradient(closest-side, rgba(30, 30, 60, .28), transparent); filter: blur(6px); }
.live-pill { position: absolute; left: 26px; top: 26px; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--white); background: rgba(20, 20, 35, .55); backdrop-filter: blur(6px); }
.live-pill b { width: 8px; height: 8px; border-radius: 50%; background: #3ee08f; box-shadow: 0 0 0 0 rgba(62, 224, 143, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(62, 224, 143, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 224, 143, 0); } }

.placeholder { overflow: hidden; display: grid; place-items: center; background: var(--ph-bg); color: var(--ph-ink); }
.placeholder .ph-shape { position: absolute; border-radius: 50%; background: var(--ph-accent); opacity: .85; animation: drift 9s ease-in-out infinite alternate; }
.placeholder .ph-shape:nth-child(2) { border-radius: 30%; opacity: .5; animation-duration: 12s; }
.placeholder .ph-title { position: relative; font: 800 clamp(26px, 4.5vw, 58px)/.95 var(--display); letter-spacing: -.03em; text-align: center; padding: 0 8%; mix-blend-mode: normal; }
.placeholder .ph-note { position: absolute; bottom: 16px; font-size: 13px; font-weight: 500; opacity: .75; }
@keyframes drift { to { transform: translate(30px, -20px) rotate(25deg) scale(1.1); } }

.info h1 { font: 800 clamp(34px, 5vw, 64px)/.98 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.tagline { margin-top: 14px; font-size: clamp(17px, 1.6vw, 20px); font-weight: 500; max-width: 32ch; text-wrap: pretty; }
.desc { margin-top: 10px; color: var(--ink-2); max-width: 44ch; text-wrap: pretty; }
.facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.facts li { font-size: 13px; font-weight: 500; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .7); box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 2px 6px rgba(40, 40, 70, .08); }
.facts li.live { background: color-mix(in oklab, #3ee08f 26%, white); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 24px; }
.actions .soon-note { font-size: 14px; color: var(--ink-2); }
.info > * { animation: swap .5s var(--ease) both; }
.info.swapping > * { animation: none; }
@keyframes swap { from { opacity: 0; transform: translateY(8px); } }

/* ---------- filters ---------- */
.browse { position: relative; }
.filters { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; padding: 18px 20px; border-radius: 22px; background: rgba(255, 255, 255, .42); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 20px 40px -28px rgba(40, 40, 80, .4); }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.group-name { font-size: 13px; color: var(--ink-2); margin-right: 2px; }
.group.right { margin-left: auto; gap: 16px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.track { width: 44px; height: 26px; border-radius: 999px; padding: 3px; background: #b9bacb; box-shadow: inset 0 2px 4px rgba(30, 30, 60, .3); transition: background .25s; }
.knob { display: block; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(#fff, #e6e6ef); box-shadow: 0 2px 4px rgba(30, 30, 60, .35); transition: transform .3s var(--spring); }
.toggle input:checked + .track { background: var(--ink); }
.toggle input:checked + .track .knob { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.sort select { padding: 4px 4px 4px 0; font-weight: 500; cursor: pointer; }
.count { margin: 22px 4px 0; font-size: 14px; color: var(--ink-2); min-height: 1.5em; }

/* ---------- shelf of acrylic slabs ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 40vw), 1fr)); gap: 40px 34px; margin-top: 14px; perspective: 1500px; }
.cell { position: relative; outline: none; cursor: pointer; animation: arrive .5s var(--ease) both; }
@keyframes arrive { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.cell.leaving { animation: none; }
.slab {
  position: relative; aspect-ratio: 3 / 4; transform-style: preserve-3d;
  transform: rotateY(-22deg) rotateX(6deg);
  transition: transform .55s var(--spring);
}
.slab > * { position: absolute; border-radius: 10px; }
.slab .face {
  inset: 0; transform: translateZ(13px); overflow: hidden;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, .25) 100%),
    color-mix(in oklab, var(--g-bg) 88%, transparent);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55), inset 0 -30px 50px -30px color-mix(in oklab, var(--g-accent) 60%, transparent);
}
.slab .back { inset: 0; transform: translateZ(-13px); background: color-mix(in oklab, var(--g-accent) 70%, #1a1a2a); }
.slab .edge-r { top: 4px; bottom: 4px; left: calc(100% - 13px); width: 26px; border-radius: 3px; transform: rotateY(90deg); background: linear-gradient(90deg, color-mix(in oklab, var(--g-accent) 80%, white), color-mix(in oklab, var(--g-accent) 70%, #1a1a2a)); }
.slab .edge-t { left: 4px; right: 4px; top: -13px; height: 26px; border-radius: 3px; transform: rotateX(90deg); background: linear-gradient(color-mix(in oklab, var(--g-accent) 50%, white), color-mix(in oklab, var(--g-accent) 85%, white)); }
.floor-shadow { position: absolute; left: 6%; right: -4%; bottom: -16px; height: 30px; border-radius: 50%; background: radial-gradient(closest-side, rgba(30, 30, 60, .32), transparent); filter: blur(4px); transition: transform .55s var(--spring), opacity .4s; z-index: -1; }
.cell::after { content: ''; position: absolute; left: 10%; right: 10%; bottom: -22px; height: 40px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in oklab, var(--g-accent) 70%, transparent), transparent); opacity: 0; transition: opacity .4s; z-index: -2; }

.cell:hover .slab, .cell:focus-visible .slab, .cell.selected .slab { transform: rotateY(-4deg) rotateX(2deg) translateY(-10px) translateZ(26px); }
.cell:hover .floor-shadow, .cell:focus-visible .floor-shadow, .cell.selected .floor-shadow { transform: scale(.85); opacity: .7; }
.cell.selected::after { opacity: .85; }
.cell:focus-visible .face { box-shadow: inset 0 0 0 3px var(--focus); }
.cell:active .slab { transform: rotateY(-4deg) translateY(-4px) translateZ(10px); transition-duration: .1s; }

.art { position: absolute; inset: 0; }
.art svg { width: 100%; height: 100%; display: block; }
.face-title { position: absolute; left: 14px; right: 14px; bottom: 14px; font: 800 clamp(17px, 1.7vw, 22px)/1 var(--display); letter-spacing: -.03em; color: var(--g-ink); text-wrap: balance; }
.face-badge { position: absolute; left: 12px; top: 12px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--g-bg); background: var(--g-ink); }
.face-badge.soon { background: rgba(255, 255, 255, .82); color: #1e1f2e; font-weight: 500; }
.cell.is-soon .face { filter: saturate(.75); }

.caption { margin-top: 26px; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.caption b { color: var(--ink); font-weight: 600; font-size: 14px; }
.caption .now { color: #158a52; font-weight: 600; white-space: nowrap; }

/* ---------- empty state ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 50px 16px 30px; }
.empty h2 { font: 600 22px var(--display); letter-spacing: -.02em; }
.empty p { color: var(--ink-2); }
.empty .keycap { margin-top: 10px; }
.empty-slab { width: 90px; height: 120px; border-radius: 10px; margin-bottom: 10px; border: 2px dashed var(--line); transform: perspective(600px) rotateY(-18deg) rotateX(6deg); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .bezel { transform: none; }
  .group.right { margin-left: 0; }
}
@media (max-width: 640px) {
  .bar { gap: 10px; position: relative; }
  .brand { margin-right: 0; flex: 1; }
  .search { order: 3; flex: 1 1 100%; }
  .join { order: 4; flex: 1 1 100%; }
  .join input { flex: 1; }
  .me .callsign input { width: 86px; }
  .filters { padding: 14px; gap: 12px; }
  .group-name { width: 100%; }
  .shelf { gap: 28px 16px; }
  .face-title { font-size: 15px; left: 10px; bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- account widget (shared /lib/auth.js) ---------- */
.arcade-link { text-decoration: none; white-space: nowrap; }
#account { display: flex; align-items: center; }
.acct { display: flex; align-items: center; gap: 8px; }
.acct-row { display: flex; gap: 6px; }
.acct-btn { display: inline-flex; align-items: center; gap: 6px; font: 600 12px var(--display); padding: 9px 12px; border: 0; border-radius: 12px; background: var(--white);
  box-shadow: inset 0 0 0 1px rgba(30,31,46,.12), 0 3px 0 #b7b8c9, 0 8px 14px -8px rgba(30,31,46,.4); transition: transform .12s var(--ease), box-shadow .12s; }
.acct-btn:hover { transform: translateY(-1px); }
.acct-btn:active { transform: translateY(2px); box-shadow: inset 0 0 0 1px rgba(30,31,46,.12), 0 1px 0 #b7b8c9; }
.acct-btn svg { width: 16px; height: 16px; }
.acct-me { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 600 13px var(--display); padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(255,255,255,.75); box-shadow: inset 0 0 0 1px rgba(30,31,46,.1); }
.acct-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--tint); color: #fff; font: 800 13px var(--display); }
.acct-out { border: 0; background: none; font-size: 12px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.acct-cta { font: 600 13px var(--display); color: var(--focus); text-decoration: none; white-space: nowrap; }
@media (max-width: 640px) { .acct-btn span { display: none; } .acct-out { display: none; } .arcade-link { display: none; } }
