@font-face {
  font-family: "Archivo Narrow";
  src: url("./ArchivoNarrow.19b584eb9a10.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 700;
}

@font-face {
  font-family: "Atkinson";
  src: url("./Atkinson.abde1ad5cf78.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 700;
}

@font-face {
  font-family: "Plex Mono";
  src: url("./PlexMono.81fc864103e7.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: light;
  --table: #1646a3;
  --seam: #0b2b69;
  --cloth: #ff5a5f;
  --chalk: #fff3d6;
  --thread: #ffd166;
  --ink: #10213a;
  --white: #fffdf7;
  --measure: #9ec8ff;
  --focus: #fff3d6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background-color: var(--table);
  color: var(--chalk);
  font-family: "Atkinson", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
}

button,
a,
[role="slider"] {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-160%);
  background: var(--chalk);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-nav {
  position: relative;
  z-index: 4;
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 243, 214, 0.42);
  padding: 0.6rem clamp(1rem, 3vw, 3rem);
  font-family: "Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

.language {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.hero {
  position: relative;
  display: grid;
  min-height: calc(100svh - 3.5rem);
  grid-template-columns: minmax(18rem, 0.75fr) minmax(30rem, 1.25fr);
  gap: clamp(1.5rem, 4vw, 5rem);
  align-items: center;
  padding: clamp(1.25rem, 3vw, 3.5rem) clamp(1rem, 3vw, 3rem) clamp(2rem, 4vw, 4rem);
  background-image:
    linear-gradient(rgba(255, 243, 214, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 243, 214, 0.1) 1px, transparent 1px);
  background-size: 2rem 2rem;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: clamp(0.35rem, 0.8vw, 0.7rem) solid var(--seam);
}

.hero-copy,
.game-board {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 35rem;
}

.eyebrow,
.round-label,
.keyboard-hint,
.trust {
  font-family: "Plex Mono", monospace;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--thread);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: "Archivo Narrow", "Arial Narrow", sans-serif;
  font-weight: 700;
  line-height: 0.91;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 10ch;
  margin-bottom: 1.2rem;
  font-size: clamp(4rem, 7.4vw, 7.8rem);
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2.5rem, 5vw, 5rem);
}

.deck {
  max-width: 36ch;
  margin-bottom: 1.1rem;
  font-size: clamp(1.08rem, 1.6vw, 1.35rem);
  line-height: 1.35;
}

.trust {
  max-width: 48ch;
  margin-bottom: 0;
  color: rgba(255, 243, 214, 0.82);
  font-size: 0.72rem;
  line-height: 1.5;
}

.trust span {
  color: var(--thread);
}

.game-board {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
  border: 2px solid var(--chalk);
  background: rgba(11, 43, 105, 0.84);
  box-shadow: 0.9rem 0.9rem 0 var(--seam);
}

.game-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed rgba(255, 243, 214, 0.45);
  padding-bottom: 0.7rem;
}

.round-label {
  margin: 0;
  color: var(--thread);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cut-record {
  display: flex;
  margin: 0;
  gap: 0.4rem;
  padding: 0;
  list-style: none;
}

.cut-record li {
  display: grid;
  width: 2.15rem;
  min-height: 1.8rem;
  place-items: center;
  border: 1px solid rgba(255, 243, 214, 0.52);
  color: var(--ink);
  font-family: "Plex Mono", monospace;
  font-size: 0.55rem;
}

.cut-record li[data-complete="true"] {
  border-color: var(--thread);
  background: var(--thread);
}

.instruction {
  margin: 1rem 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.ribbon-control {
  width: 100%;
  cursor: crosshair;
  outline: 0;
  touch-action: pan-y;
}

.ribbon-control svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 48vh;
  overflow: visible;
}

.ribbon-shadow,
.ribbon,
.ribbon-second,
.ribbon-stitch,
.ribbon-hit {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ribbon-shadow {
  stroke: var(--ink);
  stroke-width: 64;
  transform: translate(9px, 10px);
}

.ribbon {
  stroke: var(--cloth);
  stroke-width: 58;
}

.ribbon-second {
  stroke: var(--thread);
  stroke-width: 58;
  opacity: 0;
}

.hero[data-phase="result"] .ribbon-second {
  opacity: 1;
}

.ribbon-stitch {
  stroke: var(--chalk);
  stroke-width: 2.5;
  stroke-dasharray: 0.006 0.018;
  opacity: 0.82;
}

.ribbon-hit {
  stroke: transparent;
  stroke-width: 106;
  pointer-events: stroke;
}

.scissors {
  opacity: 0;
  transition: opacity 120ms ease;
}

.scissors[data-placed="true"],
.ribbon-control:focus-visible .scissors {
  opacity: 1;
}

.scissors line,
.scissors path {
  fill: none;
  stroke: var(--chalk);
  stroke-width: 6;
  stroke-linecap: round;
}

.scissors circle {
  fill: var(--seam);
  stroke: var(--chalk);
  stroke-width: 5;
}

.ribbon-control:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 0.25rem;
}

.keyboard-hint {
  margin: -0.5rem 0 0.5rem;
  color: rgba(255, 243, 214, 0.72);
  font-size: 0.68rem;
}

.cut-comparison {
  position: relative;
  height: 4.6rem;
  margin: 0.2rem 0 0.65rem;
  border-left: 2px solid var(--chalk);
  animation: comparison-in 520ms cubic-bezier(0.18, 0.78, 0.24, 1) both;
}

.comparison-bar {
  position: absolute;
  left: 0;
  height: 1.2rem;
  border-right: 4px solid var(--chalk);
  transition: width 420ms cubic-bezier(0.18, 0.78, 0.24, 1);
}

.first-bar {
  top: 0.75rem;
  background: var(--cloth);
}

.second-bar {
  top: 2.45rem;
  background: var(--thread);
}

.comparison-edge {
  position: absolute;
  top: 0.2rem;
  bottom: 0.2rem;
  left: 50%;
  border-left: 1px dashed rgba(255, 243, 214, 0.72);
}

.round-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.8fr);
  gap: 1rem;
  align-items: baseline;
}

