/* Games hub: every game is a disc case standing cover-out, side by side.
   games.js builds the spine, top and back around each cover. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bar: var(--cb-topbar-height, 0px);
  --ink: #e9edf2;
  --light: 255, 238, 214;   /* key light colour */
}

html, body { margin: 0; }
body {
  min-height: 100dvh;
  color: var(--ink);
  background: #030304;
  font-family: "DM Sans", var(--font-sans), sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- scene */
.shelves {
  --h: clamp(190px, min(36vh, 44vw), 330px);
  --w: calc(var(--h) * .75);   /* cover width */
  --d: calc(var(--h) * .1);    /* case thickness / spine width */
  position: relative;
  min-height: calc(100dvh - var(--bar));
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vh, 64px) clamp(14px, 4vw, 48px);
  background: radial-gradient(ellipse 70% 55% at 50% 40%, rgba(var(--light), .06), transparent 70%);
}
.rows {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: calc(var(--h) * .16) calc(var(--d) * 2.4);
  max-width: 1500px;
}

/* Admin-only updates button floats in the corner, under the account pill. */
.updates-btn {
  position: fixed;
  z-index: 20;
  top: calc(var(--bar) + var(--cb-float-clear, 58px));
  right: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(233,237,242,.16);
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: rgba(233,237,242,.7);
  font-size: .78rem; font-weight: 700;
  cursor: pointer;
}
.updates-btn:hover { color: #fff; }
.updates-btn svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- boxes */
.box {
  position: relative;
  display: block;
  flex: none;
  width: var(--w);
  height: var(--h);
  perspective: calc(var(--h) * 4);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.box > .title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Soft shadow on the floor under each case. */
.pool {
  position: absolute; pointer-events: none;
  left: 4%; right: 4%; bottom: calc(var(--h) * -.06);
  height: calc(var(--h) * .1);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0,0,0,.85), transparent);
  transition: transform .45s ease, opacity .45s ease;
}

