/* =========================================================
   MY GAMES: library page + shared bits used by the admin page
   ========================================================= */
:root{
  --star:        #FFC857;
  --star-off:    #2C313D;
  --glow-6:      #B26BFF;   /* 6 stars: purple */
  --glow-55:     #4F9DFF;   /* 5.5 stars: blue */

  /* game cases on the shelf */
  --case-w:      clamp(112px, 10.5vw, 150px);
  --case-depth:  11px;      /* spine thickness */
  --tilt:        34deg;     /* how far a case is turned while it sits on the shelf */
  --tilt-out:    14deg;     /* how far it stays turned when pulled out on hover */
}

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

.games-page{ position:relative; z-index:1; padding:56px 0 96px; }

/* ---------- intro (admin uses .games-intro too) ---------- */
.games-intro{
  display:flex; justify-content:space-between; align-items:flex-end;
  gap:32px; flex-wrap:wrap; margin-bottom:36px;
}
.games-intro h1{ font-size:clamp(32px, 5vw, 56px); line-height:1.05; }
.games-lede{ color:var(--text-muted); margin:12px 0 0; }

.lib-stats{ display:flex; margin:0; }
.lib-stats div{ padding:0 22px; border-left:1px solid var(--border); }
.lib-stats div:first-child{ padding-left:0; border-left:0; }
.lib-stats dd{
  margin:0; font-family:var(--font-display); font-weight:700;
  font-size:clamp(26px, 3vw, 36px); line-height:1.1;
}
.lib-stats dt{
  order:2; font-family:var(--font-mono); font-size:11px; letter-spacing:.08em;
  text-transform:uppercase; color:var(--text-faint); margin-top:4px;
}
/* each number with its label centred underneath */
.lib-stats div{ display:flex; flex-direction:column; align-items:center; text-align:center; }
.lib-stats .stat-6 dd{ color:var(--glow-6); text-shadow:0 0 18px rgba(178,107,255,.55); }
.lib-stats .stat-55 dd{ color:var(--glow-55); text-shadow:0 0 18px rgba(79,157,255,.5); }

