/* Game detail page (/g/:slug). Loaded after site.css — tokens come from there.
   Dark-first: every surface here sits on --bg / --card. */

/* site.css styles a bare <section> as a full page band (72px padding + a
   bottom rule). Every section here carries a class, so each one restates its
   own padding/border below. Do NOT add a blanket `#main section` reset — an
   id selector outranks .g-card and silently strips its padding. */

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

/* The inline icons are authored without width/height attributes, so CSS is the
   only thing standing between them and the 300x150 replaced-element default.
   Size them in one place, above every rule that uses them. */
#main .btn svg { width: 16px; height: 16px; flex: none; }
#main .g-play svg { width: 17px; height: 17px; }
#main .badge svg { width: 11px; height: 11px; flex: none; }
#main .g-art .pbtn svg { width: 22px; height: 22px; }

/* —— Breadcrumb —— */
.g-crumb {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 22px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  transition: color 0.15s ease;
}
.g-crumb:hover { color: var(--text); }

/* —— Hero —— */
.g-hero-in {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 34px;
  align-items: start;
  padding: 20px 0 40px;
}

.g-art {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0b0e;
  box-shadow: 0 24px 60px -44px rgba(0, 0, 0, 0.9);
}
.g-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.g-art-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 30px;
  text-align: center;
  font-size: clamp(1.15rem, 2.6vw, 1.75rem);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text);
  background: linear-gradient(135deg, #2a2440, #14111f);
}
.g-art-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.g-art:hover .g-art-play,
.g-art:focus-visible .g-art-play { opacity: 1; }
.g-art .pbtn { width: 58px; height: 58px; }
@media (hover: none) {
  .g-art-play { opacity: 1; background: rgba(0, 0, 0, 0.2); }
}

.g-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.badge.lineage { background: var(--violet-bg); color: var(--violet); }
.badge.plays { background: rgba(255, 255, 255, 0.06); color: var(--text-soft); }

.g-info h1 {
  font-size: clamp(1.85rem, 3.4vw, 2.45rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
}
.g-by {
  margin-top: 9px;
  font-size: 14.5px;
  color: var(--text-soft);
}
.g-by a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 3px;
}
.g-by a:hover { text-decoration-color: var(--accent); }

.g-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  list-style: none;
  margin: 20px 0 22px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.g-stats li {
  background: var(--card);
  padding: 11px 13px;
}
.g-stat-v {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.g-stat-l {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 2px;
}

.g-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.g-play {
  font-size: 15.5px;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: var(--r-lg);
}
.btn-remix {
  background: var(--violet-bg);
  color: var(--violet);
  border-color: rgba(182, 156, 240, 0.3);
  padding: 14px 20px;
  border-radius: var(--r-lg);
}
.btn-remix:hover {
  background: rgba(182, 156, 240, 0.22);
  border-color: rgba(182, 156, 240, 0.5);
}
.g-copy { padding: 14px 18px; border-radius: var(--r-lg); }
.g-status {
  min-height: 20px;
  margin-top: 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.g-status.is-warn { color: var(--amber); }

/* —— Body: content column + facts sidebar —— */
.g-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 18px;
  align-items: start;
}
.g-col {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.g-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 20px 22px;
}
.g-card h2 {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 13px;
}
.g-desc {
  font-size: 15px;
  line-height: 1.62;
  color: #d7dade;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.g-desc.is-empty {
  color: var(--text-soft);
  font-size: 14.5px;
  white-space: normal;
}

.g-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.g-tag {
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--sky-bg);
  color: var(--sky);
  border: 1px solid rgba(132, 182, 239, 0.22);
  transition: background 0.15s ease;
}
.g-tag:hover { background: rgba(132, 182, 239, 0.26); }

.g-ctrls {
  list-style: none;
  display: grid;
  gap: 8px;
}
.g-ctrls li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #d7dade;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-wrap: anywhere;
}
.g-ctrls .k {
  flex: none;
  margin-top: 1px;
  color: var(--accent);
}
.g-ctrls .k svg { width: 15px; height: 15px; }
.g-hint {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-soft);
}
.g-hint kbd {
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 6px;
}

