/* ————————————————————————————————————————————————
   Sam's Game Library — personal game shelf
   Mobile-first, atmospheric dark, cover-forward.
   ———————————————————————————————————————————————— */

:root {
  --bg: #0b0d12;
  --bg-raise: #12151d;
  --card: #151924;
  --card-edge: rgba(255, 255, 255, 0.06);
  --ink: #ece8df;
  --ink-dim: #b3ac9f;
  --ink-faint: #7d7870;
  --brass: #e2b25c;
  --brass-soft: rgba(226, 178, 92, 0.14);
  --focus: #f0c778;
  --radius: 14px;
  --radius-sm: 9px;

  /* ownership source tints */
  --src-steam: #7cb8e4;
  --src-rom: #c39bef;
  --src-physical: #e2b25c;
  --src-nintendo: #f0857c;
  --src-psn: #8a9cf5;
  --src-xbox: #86d493;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120vmax 60vmax at 85% -10%, rgba(70, 60, 110, 0.28), transparent 60%),
    radial-gradient(90vmax 50vmax at -15% 5%, rgba(226, 178, 92, 0.10), transparent 55%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: clamp(16px, 3vw, 40px);
  padding-bottom: 48px;
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* warm lamp glow behind the header */
.glow {
  position: absolute;
  inset: -80px 0 auto 0;
  height: 320px;
  pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, rgba(226, 178, 92, 0.08), transparent 70%);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 16px; top: -48px;
  z-index: 10;
  background: var(--brass);
  color: #191408;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip:focus-visible { top: 12px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ——— header ——— */

.top {
  position: relative;
  display: grid;
  gap: 20px;
  max-width: 1480px;
  margin: 0 auto 20px;
  padding-bottom: 22px;
}

/* lit shelf-edge rule */
.top::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(226, 178, 92, 0.55) 18%, rgba(226, 178, 92, 0.55) 82%, transparent);
  box-shadow: 0 6px 22px rgba(226, 178, 92, 0.18);
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
}

h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.lede {
  margin: 6px 0 0;
  color: var(--ink-dim);
  font-size: 14px;
}
.lede strong { color: var(--ink); font-weight: 600; }

/* ——— controls ——— */

.controls { display: grid; gap: 10px; }

.control-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.search {
  position: relative;
  display: block;
}
.search svg {
  position: absolute;
  left: 13px; top: 50%;
  translate: 0 -50%;
  width: 17px; height: 17px;
  color: var(--ink-faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: var(--radius);
  border: 1px solid var(--card-edge);
  background: var(--bg-raise);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus {
  outline: none;
  border-color: rgba(226, 178, 92, 0.55);
  background: #141824;
}
.search input::-webkit-search-cancel-button { cursor: pointer; }

.sort select {
  height: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--card-edge);
  background: var(--bg-raise);
  color: var(--ink-dim);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.sort select:hover { color: var(--ink); }

.stats-link {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 10px 14px;
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  background: var(--bg-raise);
  color: var(--ink-dim);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.stats-link svg { width: 16px; height: 16px; fill: currentColor; }
.stats-link:hover { color: var(--brass); border-color: rgba(226, 178, 92, 0.45); }

.view-toggle {
  display: flex;
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raise);
}
.view-toggle button {
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.view-toggle button svg { width: 17px; height: 17px; fill: currentColor; }
.view-toggle button:hover { color: var(--ink); }
.view-toggle button.active {
  background: var(--brass-soft);
  color: var(--brass);
}

/* ——— filter chips ——— */

.filters {
  max-width: 1480px;
  margin: 0 auto 24px;
}

.filter-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: -6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.chips {
  display: contents;
}

.chip { flex-shrink: 0; white-space: nowrap; }

@media (min-width: 720px) {
  .filter-row { flex-wrap: wrap; overflow: visible; padding-bottom: 0; margin-bottom: 0; }
}

.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.025);
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chip .count {
  margin-left: 5px;
  font-size: 11px;
  color: var(--ink-faint);
}
.chip:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.16); }
.chip[aria-pressed="true"] {
  background: var(--brass-soft);
  border-color: rgba(226, 178, 92, 0.6);
  color: var(--brass);
}
.chip[aria-pressed="true"] .count { color: rgba(226, 178, 92, 0.75); }