/* ---------- form fields (shared with admin) ---------- */
.games-toolbar{
  display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end;
  padding:14px; margin-bottom:40px;
  background:var(--surface); border:3px solid var(--border); border-radius:var(--radius);
}
.field{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.field-search{ flex:1 1 260px; }
.field-label{
  font-family:var(--font-mono); font-size:11px; letter-spacing:.08em;
  text-transform:uppercase; color:var(--text-faint);
}
.field input, .field select, .field textarea, .lib-toolbar select, .lib-search input{
  font:inherit; font-size:15px; color:var(--text);
  background:var(--bg-soft); border:1px solid var(--border); border-radius:10px;
  padding:10px 12px; min-height:44px; width:100%;
  transition:border-color .2s ease, box-shadow .2s ease;
}
.field select, .lib-toolbar select{
  padding-right:32px; cursor:pointer; appearance:none;
  background-image:linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                   linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size:5px 5px; background-repeat:no-repeat;
}
.field textarea{ resize:vertical; min-height:96px; line-height:1.45; }
.field input:focus, .field select:focus, .field textarea:focus,
.lib-toolbar select:focus, .lib-search input:focus{
  outline:none; border-color:var(--accent-2); box-shadow:0 0 0 3px rgba(76,211,194,.18);
}
.field input::placeholder, .field textarea::placeholder, .lib-search input::placeholder{ color:var(--text-faint); }

/* ---------- library toolbar ---------- */
.lib-toolbar{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:12px 0 18px; margin-bottom:8px; border-bottom:1px solid var(--border);
}
.seg{
  display:inline-flex; gap:2px; padding:4px; flex-shrink:0;
  background:var(--bg-soft); border:1px solid var(--border); border-radius:12px;
}
.seg-label{
  font-family:var(--font-mono); font-size:11px; letter-spacing:.08em; text-transform:uppercase;
  color:var(--text-faint); padding:0 8px 0 6px; align-self:center;
}
.seg button{
  border:0; background:transparent; color:var(--text-muted);
  font:500 14px var(--font-body); padding:8px 14px; border-radius:8px; white-space:nowrap;
  transition:background .2s ease, color .2s ease, box-shadow .2s ease;
}
.seg button:hover{ color:var(--text); }
.seg button[aria-checked="true"]{
  background:rgba(244,97,87,.14); color:var(--accent);
  box-shadow:inset 0 0 0 1px var(--accent-dim);
}
.seg button:focus-visible{ outline:2px solid var(--accent-2); outline-offset:1px; }

.lib-search{ position:relative; flex:1 1 220px; min-width:0; }
.lib-search input{ padding-left:40px; }
.lib-search::before{
  content:""; position:absolute; left:14px; top:50%; width:14px; height:14px; margin-top:-8px;
  border:2px solid var(--text-faint); border-radius:50%; pointer-events:none;
}
.lib-search::after{
  content:""; position:absolute; left:26px; top:50%; width:7px; height:2px; margin-top:5px;
  background:var(--text-faint); transform:rotate(45deg); pointer-events:none;
}
.lib-toolbar select{ width:auto; flex:0 1 190px; }

.lib-result{
  display:flex; align-items:center; gap:14px; margin:0 0 36px;
  font-family:var(--font-mono); font-size:12.5px; color:var(--text-faint);
}
.lib-result button{
  background:none; border:0; padding:0; color:var(--accent);
  font:inherit; text-decoration:underline; text-underline-offset:3px;
}

/* ---------- stars ---------- */
.stars{
  display:inline-flex; gap:1px; white-space:nowrap;
  line-height:1; font-size:15px; vertical-align:middle;
}
.star{ position:relative; display:inline-block; color:var(--star-off); }
.star.is-full{ color:var(--star); }
/* half star: the left half of a gold star drawn over a grey one */
.star.is-half::before{
  content:"★"; position:absolute; inset:0 50% 0 0; overflow:hidden; color:var(--star);
}
.stars-sm{ font-size:12px; gap:0; }
.stars-lg{ font-size:20px; gap:2px; }
.stars-xl{ font-size:28px; gap:3px; }
.stars-none{ display:inline-block; font-family:var(--font-mono); font-size:12px; color:var(--text-faint); letter-spacing:.04em; }

/* ---------- status pills ---------- */
.status-pill{
  display:inline-flex; align-items:center; gap:6px;
  font-family:var(--font-mono); font-size:11.5px; letter-spacing:.03em;
  padding:4px 9px; border-radius:6px; white-space:nowrap;
  border:1px solid var(--border); background:var(--bg-soft); color:var(--text-muted);
}
.status-100{ color:#FFD98A; border-color:#6B5320; background:rgba(255,200,87,.1); }
.status-beaten{ color:var(--accent-2); border-color:var(--accent-2-dim); background:rgba(76,211,194,.08); }
.status-currently-playing{ color:#9CC8FF; border-color:#284A78; background:rgba(79,157,255,.1); }
.status-dropped{ color:#FF9C95; border-color:var(--accent-dim); background:rgba(244,97,87,.08); }
.status-on-hold, .status-unfinished{ color:#E7C3FF; border-color:#4C3466; background:rgba(178,107,255,.08); }

/* =========================================================
   SHELVES
   ========================================================= */
.shelf{ margin-bottom:64px; padding:0; border-top:0; }
.shelf-head{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  /* one fixed height, whether the heading is stars or text, so switching
     "Shelve by" never shifts the shelves up or down */
  height:34px; margin-bottom:16px;
}
.shelf-head h2{
  display:flex; align-items:center; gap:14px; min-width:0; margin:0;
  font-size:clamp(20px, 2.4vw, 26px); line-height:1; white-space:nowrap;
}
.shelf-score{
  font-family:var(--font-mono); font-size:13px; font-weight:500;
  padding:3px 9px; border-radius:6px;
  border:1px solid var(--border); background:var(--bg-soft); color:var(--text-muted);
}
.shelf.tier-6 .shelf-score{ color:var(--glow-6); border-color:#4C3466; box-shadow:0 0 14px rgba(178,107,255,.3); }
.shelf.tier-55 .shelf-score{ color:var(--glow-55); border-color:#284A78; box-shadow:0 0 14px rgba(79,157,255,.25); }
.shelf-count{ font-family:var(--font-mono); font-size:12.5px; color:var(--text-faint); white-space:nowrap; }

/* the bookcase: a recessed back wall with a plank under every row */
.bookcase{
  position:relative;
  padding:34px clamp(14px, 2vw, 26px) 22px;
  border:3px solid var(--border); border-radius:var(--radius);
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255,255,255,.035), transparent 70%),
    linear-gradient(to bottom, #12151C, #0E1116);
  box-shadow:inset 0 14px 30px -12px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,255,255,.02);
  overflow-x:clip;   /* trims the planks sideways without adding a scrollbar */
}
.shelf.tier-6 .bookcase{
  background:
    radial-gradient(80% 55% at 50% 0%, rgba(178,107,255,.12), transparent 70%),
    linear-gradient(to bottom, #13121D, #0E1016);
}
.shelf.tier-55 .bookcase{
  background:
    radial-gradient(80% 55% at 50% 0%, rgba(79,157,255,.1), transparent 70%),
    linear-gradient(to bottom, #11141E, #0E1116);
}

.shelf-grid{
  list-style:none; margin:0; padding:0;
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(var(--case-w), 1fr));
  column-gap:clamp(4px, .8vw, 12px);
  row-gap:58px;
  padding-bottom:20px;
  isolation:isolate;
}
.shelf-item{ position:relative; }

/* plank: every item draws a very wide one; they overlap into a full-width
   plank per row and .bookcase trims them at its edges */
.shelf-item::after{
  content:""; position:absolute; z-index:-2;
  left:-100vw; right:-100vw; top:calc(100% - 4px); height:22px;
  background:linear-gradient(to bottom,
    #2E3440 0, #262B36 7px,     /* top surface */
    #3A4150 7px, #3A4150 8px,   /* front edge highlight */
    #1D212A 8px, #14171E 100%); /* front edge */
  box-shadow:0 14px 18px -8px rgba(0,0,0,.75);
}
/* soft contact shadow under each case */
.shelf-item::before{
  content:""; position:absolute; z-index:-1;
  left:4%; right:14%; top:calc(100% - 8px); height:12px;
  background:radial-gradient(closest-side, rgba(0,0,0,.75), transparent);
  transition:opacity .4s ease, transform .4s ease;
}
.shelf-item:hover::before{ opacity:.45; transform:scaleX(.85); }
/* the plank and shadow are drawn by the item above them, so without this
   pointing at the plank would count as hovering that game */
.shelf-item::before, .shelf-item::after{ pointer-events:none; }
/* freshly drawn shelves or popup cover: no hover/3D transitions until they've settled, so
   nothing (like the spines) visibly slides into place on its own */
.is-redrawing .case-front, .is-redrawing .case-spine{ transition:none; }

/* ---------- 3D game case ---------- */
.case{
  all:unset; box-sizing:border-box; display:block; width:100%; cursor:pointer;
  position:relative; z-index:0;
  -webkit-tap-highlight-color:transparent;
}
/* only the button is lifted above its neighbours. Giving the <li> a z-index
   would drag its plank (::after) in front of the other cases */
.shelf-item:hover .case, .case:focus-visible{ z-index:3; }
/* The case is NOT a shared 3D scene (no preserve-3d): Chrome splits faces
   that share one and leaves hairline seams across the covers on some screens.
   Instead the front and the spine each carry the full 3D transform and are
   drawn as single flat layers. --pose is the case's position; hover changes it. */
.case-3d{
  --pose: translate3d(0, 0, 0) rotateY(var(--tilt));
  position:relative; display:block; aspect-ratio:2/3;
  container-type:inline-size;   /* 100cqw = width of the cover, used by the spine */
}
/* hover is read from the <li>, which never moves, so the case can't slide
   out from under the pointer and flicker */
.shelf-item:hover .case-3d, .case:focus-visible .case-3d{
  --pose: translate3d(4px, -18px, 70px) rotateY(var(--tilt-out));
}
.case:focus-visible{ outline:none; }
.case:focus-visible .case-front{ outline:2px solid var(--accent-2); outline-offset:3px; }

.case-front{
  position:absolute; inset:0; overflow:hidden;
  border-radius:2px 6px 6px 2px;
  background:var(--bg-soft);
  box-shadow:0 0 0 1px rgba(255,255,255,.07), 8px 10px 20px -6px rgba(0,0,0,.7);
  transform-origin:50% 100%;
  transform:perspective(1100px) var(--pose);
  transition:transform .55s cubic-bezier(.2,.8,.2,1), box-shadow .4s ease;
}
/* overscan by 1px: some SteamGridDB covers have a thin dark line baked into an edge */
.case-front img{
  position:absolute; inset:-1px;
  width:calc(100% + 2px); height:calc(100% + 2px); max-width:none; object-fit:cover;
}
/* plastic case: hinge on the left, sheen across the front */
.case-front::after{
  content:""; position:absolute; inset:0; pointer-events:none; z-index:1;
  background:
    linear-gradient(90deg, rgba(0,0,0,.5) 0, rgba(255,255,255,.2) 3px, rgba(0,0,0,.25) 6px, transparent 12px),
    linear-gradient(118deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,.04) 30%, transparent 46%, transparent 78%, rgba(255,255,255,.06) 100%);
}
/* The spine hangs off the front's left edge, turned 90deg backwards. Its
   transform is the front's transform (pivot at the cover's bottom centre,
   50cqw to the right of the spine's pivot) followed by that 90deg turn. */
.case-spine{
  position:absolute; top:0; bottom:0;
  left:calc(-1 * var(--case-depth)); width:var(--case-depth);
  overflow:hidden;
  border-radius:3px 0 0 3px;
  background-color:hsl(var(--h, 220) 28% 22%);
  background-size:auto 100%; background-position:left center;
  transform-origin:100% 100%;
  transform:translateX(50cqw) perspective(1100px) var(--pose) translateX(-50cqw) rotateY(-90deg);
  transition:transform .55s cubic-bezier(.2,.8,.2,1);
}
/* darkening as an overlay instead of a CSS filter (filters add extra layers) */
.case-spine::after{
  content:""; position:absolute; inset:0;
  background:linear-gradient(90deg, rgba(255,255,255,.14), rgba(0,0,0,.38) 35%, rgba(0,0,0,.6));
}

/* rating tiers: the case glows */
.case.tier-6 .case-front{
  box-shadow:0 0 0 2px var(--glow-6), 0 0 20px 3px rgba(178,107,255,.55), 0 0 46px rgba(178,107,255,.25);
}
.case.tier-55 .case-front{
  box-shadow:0 0 0 2px var(--glow-55), 0 0 18px 2px rgba(79,157,255,.5), 0 0 40px rgba(79,157,255,.2);
}
.case.tier-6 .case-spine{ background-color:#4A2A78; }
.case.tier-55 .case-spine{ background-color:#1F4577; }
.case.tier-6 .case-spine::after{ background:linear-gradient(90deg, rgba(207,162,255,.25), rgba(40,10,70,.35) 35%, rgba(20,5,40,.5)); }
.case.tier-55 .case-spine::after{ background:linear-gradient(90deg, rgba(147,195,255,.25), rgba(10,30,70,.35) 35%, rgba(5,15,40,.5)); }
.shelf-item:hover .case-front{ box-shadow:0 0 0 2px var(--accent), 14px 22px 30px -8px rgba(0,0,0,.8); }
.shelf-item:hover .case.tier-6 .case-front{ box-shadow:0 0 0 2px #CFA2FF, 0 0 28px 6px rgba(178,107,255,.6), 14px 22px 30px -8px rgba(0,0,0,.8); }
.shelf-item:hover .case.tier-55 .case-front{ box-shadow:0 0 0 2px #93C3FF, 0 0 26px 5px rgba(79,157,255,.55), 14px 22px 30px -8px rgba(0,0,0,.8); }

.case-info{
  position:absolute; inset:auto 0 0 0; z-index:2;
  display:flex; flex-direction:column; gap:5px;
  padding:30px 10px 10px 14px;
  background:linear-gradient(to top, rgba(10,12,17,.96), rgba(10,12,17,.78) 55%, transparent);
  opacity:0; transform:translateY(10px);
  transition:opacity .3s ease .05s, transform .3s ease .05s;
}
.case-title{
  font-family:var(--font-display); font-weight:700; font-size:13px; line-height:1.2;
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden;
}
.shelf-item:hover .case-info, .case:focus-visible .case-info{ opacity:1; transform:none; }
.case-front:has(.cover-placeholder) .case-title{ display:none; }
.case-front:has(.cover-placeholder) .case-info:not(:has(.stars)){ display:none; }

.cover-badge{
  position:absolute; top:8px; left:12px; z-index:2;
  font-family:var(--font-mono); font-size:10px; letter-spacing:.06em; font-weight:600;
  padding:3px 6px; border-radius:5px;
}
.badge-100{ background:rgba(255,200,87,.95); color:#2A1F05; }
.badge-playing{ background:rgba(76,211,194,.95); color:#06231F; }

/* ---------- flat cover (admin thumbnails, editor preview) ---------- */
.cover{
  all:unset; box-sizing:border-box;
  display:block; width:100%;
  border:3px solid var(--border); border-radius:10px;
  background:var(--bg-soft);
  transition:transform .3s cubic-bezier(.2,.7,.2,1), border-color .25s ease, box-shadow .3s ease;
}
.cover-art{
  position:relative; display:block; aspect-ratio:2/3; overflow:hidden; border-radius:7px;
}
.cover-art img{ width:100%; height:100%; object-fit:cover; }
.cover.tier-6{ border-color:var(--glow-6); box-shadow:0 0 14px 1px rgba(178,107,255,.5); }
.cover.tier-55{ border-color:var(--glow-55); box-shadow:0 0 12px 1px rgba(79,157,255,.45); }

.cover-placeholder{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  padding:12px 12px 12px 16px; text-align:center;
  background:
    radial-gradient(120% 80% at 30% 0%, hsl(var(--h) 45% 30% / .9), transparent 60%),
    linear-gradient(160deg, hsl(var(--h) 30% 18%), hsl(calc(var(--h) + 40) 25% 10%));
}
.cover-placeholder span{
  font-family:var(--font-display); font-weight:700; font-size:clamp(12px, 1.15vw, 15px);
  line-height:1.2; color:rgba(255,255,255,.88);
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:5; overflow:hidden;
}

.games-empty{
  color:var(--text-muted); text-align:center; padding:56px 0;
  font-family:var(--font-mono); font-size:14px;
}

/* =========================================================
   DIALOGS (shared)
   ========================================================= */
dialog{
  color:var(--text); background:var(--surface);
  border:3px solid var(--border); border-radius:var(--radius);
  padding:0; max-width:min(860px, calc(100vw - 32px)); width:100%;
  max-height:calc(100dvh - 32px);
}
dialog::backdrop{ background:rgba(6,8,12,.75); backdrop-filter:blur(5px); }
dialog[open]{ animation:dialog-in .3s cubic-bezier(.2,.7,.2,1); }
@keyframes dialog-in{ from{ opacity:0; transform:translateY(16px) scale(.98); } }
.dialog-close{
  position:absolute; top:12px; right:12px; z-index:3;
  width:40px; height:40px; border-radius:10px;
  background:rgba(16,19,26,.7); border:1px solid var(--border); color:var(--text);
  font-size:24px; line-height:1; backdrop-filter:blur(6px);
  transition:border-color .2s ease, color .2s ease;
}
.dialog-close:hover{ border-color:var(--accent); color:var(--accent); }

/* game detail */
/* fixed width; the height is fixed too because the title gets a fixed box */
.game-dialog{ width:min(780px, calc(100vw - 32px)); max-width:none; overflow:hidden; }
.game-dialog.tier-6{ border-color:var(--glow-6); box-shadow:0 0 70px rgba(178,107,255,.32); }
.game-dialog.tier-55{ border-color:var(--glow-55); box-shadow:0 0 60px rgba(79,157,255,.26); }
.gd-backdrop{
  position:absolute; inset:-40px; z-index:0;
  background-size:cover; background-position:center;
  filter:blur(40px) saturate(1.3); opacity:.32;
}
.gd-backdrop::after{
  content:""; position:absolute; inset:0;
  background:linear-gradient(100deg, transparent 20%, var(--surface) 75%);
}
.gd-body{
  position:relative; z-index:1;
  display:grid; grid-template-columns:minmax(0, 220px) minmax(0, 1fr); gap:40px;
  padding:40px 40px 32px;
  align-items:stretch;
}
.gd-case{
  --tilt:16deg; cursor:default; align-self:center;
  width:100%; max-width:210px; margin:0 auto; padding-left:var(--case-depth);
}
/* a small, calm pull-out: stays inside the popup */
.gd-case:hover .case-3d{ --pose: translate3d(0, -6px, 22px) rotateY(8deg); }
.gd-info{ display:flex; flex-direction:column; gap:16px; min-width:0; }
.gd-info .eyebrow{ margin:0; }
.gd-info h2{
  --ts:clamp(26px, 3.4vw, 38px);
  font-size:var(--ts); line-height:1.05; padding-right:36px;
  /* always two lines tall, title sitting on the stars, so Previous/Next
     never move. Long titles get a smaller font and three lines instead. */
  height:calc(var(--ts) * 2.1); display:flex; align-items:flex-end;
}
.gd-title-text{
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  overflow:hidden; width:100%;
}
.gd-info h2.is-long{ font-size:calc(var(--ts) * .66); }
.gd-info h2.is-long .gd-title-text{ -webkit-line-clamp:3; }
.gd-rating{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; min-height:34px; }
.gd-score{
  font-family:var(--font-mono); font-size:13px; color:var(--text-muted);
  padding:4px 10px; border-radius:6px; border:1px solid var(--border); background:var(--bg-soft);
}
.tier-6 .gd-score{ color:var(--glow-6); border-color:#4C3466; }
.tier-55 .gd-score{ color:var(--glow-55); border-color:#284A78; }
.gd-meta{
  margin:4px 0 0; overflow:hidden;
  background:rgba(16,19,26,.55); border:1px solid var(--border); border-radius:12px;
}
.gd-meta div{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  min-height:48px; padding:8px 16px;
}
.gd-meta div + div{ border-top:1px solid var(--border); }
.gd-meta dt{
  font-family:var(--font-mono); font-size:11px; letter-spacing:.08em;
  text-transform:uppercase; color:var(--text-faint);
}
.gd-meta dd{ margin:0; font-size:15px; font-weight:500; text-align:right; min-width:0; }
.gd-nav{ display:flex; justify-content:flex-end; gap:8px; margin-top:auto; padding-top:8px; }
.gd-nav button{
  display:inline-flex; align-items:center; gap:8px;
  min-height:38px; padding:0 14px; border-radius:10px;
  background:rgba(16,19,26,.6); border:1px solid var(--border); color:var(--text-muted);
  font:500 13px var(--font-body);
  transition:border-color .2s ease, color .2s ease;
}
.gd-nav button:hover:not(:disabled){ border-color:var(--accent); color:var(--accent); }
.gd-nav button:disabled{ opacity:.35; cursor:default; }
.gd-nav kbd{ font-family:var(--font-mono); font-size:11px; color:var(--text-faint); }

/* =========================================================
   MEDAL TIERS: 5 gold, 4.5 silver, 4 bronze
   Same places as the purple/blue tiers, but a softer glow.
   ========================================================= */
.tier-5 { --medal:#E9B949; --medal-rgb:233,185,73;  --medal-line:#5A4A22; }
.tier-45{ --medal:#C7D0DB; --medal-rgb:199,208,219; --medal-line:#4A515B; }
.tier-4 { --medal:#D08A55; --medal-rgb:208,138,85;  --medal-line:#5A3B25; }
:is(.tier-5, .tier-45, .tier-4) .shelf-score,
:is(.tier-5, .tier-45, .tier-4) .gd-score{
  color:var(--medal); border-color:var(--medal-line);
  box-shadow:0 0 12px rgba(var(--medal-rgb), .18);
}
.shelf:is(.tier-5, .tier-45, .tier-4) .bookcase{
  background:
    radial-gradient(80% 55% at 50% 0%, rgba(var(--medal-rgb), .06), transparent 70%),
    linear-gradient(to bottom, #12151C, #0E1116);
}
.case:is(.tier-5, .tier-45, .tier-4) .case-front{
  box-shadow:0 0 0 1.5px rgba(var(--medal-rgb), .75), 0 0 14px 1px rgba(var(--medal-rgb), .28), 8px 10px 20px -6px rgba(0,0,0,.7);
}
.shelf-item:hover .case:is(.tier-5, .tier-45, .tier-4) .case-front{
  box-shadow:0 0 0 2px var(--medal), 0 0 20px 3px rgba(var(--medal-rgb), .35), 14px 22px 30px -8px rgba(0,0,0,.8);
}
.case:is(.tier-5, .tier-45, .tier-4) .case-spine::after{
  background:linear-gradient(90deg, rgba(var(--medal-rgb), .2), rgba(0,0,0,.4) 35%, rgba(0,0,0,.6));
}
.cover:is(.tier-5, .tier-45, .tier-4){ border-color:rgba(var(--medal-rgb), .75); box-shadow:0 0 10px rgba(var(--medal-rgb), .28); }
.game-dialog:is(.tier-5, .tier-45, .tier-4){ border-color:rgba(var(--medal-rgb), .6); box-shadow:0 0 50px rgba(var(--medal-rgb), .15); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px){
  .lib-stats div{ padding:0 16px; }
}

@media (max-width: 900px){
  .lib-stats{ width:100%; justify-content:space-between; }
  .lib-stats div{ padding:0 12px; flex:1; }
  .lib-toolbar .seg{ width:100%; overflow-x:auto; scrollbar-width:none; }
  .lib-toolbar .seg::-webkit-scrollbar{ display:none; }
  .lib-toolbar .seg button{ flex:1 0 auto; }
}

@media (max-width: 600px){
  :root{
    --case-w:     96px;
    --case-depth: 7px;
    --tilt:       24deg;
  }
  .games-page{ padding:36px 0 64px; }
  .games-intro{ margin-bottom:28px; gap:24px; }
  .lib-stats dd{ font-size:24px; }
  .lib-stats dt{ font-size:10px; }
  .lib-stats div{ padding:0 8px; }
  .seg-label{ display:none; }
  .seg button{ padding:8px 6px; font-size:13.5px; }
  .lib-search{ flex-basis:100%; }
  .lib-toolbar select{ flex:1 1 0; min-width:0; font-size:14px; }
  .lib-result{ margin-bottom:28px; }
  .shelf{ margin-bottom:48px; }
  .bookcase{ padding:26px 10px 14px; border-width:2px; }
  .shelf-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
    column-gap:8px; row-gap:44px; padding-bottom:14px;
  }
  .shelf-item::after{ height:16px; }
  .cover-badge{ top:6px; left:9px; font-size:9px; padding:2px 5px; }

  .gd-body{ grid-template-columns:1fr; padding:28px 20px 22px; gap:22px; }
  .gd-case{ width:min(160px, 50%); }
  .gd-info h2{ padding-right:0; text-align:center; }
  .gd-info .eyebrow, .gd-rating{ justify-content:center; align-self:center; }
  .gd-meta div{ min-height:44px; padding:6px 14px; }
  .gd-nav button{ flex:1; justify-content:center; }
  .gd-nav kbd{ display:none; }
}

/* touch screens: no hover, so no pulling out; keep the rating visible */
@media (hover: none){
  .shelf-item:hover .case-3d{ --pose: translate3d(0, 0, 0) rotateY(var(--tilt)); }
  .shelf-item .case:active .case-3d{ --pose: translate3d(0, -8px, 40px) rotateY(var(--tilt-out)); }
  .case-info{ opacity:1; transform:none; padding:18px 6px 6px 10px; }
  .case-title{ display:none; }
  .case-front .case-info:not(:has(.stars)){ display:none; }
  .shelf-item:hover::before{ opacity:1; transform:none; }
}