/* —— Lineage —— */
.g-lineage {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
}
.g-lin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px 8px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  font-size: 13.5px;
  font-weight: 600;
  min-width: 0;
}
a.g-lin:hover { border-color: var(--line-2); }
.g-lin.is-current {
  border-color: var(--accent-line);
  background: var(--accent-bg);
  color: var(--accent);
}
.g-lin-thumb {
  width: 46px;
  height: 30px;
  flex: none;
  border-radius: 5px;
  object-fit: cover;
  background: linear-gradient(135deg, #2a2440, #14111f);
}
.g-lin-name { overflow-wrap: anywhere; }
.g-lin-arrow {
  align-self: center;
  color: var(--text-faint);
  font-weight: 700;
}
.g-lin-note {
  margin-top: 13px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.55;
}

/* —— Facts sidebar —— */
.g-rows { display: block; }
.g-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.g-rows > div:first-child { border-top: 0; padding-top: 0; }
.g-rows dt { color: var(--text-faint); font-weight: 600; }
.g-rows dd {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}
.g-rows dd a { color: var(--violet); }

.g-remix-card {
  border-color: rgba(182, 156, 240, 0.24);
  background: linear-gradient(180deg, rgba(182, 156, 240, 0.08), var(--card) 68%);
}
.g-remix-card h2 { color: var(--violet); }
.g-remix-card p {
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--text-soft);
  margin-bottom: 15px;
}
.g-remix-card .btn { width: 100%; }
.g-remix-card.is-off { border-color: var(--line); background: var(--card); }
.g-remix-card.is-off h2 { color: var(--text-faint); }
.g-remix-card.is-off p { margin-bottom: 0; }

/* —— More games rail —— */
.g-rail {
  margin-top: 34px;
  padding: 32px 0 76px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.g-rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.g-rail h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.g-rail-head a {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}
.g-rail-head a:hover { color: var(--text); }
.g-rail .cards { margin-top: 16px; }

/* —— Not found —— */
.g-404 { padding: 40px 0 28px; }
.g-404 .empty-state { margin-top: 0; }
.g-404 + .g-rail { margin-top: 0; padding-top: 30px; }
/* The not-found card is the page's own <h1>; site.css only styles h3 here. */
.g-404-h {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.025em;
}
.g-404 .slug {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 2px 8px;
}
.g-404 ul {
  list-style: none;
  max-width: 30em;
  margin: 0 auto 22px;
  text-align: left;
  color: var(--text-soft);
  font-size: 14px;
}
.g-404 ul li {
  padding: 7px 0 7px 20px;
  position: relative;
}
.g-404 ul li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--text-faint);
}

/* —— Loading skeleton —— */
.g-skel .g-art,
.g-sk {
  background: linear-gradient(90deg, var(--card) 0%, var(--card-2) 46%, var(--card) 92%);
  background-size: 300% 100%;
  animation: g-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-md);
}
.g-skel .g-art { border-radius: var(--r-xl); }
.g-sk-title { height: 38px; width: 66%; }
.g-sk-by { height: 15px; width: 38%; margin-top: 15px; }
.g-sk-stats { height: 66px; width: 100%; margin-top: 22px; border-radius: var(--r-lg); }
.g-sk-btns { display: flex; gap: 10px; margin-top: 22px; }
.g-sk-btn { height: 48px; width: 148px; border-radius: var(--r-lg); }
.g-sk-btn.two { width: 118px; }
@keyframes g-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -60% 0; }
}

/* —— Responsive —— */
@media (max-width: 960px) {
  .g-hero-in { grid-template-columns: 1fr; gap: 24px; padding-bottom: 30px; }
  .g-body { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .g-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-card { padding: 18px; }
  .g-cta { gap: 8px; }
  .g-play { flex: 1 1 100%; }
  .g-rail { padding-bottom: 56px; }
}
@media (max-width: 400px) {
  .g-cta .btn { flex: 1 1 100%; }
  /* A wrapped horizontal chain strands the arrow on its own row; stack it. */
  .g-lineage { flex-direction: column; align-items: stretch; gap: 8px; }
  .g-lin { width: 100%; }
  .g-lin-arrow { align-self: center; transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  .g-skel .g-art,
  .g-sk { animation: none; }
  .g-art-play,
  .g-crumb,
  .g-tag { transition: none; }
}
