/* The homepage console uses the same paper, ink and vermilion as the game. */
.hero {
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(24px, 5vw, 78px);
  padding-block: clamp(35px, 5vw, 72px);
}

.hero-copy { min-width: 0; }
.hero-description { max-width: 28em; }
.practice-stage [hidden] { display: none; }

.practice-stage {
  position: relative;
  isolation: isolate;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 5px 7px 0 var(--ink);
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding-inline: clamp(12px, 2.5vw, 26px);
  border-radius: 12px 12px 0 0;
  background: var(--ink);
  color: var(--paper);
}

.stage-bar h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Arial, sans-serif;
  font-size: 16px;
  letter-spacing: .07em;
}

.stage-bar h2 span:last-child {
  padding-left: 10px;
  border-left: 1px solid #8a887d;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .06em;
}

.stage-lamp {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--yellow);
}

.practice-stage button { font-family: inherit; cursor: pointer; }
.practice-stage :is(button, a):focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.motion-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
}

.stage-bar .motion-toggle:focus-visible { outline-color: var(--yellow); outline-offset: -2px; }
.motion-icon {
  width: 10px;
  height: 11px;
  border-inline: 3px solid currentColor;
}
.motion-toggle[aria-pressed="false"] .motion-icon {
  width: 0;
  height: 0;
  border: solid transparent;
  border-width: 6px 0 6px 9px;
  border-left-color: currentColor;
}

.stage-well {
  position: relative;
  display: grid;
  min-height: clamp(22.5rem, 34vw, 28rem);
  margin: 10px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #bebaab;
  border-radius: 5px;
  background-color: #e8e9dc;
  background-image: radial-gradient(#a4a998 1px, transparent 1px);
  background-size: 9px 9px;
}

.mascot-scene, .quiz-sheet { grid-area: 1 / 1; min-width: 0; }
.mascot-scene { position: relative; isolation: isolate; }

.stage-disc {
  position: absolute;
  top: 47%;
  left: 50%;
  width: min(76%, 345px);
  aspect-ratio: 1;
  border: 1px solid #a47d37;
  border-radius: 50%;
  background: var(--yellow);
  transform: translate(-50%, -50%);
}

.disc-orbit {
  position: absolute;
  inset: 5%;
  border: 1px dashed #8f702f;
  border-radius: inherit;
}
.disc-orbit::before, .disc-orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid var(--ink);
  background: var(--red);
  transform: translate(-50%, -50%) rotate(45deg);
}
.disc-orbit::after { left: 100%; background: var(--white); }

.paper-hand {
  position: absolute;
  top: 15%;
  right: 10%;
  width: 37px;
  height: 50px;
  transform: rotate(15deg);
}
.paper-hand i {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--white);
  transform-origin: 50% 95%;
}
.paper-hand i:first-child { transform: rotate(-32deg); background: var(--red); }
.paper-hand i:nth-child(2) { transform: rotate(-16deg); background: var(--yellow); }
.paper-hand i:last-child::after {
  content: "";
  position: absolute;
  inset: 28%;
  background: var(--red);
  clip-path: polygon(45% 0, 90% 0, 60% 40%, 90% 40%, 13% 100%, 39% 56%, 11% 56%);
}

.mascot-shadow {
  position: absolute;
  bottom: 9%;
  left: 26%;
  width: 48%;
  height: 8%;
  border-radius: 50%;
  background: #5d573c36;
}
.mascot-track {
  position: absolute;
  inset: 4% 8% 9%;
}
.mascot-float { height: 100%; transform-origin: 50% 86%; }
.mascot-float img { width: 100%; height: 100%; object-fit: contain; }

.draw-trigger {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  padding: 0 15px 14px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--white);
  text-decoration: none;
  touch-action: manipulation;
}
.practice-stage .draw-trigger:focus-visible { outline-offset: -4px; }
.draw-key {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 45px;
  padding: 8px 19px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--red);
  box-shadow: 0 4px 0 var(--ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}
