@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #050505;
  --panel: #0a0a0a;
  --ink: #f4f4f1;
  --ink-soft: rgba(244, 244, 241, 0.72);
  --line: rgba(244, 244, 241, 0.22);
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.46);
  --accent-cyan: #93efe8;
  --accent-red: #f06d63;
  --card-max-width: min(92vw, 980px);
  --card-radius: 2px;
  --page-gutter: clamp(18px, 3vw, 42px);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
  line-height: 1.45;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(147, 239, 232, 0.06), transparent 28%),
    radial-gradient(circle at bottom right, rgba(240, 109, 99, 0.06), transparent 24%),
    linear-gradient(180deg, #070707 0%, #040404 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.18;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: calc(var(--page-gutter) * 1.3) var(--page-gutter) 6rem;
}

.page-stack {
  width: min(100%, 1120px);
  display: grid;
  gap: 1.5rem;
}

.page-stage {
  width: min(100%, 1320px);
  display: grid;
  grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
  align-items: center;
  gap: clamp(10px, 2vw, 28px);
}

.site-kicker,
.card-topline,
.card-meta,
.legal-links,
.analysis-meta,
.legal-backlink {
  font-family: "IBM Plex Mono", monospace;
}

.site-kicker,
.card-topline,
.card-meta,
.analysis-meta,
.legal-links {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-kicker,
.card-topline,
.card-meta,
.analysis-meta {
  color: var(--ink-soft);
}

.card-shell {
  width: var(--card-max-width);
  aspect-ratio: 3 / 2;
  position: relative;
  perspective: 1800px;
}

.card-stack {
  position: absolute;
  inset: 0;
}

.card-stack::before,
.card-stack::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(244, 244, 241, 0.09);
  border-radius: var(--card-radius);
  pointer-events: none;
}

.card-stack::before {
  transform: translate(10px, 10px);
}

.card-stack::after {
  transform: translate(18px, 18px);
  opacity: 0.33;
}

.fragment-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.2, 0.72, 0.18, 1);
}

.fragment-card.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  backface-visibility: hidden;
  overflow: hidden;
}

.card-front {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 22%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--panel);
}

.card-back {
  background: rgba(236, 236, 230, 0.98);
  color: #111;
  transform: rotateY(180deg);
}

.card-grid,
.card-back-grid,
.start-grid {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  height: 100%;
  padding: clamp(20px, 2.7vw, 34px);
}

.card-main,
.start-main {
  display: grid;
  place-items: center;
  text-align: center;
}

.card-grid > .card-main,
.start-grid > .start-main {
  grid-row: 2;
}

.poem-word,
.intro-word {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.04em;
  font-size: clamp(2.8rem, 9vw, 7rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--ink);
  text-wrap: balance;
}

.intro-word {
  font-size: clamp(3.2rem, 10vw, 8rem);
}

.poem-word[data-accent="cyan"],
.intro-punctuation {
  text-shadow: 0 0 28px rgba(147, 239, 232, 0.14);
}

.poem-word[data-accent="red"] {
  text-shadow: 0 0 28px rgba(240, 109, 99, 0.12);
}

.intro-punctuation {
  display: inline-block;
  min-width: 0.36em;
  color: var(--accent-cyan);
}

.analysis-meta {
  color: rgba(17, 17, 17, 0.56);
  border-bottom: 1px solid rgba(17, 17, 17, 0.12);
  padding-bottom: 0.9rem;
}

.postcard-back {
  position: relative;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: 1fr;
  gap: clamp(18px, 2.2vw, 28px);
}

.postcard-back::before {
  content: "";
  position: absolute;
  top: clamp(20px, 2.7vw, 34px);
  bottom: clamp(20px, 2.7vw, 34px);
  left: 50%;
  width: 1px;
  background: rgba(17, 17, 17, 0.14);
  transform: translateX(-0.5px);
}

.postcard-message {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1rem;
  padding-right: clamp(10px, 1.2vw, 16px);
}

