/* Madishan Games — public site styles v6 = v5 (v3 locked bright design, brief v2 §4, + game pages) + the in-browser player at the end.
   Mobile-first: base rules are the 320–639 px single-column contract (§4.5), then 640 px (two-column
   catalogue, 24 px gutters) and 1024 px (desktop contract §4.3). Plain CSS only — no nesting, no @scope,
   no container queries — so it runs the same in Safari. Light only: no prefers-color-scheme rules. */

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Short pages (404) keep the footer at the bottom of the small viewport; no forced 100vh frames. */
@supports (min-height: 100svh) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
  }

  body > main {
    flex: 1 0 auto;
  }
}

[hidden] {
  display: none !important;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--primary);
}

button {
  font: inherit;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Safari before 15.4 has no :focus-visible: keep a visible keyboard ring there, hide it for pointer focus elsewhere. */
a:focus,
button:focus,
input:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
  outline: none;
}

.skip {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  z-index: 20;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-weight: 700;
  text-decoration: none;
}

.skip:focus {
  top: var(--sp-4);
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- buttons and pills ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 10px 20px;
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease-out;
}

.btn:hover {
  background: var(--primary-hover);
  color: var(--on-primary);
}

.btn--lg {
  min-height: 48px;
  font-size: 16px;
  line-height: 24px;
}

.btn--block {
  width: 100%;
}

.pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}

