:root {
  --paper: #f6efdf;
  --paper-dot: #e9dfc8;
  --ink: #1d2340;
  --ink-soft: #4a5070;
  --tile: #fffaf0;
  --red: #b3261e;
  --on-red: #ffffff;
  --green: #1e7a3c;
  --on-green: #ffffff;
  --lilac: #cdb8ff;
  --yellow: #ffcf3f;
  --mint: #7fd8b8;
  --on-bright: #1d2340;
  --focus: #2152ff;
  --display: 'Anton', 'Impact', 'Arial Narrow Bold', sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --type: 'Special Elite', 'Courier New', monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151a33;
    --paper-dot: #1e2445;
    --ink: #f6efdf;
    --ink-soft: #c5c8da;
    --tile: #232a4d;
    --red: #ff7a6b;
    --on-red: #151a33;
    --focus: #8fb0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; } /* stamp slam-in starts at 2.4x and would widen the mobile layout */
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper) radial-gradient(var(--paper-dot) 1px, transparent 1.5px) 0 0 / 14px 14px;
  color: var(--ink);
  font: 500 1.05rem/1.5 var(--body);
}
main { max-width: 28rem; margin: 0 auto; padding: 0 16px 2rem; outline: none; }
a { color: inherit; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: .02em; line-height: 1.1; }
h1:focus { outline: none; }
.headline { font-size: clamp(2rem, 9vw, 2.6rem); margin: 1rem 0 .5rem; }
.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; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .75rem 1rem; z-index: 10; }
.skip:focus { left: 16px; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

/* masthead: ransom-note logo */
.masthead { text-align: center; padding: 1rem 16px .25rem; }
.logo { text-decoration: none; display: inline-flex; gap: .3rem; flex-wrap: wrap; justify-content: center; }
.cut { font-family: var(--display); font-size: 1.6rem; padding: .05rem .5rem; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); display: inline-block; }
.cut.a { background: var(--ink); color: var(--paper); transform: rotate(-2deg); }
.cut.b { background: var(--yellow); color: var(--on-bright); transform: rotate(2deg); font-family: var(--type); }

/* ticker */
.ticker { background: var(--red); color: var(--on-red); font-family: var(--display); letter-spacing: .05em; margin: .75rem -16px 0; padding: .5rem 0; overflow: hidden; white-space: nowrap; }
.ticker span { display: inline-block; padding-left: 16px; animation: ticker 14s linear 2; } /* finite: WCAG 2.2.2, ends back at rest */
@keyframes ticker { 0%, 15% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* cards */
.card { background: var(--tile); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); border-radius: 6px; padding: 1rem; margin: 1rem 0; }
.sticker { display: inline-block; background: var(--mint); color: var(--on-bright); font-weight: 900; font-size: .9rem; padding: .15rem .6rem; border: 2px solid var(--ink); transform: rotate(-2deg); margin-bottom: .5rem; }
.games { list-style: none; padding: 0; margin: 0; }
a.game { display: block; text-decoration: none; }
a.game:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--ink); }
.vs { display: block; font-family: var(--display); font-size: 1.4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }
.chip { background: var(--yellow); color: var(--on-bright); font-weight: 900; padding: .2rem .6rem; border-radius: 999px; border: 2px solid var(--ink); }
.streak { display: block; margin-top: .5rem; font-weight: 700; }

/* word tiles */
.sentence { line-height: 2.4; margin: .25rem 0; }
.sentence.small .tile { font-size: 1rem; }
.tile {
  display: inline-block; margin: .1rem .1rem; padding: .2rem .5rem;
  background: var(--tile); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 3px; box-shadow: 3px 3px 0 var(--ink);
  font: 700 1.3rem/1.3 var(--body);
  transform: rotate(var(--tilt, 0deg));
}
.tile.f1 { font-family: var(--display); font-weight: 400; letter-spacing: .03em; }
.tile.f2 { font-family: var(--type); font-weight: 400; }
.tile.f3 { font-family: Georgia, 'Times New Roman', serif; font-style: italic; }
button.tile { cursor: pointer; min-height: 44px; min-width: 44px; transition: transform .15s ease, box-shadow .15s ease; }
button.tile:hover { transform: rotate(var(--tilt, 0deg)) translateY(-2px); }
button.tile[aria-pressed="true"] { background: var(--yellow); color: var(--on-bright); transform: rotate(var(--tilt, 0deg)) translateY(-5px) scale(1.06); box-shadow: 5px 8px 0 var(--ink); }
.tile.target { background: var(--yellow); color: var(--on-bright); border-style: dashed; }
.tile.answer { background: var(--mint); color: var(--on-bright); }
.tile.decoy { background: var(--lilac); color: var(--on-bright); border-style: dotted; }
button.tile:disabled, button.tile:disabled:hover { cursor: not-allowed; transform: rotate(var(--tilt, 0deg)); }
.orig-plain { margin: 0 0 1rem; padding: .1rem 0 .1rem .7rem; border-left: 3px solid var(--ink-soft); color: var(--ink-soft); font-style: italic; line-height: 1.45; }
.orig-plain mark { color: var(--on-bright); font-style: normal; padding: 0 .2rem; border-radius: 3px; }
.orig-plain mark.t { background: var(--mint); }
.orig-plain mark.d { background: var(--lilac); }
.round-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; margin: 0 0 .75rem; }
.role { font: 400 1.35rem var(--display); letter-spacing: .02em; }
.won { font: 400 1.1rem var(--display); padding: .1rem .6rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--tile); color: var(--ink); }
.won.me { background: var(--green); color: var(--on-green); }
.outcome { margin: 0 0 .75rem; }
.outcome mark { background: var(--red); color: var(--on-red); padding: 0 .2rem; border-radius: 3px; }
.tile.wrong { background: var(--red); color: var(--on-red); text-decoration: line-through 2px; }

