:root {
  --play-bg: #080a0f;
  --play-panel: #151714;
  --play-orange: #ff7040;
  --play-cream: #f2e6bd;
  --play-muted: #b8b2a2;
  --play-line: rgba(242, 230, 189, 0.15);
  --play-serif: "Instrument Serif", Georgia, serif;
  --play-sans: "DM Sans", system-ui, sans-serif;
  --play-ui: "Nunito Sans", sans-serif;
}

body.play-page {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--play-bg);
  color: var(--play-cream);
  font-family: var(--play-sans);
}

.play-page .polaroid-caption,
.play-page .mountain-preview-badge {
  font-size: 0.75rem;
}

.play-main-container {
  position: relative;
  z-index: 2;
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 120px 48px 100px;
}

.play-hero-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  margin: 20px 0 8px;
}

.hero-line {
  width: clamp(40px, 12vw, 140px);
  height: 1px;
  background: #742e22;
}

.left-line { background: linear-gradient(90deg, transparent, #742e22); }
.right-line { background: linear-gradient(270deg, transparent, #742e22); }

.play-hero-title {
  margin: 0;
  color: var(--play-orange);
  font-family: var(--play-serif);
  font-size: clamp(4rem, 10vw, 8.2rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
}

.play-hero-sub {
  max-width: 640px;
  margin: 0 auto 72px;
  color: var(--play-muted);
  font-family: var(--play-ui);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.55;
  text-align: center;
}

.game-zone,
.labs-zone {
  margin-bottom: 96px;
}

.game-zone-heading,
.experiment-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.game-zone-heading h2,
.experiment-heading h2 {
  max-width: 13ch;
  margin: 0;
  color: var(--play-cream);
  font-family: var(--play-serif);
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.game-zone-heading p,
.experiment-heading p {
  max-width: 35ch;
  margin: 0;
  color: var(--play-muted);
  font-size: 1rem;
  line-height: 1.55;
  text-align: right;
}

.game-grid,
.play-grid {
  display: grid;
  gap: 28px;
}

.game-grid { grid-template-columns: 1.15fr 0.85fr; }
.play-grid { grid-template-columns: repeat(2, 1fr); }

.play-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--play-line);
  border-radius: 14px;
  background: var(--play-panel);
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms ease, box-shadow 220ms ease;
}

.play-card:hover,
.play-card:focus-visible {
  border-color: rgba(255, 112, 64, 0.68);
  outline: none;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
  transform: translateY(-4px);
}

.game-card-scene {
  position: relative;
  height: 280px;
  overflow: hidden;
  isolation: isolate;
  background: #0b1221;
}

.game-card-dodge .game-card-scene::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 40%;
  background: linear-gradient(165deg, transparent 18%, #1b2030 19% 57%, #101521 58%);
}

.game-preview-player {
  position: absolute;
  z-index: 2;
  bottom: 28px;
  left: 50%;
  width: 54px;
  height: 22px;
  border-radius: 6px 6px 12px 12px;
  background: var(--play-orange);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.44);
  transform: translateX(-50%);
}

.game-preview-file {
  position: absolute;
  width: 38px;
  height: 48px;
  border: 1px solid rgba(242, 230, 189, 0.55);
  border-radius: 5px;
  background: rgba(18, 24, 38, 0.9);
}

.game-preview-file::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 8px;
  left: 8px;
  height: 1px;
  background: rgba(242, 230, 189, 0.36);
  box-shadow: 0 8px 0 rgba(242, 230, 189, 0.22);
}

.file-one { top: 24%; left: 24%; transform: rotate(10deg); }
.file-two { top: 44%; right: 20%; transform: rotate(-12deg); }

.game-preview-orb,
.game-preview-spark {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.48);
}

.game-preview-orb { top: 22%; left: 62%; width: 16px; height: 16px; background: #ffd875; }
.spark-one { top: 30%; left: 18%; width: 24px; height: 24px; background: #ffd875; }
.spark-two { top: 22%; right: 18%; width: 16px; height: 16px; background: #ff7040; }
.spark-three { right: 26%; bottom: 20%; width: 32px; height: 32px; background: #91a8ff; }

.game-preview-line {
  position: absolute;
  z-index: 3;
  bottom: 50px;
  left: 50%;
  width: 1px;
  height: 110px;
  background: linear-gradient(transparent, rgba(255, 112, 64, 0.55));
}

.game-card-pop .game-card-scene { background: #0c1120; }

.game-preview-reticle {
  position: absolute;
  top: 45%;
  left: 48%;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(242, 230, 189, 0.72);
  border-radius: 50%;
}

.game-preview-reticle::before,
.game-preview-reticle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(242, 230, 189, 0.72);
  transform: translate(-50%, -50%);
}

.game-preview-reticle::before { width: 68px; height: 1px; }
.game-preview-reticle::after { width: 1px; height: 68px; }

.play-card-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 28px 28px;
}

.play-card-num {
  color: var(--play-orange);
  font-family: var(--play-ui);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.play-card-title {
  margin: 0;
  color: var(--play-cream);
  font-family: var(--play-serif);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1.1;
}

.play-card-desc {
  margin: 0;
  color: var(--play-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.game-card-action {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  border-bottom: 1px solid currentColor;
  color: var(--play-orange);
  font-family: var(--play-ui);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.7;
}

.play-card-img-wrap {
  position: relative;
  height: 260px;
  overflow: hidden;
  background: #0d0e0c;
}

.play-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.play-card:hover .play-card-img-wrap img { transform: scale(1.045); }

.play-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 15, 0.54);
  opacity: 0;
  transition: opacity 220ms ease;
}

.play-card:hover .play-card-overlay,
.play-card:focus-visible .play-card-overlay { opacity: 1; }

.play-card-overlay span {
  padding: 9px 16px;
  border-radius: 7px;
  background: var(--play-orange);
  color: #080a0f;
  font-family: var(--play-ui);
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

dialog.play-dialog {
  display: none;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

dialog.play-dialog[open] {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 11, 0.9);
  backdrop-filter: blur(12px);
}

.dialog-card {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  width: min(960px, 92vw);
  max-height: 90vh;
  border-radius: 14px;
  background: #161815;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.62);
}

.game-dialog-card { background: #0c0e14; }

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--play-line);
}

.dialog-header h2 {
  margin: 0;
  color: var(--play-cream);
  font-family: var(--play-serif);
  font-size: 1.9rem;
  font-weight: 400;
}

.dialog-header p {
  margin: 3px 0 0;
  color: var(--play-muted);
  font-size: 0.9rem;
}

.dialog-close-btn {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(242, 230, 189, 0.08);
  color: var(--play-cream);
  cursor: pointer;
  font-size: 1.25rem;
  place-items: center;
}

.dialog-close-btn:hover { background: rgba(242, 230, 189, 0.16); }

.dialog-body {
  overflow-y: auto;
  padding: 24px;
}

.game-hud {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 12px;
  color: var(--play-muted);
  font-family: var(--play-ui);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game-hud span:last-child { margin-left: auto; }
.game-hud strong { margin-left: 5px; color: var(--play-cream); font-size: 1rem; }

.game-stage-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #070910;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42);
  aspect-ratio: 19 / 11;
}

.game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.game-start-screen {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: rgba(7, 9, 16, 0.76);
  backdrop-filter: blur(8px);
  text-align: center;
}

.game-start-screen[hidden] { display: none; }

.game-start-screen p {
  max-width: 38ch;
  margin: 0;
  color: var(--play-cream);
  font-family: var(--play-serif);
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.1;
}

.game-start-btn {
  min-height: 46px;
  padding: 0 23px;
  border: 0;
  border-radius: 8px;
  background: var(--play-orange);
  color: #080a0f;
  cursor: pointer;
  font-family: var(--play-ui);
  font-size: 0.95rem;
  font-weight: 900;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), background-color 180ms ease;
}

.game-start-btn:hover { background: #ff865f; transform: translateY(-2px); }

.game-canvas:focus-visible,
.game-start-btn:focus-visible,
.dialog-close-btn:focus-visible {
  outline: 2px solid #ffd875;
  outline-offset: 3px;
}

.game-instructions,
.comparison-hint {
  margin: 13px 0 0;
  color: var(--play-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  text-align: center;
}

.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.gallery-item { overflow: hidden; border-radius: 10px; background: #0d0f0d; }
.gallery-item img { display: block; width: 100%; height: 220px; object-fit: cover; }
.gallery-item span { display: block; padding: 11px 12px; color: var(--play-muted); font-size: 0.82rem; }

.video-container { overflow: hidden; border-radius: 10px; background: #000; }
.video-container video { display: block; width: 100%; height: auto; }
.video-notes { margin-top: 20px; }
.video-notes h3 { margin: 0; color: var(--play-orange); font-family: var(--play-serif); font-size: 1.65rem; font-weight: 400; }
.video-notes p { margin: 8px 0 0; color: var(--play-muted); font-size: 1rem; line-height: 1.55; }

.comparison-container {
  position: relative;
  width: 100%;
  height: 440px;
  overflow: hidden;
  border-radius: 10px;
  cursor: ew-resize;
  user-select: none;
}

.comp-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.comp-clipper { position: absolute; top: 0; bottom: 0; left: 0; width: 50%; overflow: hidden; border-right: 2px solid var(--play-orange); }
.comp-clipper .comp-img { width: 960px; max-width: none; }
.comp-slider-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; pointer-events: none; transform: translateX(-50%); }
.handle-line { width: 2px; height: 100%; margin: 0 auto; background: var(--play-orange); }
.handle-circle { position: absolute; top: 50%; left: 50%; display: grid; width: 38px; height: 38px; border-radius: 50%; background: var(--play-orange); color: #080a0f; font-weight: 900; place-items: center; transform: translate(-50%, -50%); }
.comp-label { position: absolute; z-index: 2; top: 16px; padding: 7px 11px; border-radius: 5px; background: rgba(0, 0, 0, 0.76); color: var(--play-cream); font-size: 0.8rem; font-weight: 800; }
.comp-label-after { right: 16px; }
.comp-label-before { left: 16px; }

.stack-breakdown { display: flex; flex-direction: column; gap: 0; }
.stack-step { display: grid; grid-template-columns: 64px 1fr; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--play-line); }
.stack-step:last-child { border-bottom: 0; }
.step-num { color: var(--play-orange); font-family: var(--play-serif); font-size: 2.2rem; line-height: 1; }
.step-info h3 { margin: 0; color: var(--play-cream); font-family: var(--play-serif); font-size: 1.5rem; font-weight: 400; }
.step-info p { margin: 6px 0 0; color: var(--play-muted); font-size: 1rem; line-height: 1.55; }

.play-footer-wrap { width: min(100%, 1440px); margin: 0 auto; padding: 0 48px 48px; }
.end-scene { position: relative; overflow: hidden; min-height: 260px; padding: 48px; border-radius: 14px; background: #111b2c; }
.end-scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.28; }
.end-scene-word { position: relative; margin: 0; color: var(--play-cream); font-family: var(--play-serif); font-size: clamp(3.5rem, 9vw, 8rem); line-height: 0.9; }
.end-scene-lines { position: relative; display: flex; justify-content: space-between; gap: 24px; margin-top: 44px; color: #d5ccb0; font-size: 0.9rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 860px) {
  .game-grid,
  .play-grid { grid-template-columns: 1fr; }
  .gallery-masonry { grid-template-columns: 1fr; }
  .comparison-container { height: 330px; }
}

@media (max-width: 640px) {
  .play-main-container { padding: 96px 22px 72px; }
  .play-hero-header { gap: 18px; }
  .play-hero-sub { margin-bottom: 56px; }
  .game-zone-heading,
  .experiment-heading { align-items: flex-start; flex-direction: column; }
  .game-zone-heading p,
  .experiment-heading p { text-align: left; }
  .game-card-scene,
  .play-card-img-wrap { height: 230px; }
  .dialog-card { width: 96vw; max-height: 92vh; }
  .dialog-header { padding: 15px 16px; }
  .dialog-header h2 { font-size: 1.55rem; }
  .dialog-header p { font-size: 0.8rem; }
  .dialog-body { padding: 16px; }
  .game-hud { gap: 12px; font-size: 0.78rem; }
  .game-hud strong { display: block; margin: 2px 0 0; }
  .game-instructions { font-size: 0.8rem; }
  .comparison-container { height: 250px; }
  .stack-step { grid-template-columns: 44px 1fr; }
  .play-footer-wrap { padding: 0 22px 22px; }
  .end-scene { min-height: 230px; padding: 32px 24px; }
  .end-scene-lines { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .play-card,
  .play-card-img-wrap img,
  .game-start-btn { transition: none; }
}