.draw-key > span:last-child { font-size: 20px; }
.card-icon {
  position: relative;
  width: 13px;
  height: 17px;
  border: 1.5px solid var(--paper);
  border-radius: 2px;
  transform: rotate(-12deg);
}
.card-icon::after {
  content: "";
  position: absolute;
  inset: 3px -5px -4px 4px;
  border: 1.5px solid var(--paper);
  border-radius: 2px;
  background: var(--red);
  transform: rotate(22deg);
}
.draw-trigger:active .draw-key { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.practice-stage:not([data-view="lobby"]) .mascot-scene { opacity: .2; }
.quiz-sheet {
  position: relative;
  align-self: center;
  margin: clamp(12px, 3.3%, 24px);
  padding: 13px clamp(14px, 4%, 26px) 23px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 3px 4px 0 var(--ink);
  color: var(--ink);
  transform-origin: 22% 93%;
}
.card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed #c3bda9;
}
.card-subject {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}
.card-subject::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--red);
  transform: rotate(-8deg);
}
.card-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-right: -6px;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--muted);
  font-size: 12px;
}
.card-back span { font-size: 19px; }
.quiz-word {
  margin: clamp(14px, 2vw, 24px) 0 7px;
  font: 750 clamp(26px, 3.5vw, 46px)/1.08 Arial, sans-serif;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.quiz-word:focus, .result-heading:focus { outline-offset: 4px; }
.question-hint { margin: 0 0 17px; color: var(--muted); font-size: 13px; }
.quiz-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.quiz-choice, .next-card {
  min-height: 46px;
  padding: 8px 11px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 2px 0 var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  touch-action: manipulation;
}
.quiz-choice { background: var(--paper); color: var(--ink); text-align: center; }
.quiz-choice:active, .next-card:active { transform: translateY(2px); box-shadow: none; }
.result-pane { padding-top: 8px; }
.result-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(19px, 2vw, 26px);
  line-height: 1.45;
}
.result-stamp {
  display: inline-block;
  padding: 3px 7px;
  border: 2px solid currentColor;
  border-radius: 4px;
  color: #41623b;
  font-size: 13px;
  letter-spacing: .04em;
  transform: rotate(-4deg);
}
[data-view="miss"] .result-stamp { color: #964024; transform: none; }
.result-pane p { margin: 11px 0 15px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 17px; }
.next-card { background: var(--ink); color: var(--paper); box-shadow: 0 2px 0 #747466; }
.next-card span { margin-left: 8px; }
.result-actions a { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; font-size: 12px; }

.arcade-rule {
  height: 9px;
  border-block: 1px solid var(--ink);
  background: repeating-linear-gradient(115deg, var(--yellow) 0 22px, var(--ink) 22px 24px, var(--paper) 24px 29px);
}
.games .section-heading h2 { margin-top: 0; }

@media (max-width: 700px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-block: 25px 34px; }
  .hero h1 { font-size: clamp(33px, 9vw, 53px); line-height: 1.28; }
  .hero h1 br { display: none; }
  .hero .marked::after { bottom: 2px; height: 7px; }
  .hero-description { margin: 12px 0 0; font-size: 13px; line-height: 1.8; }
  /* The header's play link remains in reach above the sampler on phones. */
  .hero .hero-game-link { display: none; }
  .practice-stage { width: 100%; max-width: 460px; margin-inline: auto; box-shadow: 3px 5px 0 var(--ink); }
  .stage-well { min-height: clamp(19rem, 82vw, 24rem); margin: 6px; }
  .paper-hand { width: 28px; height: 38px; right: 9%; }
  .quiz-sheet { margin: 11px; padding: 6px 12px 17px; }
  .quiz-choice { font-size: 13px; }
}

@media (hover: hover) and (pointer: fine) {
  .draw-trigger:hover .draw-key { background: #a83626; }
  .quiz-choice:hover { text-decoration: underline; text-underline-offset: 4px; }
  .card-back:hover, .result-actions a:hover { color: var(--red); }
}

@media (prefers-reduced-motion: no-preference) {
  html[data-motion="on"] .marked::after {
    transform-origin: left;
    animation: ink-swipe .65s cubic-bezier(.2,.75,.2,1) both;
  }
  html[data-motion="on"] .mascot-track {
    transform: translate(var(--drift, 0px), 0) rotate(var(--lean, 0deg));
    transition: transform .18s ease-out;
  }
  html[data-motion="on"] .practice-stage:not([data-view="lobby"]) .mascot-track {
    transform: translate(-7%, 5%) rotate(-6deg) scale(.91);
  }
  html[data-motion="on"] .mascot-scene { transition: opacity .22s ease; }
  html[data-motion="on"] .draw-key { transition: transform .12s, box-shadow .12s; }
  html[data-motion="on"] .practice-stage[data-view="hit"] .quiz-sheet::after {
    content: "";
    position: absolute;
    top: 18%;
    left: 64%;
    width: 5px;
    height: 10px;
    pointer-events: none;
    background: var(--yellow);
    box-shadow: -21px 9px 0 var(--red), 23px -8px 0 #587048, 44px 10px 0 var(--yellow);
    opacity: 0;
    animation: paper-scatter .55s ease-out;
  }
  .practice-stage[data-awake="true"][data-view="lobby"] .mascot-float {
    animation: companion-float 3.8s ease-in-out infinite;
  }
  .practice-stage[data-awake="true"][data-view="lobby"] .mascot-shadow {
    animation: floor-breathe 3.8s ease-in-out infinite;
  }
  .practice-stage[data-awake="true"][data-view="lobby"] .disc-orbit {
    animation: disc-turn 26s linear infinite;
  }
  .practice-stage[data-awake="true"][data-view="lobby"] .paper-hand {
    animation: cards-fan 3.8s ease-in-out infinite;
  }
  html[data-motion="on"] .faq details[open] > p,
  html[data-motion="on"] .sample-word[open] > p {
    animation: paper-open .23s ease-out;
  }
  @keyframes ink-swipe {
    from { transform: rotate(-2deg) scaleX(.08); }
    to { transform: rotate(-2deg) scaleX(1); }
  }
  @keyframes companion-float {
    0%, 100% { transform: translateY(2px) rotate(-2deg); }
    50% { transform: translateY(-7px) rotate(2deg); }
  }
  @keyframes floor-breathe {
    0%, 100% { transform: scaleX(1); }
    50% { transform: scaleX(.87); }
  }
  @keyframes disc-turn { to { transform: rotate(1turn); } }
  @keyframes paper-scatter {
    0% { opacity: 0; transform: translateY(9px) scale(.55); }
    22% { opacity: .95; }
    100% { opacity: 0; transform: translateY(-24px) scale(1.15) rotate(16deg); }
  }
  @keyframes cards-fan {
    0%, 100% { transform: translateY(0) rotate(15deg); }
    50% { transform: translateY(4px) rotate(22deg); }
  }
  @keyframes paper-open {
    from { opacity: .65; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

html[data-motion="off"] { scroll-behavior: auto; }
html[data-motion="off"] .button { transition: none; }
html[data-motion="off"] .button:hover { transform: none; }