.round-result p {
  margin-bottom: 0;
  color: rgba(255, 243, 214, 0.78);
  font-size: 0.84rem;
}

.result-value {
  margin-bottom: 0;
  color: var(--thread);
  font-family: "Archivo Narrow", "Arial Narrow", sans-serif;
  font-size: clamp(2rem, 4.2vw, 3.8rem);
  font-weight: 700;
  line-height: 0.95;
}

.next-button,
.summary-actions button,
.error-link {
  min-height: 3rem;
  border: 2px solid var(--chalk);
  border-radius: 0;
  padding: 0.65rem 1rem;
  background: var(--chalk);
  color: var(--ink);
  font-family: "Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.next-button {
  margin-top: 1rem;
}

.next-button:hover,
.summary-actions button:hover,
.error-link:hover {
  background: var(--thread);
}

.summary {
  margin-top: 1.1rem;
  border-top: 2px solid var(--thread);
  padding-top: 1.1rem;
  outline: none;
}

.summary h2 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
}

.summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.summary dl div {
  border-top: 1px dashed rgba(255, 243, 214, 0.6);
  padding-top: 0.65rem;
}

.summary dt {
  font-size: 0.78rem;
}

.summary dd {
  margin: 0.15rem 0 0;
  color: var(--thread);
  font-family: "Plex Mono", monospace;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.summary-actions button:last-child {
  background: transparent;
  color: var(--chalk);
}

.share-status {
  min-height: 1.5em;
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
}

.method {
  max-width: 54rem;
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 8rem) clamp(1.25rem, 4vw, 3rem);
}

.method p:not(.eyebrow) {
  max-width: 58ch;
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
}

footer {
  border-top: 1px solid rgba(255, 243, 214, 0.42);
  padding: 1.3rem clamp(1rem, 3vw, 3rem);
  font-family: "Plex Mono", monospace;
  font-size: 0.7rem;
}

footer p {
  margin: 0;
}

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

.error-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 2rem;
  background-image:
    linear-gradient(rgba(255, 243, 214, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 243, 214, 0.1) 1px, transparent 1px);
  background-size: 2rem 2rem;
}

.error-page main {
  max-width: 42rem;
}

.error-page h1 {
  max-width: 12ch;
}

.error-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 0.25rem;
}

@keyframes comparison-in {
  from {
    opacity: 0;
    transform: translateY(-1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
    align-content: start;
  }

  .hero-copy {
    max-width: 46rem;
  }

  h1 {
    max-width: 12ch;
    font-size: clamp(3.8rem, 13vw, 6.8rem);
  }

  .game-board {
    box-shadow: 0.6rem 0.6rem 0 var(--seam);
  }

  .ribbon-control svg {
    max-height: none;
  }
}

@media (max-width: 540px) {
  .site-nav {
    min-height: 3rem;
    padding: 0.25rem 1rem;
  }

  .hero {
    min-height: calc(100svh - 3rem);
    gap: 1rem;
    padding: 1rem 0.85rem 1.75rem;
    background-size: 1.5rem 1.5rem;
  }

  .eyebrow {
    margin-bottom: 0.45rem;
  }

  h1 {
    margin-bottom: 0.7rem;
    font-size: clamp(3.15rem, 15.3vw, 4.4rem);
  }

  .deck {
    margin-bottom: 0.65rem;
    font-size: 1rem;
  }

  .trust {
    font-size: 0.64rem;
  }

  .game-board {
    padding: 0.8rem;
  }

  .round-label {
    font-size: 0.62rem;
  }

  .cut-record {
    gap: 0.22rem;
  }

  .cut-record li {
    width: 1.55rem;
    min-height: 1.45rem;
    font-size: 0.46rem;
  }

  .instruction {
    margin-top: 0.7rem;
    font-size: 0.9rem;
  }

  .ribbon-control svg {
    margin: -0.4rem 0 -0.75rem;
  }

  .keyboard-hint {
    display: none;
  }

  .round-result {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .result-value {
    font-size: 2.25rem;
  }

  .next-button {
    width: 100%;
  }

  .summary-actions button {
    flex: 1 1 10rem;
  }

  .method {
    padding-top: 4.5rem;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