.postcard-address {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding-left: clamp(18px, 2vw, 28px);
  padding-right: clamp(2px, 0.3vw, 6px);
}

.postcard-stamp {
  justify-self: end;
  width: clamp(82px, 10vw, 118px);
  aspect-ratio: 5 / 6;
  border: 1px solid rgba(17, 17, 17, 0.24);
  display: grid;
  place-items: center;
  padding: clamp(8px, 1vw, 12px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.12)),
    rgba(17, 17, 17, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32);
  overflow: hidden;
  position: relative;
}

.postcard-stamp::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(17, 17, 17, 0.16);
  pointer-events: none;
}

.postcard-stamp img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  opacity: 0.92;
}

.postcard-address-body {
  display: grid;
  align-content: end;
  gap: 0.95rem;
  min-height: 100%;
  padding-top: clamp(20px, 4vh, 48px);
  padding-bottom: clamp(18px, 3.5vh, 34px);
}

.postcard-address-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(17, 17, 17, 0.48);
}

.postcard-address-lines {
  display: grid;
  gap: 1rem;
  width: min(100%, 240px);
  justify-self: end;
}

.postcard-address-lines span {
  display: block;
  width: 100%;
  border-bottom: 1px solid rgba(17, 17, 17, 0.24);
}

.analysis-scroll {
  overflow: auto;
  padding-right: 0.4rem;
}

.analysis-scroll p,
.legal-page p,
.legal-page li {
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.5;
}

.analysis-scroll p {
  margin: 0 0 1rem;
  font-size: clamp(0.91rem, 1.25vw, 1.03rem);
  color: rgba(17, 17, 17, 0.92);
  max-width: 72ch;
}

.analysis-scroll p:last-child {
  margin-bottom: 0;
}

.start-panel {
  position: relative;
  width: var(--card-max-width);
  aspect-ratio: 3 / 2;
  perspective: 1800px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 22%),
    radial-gradient(circle at 50% 24%, rgba(147, 239, 232, 0.07), transparent 22%),
    var(--panel);
  overflow: hidden;
}

.start-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(244, 244, 241, 0.07);
  transform: translate(18px, 18px);
  pointer-events: none;
}

.start-panel .fragment-card,
.start-panel .card-face {
  width: 100%;
  height: 100%;
}

.start-panel .card-front {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 22%),
    radial-gradient(circle at 50% 24%, rgba(147, 239, 232, 0.07), transparent 22%),
    var(--panel);
}

.start-panel .card-back {
  background: rgba(236, 236, 230, 0.98);
}

.legal-links {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 40;
  display: inline-flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: rgba(244, 244, 241, 0.46);
}

.legal-links a,
.legal-backlink {
  text-decoration: none;
}

.legal-links a:hover,
.legal-backlink:hover {
  color: var(--ink);
}

.legal-page {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 6rem var(--page-gutter) 7rem;
}

.games-page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 4.5rem var(--page-gutter) 7rem;
}

.games-page h1,
.games-page h2,
.games-page h3 {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.games-page h1 {
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  margin: 0 0 1.25rem;
}

.games-page h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 0.85rem;
}

.games-page p,
.games-page li,
.game-status,
.game-question,
.game-response,
.game-result,
.game-note,
.game-button,
.game-link {
  font-family: "IBM Plex Mono", monospace;
}

.games-page p,
.games-page li {
  line-height: 1.7;
  color: rgba(244, 244, 241, 0.84);
}

.games-page > p {
  max-width: 68ch;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.game-link {
  display: grid;
  gap: 0.8rem;
  padding: 1.2rem 1.25rem;
  min-height: 220px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 26%),
    rgba(10, 10, 10, 0.92);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.game-link:hover {
  transform: translateY(-2px);
  border-color: rgba(244, 244, 241, 0.38);
  background: rgba(16, 16, 16, 0.96);
}

.game-link__meta {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.game-link__title {
  font-size: 1.35rem;
  color: var(--ink);
}

.game-link__body {
  color: rgba(244, 244, 241, 0.72);
  line-height: 1.72;
}

.games-backlink {
  display: inline-flex;
  margin-top: 2.5rem;
  color: var(--ink-soft);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.game-panel {
  margin-top: 2rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 26%),
    rgba(10, 10, 10, 0.94);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 32px);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.3rem;
}

.game-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: border-color 180ms ease, background 180ms ease;
}

