:root {
  --bg: #080c18;
  --bg-elev: #11182c;
  --bg-hover: #192340;
  --border: rgba(148, 163, 214, 0.14);
  --border-strong: rgba(148, 163, 214, 0.26);
  --text: #eef2ff;
  --text-dim: #94a0c4;
  --accent: #7c3aed;
  --accent-2: #4f46e5;
  --accent-glow: rgba(124, 58, 237, 0.35);
  --play: #22c55e;
  --star: #f59e0b;
  --fav: #ef4444;
  --card-w: 150px;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 15% -5%, rgba(124, 58, 237, 0.16), transparent 60%),
    radial-gradient(700px 380px at 85% -8%, rgba(79, 70, 229, 0.14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
}

img { display: block; }

/* ---------- header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 12, 24, 0.78);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border-bottom: 1px solid var(--border);
}

.app-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
}

.app-header__row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: 0 0 auto;
  transition: opacity 0.15s, transform 0.15s;
}
.brand:hover { opacity: 0.92; }
.brand:active { transform: scale(0.97); }
.brand__mark {
  width: 34px; height: 34px; border-radius: 10px; display: block;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.brand__name {
  font-size: 20px; font-weight: 800; letter-spacing: -0.2px;
  background: linear-gradient(135deg, #fff 35%, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-box--header {
  flex: 1 1 260px;
  max-width: 620px;
  margin: 0 auto;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.filters-panel {
  margin-top: 8px;
  padding: 8px 0 2px;
  border-top: 1px dashed var(--border);
  animation: panelIn 0.18s ease-out;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.chip--toggle { border-style: dashed; }
.chip--toggle.is-active { background: rgba(124, 58, 237, 0.15); color: #a78bfa; border-color: var(--accent); }

@media (max-width: 640px) {
  .search-box--header { order: 3; flex-basis: 100%; max-width: none; margin: 10px 0 0; }
  .header-actions { margin-left: auto; }
  .app-stats { display: none; }
}

.app-title { margin: 0; font-size: 19px; font-weight: 700; white-space: nowrap; }

.app-stats { color: var(--text-dim); font-size: 12px; white-space: nowrap; }

.search-box { min-width: 0; }

.search-input {
  width: 100%;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 44, 0.85);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.search-input:focus {
  border-color: var(--accent);
  background: var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
}
.search-input::placeholder { color: var(--text-dim); }

.chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chips--sub { margin-top: 6px; }
.chips--sub .chip { font-size: 12px; padding: 5px 11px; }

/* age badge on card art */
.card__age {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: rgba(11, 16, 32, 0.55);
  border: 1.5px solid;
  backdrop-filter: blur(4px);
}
.card__age--0 { border-color: #22c55e; }
.card__age--6 { border-color: #3b82f6; }
.card__age--12 { border-color: #eab308; }
.card__age--16 { border-color: #f97316; }
.card__age--18 { border-color: #ef4444; }

/* auth button (svg-иконки, единый вид на всех платформах) */
.auth-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.auth-btn svg { width: 22px; height: 22px; }
.auth-btn:hover { color: var(--text); }
.auth-btn.is-on { color: #a78bfa; border-color: var(--accent); background: rgba(124, 58, 237, 0.12); }

.lang-btn {
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.lang-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* featured random game button */
.dice-btn {
  height: 42px;
  padding: 0 14px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.55);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.28), rgba(79, 70, 229, 0.24));
  color: #f3e8ff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.26);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.dice-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.dice-btn:hover {
  border-color: #c4b5fd;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.45), rgba(79, 70, 229, 0.4));
  box-shadow: 0 6px 22px rgba(124, 58, 237, 0.42);
}
.dice-btn:hover svg { transform: rotate(-14deg) scale(1.08); }
.dice-btn:active { transform: scale(0.96); }

@media (max-width: 640px) {
  .dice-btn { width: 42px; padding: 0; justify-content: center; }
  .dice-btn__label { display: none; }
}

@media (min-width: 1600px) {
  .auth-btn { width: 50px; height: 50px; border-radius: 14px; }
  .auth-btn svg { width: 26px; height: 26px; }
}

.sheet__panel--modal { max-width: 480px; }
.sheet__body--modal { max-height: min(80vh, 720px); }

.mtitle { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.mtabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.stat-card__val { font-size: 18px; font-weight: 800; color: #fff; }
.stat-card__lbl { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-top: 4px; }
.bar-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(148, 163, 214, 0.14); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #38bdf8); }
.mfield { margin-bottom: 12px; }
.mfield label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.mfield input, .mfield select, .mfield textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.mfield input:focus, .mfield select:focus, .mfield textarea:focus { border-color: var(--accent); }
.mfield textarea { resize: vertical; min-height: 70px; }
.mrow { display: flex; gap: 10px; }
.mrow .mfield { flex: 1; }
.mhint { color: var(--text-dim); font-size: 12px; margin: 10px 0 12px; }
.mcheck { display: flex; align-items: center; gap: 9px; margin: 0 0 6px; font-size: 14px; cursor: pointer; }
.mcheck input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.merr { color: var(--fav); font-size: 13px; margin: 0 0 10px; min-height: 18px; }

.mlist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.mitem {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.mitem__name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.mitem__meta { color: var(--text-dim); font-size: 12px; overflow-wrap: anywhere; }
.mitem__row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge--pending { background: rgba(245, 158, 11, 0.15); color: var(--star); border: 1px solid var(--star); }
.badge--approved { background: rgba(34, 197, 94, 0.12); color: var(--play); border: 1px solid var(--play); }
.badge--rejected { background: rgba(239, 68, 68, 0.12); color: var(--fav); border: 1px solid var(--fav); }

.mlinkbtn {
  background: none; border: none; color: var(--accent);
  font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; padding: 0;
}
.mlinkbtn:hover { text-decoration: underline; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(17, 24, 44, 0.72);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-hover); }
.chip:active { transform: scale(0.96); }
.chip.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

/* ---------- layout ---------- */

.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 14px 28px;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  margin-top: 16px;
  border-radius: 20px;
  overflow: hidden;
  min-height: 310px;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  transition: opacity 0.35s ease, transform 0.6s ease;
}
.hero:hover .hero__bg { transform: scale(1.02); }
.hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8,12,24,0.88) 0%, rgba(8,12,24,0.45) 55%, rgba(8,12,24,0.12) 100%),
    linear-gradient(180deg, rgba(8,12,24,0.05) 25%, rgba(8,12,24,0.95) 88%);
}

.hero__info {
  position: relative;
  z-index: 1;
  padding: 24px 24px 22px;
  width: 100%;
  max-width: 720px;
}

.hero__title {
  margin: 6px 0 6px;
  font-size: clamp(23px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.12;
  text-shadow: 0 4px 18px rgba(0,0,0,0.65);
}

.hero__meta { margin: 0 0 16px; color: #c4cce4; font-size: 13.5px; white-space: pre-line; }

.hero__badges { display: flex; gap: 6px; }

.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.hero__dots {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.hero__dots button {
  width: 8px; height: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(255,255,255,0.32);
  cursor: pointer;
  padding: 0;
  transition: width 0.22s ease, background 0.2s ease;
}
.hero__dots button.is-active { width: 22px; background: #fff; }

/* ---------- buttons ---------- */

.btn {
  padding: 11px 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.48);
}
.btn--ghost { background: rgba(17, 24, 44, 0.72); backdrop-filter: blur(8px); }
.btn--ghost.is-on { color: var(--fav); border-color: var(--fav); }
.btn--dim { opacity: 0.72; font-size: 13px; padding: 9px 14px; }

/* ---------- shelves (EGS-style rows) ---------- */

.shelf { margin-top: 26px; }

.shelf__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shelf__track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.shelf__track::-webkit-scrollbar { height: 6px; }
.shelf__track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---------- game card ---------- */

.card {
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  scroll-snap-align: start;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.card__art {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.card__art img.is-loaded { opacity: 1; }

.card:hover .card__art,
.card:focus-visible .card__art {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(167, 139, 250, 0.4);
  border-color: var(--accent);
}
.card:hover .card__art img.is-loaded { transform: scale(1.04); }

/* fallback tile when there is no artwork */
.card__fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 12px;
  background:
    radial-gradient(circle at 85% 12%, rgba(255,255,255,0.14) 0 18%, transparent 19%),
    radial-gradient(circle at 10% 88%, rgba(255,255,255,0.08) 0 22%, transparent 23%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 9px);
}
.card__fallback.is-visible { display: flex; }
.card__fallback .initials {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(11, 16, 32, 0.3);
  font-size: 24px;
  font-weight: 800;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.card__fallback .fname {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__flags {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(8, 12, 24, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  line-height: 1.2;
}

.card__name {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- catalog grid ---------- */

.grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 16px 12px;
}
.grid .card { width: auto; flex: none; }
.grid .card__art { aspect-ratio: 2 / 3; }

.grid__letter {
  grid-column: 1 / -1;
  margin: 14px 0 0;
  padding: 4px 2px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}

.alls-title { margin: 28px 0 6px; font-size: 19px; font-weight: 800; }

/* developer promo banner on home */
.dev-banner {
  margin-top: 26px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(167, 139, 250, 0.38);
  background:
    radial-gradient(480px 180px at 90% 0%, rgba(124, 58, 237, 0.22), transparent 70%),
    linear-gradient(135deg, rgba(17, 24, 44, 0.92), rgba(25, 35, 64, 0.85));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.dev-banner[hidden] { display: none; }
.dev-banner__text { flex: 1 1 280px; min-width: 0; }
.dev-banner__text strong { display: block; font-size: 16px; font-weight: 800; margin-bottom: 4px; color: #fff; }
.dev-banner__text span { display: block; font-size: 13.5px; color: #c4cce4; line-height: 1.45; }
.dev-banner__actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.dev-banner__actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.dev-banner__close {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(8, 12, 24, 0.45);
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
}
.dev-banner__close:hover { color: var(--text); border-color: var(--border-strong); }

/* skeleton + entrance animations */
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--bg-elev) 40%, var(--bg-hover) 50%, var(--bg-elev) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card { animation: cardIn 0.3s ease-out both; animation-delay: calc(var(--i, 0) * 25ms); }
.card--hidden { opacity: 0.55; }
@media (prefers-reduced-motion: reduce) {
  .card, .skeleton { animation: none; }
}

/* hero crossfade */
.hero__bg { transition: opacity 0.35s ease; }

/* toast entrance */
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast { animation: toastIn 0.25s ease-out; }

/* sheet art overlay (title on artwork, Steam-style) */
.sheet__art { position: relative; }
.sheet__art-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 44px 18px 12px;
  background: linear-gradient(transparent, rgba(4, 7, 16, 0.92));
}
.sheet__art-title { margin: 0; font-size: 22px; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.sheet__art-chips { margin-top: 3px; font-size: 12.5px; color: #aab2cf; overflow-wrap: anywhere; }
.sheet__title.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0;
}

/* sandboxed player for hosted games */
.player {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: #000;
}
.player[hidden] { display: none !important; }
.player__bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: calc(env(safe-area-inset-top) + 6px) 10px 6px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.player__btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #3b4569;
  background: #1b2440;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.player__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.player__actions { display: flex; gap: 6px; flex: 0 0 auto; }
.player__btn--icon { padding: 8px 11px; }
.player__frame { width: 100%; height: 100%; border: 0; background: #000; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty__title { font-size: 17px; font-weight: 700; color: var(--text); }

.loadmore {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 18px 0 6px;
}
.loadmore__btn { min-width: 240px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.app-footer {
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.app-footer a { color: var(--accent); }

/* ---------- detail sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 60; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 16, 0.7);
  backdrop-filter: blur(3px);
}

.sheet__panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  overflow: hidden;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.65);
  animation: sheet-up 0.22s ease-out;
}
.sheet__panel::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  z-index: 3;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.5; } }

.sheet__art {
  aspect-ratio: 16 / 8;
  background: var(--bg-hover) center 30% / cover no-repeat;
}

.sheet__body {
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

.sheet__title { margin: 0 0 4px; font-size: 22px; font-weight: 800; }
.sheet__meta { margin: 0 0 16px; color: var(--text-dim); font-size: 13px; overflow-wrap: anywhere; white-space: pre-line; }

.sheet__desc {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}

.sheet__shots {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}
.sheet__shots img {
  flex: 0 0 auto;
  width: 200px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* leaderboard in sheet */
.sheet__scores {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(8, 12, 24, 0.55);
  border: 1px solid var(--border);
}
.sheet__scores-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--star);
}
.sheet__scores-list { display: flex; flex-direction: column; gap: 5px; }
.sheet__score-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text);
}
.sheet__score-val { font-weight: 800; color: #c4b5fd; font-variant-numeric: tabular-nums; }

/* similar games in sheet */
.sheet__similar { margin: 0 0 14px; }
.sheet__similar-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: var(--text-dim); }
.sheet__similar-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.sim {
  flex: 0 0 auto;
  width: 132px;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}
.sim__art {
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.sim__art img { width: 100%; height: 100%; object-fit: cover; }
.sim__name {
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sheet__donate { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.sheet__donate-stars { font-size: 13px; color: var(--star); font-weight: 700; }

.sheet__reviews {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.review-votes { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.review-form { display: flex; gap: 8px; margin-bottom: 10px; }
.review-form input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item {
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(8, 12, 24, 0.55);
  border: 1px solid var(--border);
  font-size: 13px;
}
.review-item__head { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 12px; margin-bottom: 3px; }
.review-item__author { font-weight: 700; color: var(--text); }

.author-filter-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.16);
  border: 1px solid rgba(167, 139, 250, 0.45);
  font-size: 13px;
  font-weight: 600;
}
.streak-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.32);
  font-size: 13.5px;
  font-weight: 700;
}
.ach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ach {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(124, 58, 237, 0.16);
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: #e9d5ff;
}
.ach--locked { opacity: 0.4; background: var(--bg); border-color: var(--border); color: var(--text-dim); }

.sheet__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- responsive: tablets / ChromeOS / desktop ---------- */

@media (min-width: 700px) {
  :root { --card-w: 170px; }
  .hero { min-height: 380px; }
}

@media (min-width: 1100px) {
  :root { --card-w: 185px; }
  .hero { min-height: 440px; }
  .app-title { font-size: 22px; }
}

/* ---------- TV / D-pad & keyboard focus ---------- */

:focus { outline: none; }

:focus-visible {
  outline: 3px solid #a78bfa;
  outline-offset: 2px;
  border-radius: 8px;
}

@media (hover: none) and (pointer: coarse) {
  .card:focus-visible .card__art { transform: translateY(-4px); border-color: var(--accent); }
}

@media (min-width: 1600px) {
  :root { --card-w: 210px; }
  body { font-size: 17px; }
  .content, .app-header__inner { max-width: 1560px; }
}