.pill:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.pill[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

@media (prefers-reduced-motion: no-preference) {
  .btn:active,
  .pill:active {
    transform: scale(0.99);
  }
}

/* ---------- header ---------- */
.hdr {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.hdr__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 64px;
}

.mark {
  color: var(--text);
  font-size: 21px;
  line-height: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.mark:hover {
  color: var(--primary);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.nav a {
  color: var(--text);
  font-size: 15px;
  line-height: 22px;
  font-weight: 700;
  text-decoration: none;
  padding: var(--sp-2) 0;
}

.nav a:hover {
  color: var(--primary);
}

/* Mobile: only the small "Games" anchor pill; About and Contact live in the page and footer. */
.nav__more {
  display: none;
}

.nav a.nav__games {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 9px 16px;
}

.nav a.nav__games:hover {
  color: var(--primary-hover);
}

/* ---------- hero ---------- */
.hero {
  padding-top: var(--sp-5);
}

.hero__copy {
  position: relative;
}

.hero__label {
  display: none;
}

.hero__title {
  font-size: 30px;
  line-height: 36px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}

.hero__title br {
  display: none;
}

.hero__intro {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: 15px;
  line-height: 23px;
}

.hero__tile {
  display: none;
}

/* Featured panel ("In the spotlight") */
.spot {
  position: relative;
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-card);
  scroll-margin-top: var(--sp-4);
}

.spot__row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.spot__body {
  min-width: 0;
}

.spot__labels {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.spot__title {
  margin-top: var(--sp-2);
  font-size: 20px;
  line-height: 27px;
  font-weight: 800;
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}

.spot__desc {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: 15px;
  line-height: 22px;
}

.spot__btn {
  margin-top: 14px;
}

/* ---------- trays (pastel icon tiles) ---------- */
.tray {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  background: var(--sky);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
}

.tray--sky {
  background: var(--sky);
}

.tray--mint {
  background: var(--mint);
}

.tray--peach {
  background: var(--peach);
}

.tray--lemon {
  background: var(--lemon);
}

.tray--lilac {
  background: var(--lilac);
}

.tray img {
  width: 64px;
  height: 64px;
  border-radius: 20%;
}

/* Missing or broken icon: readable initials on the same tray; title and store link still work. */
.tray--fallback::before {
  content: attr(data-initials);
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.spot .tray {
  width: 88px;
  height: 88px;
  border-radius: 18px;
}

.spot .tray img {
  width: 72px;
  height: 72px;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--spot {
  background: var(--surface);
  color: var(--primary);
}

.badge--selected {
  background: var(--primary);
  color: var(--on-primary);
}

.badge--new {
  background: var(--mint);
  color: var(--success);
}

.card .badge {
  min-height: 20px;
  padding: 1px 8px;
}

/* On a white card the pill needs the lilac tint to read as a pill (indigo on lilac: 5.5:1). */
.card .badge--spot {
  background: var(--primary-soft);
}

.card__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

/* ---------- catalogue section ---------- */
.games {
  padding-top: 28px;
  scroll-margin-top: var(--sp-4);
}

.sec__title {
  font-weight: 800;
}

.sec__eyebrow {
  display: block;
  font-size: 24px;
  line-height: 32px;
}

.sec__lead {
  display: none;
}

.tools {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.search {
  width: 100%;
  max-width: 360px;
  margin-top: var(--sp-2);
}

.search__field {
  position: relative;
}

.search__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 48px 10px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  -webkit-appearance: none;
  appearance: none;
}

.search__input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search__input:focus {
  border-color: var(--primary);
}

.search__clear {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 36px;
  height: 36px;
  transform: translateY(-50%);
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.search__clear:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

/* Category pills: one scrollable row on phones (edge fade, page never overflows), wrapping row from 640 px. */
.filter-wrap {
  position: relative;
  margin: 0 calc(-1 * var(--gutter));
}

.filter {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) calc(var(--gutter) + 40px) var(--sp-2) var(--gutter);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter::-webkit-scrollbar {
  display: none;
}

.filter-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  background: linear-gradient(90deg, rgb(244 250 255 / 0) 0%, var(--page) 100%);
}

.status {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.status:empty {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

/* ---------- game card: compact horizontal row (mobile and /links) ---------- */
.card {
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start;
  min-width: 0;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  scroll-margin-top: var(--sp-6);
}

.card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.card__title {
  font-size: 16px;
  line-height: 22px;
  font-weight: 800;
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}

.card__meta {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.card__meta svg {
  flex: 0 0 auto;
}

.card__btn {
  margin-top: var(--sp-2);
  min-width: 132px;
  max-width: 100%;
}

.card--pinned {
  border-color: var(--primary-line);
}

/* ?game=<slug>: the selected card (or spotlight) gets a visible label plus a 3 px indigo outline. */
.is-selected,
.is-selected:focus,
.is-selected:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (hover: hover) {
  .card {
    transition: transform 160ms ease-out, box-shadow 160ms ease-out;
  }

  .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
  }
}

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

  .card,
  .btn,
  .pill {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}

/* ---------- states ---------- */
.state {
  margin-top: var(--sp-4);
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-align: center;
}

.state p {
  color: var(--muted);
}

.state .btn {
  margin-top: var(--sp-3);
}

/* ---------- studio section ---------- */
.about {
  margin-top: var(--sp-10);
  scroll-margin-top: var(--sp-4);
}

.about__panel {
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.about__title {
  font-size: 22px;
  line-height: 28px;
  font-weight: 800;
}

.about__text {
  margin-top: var(--sp-2);
  max-width: 720px;
  color: var(--muted);
  font-size: 16px;
  line-height: 26px;
}

.about__contact {
  margin-top: var(--sp-3);
  font-size: 16px;
  line-height: 26px;
}

.about__contact a,
.prose a:not(.btn),
.state a:not(.btn) {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about__contact a:hover,
.prose a:not(.btn):hover {
  color: var(--primary-hover);
}

/* ---------- footer ---------- */
.ftr {
  margin-top: var(--sp-10);
  padding-top: var(--sp-6);
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
  background: var(--sky);
  border-top: 1px solid var(--border);
}

.ftr__in {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.ftr__nav {
  display: flex;
  flex-direction: column;
}

.ftr__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  text-decoration: none;
}

.ftr__nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.ftr__copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

/* ---------- privacy (reading page) and 404 ---------- */
.prose {
  padding-top: var(--sp-5);
}

.prose__panel {
  max-width: 720px;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.prose h1 {
  font-size: 30px;
  line-height: 36px;
  font-weight: 800;
}

.prose h2 {
  margin-top: var(--sp-6);
  font-size: 20px;
  line-height: 28px;
  font-weight: 800;
}

.prose p {
  margin-top: var(--sp-2);
  font-size: 16px;
  line-height: 27px;
}

.prose .meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.nf {
  padding-top: var(--sp-10);
}

.nf__in {
  max-width: 560px;
}

.nf h1 {
  font-size: 30px;
  line-height: 36px;
  font-weight: 800;
}

.nf p {
  margin-top: var(--sp-2);
  color: var(--muted);
  font-size: 18px;
  line-height: 28px;
}

/* ---------- /links: compact bio view (max 480 px column at every width) ---------- */
.links {
  width: 100%;
  max-width: calc(480px + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--sp-6) var(--gutter) calc(var(--sp-8) + env(safe-area-inset-bottom));
}

.links__head {
  margin-bottom: var(--sp-4);
}

.links__mark {
  font-size: 21px;
  line-height: 28px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.links__mark a {
  color: var(--text);
  text-decoration: none;
}

.links__mark a:hover {
  color: var(--primary);
}

.links__lead {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: 15px;
  line-height: 23px;
}

.links__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.links__foot {
  display: flex;
  justify-content: center;
  gap: var(--sp-6);
  margin-top: var(--sp-6);
}

.links__foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  text-decoration: none;
}

.links__foot a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ====================================================================================
   640 px and up: 24 px gutters, two-column catalogue, desktop-style cards, full header nav
   ==================================================================================== */
@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }

  .nav__more {
    display: inline;
  }

  .nav a.nav__games {
    background: transparent;
    color: var(--text);
    border-radius: 0;
    padding: var(--sp-2) 0;
  }

  .nav a.nav__games:hover {
    color: var(--primary);
  }

  .tools {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
  }

  .search {
    margin-top: 0;
  }

  .filter-wrap {
    margin: 0;
  }

  .filter-wrap::after {
    display: none;
  }

  .filter {
    flex-wrap: wrap;
    padding: 0;
    overflow: visible;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-5);
    margin-top: var(--sp-6);
  }

  /* Regular desktop card (§4.4): 104 px tray column + content, actions aligned along the row. */
  .card:not(.card--row) {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: var(--sp-4);
    align-items: stretch;
    min-height: 152px;
    border-radius: 20px;
  }

  .card:not(.card--row) .tray {
    width: 104px;
    height: 104px;
    border-radius: 18px;
  }

  .card:not(.card--row) .tray img {
    width: 88px;
    height: 88px;
  }

  .card:not(.card--row) .tray--fallback::before {
    font-size: 30px;
  }

  .card:not(.card--row) .card__title {
    font-size: 17px;
    line-height: 24px;
  }

  .card:not(.card--row) .card__meta {
    margin-bottom: var(--sp-2);
  }

  .card:not(.card--row) .card__actions {
    margin-top: auto;
  }

  .about__panel {
    padding: var(--sp-8);
  }

  .ftr__in {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
  }

  .ftr__nav {
    flex-direction: row;
    gap: var(--sp-6);
  }

  .prose {
    padding-top: var(--sp-8);
  }

  .prose__panel {
    padding: var(--sp-8);
  }

  .prose h1,
  .nf h1 {
    font-size: 36px;
    line-height: 44px;
  }
}

/* ====================================================================================
   1024 px and up: desktop contract (§4.3) — 80 px header, two-column hero, three-column catalogue
   ==================================================================================== */
@media (min-width: 1024px) {
  :root {
    --gutter: 32px;
  }

  .hdr__in {
    min-height: 80px;
  }

  .mark {
    font-size: 26px;
    line-height: 32px;
  }

  .hero {
    padding-top: var(--sp-8);
  }

  .hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--sp-8);
    align-items: center;
  }

  .hero__label {
    display: block;
    margin-bottom: var(--sp-3);
    color: var(--muted);
    font-size: 12px;
    line-height: 18px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .hero__title {
    font-size: 52px;
    line-height: 56px;
    letter-spacing: -0.02em;
  }

  .hero__title br {
    display: inline;
  }

  .hero__intro {
    margin-top: var(--sp-3);
    font-size: 18px;
    line-height: 28px;
  }

  /* Three small abstract pastel tiles in the empty right side of the text column; never behind text. */
  .hero__tile {
    display: block;
    position: absolute;
    right: 0;
    pointer-events: none;
    border-radius: 14px;
  }

  .hero__tile--1 {
    top: 0;
    right: 16px;
    width: 56px;
    height: 56px;
    background: var(--lemon);
    transform: rotate(14deg);
  }

  .hero__tile--2 {
    top: 112px;
    right: 72px;
    width: 36px;
    height: 36px;
    background: var(--mint);
    border-radius: 50%;
  }

  .hero__tile--3 {
    bottom: 0;
    right: 8px;
    width: 32px;
    height: 32px;
    background: var(--peach);
    transform: rotate(-10deg);
  }

  .spot {
    margin-top: 0;
    padding: var(--sp-6);
  }

  .spot__row {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: var(--sp-4);
  }

  .spot .tray {
    width: 104px;
    height: 104px;
  }

  .spot .tray img {
    width: 88px;
    height: 88px;
  }

  .spot__title {
    font-size: 28px;
    line-height: 36px;
  }

  .spot__desc {
    font-size: 16px;
    line-height: 24px;
  }

  .spot__btn {
    margin-top: var(--sp-4);
  }

  .games {
    padding-top: var(--sp-8);
  }

  .sec__eyebrow {
    margin-bottom: var(--sp-1);
    color: var(--muted);
    font-size: 12px;
    line-height: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .sec__lead {
    display: block;
    font-size: 28px;
    line-height: 36px;
  }

  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .about {
    margin-top: var(--sp-12);
  }

  .about__title {
    font-size: 24px;
    line-height: 32px;
  }

  .ftr {
    margin-top: var(--sp-12);
  }

  .nf {
    padding-top: var(--sp-16);
  }
}

/* ====================================================================================
   v4 additions (28 Sep 2026): game pages (/games/<slug>), linked card titles,
   App Store / Website links. Same tokens and shapes as the locked v2 design; no new hues.
   ==================================================================================== */

/* Card and spotlight titles open the game's page; they still read as titles. */
.card__link {
  color: inherit;
  text-decoration: none;
  border-radius: 4px;
}

.card__link:hover {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.card__link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* App Store / Website links next to the Play button (only for games that have them). */
.card__alt,
.spot__alt {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin-top: 4px;
  font-size: 13px;
  line-height: 20px;
  font-weight: 800;
}

.card__alt a,
.spot__alt a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.card__alt a:hover,
.spot__alt a:hover {
  color: var(--primary-hover);
  text-decoration-thickness: 2px;
}

.spot__alt {
  justify-content: center;
  margin-top: 10px;
  font-size: 14px;
}

/* Gentle breathing room between the App Store / Website links and the Play button below them. */
.card__alt {
  margin-bottom: 6px;
}

@media (min-width: 640px) {
  .card:not(.card--row) .card__alt {
    margin-bottom: 12px;
  }
}

/* Secondary buttons: outlined (App Store) and soft (website, trailer). */
.btn--alt {
  background: var(--surface);
  color: var(--primary);
  box-shadow: inset 0 0 0 2px var(--primary);
}

.btn--alt:hover {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.btn--ghost {
  background: var(--surface);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary-line);
}

.btn--ghost:hover {
  background: var(--primary-soft);
  color: var(--primary-hover);
}

/* ---------- game page ---------- */
.gp {
  padding-top: var(--sp-4);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}

.crumbs li + li::before {
  content: "›";
  margin-right: 8px;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.crumbs [aria-current] {
  color: var(--text);
  font-weight: 700;
}

.gp__hero {
  margin-top: var(--sp-3);
  padding: var(--sp-5);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-card);
}

.gp__row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.gp__hero .tray {
  width: 88px;
  height: 88px;
  border-radius: 18px;
}

.gp__hero .tray img {
  width: 72px;
  height: 72px;
}

.gp__head {
  min-width: 0;
}

.gp__head .spot__labels {
  margin-bottom: var(--sp-1);
}

.gp__title {
  font-size: 26px;
  line-height: 32px;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}

.gp__meta {
  margin-top: var(--sp-1);
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}

.gp__meta span {
  white-space: nowrap;
}

.gp__meta svg {
  display: inline-block;
  margin-right: 4px;
  vertical-align: -2px;
}

.gp__desc {
  margin-top: var(--sp-2);
  font-size: 16px;
  line-height: 24px;
}

.gp__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}

.gp__actions .btn {
  width: 100%;
}

.gp__sec {
  margin-top: var(--sp-8);
}

.gp__h2 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 800;
}

/* Screenshots: one sideways-scrolling row, fixed height, natural width (portrait or landscape). */
.shots {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  padding-bottom: var(--sp-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.shots:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 16px;
}

.shots__item {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.shots img {
  display: block;
  height: 300px;
  width: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.gp__about {
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.gp__about p {
  max-width: 72ch;
  margin-top: var(--sp-3);
  font-size: 16px;
  line-height: 26px;
}

.gp__about .gp__trailer {
  margin-top: var(--sp-5);
}

.gp .grid {
  margin-top: var(--sp-4);
}

@media (min-width: 640px) {
  .gp__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .gp__actions .btn {
    width: auto;
    min-width: 220px;
  }

  .shots img {
    height: 380px;
  }

  .gp__about {
    padding: var(--sp-8);
  }
}

@media (min-width: 1024px) {
  .gp {
    padding-top: var(--sp-6);
  }

  .gp__hero {
    margin-top: var(--sp-4);
    padding: var(--sp-8);
  }

  .gp__row {
    grid-template-columns: 120px minmax(0, 1fr);
    gap: var(--sp-6);
    align-items: center;
  }

  .gp__hero .tray {
    width: 120px;
    height: 120px;
    border-radius: 24px;
  }

  .gp__hero .tray img {
    width: 100px;
    height: 100px;
  }

  .gp__title {
    font-size: 40px;
    line-height: 46px;
    letter-spacing: -0.02em;
  }

  .gp__meta {
    font-size: 14px;
  }

  .gp__desc {
    max-width: 60ch;
    font-size: 18px;
    line-height: 28px;
  }

  .gp__actions {
    margin-top: var(--sp-6);
  }

  .gp__sec {
    margin-top: var(--sp-12);
  }

  .gp__h2 {
    font-size: 28px;
    line-height: 36px;
  }

  .shots img {
    height: 440px;
  }
}

/* ---------- in-browser play (v6) ---------- */
/* Play buttons reuse .btn; the triangle icon sits before the label. */
.btn__icon {
  flex: 0 0 auto;
  margin-left: -2px;
}

/* Card buttons: "Play" + "Google Play" side by side, wrapping when the card is narrow. */
.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.card__actions .card__btn {
  margin-top: 0;
}

.card__actions--two .card__btn {
  min-width: 0;
  padding-left: 16px;
  padding-right: 16px;
}

/* Spotlight: Play now + Get it on Google Play (stacked on phones, side by side from 640 px). */
.spot__actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.spot__actions .spot__btn {
  margin-top: 0;
}

/* Player section on a game page (from 640 px; phones use the full-screen overlay instead). */
.player {
  display: none;
  scroll-margin-top: var(--sp-4);
}

.player__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--sp-3);
  padding: var(--sp-4);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-card);
}

.player__poster,
.player__frame {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 78vh;
  border: 0;
  border-radius: 16px;
}

.player--portrait .player__poster,
.player--portrait .player__frame {
  width: auto;
  height: min(78vh, 760px);
  aspect-ratio: 9 / 16;
}

.player--landscape .player__poster,
.player--landscape .player__frame {
  max-width: calc(78vh * 16 / 9);
}

.player__poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.player__poster[hidden] {
  display: none;
}

.player__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
}

/* Poster with the game's first screenshot behind a soft slate fade; the title and button sit low. */
.player__poster--cover {
  position: relative;
  justify-content: flex-end;
  padding-bottom: var(--sp-8);
  overflow: hidden;
  background: var(--text);
}

.player__cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player__poster--cover::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(180deg, rgb(52 70 90 / 0%) 25%, rgb(52 70 90 / 88%) 75%);
}

.player__poster--cover .player__intro {
  position: relative;
  z-index: 1;
}

.player__poster--cover .player__name {
  color: var(--on-primary);
}

.player__poster--cover .player__note {
  color: rgb(255 255 255 / 88%);
}

.player__poster .tray {
  width: 120px;
  height: 120px;
  border-radius: 28px;
}

.player__poster .tray img {
  width: 100px;
  height: 100px;
}

.player__name {
  max-width: 28ch;
  font-size: 22px;
  line-height: 28px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.player__start {
  min-width: 200px;
  margin-top: var(--sp-1);
}

.player__note {
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.player__frame {
  background: var(--text);
  box-shadow: var(--shadow-card);
}

.player__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}

.player__bar[hidden] {
  display: none;
}

/* Desktop full screen: the stage fills the screen, the game keeps its shape. */
.player__stage:fullscreen {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--text);
}

.player__stage:fullscreen .player__frame {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}

.player--portrait .player__stage:fullscreen .player__frame {
  width: auto;
  aspect-ratio: 9 / 16;
}

/* Phone overlay: the game fills the screen under a slim bar with the title and a close button. */
.has-player-overlay,
.has-player-overlay body {
  overflow: hidden;
}

.player-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--text);
}

.player-overlay__bar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.player-overlay__title,
.player-overlay__hint {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 20px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-overlay__hint {
  display: none;
  color: var(--primary);
}

.player-overlay__close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--primary-soft);
  color: var(--primary);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.player-overlay .player__frame {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}

/* A sideways game on an upright phone: say so in the bar instead of the title. */
@media (orientation: portrait) {
  .player-overlay--landscape .player-overlay__title {
    display: none;
  }

  .player-overlay--landscape .player-overlay__hint {
    display: block;
  }
}

/* Phone held sideways: no bar, just a small round close button in the corner. */
@media (orientation: landscape) and (max-height: 520px) {
  .player-overlay__bar {
    position: absolute;
    top: max(6px, env(safe-area-inset-top, 0px));
    left: max(6px, env(safe-area-inset-left, 0px));
    z-index: 1;
    min-height: 0;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .player-overlay__title,
  .player-overlay__hint {
    display: none;
  }

  .player-overlay__close {
    width: 36px;
    height: 36px;
    background: rgb(255 255 255 / 85%);
    box-shadow: var(--shadow-card);
  }
}

@media (min-width: 640px) {
  .player {
    display: block;
  }

  .spot__actions--two {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .player__stage {
    margin-top: var(--sp-4);
    padding: var(--sp-6);
  }

  .player__name {
    font-size: 26px;
    line-height: 32px;
  }
}