.game-button:hover {
  border-color: rgba(244, 244, 241, 0.42);
  background: rgba(255, 255, 255, 0.05);
}

.game-button--accent {
  border-color: rgba(147, 239, 232, 0.36);
  color: var(--accent-cyan);
}

.game-button--accent:hover {
  border-color: rgba(147, 239, 232, 0.62);
  background: rgba(147, 239, 232, 0.08);
}

.game-result {
  min-height: 5rem;
  display: grid;
  align-content: center;
  gap: 0.6rem;
  margin-top: 1.4rem;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(244, 244, 241, 0.12);
}

.game-result__word {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.game-note {
  color: rgba(244, 244, 241, 0.72);
  line-height: 1.72;
  max-width: 64ch;
}

.nothing-field {
  position: relative;
  min-height: 340px;
  margin-top: 1.4rem;
  border: 1px solid rgba(244, 244, 241, 0.12);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(147, 239, 232, 0.04), transparent 24%),
    rgba(5, 5, 5, 0.72);
}

.nothing-button {
  position: absolute;
}

.game-status {
  margin-top: 1.15rem;
  min-height: 1.8rem;
  color: rgba(244, 244, 241, 0.72);
}

.riddle-stack {
  display: grid;
  gap: 1rem;
}

.game-question {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 20ch;
}

.game-response {
  min-height: 3.4rem;
  color: rgba(244, 244, 241, 0.76);
  line-height: 1.72;
  max-width: 64ch;
}

.legal-page h1,
.legal-page h2 {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.legal-page h1 {
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  margin-bottom: 1.5rem;
}

.legal-page h2 {
  font-size: 1.15rem;
  margin-top: 2.2rem;
  margin-bottom: 0.55rem;
}

.legal-page ul {
  padding-left: 1.1rem;
}

.legal-backlink {
  display: inline-flex;
  margin-top: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.nav-zone {
  min-height: min(72vh, 760px);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: rgba(244, 244, 241, 0.12);
  transition: color 180ms ease, opacity 180ms ease;
}

.nav-zone:hover {
  color: rgba(244, 244, 241, 0.38);
}

.nav-zone[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.16;
}

.nav-zone__icon {
  font-size: 0.95rem;
}

.card-face[data-card-surface] {
  cursor: pointer;
}

.analysis-scroll {
  cursor: auto;
}

.poem-word.is-jittering {
  animation: word-jitter 650ms cubic-bezier(0.22, 0.88, 0.32, 1);
}

@keyframes word-jitter {
  0%, 100% { transform: translate3d(0, 0, 0); }
  24% { transform: translate3d(-3px, 1px, 0); }
  50% { transform: translate3d(3px, -1px, 0); }
  74% { transform: translate3d(-2px, 0, 0); }
}

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

@media (max-width: 860px) {
  .card-shell, .start-panel { width: min(100%, 94vw); }
  .card-stack::before, .card-stack::after, .start-panel::after { display: none; }
  .page-stage { grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 10px; }
  .games-grid { grid-template-columns: 1fr; }
  .postcard-back {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .postcard-back::before {
    display: none;
  }
  .postcard-address {
    padding-left: 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(17, 17, 17, 0.12);
  }
  .postcard-address-body {
    align-content: start;
    padding-top: 0.4rem;
    padding-bottom: 0;
  }
  .postcard-address-lines {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .page-shell { padding-bottom: 7rem; }
  .card-shell, .start-panel { aspect-ratio: auto; min-height: 74vh; }
  .fragment-card, .card-face { min-height: 74vh; }
  .nav-zone { min-height: 74vh; }
  .legal-links {
    right: 12px;
    left: 12px;
    justify-content: flex-end;
    font-size: 0.68rem;
  }
}
