* { box-sizing: border-box; }

html {
  min-width: 300px;
  color: var(--ink);
  background: var(--paper);
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgb(22 39 46 / 2.2%) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration-color: rgb(22 39 46 / 30%); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, select:focus-visible, iframe:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.hero {
  position: relative;
  display: grid;
  width: min(calc(100% - 3rem), 1360px);
  min-height: calc(min(900px, 100svh) - 72px);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vh, 7rem) 0 5rem;
  /* Keep the unbroken project name inside the copy column. The former
     0.86/1.14 split let the heading spill into (and behind) the first card
     once the type reached its desktop maximum. */
  grid-template-columns: minmax(0, 1fr) minmax(480px, 1fr);
  gap: clamp(3rem, 7vw, 8rem);
  align-items: center;
}
.hero::before {
  position: absolute;
  z-index: -1;
  top: -72px;
  right: calc(50% - 50vw);
  bottom: 0;
  left: 56%;
  background:
    radial-gradient(circle at 50% 45%, rgb(45 107 139 / 12%), transparent 35%),
    var(--paper-deep);
  content: "";
}
.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--terracotta);
  font-size: 0.7rem;
  font-weight: 820;
  letter-spacing: 0.15em;
  line-height: 1.35;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 780px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(4.4rem, 7.2vw, 7.9rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.84;
}
.hero-dek {
  max-width: 630px;
  margin: 2rem 0 0;
  color: #33464e;
  font-size: clamp(1.04rem, 1.5vw, 1.23rem);
  line-height: 1.55;
}
.hero-actions { display: flex; margin-top: 2.1rem; gap: 0.75rem; flex-wrap: wrap; }
.button {
  display: inline-flex;
  min-height: 48px;
  padding: 0.75rem 1.1rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 790;
  letter-spacing: 0.055em;
  line-height: 1.2;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { border-color: var(--ink); background: var(--ink); color: white; box-shadow: 0 9px 24px rgb(22 39 46 / 18%); }
.button-primary:hover { background: var(--navy); }
.button-secondary { background: transparent; color: var(--ink); }
.button-secondary:hover { background: rgb(251 249 244 / 78%); }
.hero-note {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.hero-exhibit {
  position: relative;
  min-height: 620px;
  isolation: isolate;
}
.hero-exhibit::before {
  position: absolute;
  inset: 10% 4% 5% 12%;
  border: 1px solid rgb(22 39 46 / 13%);
  border-radius: 50%;
  content: "";
}
.exhibit-card {
  position: absolute;
  overflow: hidden;
  width: clamp(190px, 18vw, 245px);
  aspect-ratio: 9 / 13;
  border: 8px solid var(--surface);
  border-radius: 0.5rem;
  background: #10242d;
  box-shadow: var(--shadow);
}
.exhibit-card img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.exhibit-card span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2.2rem 0.9rem 0.75rem;
  background: linear-gradient(transparent, rgb(8 20 26 / 88%));
  color: white;
  font-size: 0.69rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.exhibit-card-a { z-index: 1; top: 4%; left: 5%; transform: rotate(-5deg); }
.exhibit-card-b { z-index: 3; top: 18%; left: 34%; transform: rotate(3deg); }
.exhibit-card-c { z-index: 2; top: 35%; right: 0; transform: rotate(-2deg); }
.exhibit-line {
  position: absolute;
  z-index: 4;
  top: 48%;
  left: 12%;
  width: 74%;
  border-top: 2px solid var(--terracotta);
  transform: rotate(9deg);
  transform-origin: left;
}
.exhibit-line::after {
  position: absolute;
  top: -5px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--terracotta);
  content: "";
}

.gallery-section {
  padding: clamp(5rem, 9vw, 8rem) max(1.5rem, calc((100vw - 1360px) / 2));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.section-heading {
  display: grid;
  margin-bottom: 2.7rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.62fr);
  gap: 3rem;
  align-items: end;
}
.section-heading h2, .integrity-strip h2 {
  max-width: 790px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.8rem, 5vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.95;
}
.section-heading > p {
  max-width: 560px;
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.98rem;
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}
.game-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 8px 24px rgb(22 39 46 / 4%);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.game-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--game-accent);
  content: "";
}
.game-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.game-preview { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: #10242d; }
.game-preview::after { position: absolute; inset: 0; box-shadow: inset 0 -50px 70px rgb(8 18 23 / 20%); content: ""; }
.game-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 24%;
  transition: transform 320ms ease;
}
.game-card:hover .game-preview img { transform: scale(1.025); }
.preview-badge {
  position: absolute;
  z-index: 2;
  top: 0.8rem;
  left: 0.8rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: 999px;
  background: rgb(8 18 23 / 72%);
  color: white;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.game-card-body { display: flex; min-height: 270px; padding: 1.25rem 1.3rem 1.35rem; flex-direction: column; }
.game-meta {
  margin: 0 0 0.4rem;
  color: var(--terracotta);
  font-size: 0.65rem;
  font-weight: 810;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.game-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 520;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.game-objective { margin: 0.8rem 0 1.2rem; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.game-facts { display: flex; margin-top: auto; gap: 0.45rem; flex-wrap: wrap; }
.game-facts span {
  padding: 0.3rem 0.55rem;
  border: 1px solid rgb(22 39 46 / 13%);
  border-radius: 999px;
  color: #405159;
  font-family: var(--mono);
  font-size: 0.61rem;
}
.card-play {
  display: flex;
  width: 100%;
  margin-top: 1rem;
  padding: 0.72rem 0;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 810;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}
.card-play::after { color: var(--game-accent); font-size: 1.25rem; content: "→"; }

.integrity-strip {
  display: grid;
  padding: clamp(4rem, 8vw, 7rem) max(1.5rem, calc((100vw - 1360px) / 2));
  grid-template-columns: 1fr 0.85fr;
  gap: 3rem 6rem;
  border-top: 1px solid rgb(242 238 229 / 16%);
  background: var(--ink);
  color: var(--paper);
}
.integrity-strip .eyebrow { color: #d9c58f; }
.integrity-strip h2 { font-size: clamp(2.6rem, 4.5vw, 4.7rem); }
.integrity-strip > p { align-self: end; margin: 0; color: rgb(242 238 229 / 72%); }
.integrity-strip > a {
  width: max-content;
  color: #e2bd69;
  font-size: 0.72rem;
  font-weight: 790;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-view {
  width: min(calc(100% - 3rem), 1360px);
  min-height: calc(100svh - 72px);
  margin: 0 auto;
  padding: 1.2rem 0 4rem;
}
.game-view-heading { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 1rem; }
.text-button {
  padding: 0.4rem 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 790;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.text-button:hover { color: var(--ink); }
.live-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgb(191 145 64 / 12%); }
.live-status[data-status="running"] .status-dot, .live-status[data-status="success"] .status-dot { background: var(--good); box-shadow: 0 0 0 4px rgb(66 110 90 / 13%); }
.live-status[data-status="failure"] .status-dot, .live-status[data-status="unavailable"] .status-dot { background: var(--danger); }

.play-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.72fr) minmax(430px, 1.28fr);
  gap: clamp(2rem, 5vw, 6rem);
  align-items: start;
}
.game-brief { position: sticky; top: 1.2rem; padding: clamp(1.3rem, 3vw, 2.3rem) 0; }
.game-brief h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.6rem, 6vw, 6.2rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.88;
}
.objective { max-width: 560px; margin: 1.4rem 0 0; color: #405159; font-size: 1rem; line-height: 1.55; }
.level-picker { margin-top: 2rem; }
.level-picker label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 810;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.select-wrap { position: relative; }
.select-wrap::after { position: absolute; top: 50%; right: 1rem; content: "⌄"; pointer-events: none; transform: translateY(-58%); }
.level-picker select {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 2.7rem 0.7rem 0.9rem;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
}
.level-picker > p { margin: 0.55rem 0 0; color: var(--muted); font-family: var(--mono); font-size: 0.65rem; }
.control-card {
  display: grid;
  margin-top: 1.5rem;
  padding: 1rem;
  grid-template-columns: 42px 1fr;
  gap: 0.85rem;
  border: 1px solid var(--line);
  background: rgb(251 249 244 / 68%);
}
.control-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 1.1rem;
}
.control-card strong { font-size: 0.69rem; letter-spacing: 0.08em; text-transform: uppercase; }
.control-card p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.session-stats { display: grid; margin: 1.5rem 0 0; grid-template-columns: 1fr 1fr; border-block: 1px solid var(--line); }
.session-stats div { padding: 0.85rem 0; }
.session-stats div + div { padding-left: 1rem; border-left: 1px solid var(--line); }
.session-stats dt { color: var(--muted); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.session-stats dd { margin: 0.15rem 0 0; font-family: var(--mono); font-size: 1rem; font-weight: 730; }
.game-actions { display: grid; margin-top: 1.5rem; grid-template-columns: 0.72fr 1.28fr; gap: 0.6rem; }
.game-actions .button { width: 100%; }
.do-not-warn { margin: 1rem 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }

.runtime-column { display: flex; min-width: 0; flex-direction: column; align-items: center; }
.runtime-quick-guide { display: none; }
.runtime-frame {
  position: relative;
  overflow: hidden;
  width: min(100%, calc((100svh - 150px) * 9 / 16));
  min-width: 320px;
  aspect-ratio: 9 / 16;
  border: 10px solid #10242d;
  border-radius: 1.1rem;
  background: #10242d;
  box-shadow: 0 28px 80px rgb(22 39 46 / 22%);
}
.runtime-frame::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 0.55rem;
  content: "";
  pointer-events: none;
}
.runtime-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #10242d; opacity: 0; transition: opacity 220ms ease; }
.runtime-frame.is-ready iframe { opacity: 1; }
.runtime-loader {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  padding: 2rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #10242d;
  color: white;
  text-align: center;
  transition: opacity 180ms ease, visibility 180ms ease;
}
.runtime-frame.is-ready .runtime-loader { opacity: 0; visibility: hidden; }
.runtime-loader > span {
  width: 38px;
  height: 38px;
  margin-bottom: 1rem;
  border: 2px solid rgb(255 255 255 / 18%);
  border-top-color: #e2bd69;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
.runtime-loader strong { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; }
.runtime-loader small { max-width: 240px; margin-top: 0.35rem; color: rgb(255 255 255 / 58%); }
.runtime-frame[data-status="unavailable"] .runtime-loader > span { display: none; }
.viewport-note { max-width: 480px; margin: 0.9rem auto 0; color: var(--muted); font-size: 0.67rem; text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }

.completion-toast {
  position: fixed;
  z-index: 100;
  right: 1.4rem;
  bottom: 1.4rem;
  display: flex;
  width: min(440px, calc(100% - 2rem));
  padding: 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #244c3a;
  border-radius: 0.5rem;
  background: #18382b;
  color: white;
  box-shadow: 0 20px 60px rgb(22 39 46 / 28%);
  animation: toast-in 260ms ease both;
}
.completion-toast > div { display: flex; align-items: center; gap: 0.8rem; }
.completion-mark { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #dce9e0; color: #244c3a; font-weight: 900; }
.completion-toast strong { font-size: 0.83rem; letter-spacing: 0.06em; text-transform: uppercase; }
.completion-toast p { margin: 0.1rem 0 0; color: rgb(255 255 255 / 70%); font-size: 0.72rem; }
.completion-toast .button { min-height: 39px; border-color: rgb(255 255 255 / 35%); color: white; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.noscript-note { position: fixed; z-index: 1000; right: 1rem; bottom: 1rem; left: 1rem; padding: 1rem; background: var(--danger); color: white; text-align: center; }

@media (max-width: 1080px) {
  .hero { grid-template-columns: 0.9fr 1.1fr; gap: 2.5rem; }
  .hero-exhibit { min-height: 540px; }
  .exhibit-card { width: clamp(165px, 21vw, 215px); }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play-layout { gap: 2.5rem; }
  .game-brief h1 { font-size: clamp(3.3rem, 6vw, 4.9rem); }
}

@media (max-width: 820px) {
  .hero { width: min(calc(100% - 2rem), 1360px); min-height: auto; padding: 4.5rem 0 3rem; grid-template-columns: 1fr; }
  .hero::before { top: 52%; left: calc(50% - 50vw); }
  .hero h1 { font-size: clamp(3.25rem, 10.5vw, 5.6rem); }
  .hero-exhibit { min-height: 590px; }
  .exhibit-card { width: min(40vw, 215px); }
  .exhibit-card-a { left: 2%; }
  .exhibit-card-b { left: 34%; }
  .gallery-section { padding-inline: 1rem; }
  .section-heading { grid-template-columns: 1fr; gap: 1.2rem; }
  .integrity-strip { padding-inline: 1.5rem; grid-template-columns: 1fr; gap: 1.5rem; }
  .game-view { width: min(calc(100% - 2rem), 1360px); }
  .play-layout { grid-template-columns: 1fr; }
  .game-brief { position: static; padding-bottom: 0; }
  .runtime-column { order: -1; margin-top: 0.5rem; }
  .runtime-quick-guide {
    display: flex;
    width: min(100%, 520px);
    margin-bottom: 0.65rem;
    padding: 0 0.2rem;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
  }
  .runtime-quick-guide strong { flex: 0 0 auto; font-family: var(--serif); font-size: 1.25rem; font-weight: 520; }
  .runtime-quick-guide span { color: var(--muted); font-size: 0.68rem; line-height: 1.35; text-align: right; }
  .runtime-frame { width: min(100%, 520px); min-width: 0; }
}

@media (max-width: 560px) {
  .hero { padding-top: 3.2rem; }
  .hero h1 { font-size: clamp(2.5rem, 12.4vw, 4.3rem); }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .hero-exhibit { min-height: 420px; }
  .exhibit-card { width: 39vw; border-width: 5px; }
  .exhibit-card-b { top: 12%; left: 31%; }
  .exhibit-card-c { top: 31%; }
  .exhibit-card span { padding-inline: 0.55rem; font-size: 0.52rem; }
  .game-grid { grid-template-columns: 1fr; }
  .game-card-body { min-height: 240px; }
  .game-view { width: min(calc(100% - 1rem), 1360px); }
  .game-view-heading { padding-inline: 0.25rem; }
  .game-brief h1 { font-size: clamp(3.2rem, 17vw, 4.8rem); }
  .game-actions { grid-template-columns: 1fr; }
  .runtime-frame { width: 100%; border-width: 5px; border-radius: 0.65rem; }
  .viewport-note { padding-inline: 0.5rem; }
  .completion-toast { right: 0.5rem; bottom: 0.5rem; left: 0.5rem; width: auto; align-items: stretch; flex-direction: column; }
  .completion-toast .button { width: 100%; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .game-view { width: calc(100% - 1rem); }
  .play-layout { grid-template-columns: minmax(280px, 0.8fr) minmax(300px, 1.2fr); gap: 1.25rem; }
  .game-brief { padding-top: 0.5rem; }
  .game-brief h1 { font-size: 3rem; }
  .objective { margin-top: 0.7rem; font-size: 0.82rem; }
  .level-picker, .control-card, .session-stats, .game-actions { margin-top: 0.7rem; }
  .runtime-frame { width: min(100%, calc((100svh - 125px) * 9 / 16)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