.console-row {
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid rgba(226, 178, 92, 0.35);
}
.console-row[hidden] { display: none; }
.console-row .chip { padding: 4px 11px; font-size: 12.5px; }
.console-label {
  flex-shrink: 0;
  margin-right: 2px;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-sep {
  flex-shrink: 0;
  align-self: stretch;
  width: 1px;
  margin: 2px 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
}


.linkish {
  border: 0;
  background: none;
  padding: 6px 8px;
  color: var(--ink-faint);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover { color: var(--ink); }

/* ——— grid of cards ——— */

.grid {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 14px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%), var(--card);
  border: 1px solid var(--card-edge);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(226, 178, 92, 0.28);
  box-shadow:
    0 14px 30px -14px rgba(0, 0, 0, 0.75),
    0 2px 10px rgba(0, 0, 0, 0.4);
}

.cover {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #0e1119;
  overflow: hidden;
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* seat the cover into the shelf */
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 -26px 26px -20px rgba(0, 0, 0, 0.55);
}

/* placeholder “spine” shown when no cover / all URLs 404 */
.ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 14px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(226, 178, 92, 0.10), transparent 55%),
    linear-gradient(20deg, rgba(90, 80, 140, 0.22), transparent 60%),
    #131624;
}
.ph::before {
  content: "";
  width: 30px;
  height: 2px;
  border-radius: 2px;
  background: rgba(226, 178, 92, 0.6);
}
.ph .ph-title {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-dim);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


.card-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 11px 12px;
}

.card-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ownership source badges */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--src, var(--ink-dim));
  background: color-mix(in srgb, var(--src, #888) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--src, #888) 32%, transparent);
}
.badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge.src-Steam    { --src: var(--src-steam); }
.badge.src-ROM      { --src: var(--src-rom); }
.badge.src-Physical { --src: var(--src-physical); }
.badge.src-Nintendo { --src: var(--src-nintendo); }
.badge.src-PSN      { --src: var(--src-psn); }
.badge.src-Xbox     { --src: var(--src-xbox); }

/* platform tags */
.plats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 11px;
  color: var(--ink-dim);
}
.plat + .plat::before {
  content: "· ";
  color: var(--ink-faint);
}

/* secondary meta — rendered only when present */
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: auto;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ——— list view ——— */

.grid.list {
  grid-template-columns: 1fr;
  gap: 8px;
  max-width: 900px;
}
.grid.list .card {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding-right: 14px;
}
.grid.list .card:hover { transform: none; }
.grid.list .cover {
  flex: 0 0 58px;
  aspect-ratio: 2 / 3;
  align-self: stretch;
  min-height: 87px;
}
.grid.list .cover::after { display: none; }
.grid.list .ph { padding: 4px; gap: 4px; }
.grid.list .ph::before { width: 14px; }
.grid.list .ph .ph-title { font-size: 8px; -webkit-line-clamp: 3; }
.grid.list .card-body {
  flex: 1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 0;
}
.grid.list .card-title {
  flex-basis: 100%;
  font-size: 14.5px;
  -webkit-line-clamp: 1;
}
.grid.list .meta { margin-top: 0; }

@media (min-width: 480px) {
  .grid.list .card-title { flex-basis: auto; }
}

/* ——— empty state / footer ——— */

.empty {
  max-width: 1480px;
  margin: 48px auto;
  text-align: center;
  color: var(--ink-dim);
}
.empty-mark {
  margin: 0 0 6px;
  font-size: 40px;
  color: var(--ink-faint);
}
.empty p { margin: 0 0 10px; }
.hidden { display: none; }

.empty-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 6px;
}
.empty-hints:empty { display: none; }

.foot-link { margin-left: auto; }

.kbd-hint {
  position: absolute;
  right: 12px; top: 50%;
  translate: 0 -50%;
  padding: 1px 7px;
  border: 1px solid var(--card-edge);
  border-radius: 5px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-faint);
  pointer-events: none;
}
.search:focus-within .kbd-hint,
.search:has(input:not(:placeholder-shown)) .kbd-hint { display: none; }
@media (hover: none), (max-width: 719px) { .kbd-hint { display: none; } }