.tilt, .cube { position: absolute; inset: 0; transform-style: preserve-3d; }
/* Resting a little turned so the spine shows; hover squares it up and lifts it. */
.tilt {
  transform: rotateY(22deg);
  transition: transform .45s cubic-bezier(.2,.9,.25,1.15);
}
.cube { transform: translateZ(calc(var(--d) * -.5)); }
.face { position: absolute; overflow: hidden; background: var(--c1); backface-visibility: hidden; }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover { left: 0; top: 0; width: var(--w); height: var(--h); transform: translateZ(var(--d)); container-type: size; border-radius: 2px; }
.spine { left: 0; top: 0; width: var(--d); height: var(--h); transform-origin: 0 50%; transform: rotateY(-90deg); container-type: size; }
.back-cover { left: 0; top: 0; width: var(--w); height: var(--h); transform: rotateY(180deg); }
.top { left: 0; top: 0; width: var(--w); height: var(--d); transform-origin: 50% 0; transform: rotateX(90deg); }
.cover::after, .spine::after, .top::after, .back-cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
/* Plastic sleeve: a sheen and the hinge shadow along the spine edge. */
.cover::after {
  background:
    linear-gradient(90deg, rgba(0,0,0,.5), rgba(255,255,255,.12) 2.5%, transparent 6%),
    linear-gradient(115deg, rgba(255,255,255,.14), transparent 32%, transparent 70%, rgba(0,0,0,.25));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.top { background: linear-gradient(90deg, rgba(var(--light), .35), rgba(var(--light), .12)), var(--c1); }
.back-cover { background: linear-gradient(90deg, rgba(0,0,0,.75), rgba(0,0,0,.45)), var(--c1); }

.spine img { opacity: .55; object-position: var(--sp, 50% 50%); }
.spine::after {
  background:
    linear-gradient(rgba(var(--light), .12), transparent 30%, transparent 75%, rgba(0,0,0,.35)),
    linear-gradient(90deg, rgba(0,0,0,.65), rgba(0,0,0,.35) 50%, rgba(0,0,0,.55));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.sp-title {
  position: absolute; z-index: 1;
  left: 0; right: 0; top: 8%; bottom: 8%;
  display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl;
  color: var(--c2);
  font-family: var(--sf), sans-serif;
  font-size: min(62cqw, calc(118cqh / var(--len)));
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0,0,0,.55), 0 1px 0 rgba(0,0,0,.6);
}

.box:hover .tilt, .box:focus-visible .tilt { transform: translateY(calc(var(--h) * -.05)) rotateY(4deg); }
.box:hover .pool, .box:focus-visible .pool { transform: scale(.85); opacity: .6; }
.box:focus-visible .cover::after { box-shadow: inset 0 0 0 2px var(--c2); }

/* ---------------------------------------------------------------- cover logos */
.logo { position: absolute; z-index: 1; left: 0; right: 0; text-align: center; line-height: .9; pointer-events: none; }
.logo small, .logo i { display: block; font-style: normal; }

.smash-logo { top: 4cqh; font-family: "Bungee", sans-serif; }
.smash-logo small { font-size: 8cqw; letter-spacing: .14em; color: #fff3c4; text-shadow: 0 .6cqw 0 #3a0610; }
.smash-logo b { display: block; font-weight: 400; font-size: 31cqw; color: #ffd447; -webkit-text-stroke: .5cqw #2a0508; text-shadow: 0 1cqw 0 #ff7a1f, 0 2cqw 0 #8a1220, 0 3cqw 0 #2a0508, 0 0 8cqw rgba(255,190,60,.6); }

.vhs { position: absolute; z-index: 1; top: 3.5cqh; font: 7.5cqw/1 "VT323", monospace; color: #e8f0e8; text-shadow: -.4cqw 0 rgba(255,0,60,.7), .4cqw 0 rgba(0,200,255,.7); }
.vhs-play { left: 6cqw; }
.vhs-rec { right: 6cqw; color: #ff3b30; animation: rec 1.4s steps(2, jump-none) infinite; }
.analog-logo { bottom: 9cqh; font-family: "VT323", monospace; font-size: 18cqw; letter-spacing: .04em; text-transform: uppercase; color: #f2f2f2; line-height: .78; text-shadow: -.7cqw 0 rgba(255,0,60,.85), .7cqw 0 rgba(0,200,255,.85), 0 0 4cqw rgba(255,255,255,.35); }
.analog-logo small { margin-top: 3cqw; font-size: 6.5cqw; letter-spacing: .14em; color: #cfd8cf; }

.celestial-logo { bottom: 6cqh; font: 600 14.5cqw/1 "Cinzel", serif; color: #fff3e6; letter-spacing: .02em; text-shadow: 0 0 4cqw rgba(255,180,220,.9), 0 .5cqw 0 rgba(40,20,80,.6); }
.celestial-logo small { margin-top: 1.5cqw; font-size: 6.4cqw; font-weight: 800; letter-spacing: .58em; padding-left: .58em; color: #ffd6a6; }

.ziad-logo { top: 5cqh; font: 900 17cqw/1 "Orbitron", sans-serif; letter-spacing: .2em; padding-left: .2em; color: #eef8ff; text-transform: uppercase; text-shadow: 0 0 3cqw #3fb6ff, 0 0 9cqw rgba(63,182,255,.6); }
.ziad-logo small { margin-top: 2cqw; font-size: 6cqw; font-weight: 700; letter-spacing: .9em; padding-left: .9em; color: #3fb6ff; }
.backrooms-logo { bottom: 8cqh; font: 500 13cqw/1 "IBM Plex Mono", monospace; letter-spacing: -.03em; color: #f4f1dc; text-shadow: 0 0 5cqw rgba(244,241,220,.45), 0 .4cqw 0 rgba(0,0,0,.6); }
.backrooms-logo small { margin-top: 2.5cqw; font-size: 5cqw; letter-spacing: .14em; color: #e9dfb4; }
.hud { position: absolute; z-index: 1; left: 40%; top: 49%; font: 4cqw/1 "DM Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: #ffb547; }

.uc-logo { top: 5cqh; font: 700 17.5cqw/1 "Oswald", sans-serif; text-transform: uppercase; letter-spacing: .01em; color: #efe6d2; text-shadow: 0 .8cqw 0 rgba(0,0,0,.7); }
.uc-logo b { color: #e2463a; }
.uc-logo small { margin-top: 1.5cqw; font-size: 4.6cqw; font-weight: 500; letter-spacing: .6em; padding-left: .6em; color: rgba(239,230,210,.75); }
.stamp { position: absolute; z-index: 1; right: 5cqw; bottom: 8cqh; padding: .6cqw 2.4cqw; border: .9cqw solid #c8281c; border-radius: 1.5cqw; color: #c8281c; font: 700 8cqw/1 "Oswald", sans-serif; letter-spacing: .14em; text-transform: uppercase; transform: rotate(-14deg); opacity: .92; }

.odd-logo { top: 5cqh; white-space: nowrap; font: 18cqw/.9 "Archivo Black", sans-serif; text-transform: uppercase; color: #111128; text-shadow: 1.2cqw 1.2cqw 0 #ff5c9a; }
.odd-logo i { display: inline-block; color: #ff5c9a; text-shadow: 1.2cqw 1.2cqw 0 #111128; transform: rotate(14deg) translateY(-1.5cqw); }
.odd-logo small { white-space: normal; margin-top: 3cqw; font: 3.8cqw/1.2 "DM Mono", monospace; letter-spacing: .06em; text-shadow: none; color: rgba(17,17,40,.75); }

.times-logo { bottom: 4cqh; font: 21cqw/.86 "Bungee", sans-serif; color: #fff5d7; -webkit-text-stroke: .7cqw #14100d; text-shadow: 1cqw 1cqw 0 #f23d2e, 2cqw 2cqw 0 #14100d; transform: rotate(-4deg); }

.aura-logo { top: 6cqh; font: 15cqw/1 "Press Start 2P", monospace; color: #fff; text-shadow: 1cqw 1cqw 0 #ff5c9a, 0 0 6cqw rgba(0,224,196,.9); }
.rpg-box { position: absolute; z-index: 1; left: 5cqw; right: 5cqw; bottom: 3cqh; padding: 3cqw; border: .9cqw solid #f4f0ff; background: #10071f; box-shadow: 0 0 0 .9cqw #10071f; font: 3.6cqw/1.5 "Press Start 2P", monospace; color: #f4f0ff; }
.rpg-box i { float: right; font-style: normal; animation: rec 1s steps(2, jump-none) infinite; }

.tardis-logo { top: 5cqh; font: 800 16cqw/1 "Cinzel", serif; letter-spacing: .16em; padding-left: .16em; text-transform: uppercase; color: #ffe6b0; text-shadow: 0 0 4cqw rgba(255,170,80,.8), 0 .5cqw 0 rgba(0,0,0,.6); }
.tardis-logo small { margin: 2cqw auto 0; max-width: 80%; font-size: 3.6cqw; font-weight: 600; letter-spacing: .18em; line-height: 1.5; color: rgba(255,230,176,.8); }

.whist-logo { top: 5cqh; font: 900 20cqw/1 "Playfair Display", serif; letter-spacing: .06em; text-transform: uppercase; color: #e2c46e; text-shadow: 0 .6cqw 0 #5a4313, 0 0 6cqw rgba(0,0,0,.6); }
.whist-logo small { font-size: 10cqw; font-style: italic; font-weight: 700; text-transform: none; letter-spacing: 0; color: #f3e3b4; margin-bottom: -1cqw; }
.whist-logo i { margin-top: 2cqw; font: 5cqw/1 serif; letter-spacing: .5em; padding-left: .5em; color: #e2c46e; text-shadow: none; }

/* ---------------------------------------------------------------- updates (shadcn-style dialog on tweakcn tokens) */
.updates {
  width: min(720px, calc(100% - 24px));
  max-height: min(84vh, 760px);
  padding: 0;
  color: var(--card-foreground, var(--foreground));
  background: var(--card, var(--background));
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.updates::backdrop { background: rgba(0,0,0,.55); }
.updates[open] { display: flex; flex-direction: column; }
.updates header { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.updates header h2 { margin: 0; font-size: 1.05rem; }
.updates header p { margin: 2px 0 0; color: var(--muted-foreground); font-size: .78rem; }
.updates header .grow { flex: 1; }
.updates .list { overflow: auto; padding: 8px 12px 14px; }
.upd-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 12px 8px; border-bottom: 1px solid var(--border); }
.upd-row:last-child { border-bottom: 0; }
.upd-row h3 { margin: 0; font-size: .92rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upd-meta { margin: 3px 0 0; color: var(--muted-foreground); font-size: .74rem; overflow-wrap: anywhere; }
.upd-meta code { font-family: "DM Mono", monospace; }
.upd-actions { display: flex; gap: 6px; }
.upd-log { grid-column: 1 / -1; margin: 4px 0 0; max-height: 220px; overflow: auto; padding: 10px 12px; border-radius: calc(var(--radius, 12px) - 4px); background: var(--muted); color: var(--muted-foreground); font: 500 .7rem/1.45 "DM Mono", monospace; white-space: pre-wrap; }
.pill { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); font-size: .64rem; font-weight: 700; color: var(--muted-foreground); }
.pill.ok { color: #3fae5c; border-color: color-mix(in srgb, #3fae5c 45%, transparent); }
.pill.new { color: var(--primary-foreground); background: var(--primary); border-color: var(--primary); }
.pill.warn { color: #d9822b; border-color: color-mix(in srgb, #d9822b 45%, transparent); }
.pill.running { color: var(--primary); border-color: var(--primary); }
.pill.bad { color: var(--destructive); border-color: color-mix(in srgb, var(--destructive) 45%, transparent); }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: calc(var(--radius, 12px) - 4px); border: 1px solid var(--border); background: transparent; color: var(--foreground); font-size: .78rem; font-weight: 600; cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--accent); color: var(--accent-foreground); }
.btn.primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.btn.primary:hover:not(:disabled) { opacity: .9; background: var(--primary); color: var(--primary-foreground); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.icon { width: 32px; padding: 0; justify-content: center; }
.btn svg { width: 15px; height: 15px; }
.spin { animation: spin 1s linear infinite; }

/* ---------------------------------------------------------------- feedback (quiet corner button + dialog) */
.feedback-btn {
  position: fixed;
  z-index: 20;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border: 1px solid rgba(233,237,242,.1);
  border-radius: 999px;
  background: rgba(0,0,0,.4);
  color: rgba(233,237,242,.42);
  font-size: .72rem; font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.feedback-btn:hover, .feedback-btn:focus-visible { color: #fff; border-color: rgba(233,237,242,.3); }
.feedback-btn svg { width: 14px; height: 14px; }
.feedback { width: min(480px, calc(100% - 24px)); }
.feedback form { display: flex; flex-direction: column; min-height: 0; }
.fb-body { display: grid; gap: 14px; padding: 16px 20px 4px; overflow: auto; }
.fb-field { display: grid; gap: 6px; font-size: .8rem; font-weight: 600; }
.fb-field em { font-style: normal; font-weight: 500; color: var(--muted-foreground); }
.fb-field textarea, .fb-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--input, var(--border));
  border-radius: calc(var(--radius, 12px) - 4px);
  background: transparent;
  color: var(--foreground);
  font: 500 .88rem/1.45 "DM Sans", var(--font-sans), sans-serif;
}
.fb-field textarea { resize: vertical; min-height: 110px; }
.fb-field textarea:focus, .fb-field input:focus { outline: 2px solid var(--ring, var(--primary)); outline-offset: 1px; }
.fb-status { min-height: 1.2em; margin: 0; font-size: .78rem; color: var(--muted-foreground); }
.fb-status.bad { color: var(--destructive); }
.fb-status.ok { color: #3fae5c; }
.feedback footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }

/* ---------------------------------------------------------------- without JS: plain covers */
html:not(.js) .box .cover { transform: none; }

@keyframes rec { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes spin { to { rotate: 360deg; } }

@media (max-width: 760px) {
  .updates-btn span, .feedback-btn span { display: none; }
  .feedback-btn { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
