/* ── RESET & TOKENS ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0b0b14;
  --bg-raised: #14141f;
  --text: #f2f2f7;
  --text-secondary: #b7b7c9;
  --text-muted: #7d7d92;
  --rule: rgba(255,255,255,0.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
          'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Courier New', Courier, monospace;
  --max-w: 1100px;
  --nav-h: 52px;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; }

/* ── NAV (minimal, matches DT-IA-Guide) ─────────────────────────
   Static, not fixed — a quiet "you came from here" reminder that
   scrolls away with the page rather than staying pinned. */
nav.site-nav {
  height: var(--nav-h);
  background: rgba(11,11,20,0.85);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  padding: 0 28px;
  flex-shrink: 0;
}
.nav-attribution {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.nav-attribution a {
  color: #7fd8ff;
  text-decoration: none;
  font-weight: 500;
}
.nav-attribution a:hover { text-decoration: underline; }

/* ── HERO ─────────────────────────────────────────────────────── */
.gg-hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 24px 16px;
  text-align: center;
}
.gg-hero h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  background: linear-gradient(120deg, #ff5c9e, #ffb84d 45%, #4cc9ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── FILTERS ──────────────────────────────────────────────────── */
.gg-filters {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gg-filters-toggle {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 8px 16px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.gg-filters-toggle:hover,
.gg-filters-toggle[aria-expanded="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, #7fd8ff 45%, var(--rule));
  background: rgba(255,255,255,0.09);
}
.gg-filters-toggle:focus-visible { outline: 2px solid #7fd8ff; outline-offset: 3px; }
.gg-filters-icon { flex-shrink: 0; }
.gg-filters-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #7fd8ff;
  color: #0b0b14;
  font-size: 0.7rem;
  font-weight: 800;
}
.gg-filters-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.gg-filters-toggle[aria-expanded="true"] .gg-filters-chevron { transform: rotate(180deg); }

/* CSS-only smooth collapse via animatable grid track, no JS height math. */
.gg-filters-collapse {
  display: grid;
  grid-template-rows: 0fr;
  width: 100%;
  transition: grid-template-rows 0.25s ease;
}
.gg-filters-collapse.expanded { grid-template-rows: 1fr; }
.gg-filters-collapse-inner { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .gg-filters-collapse { transition: none; }
}

.gg-filters-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 36px;
  padding: 20px 4px 8px;
}
.gg-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 6px;
}
.gg-filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
  flex-shrink: 0;
}
.gg-filter-chip {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 5px 12px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.gg-filter-chip:hover { border-color: color-mix(in srgb, #7fd8ff 40%, var(--rule)); color: var(--text); }
.gg-filter-chip:focus-visible { outline: 2px solid #7fd8ff; outline-offset: 2px; }
.gg-filter-chip[aria-pressed="true"] {
  color: #0b0b14;
  background: #7fd8ff;
  border-color: #7fd8ff;
}

.gg-filters-clear {
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  text-decoration: underline;
  padding: 10px 4px 4px;
}
.gg-filters-clear:hover { color: #7fd8ff; }

@media (max-width: 719px) {
  .gg-filters-panel { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ── GALLERY (horizontal swipe) ───────────────────────────────── */
.gg-gallery {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  /* overflow-x:auto forces overflow-y to auto too, so the active card's
     scale+glow (which extends above its own box) needs real padding
     here or it gets clipped in a hard flat line at the gallery's edge. */
  padding: 28px calc(50vw - 100px) 48px;
  scroll-padding-inline: calc(50vw - 100px);
}
.gg-gallery::-webkit-scrollbar { height: 0; }
.gg-gallery { scrollbar-width: none; }

.gg-card {
  appearance: none;
  background: none;
  font: inherit;
  text-align: inherit;
  flex: 0 0 auto;
  width: 250px;
  aspect-ratio: 10 / 16;
  overflow: hidden;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.gg-card:hover,
.gg-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.gg-card.active {
  transform: scale(1.06);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent),
              0 12px 32px color-mix(in srgb, var(--accent) 35%, transparent);
}
.gg-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.gg-cover {
  position: relative;
  aspect-ratio: 460 / 215;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 30%, #05050c));
  display: flex;
  align-items: center;
  justify-content: center;
}
.gg-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gg-cover-glyph {
  font-size: 2.6rem;
  font-weight: 800;
  color: rgba(255,255,255,0.35);
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.gg-cover-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.35);
  padding: 3px 7px;
  border-radius: 20px;
}

.gg-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.gg-card-tagline {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gg-card-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gg-card-footer {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.gg-card-age {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}
.gg-age-16 { background-image: linear-gradient(120deg, #ff5c9e, #ffb84d); }
.gg-age-13 { background-image: linear-gradient(120deg, #ffb84d, #ffe14d); }
.gg-age-10 { background-image: linear-gradient(120deg, #ffe14d, #7ee787); }
.gg-age-7  { background-image: linear-gradient(120deg, #7ee787, #4cc9ff); }

.gg-card-systems {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding-top: 4px;
}
.gg-card-system-tag {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}

.gg-empty-state {
  width: 100%;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── GAME DETAIL POPUP ────────────────────────────────────────── */
.gg-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gg-modal[hidden] { display: none; }
.gg-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}
.gg-modal-box {
  position: relative;
  width: min(560px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 20px;
  padding: 32px 24px 28px;
  background:
    radial-gradient(760px circle at 15% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--bg-raised);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--rule));
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.gg-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.gg-modal-close:hover { background: rgba(255,255,255,0.14); }
.gg-modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gg-detail-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gg-detail-cover {
  align-self: center;
  width: min(300px, 80vw);
  aspect-ratio: 460 / 215;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 30%, #05050c));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 60px color-mix(in srgb, var(--accent) 30%, transparent);
}
.gg-detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gg-detail-cover .gg-cover-glyph { font-size: 4rem; }

.gg-detail-body { min-width: 0; }

.gg-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gg-tag-pill {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.gg-detail-title {
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 10px;
}
.gg-detail-tagline {
  margin-top: 8px;
  font-size: 1rem;
  color: var(--text-secondary);
}

.gg-detail-desc {
  margin-top: 20px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.gg-why-title {
  margin-top: 24px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gg-discussion-subtitle {
  margin-top: 16px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}
.gg-why-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gg-why-item {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  list-style: none;
}
.gg-why-item::before {
  content: '';
  flex-shrink: 0;
  width: 8px; height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.gg-cta-row {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.gg-cta {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  background: var(--accent);
  color: #0b0b14;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gg-cta:hover { transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent); }
.gg-cta-note {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
}

@media (max-width: 719px) {
  .gg-hero {
    padding: 10px 16px 8px;
  }
  .gg-hero h1 {
    font-size: 6.2vw;
    white-space: nowrap;
  }
}

/* ── FOOTER (matches DT-IA-Guide's style, placeholder content) ─── */
footer {
  background: var(--bg-raised);
  border-top: 1px solid var(--rule);
  padding: 40px 28px;
  text-align: center;
}
footer a { color: #7fd8ff; text-decoration: none; font-weight: 500; }
footer a:hover { text-decoration: underline; }
.footer-source { font-size: 14px; color: var(--text-muted); max-width: 640px; margin: 0 auto 8px; }
.footer-disclaimer { font-size: 13px; color: #6a6a7c; max-width: 640px; margin: 0 auto; }

/* ── ACCESSIBILITY ────────────────────────────────────────────── */
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus {
  left: 10px; top: 10px;
  background: #4cc9ff;
  color: #0b0b14;
  padding: 8px 16px;
  border-radius: 8px;
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}