.foot {
  max-width: 1480px;
  margin: 40px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--card-edge);
  font-size: 12.5px;
  color: var(--ink-faint);
  display: flex;
  gap: 8px;
  align-items: center;
}
.foot a { color: var(--ink-dim); text-underline-offset: 3px; }
.foot a:hover { color: var(--brass); }

/* ——— wider screens ——— */

@media (min-width: 720px) {
  .top {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
  .controls {
    grid-template-columns: minmax(260px, 340px);
    justify-items: end;
  }
  .search { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 22px 18px; }
}

@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); }
}

/* ——— motion & contrast preferences ——— */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover { transform: none; }
  .lb-spinner { animation-duration: 1.6s !important; }   /* loading cue is essential motion */
}

@media (prefers-contrast: more) {
  :root {
    --ink-dim: #cfc9bd;
    --ink-faint: #a49e93;
    --card-edge: rgba(255, 255, 255, 0.22);
  }
  body::after { display: none; }
}

/* ——— card → detail link ——— */

.card-link {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
}
.card-link:focus-visible { outline-offset: -2px; border-radius: var(--radius); }
.card:has(.card-link:focus-visible) { border-color: rgba(226, 178, 92, 0.5); }
.card { cursor: pointer; }

body.modal-open { overflow: hidden; }

/* ——— detail panel ——— */

.detail {
  width: min(980px, calc(100% - 32px));
  max-width: none;
  /* Fit content (scroll only on real overflow); top-anchored so stepping ←/→
     only moves the bottom edge, never the header or buttons. */
  max-height: calc(100dvh - 32px);
  margin: 16px auto auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: var(--bg-raise);
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  scrollbar-width: thin;
}
.detail:focus { outline: none; }
.detail[open] { animation: d-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.detail::backdrop {
  background: rgba(5, 6, 10, 0.74);
  backdrop-filter: blur(6px);
}
@keyframes d-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* sticky toolbar floats over the hero */
.d-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 0;              /* takes no layout space; buttons overhang the hero */
  padding: 0 14px;
  overflow: visible;
}
.d-bar > * { transform: translateY(32px); }
.d-nav { display: flex; align-items: center; gap: 6px; }
.d-pos {
  margin-left: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(10, 11, 16, 0.6);
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.d-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 11, 16, 0.62);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.d-btn.d-close { font-size: 15px; }
.d-btn:hover:not([disabled]) { background: rgba(226, 178, 92, 0.2); border-color: rgba(226, 178, 92, 0.5); color: var(--brass); }
.d-btn[disabled] { opacity: 0.35; cursor: default; }

.d-hero {
  position: relative;
  height: clamp(160px, 20vw, 224px);
  overflow: hidden;
  background: #0e1119;
}
.d-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.d-hero-blur {
  filter: blur(28px) saturate(1.2) brightness(0.7);
  transform: scale(1.3);
}
.d-hero-img { opacity: 0; transition: opacity 0.35s ease; }
.d-hero.has-art .d-hero-img { opacity: 1; }
.d-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(18, 21, 29, 0.25) 0%, transparent 35%, rgba(18, 21, 29, 0.75) 78%, var(--bg-raise) 100%);
}

.d-top {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 22px;
  align-items: flex-end;
  margin-top: -96px;
  padding: 0 28px;
}
.d-cover {
  flex: 0 0 150px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.85);
}
.d-head { flex: 1; min-width: 0; padding-bottom: 4px; }
.d-eyebrow {
  margin: 0 0 4px;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}