/* forms */
.label { display: block; font-weight: 900; margin: 1rem 0 .4rem; font-size: 1.1rem; }
.label mark { background: var(--yellow); color: var(--on-bright); padding: 0 .3rem; }
input[type="text"], input:not([type]) {
  width: 100%; min-height: 52px; font: 700 1.4rem var(--body); padding: .5rem .75rem;
  background: var(--tile); color: var(--ink); border: 3px solid var(--ink); border-radius: 4px;
}
input[aria-invalid="true"] { border-color: var(--red); }
.word-box { position: relative; }
/* sits over the empty box, styled like the picked tile; taps go through to the input */
.pick-prompt { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; max-width: calc(100% - 1rem);
  background: var(--yellow); color: var(--on-bright); border: 2px dashed var(--ink); border-radius: 3px; padding: 0 .4rem; line-height: 1.15;
  font-weight: 800; text-align: center; pointer-events: none; }
.hint { color: var(--ink-soft); margin: .4rem 0 0; }
.waiting { font-weight: 800; border: 2px dashed var(--ink); border-radius: 6px; padding: .55rem .75rem; }
.credit { text-align: center; color: var(--ink-soft); margin: 0 auto; padding: 0 16px 1.5rem; }
.credit a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-weight: 700; }
.error { color: var(--red); font-weight: 900; min-height: 1.5em; margin: .4rem 0 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: .6rem 1.3rem; text-decoration: none; cursor: pointer;
  font: 400 1.25rem var(--display); letter-spacing: .05em; text-transform: uppercase;
  background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 6px;
  box-shadow: 4px 4px 0 var(--red);
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--red); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.big { width: 100%; font-size: 1.5rem; }
.btn.small { font-size: 1rem; min-height: 44px; }
.actions { position: sticky; bottom: 0; padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--paper) 35%); }

/* result stamps */
.stamp-wrap { text-align: center; margin: 1.5rem 0 2rem; }
.stamp {
  display: inline-block; margin: 0; padding: .05em .4em;
  font: 400 clamp(2.8rem, 15vw, 4.2rem)/1 var(--display); letter-spacing: .06em;
  color: var(--red); border: 6px solid currentColor; border-radius: 10px;
  transform: rotate(-8deg); animation: slam .4s cubic-bezier(.2, 1.6, .4, 1) both;
}
.stamp.correct { background: var(--green); color: var(--on-green); border-color: var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.stamp.fooled { color: var(--ink); position: relative; }
.stamp.fooled::after { content: ''; position: absolute; right: -1.2rem; top: -1rem; width: 2.4rem; height: 2.4rem; background: var(--ink); border-radius: 46% 54% 38% 62% / 55% 40% 60% 45%; opacity: .85; }
@keyframes slam { from { transform: scale(2.4) rotate(-20deg); opacity: 0; } to { transform: rotate(-8deg); opacity: 1; } }
.was { font-size: 1.15rem; margin: .5rem 0 0; }
.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin: .5rem 0 1rem; }
.side { position: relative; text-align: center; padding: .5rem .5rem .6rem; background: var(--tile); color: var(--ink); border: 3px solid var(--ink); border-radius: 6px; box-shadow: 4px 4px 0 var(--ink); }
.side .who { display: block; font-weight: 900; font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
.side .pts { display: block; font: 400 2.8rem/1 var(--display); }
.side.scored { background: var(--yellow); color: var(--on-bright); }
.plus { position: absolute; top: -.85rem; right: -.6rem; padding: .1rem .55rem; font: 400 1.15rem var(--display); background: var(--green); color: var(--on-green); border: 2px solid var(--ink); border-radius: 999px; transform: rotate(8deg); animation: pop .45s .35s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(0) rotate(8deg); } to { transform: rotate(8deg); } }
.history { list-style: none; padding: 0; }
.loading { font-family: var(--type); text-align: center; margin-top: 3rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tile, .cut, .sticker, .stamp, button.tile:hover, button.tile[aria-pressed="true"] { transform: none !important; }
  .ticker { white-space: normal; padding: .5rem 16px; }
  .ticker span { padding-left: 0; white-space: normal; }
}
.card .btn + .btn { margin-left: .5rem; }
