.game-directory {
  width: min(100%, 108rem);
  margin: auto;
  padding: clamp(3rem, 6vw, 6rem) var(--gutter);
  scroll-margin-top: 1rem;
}
.directory-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: clamp(1.4rem, 3vw, 2.4rem);
}
.directory-heading h2 {
  margin: 0;
  color: #f5f4e9;
  font: 800 clamp(3.8rem, 6vw, 6.5rem)/.88 'Barlow Condensed', Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: -.025em;
}
.directory-heading h2 span { color: var(--aqua); }
.directory-link {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  min-height: 44px;
  font-size: .86rem;
}
.directory-link span { color: var(--aqua); font-size: 1.2rem; }
.directory-link:hover { text-decoration: underline; }
.game-shelf { isolation: isolate; min-width: 0; }
.game-shelf button { font: inherit; color: inherit; cursor: pointer; }
.game-shelf button:focus-visible, .game-shelf a:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }
.shelf-controls { display: none; }
.shelf-screen {
  position: relative;
  overflow: hidden;
  border: 1px solid #384648;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 65%, #3c585548, transparent 65%),
    radial-gradient(#93b8b323 .7px, transparent .95px) 0 0 / 6px 6px,
    #10191d;
}
.game-shelf[data-ready] .shelf-screen { border-radius: 18px 18px 0 0; }
.game-shelf[data-ready] .shelf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem clamp(.9rem, 2vw, 2rem) 0;
}
.shelf-count { display: flex; gap: .7rem; align-items: center; color: #c6d3d2; font: 600 .78rem/1 Geist, sans-serif; letter-spacing: .13em; font-variant-numeric: tabular-nums; }
.power-light { width: 7px; height: 7px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 10px #00fdff80; }
.shelf-arrows { display: flex; gap: 6px; }
.shelf-arrows button {
  display: grid;
  width: 46px;
  height: 44px;
  place-items: center;
  border: 1px solid #718084;
  border-radius: 50%;
  background: #131f24;
  transition: background .15s, color .15s;
}
.shelf-arrows button:hover { background: #edf4ec; color: var(--ink); }
.shelf-arrows svg { width: 19px; }
.cartridge-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: center;
  gap: 1.5rem;
  padding: 2rem;
}
.cartridge {
  --plastic: #3d4444;
  --edge: #687575;
  display: block;
  position: relative;
  aspect-ratio: .89;
  width: min(100%, 282px);
  border: 1px solid var(--edge);
  border-radius: 6% 6% 4% 4%;
  background:
    radial-gradient(circle at 7% 5%, #141c20 0 .65%, #88918e .8%, transparent 1.2%),
    radial-gradient(circle at 93% 5%, #141c20 0 .65%, #88918e .8%, transparent 1.2%),
    linear-gradient(125deg, #ffffff15, transparent 42%, #0003), var(--plastic);
  box-shadow: inset 0 3px 1px #ffffff27, inset 3px 0 2px #ffffff12, inset -3px -5px 2px #0006, 0 5px 0 #080d10, 0 12px 14px #04080d70;
  user-select: none;
  -webkit-user-drag: none;
}
.cartridge[data-game="padel"] { --plastic: #2e4657; --edge: #657990; }
.cartridge[data-game="one-cut"] { --plastic: #5c3e3e; --edge: #836968; }
.cartridge[data-game="zenquest"] { --plastic: #536657; --edge: #899681; }
.cartridge[data-game="smite"] { --plastic: #51435c; --edge: #88768f; }
.cartridge[data-game="doublets"] { --plastic: #31545f; --edge: #68838a; }
.cartridge[data-game="acromaniac"] { --plastic: #624452; --edge: #927b85; }
.cartridge::before, .cartridge::after { content: ""; position: absolute; left: 50%; translate: -50% 0; }
.cartridge::before {
  top: 3.1%; width: 28%; height: 3.4%;
  background: repeating-linear-gradient(0deg, #0004 0 1px, #fff1 1px 2px, transparent 2px 4px);
}
.cartridge::after {
  bottom: 4.7%; width: 59%; height: 6.2%; border-radius: 2px;
  background: repeating-linear-gradient(0deg, #080f1199 0 1px, #ffffff20 1.4px 2.3px, transparent 2.8px 5px);
}
.cover-label {
  position: absolute; inset: 9% 5% 14%;
  display: grid; grid-template: 65% 35% / minmax(0, 1fr);
  overflow: hidden; border: 1px solid #10201b;
  border-radius: 3% 3% 5% 5%; background: #15202a;
}
.cover-art { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
[data-game="one-cut"] .cover-art { object-position: right center; }
.cover-brand {
  padding: 2.5% 6%; background: var(--label-paper);
  border-top: 2px solid #fff3;
}
.cover-brand img { width: 100%; height: 100%; object-fit: contain; }
[data-game="knockout"] { --label-paper: #081630; }
[data-game="one-cut"] { --label-paper: #11171b; }
[data-game="padel"] { --label-paper: #07152f; }
[data-game="zenquest"] { --label-paper: #f8f5f1; }
[data-game="smite"] { --label-paper: #e9ce92; }
[data-game="doublets"] { --label-paper: #0b1220; }
[data-game="acromaniac"] { --label-paper: #15152d; }

.game-shelf[data-ready] .cartridge-track {
  display: block;
  container-type: inline-size;
  height: clamp(260px, 26.5vw, 414px);
  padding: 0;
  overflow: clip;
  touch-action: pan-y pinch-zoom;
}
[data-ready] .cartridge {
  --shift: 0%; --turn: 0deg; --scale: 1; --drop: 0%;
  width: clamp(200px, 23cqw, 328px);
  position: absolute;
  top: 46%; left: 50%;
  z-index: 3;
  transform: translate(calc(-50% + var(--shelf-drag, 0px)), -50%) translate(var(--shift), var(--drop)) rotate(var(--turn)) scale(var(--scale));
  transition: transform .36s cubic-bezier(.2,.74,.24,1), filter .25s, opacity .24s;
}
.cartridge-track.is-dragging .cartridge { transition: none; }
.cartridge[data-offset="0"] { z-index: 4; }
.cartridge[data-offset="-1"] { --shift: -93%; --turn: -8deg; }
.cartridge[data-offset="1"] { --shift: 93%; --turn: 8deg; }
.cartridge:is([data-offset="-1"], [data-offset="1"]) { --scale: .84; --drop: 7%; filter: brightness(.87); }
.cartridge[data-offset="-2"] { --shift: -167%; --turn: -14deg; }
.cartridge[data-offset="2"] { --shift: 167%; --turn: 14deg; }
.cartridge:is([data-offset="-2"], [data-offset="2"]) { --scale: .70; --drop: 13%; z-index: 2; filter: brightness(.72); }
.cartridge[inert] { opacity: 0; z-index: 0; pointer-events: none; --scale: .55; --drop: 16%; }
@media (hover: hover) {
  .cartridge[data-offset]:hover { filter: brightness(1.06); }
}
.game-shelf[data-ready] .shelf-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(1.3rem, 2.7vw, 3rem);
  background: #192226;
  border: 1px solid #384648;
  border-top: 2px solid #526265;
  border-radius: 0 0 16px 16px;
  box-shadow: inset 0 3px #0b1217;
}
.shelf-selection p { margin: 0 0 .26rem; font: 600 .66rem/1.4 Geist,sans-serif; text-transform: uppercase; letter-spacing: .14em; color: #a9c9c6; }
.shelf-selection h3 { margin: 0; font: 600 clamp(1.45rem, 2.4vw, 2.35rem)/1.15 'Space Grotesk', sans-serif; letter-spacing: -.05em; }
.shelf-play {
  display: inline-flex; min-height: 50px; justify-content: center; align-items: center; gap: 2.6rem;
  border-radius: 7px; background: var(--aqua); color: #071417; border: 1px solid #a0ffed;
  padding: .7rem 1.2rem; font: 600 1rem/1 Geist,sans-serif;
  box-shadow: 0 4px 0 #057276; transition: background .2s, transform .15s;
}
.shelf-play:hover { background: #78fffa; }
.shelf-play:active { transform: translateY(2px); }
.shelf-play svg { fill: currentColor; stroke-width: 1.2; width: 17px; height: 17px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 700px), (pointer: coarse) and (max-height: 530px) {
  .game-directory { display: flex; flex-direction: column; padding: 2.5rem 0 1.2rem; scroll-margin-top: .5rem; }
  .directory-heading { display: contents; }
  .directory-heading > div { margin: 0 1.25rem 1.3rem; }
  .directory-heading h2 { font-size: clamp(3.15rem, 12vw, 4.5rem); }
  .directory-link { order: 3; align-self: center; margin-top: 1rem; color: var(--muted); font-size: .78rem; }
  .shelf-screen, .game-shelf[data-ready] .shelf-screen { border-radius: 0; border-inline: 0; }
  .cartridge-track { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1.4rem 1rem; }
  .game-shelf[data-ready] .shelf-toolbar { position: absolute; z-index: 5; top: .9rem; right: 1.2rem; padding: 0; pointer-events: none; }
  .shelf-count { gap: .4rem; font-size: .64rem; }
  .power-light { width: 5px; height: 5px; }
  .shelf-arrows { display: none; }
  .game-shelf[data-ready] .cartridge-track { height: clamp(255px, 79vw, 361px); }
  [data-ready] .cartridge { width: clamp(174px, 54cqw, 240px); top: 52%; }
  .cartridge:is([data-offset="-1"], [data-offset="1"]) { --drop: 1%; --scale: .80; --turn: 0deg; filter: brightness(.72); }
  .cartridge[data-offset="-1"] { --shift: -92%; }
  .cartridge[data-offset="1"] { --shift: 92%; }
  .cartridge:is([data-offset="-2"], [data-offset="2"]) { opacity: 0; visibility: hidden; pointer-events: none; }
  .game-shelf[data-ready] .pocket-dock {
    display: flex; flex-wrap: wrap; justify-content: center; padding: .65rem 0 .35rem; gap: clamp(0px, calc(3vw - 10px), 7px);
    background: #111b20;
  }
  .pocket-dock button {
    display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 4px;
    background: var(--label-paper); border: 2px solid transparent; border-radius: 9px;
  }
  .pocket-dock img { width: clamp(30px, 9.5vw, 46px); height: 30px; object-fit: contain; }
  .pocket-dock button[aria-pressed="true"] { border-color: var(--aqua); }
  .game-shelf[data-ready] .shelf-detail {
    flex-direction: column; gap: .85rem; text-align: center; padding: .75rem max(1.25rem, env(safe-area-inset-right)) 1.25rem;
    border-radius: 0; border: 0; border-bottom: 1px solid #354145; box-shadow: none; background: #111b20;
  }
  .shelf-selection { display: flex; flex-direction: column-reverse; gap: .15rem; }
  .shelf-selection h3 { font-size: 1.55rem; }
  .shelf-selection p { font-size: .78rem; letter-spacing: 0; text-transform: none; margin: 0; color: var(--muted); }
  .shelf-play { width: min(100%, 26rem); min-height: 48px; border-radius: 14px; gap: .6rem; box-shadow: none; }
}
@media (orientation: landscape) and (pointer: coarse) and (max-height: 530px) {
  .game-directory { padding: 1.2rem max(1rem, env(safe-area-inset-left)); }
  .directory-heading { display: flex; margin-bottom: .8rem; }
  .directory-heading > div { margin: 0; }
  .directory-heading h2 { font-size: 2.5rem; }
  .directory-link { margin: 0; align-self: end; }
  .game-shelf[data-ready] {
    display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(11rem, 1fr);
    grid-template-areas: "screen detail" "dock detail";
    overflow: hidden; border-radius: 16px; border: 1px solid #384648;
  }
  .game-shelf[data-ready] .shelf-screen { grid-area: screen; border: 0; }
  .game-shelf[data-ready] .cartridge-track { height: clamp(150px, 49svh, 210px); }
  [data-ready] .cartridge { width: clamp(108px, 37svh, 160px); top: 50%; }
  .game-shelf[data-ready] .pocket-dock { grid-area: dock; gap: 2px; padding: 5px; }
  .pocket-dock img { width: 30px; height: 26px; }
  .game-shelf[data-ready] .shelf-detail {
    grid-area: detail; border: 0; border-left: 1px solid #384648; justify-content: center;
    align-items: start; text-align: left; padding: 1.3rem; gap: 1.3rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .game-shelf *, .game-shelf *::before, .game-shelf *::after { transition: none !important; }
}