.d-title {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  line-height: 1.08;
  text-wrap: balance;
}
.d-facts {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.d-facts .dot { margin: 0 7px; color: var(--ink-faint); }
.d-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.d-stat {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  color: var(--ink-dim);
}
.d-stat strong { color: var(--ink); font-weight: 650; }
.d-mc strong { font-variant-numeric: tabular-nums; }
.d-mc.good  { border-color: rgba(102, 204, 51, 0.45); } .d-mc.good strong  { color: #7fd650; }
.d-mc.mixed { border-color: rgba(255, 204, 51, 0.45); } .d-mc.mixed strong { color: #ffcc33; }
.d-mc.bad   { border-color: rgba(255, 90, 90, 0.45); }  .d-mc.bad strong   { color: #ff6b6b; }

.d-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 8px 32px;
  padding: 20px 28px 22px;
}
.d-body.solo { grid-template-columns: minmax(0, 560px); }
.d-col-main:empty { display: none; }
.d-col-main, .d-col-side { display: grid; gap: 20px; align-content: start; min-width: 0; }

.d-section { min-width: 0; }   /* let the screenshot strip scroll instead of widening the column */
.d-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.d-count {
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
  letter-spacing: 0;
  color: var(--ink-dim);
}

.d-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 68ch;
}
.d-desc.expanded { display: block; }
.d-desc-foot { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.d-desc-foot .linkish { padding: 4px 0; color: var(--brass); }
.d-attrib { font-size: 12px; color: var(--ink-faint); }
.d-attrib a { color: var(--ink-dim); text-underline-offset: 3px; }

.skeleton { display: grid; gap: 9px; }
.skeleton span {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton .short { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* screenshots — horizontal strip */
.shots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(170px, 36%);
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.shot {
  position: relative;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 1px solid var(--card-edge);
  border-radius: 10px;
  overflow: hidden;
  background: #0e1119;
  cursor: zoom-in;
  scroll-snap-align: start;
}
.shot.pixel { aspect-ratio: 4 / 3; }
.shot.pixel img { image-rendering: pixelated; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.shot:hover img { transform: scale(1.03); }

/* copies */
.copies { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.copy {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.025);
}
.copy .badge { flex-shrink: 0; }
.copy-main { display: grid; min-width: 0; flex: 1; }
.copy-what { font-size: 13.5px; font-weight: 550; }
.copy-sub { font-size: 12px; color: var(--ink-dim); overflow-wrap: anywhere; }
.copy-pt { flex-shrink: 0; font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* outbound links */
.d-links { display: flex; flex-wrap: wrap; gap: 7px; }
.d-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.d-link:hover { border-color: rgba(226, 178, 92, 0.5); background: var(--brass-soft); color: var(--brass); }
.d-link-arrow { font-size: 11px; color: var(--ink-faint); }
.d-link-note { font-size: 11px; color: var(--ink-faint); }
.link-steam { border-color: color-mix(in srgb, var(--src-steam) 35%, transparent); }

/* screenshot lightbox (inside the dialog's top layer) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 56px 16px;
  background: rgba(4, 5, 8, 0.93);
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  cursor: default;
}
.lightbox img.lb-loading { opacity: 0; }
.lb-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--brass);
  animation: lb-spin 0.8s linear infinite;
  pointer-events: none;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }
.lb-error {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  font-size: 14px;
  color: var(--ink-dim);
  pointer-events: none;
}
.lightbox img.pixel {
  width: min(100%, 960px);
  height: auto;
  image-rendering: pixelated;
}
.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(20, 22, 30, 0.8);
  color: var(--ink);
  font: inherit;
  font-size: 24px;
  cursor: pointer;
}
.lb-btn:hover { color: var(--brass); border-color: rgba(226, 178, 92, 0.5); }
.lb-prev { left: 16px; top: 50%; translate: 0 -50%; }
.lb-next { right: 16px; top: 50%; translate: 0 -50%; }
.lb-close { right: 16px; top: calc(12px + env(safe-area-inset-top, 0px)); font-size: 16px; }
.lb-count {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  translate: -50% 0;
  font-size: 12.5px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* phones: full-screen sheet, stacked layout */
@media (max-width: 719px) {
  .detail {
    width: 100%;
    max-height: none;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .detail[open] { animation-name: d-sheet; }
  .d-bar > * { transform: translateY(calc(14px + env(safe-area-inset-top, 0px))); }
  .d-hero { height: calc(210px + env(safe-area-inset-top, 0px)); }
  .d-top { gap: 14px; margin-top: -70px; padding: 0 16px; }
  .d-cover { flex-basis: 104px; }
  .d-title { font-size: 25px; }
  .d-body { grid-template-columns: 1fr; gap: 24px; padding: 22px 16px 32px; }
  /* what you own → what it is → pictures → where to read more */
  .d-col-main, .d-col-side { display: contents; }
  .d-copies { order: 1; }
  .d-about { order: 2; }
  .d-shots { order: 3; }
  .d-linksec { order: 4; }
  .shots { grid-auto-columns: 78%; }
  .lb-prev, .lb-next { top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); translate: none; }
}
@keyframes d-sheet {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
