/* Trawl. A quiet sheet of letters on the night page: a lifted panel, large serif capitals, found
   words held in soft translucent pills (one calm tint per word), the list crossing off beneath,
   and the secret's empty slots waiting at the bottom. The page tokens (--bg, --ink, --gold and
   friends) are set inline by the Function. One off-white filled button per screen at most (Spell
   it, then Share), the rest outlined or plain text; gold is an accent, never a filled button.
   Transform and opacity motion only, eased, none when the reader asks for less. */

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.tw { width: 100%; max-width: 552px; margin: 0 auto; padding: 0 16px 8px; }
html.gm-play .tw { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 16px; }
html.gm-play .tw-app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- the static introduction the script replaces ---- */
.tw-intro { padding: 18px 0 8px; }
.tw-intro-h { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; font-size: 23px; line-height: 1.3; }
.tw-intro-p { margin: 0 0 12px; font-size: 16.5px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.tw-steps { margin: 10px 0 0; padding-left: 22px; }
.tw-steps li { margin: 0 0 6px; padding-left: 2px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.tw-steps li::marker { color: var(--gold); font-family: var(--serif); }

/* ---- playing ---- */
.tw-play { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 0 max(10px, env(safe-area-inset-bottom)); -webkit-user-select: none; user-select: none; }
.tw-status { flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 2px 0; }
.tw-found { margin: 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tw-found b { margin-right: 1px; font-family: var(--serif); font-weight: 400; font-size: 22px; color: var(--ink); }
.tw-theme { margin: 0; min-width: 0; font-size: 14px; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The stage grows to the board's own size and no more, so spare height on a tall phone splits
   evenly above the board and above the buttons instead of pooling around the grid. */
.tw-stage { flex: 1 1 auto; min-height: 0; max-height: calc(min(100vw, 552px) - 16px); margin-top: auto; display: flex; align-items: center; justify-content: center; padding: 10px 0 6px; container-type: size; }

/* The board: sized to the space, every size inside in container units of the board, so the
   letters, the pills and the rings scale together from a 6 by 6 to an 8 by 8. */
.tw-board {
  position: relative;
  width: min(100cqw, 100cqh, 520px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(241, 239, 233, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 24px 48px -28px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.35);
  container-type: inline-size;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.tw-board:focus { outline: none; }
.tw-board:focus-visible { outline: 1.5px solid rgba(232, 193, 105, 0.6); outline-offset: 5px; border-radius: 18px; }
.tw-cells { position: absolute; inset: 0; z-index: 2; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); pointer-events: none; }
.tw-cell { display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 500; font-size: calc(100cqw / var(--n) * 0.5); line-height: 1; color: var(--ink); font-variant-numeric: lining-nums; transition: color 260ms var(--ease), opacity 260ms var(--ease); }
.tw-board.is-kb .tw-cell.is-cursor { border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.7); }
.tw-marks, .tw-hints { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.tw-hints { z-index: 1; }

/* A pill: positioned and turned by the script in board percentages; its face is the <i>. */
.tw-pill { position: absolute; pointer-events: none; }
.tw-pill > i { position: absolute; inset: 0; border-radius: 999px; transform-origin: calc(50cqw / var(--n)) 50%; }
.tw-found-pill > i { background: rgba(var(--rgb), 0.2); box-shadow: inset 0 0 0 1.5px rgba(var(--rgb), 0.5); }
.tw-found-pill.is-shown > i { background: rgba(241, 239, 233, 0.06); box-shadow: inset 0 0 0 1.25px rgba(241, 239, 233, 0.28); }
.tw-sel { z-index: 3; }
.tw-sel > i { background: rgba(241, 239, 233, 0.12); box-shadow: inset 0 0 0 1.5px rgba(241, 239, 233, 0.55); transition: opacity 200ms var(--ease); }
.tw-sel.is-anchor > i { background: rgba(232, 193, 105, 0.16); box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.8); }
.tw-sel.is-miss > i { opacity: 0; transition: opacity 340ms var(--ease) 40ms; }
.tw-hint-dot > i { box-shadow: inset 0 0 0 1.75px rgba(232, 193, 105, 0.85), 0 0 18px -4px rgba(232, 193, 105, 0.55); background: rgba(232, 193, 105, 0.1); }
.tw-hint-line > i { box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.55); background: transparent; border: 1.5px dashed rgba(232, 193, 105, 0.6); box-shadow: none; }

/* Every word found: the leftover letters wait in gold, then light one by one as they spell. */
.tw-board.is-done .tw-cell.is-left { color: var(--gold); }
.tw-cell.is-left { position: relative; }
.tw-cell.is-left::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; background: rgba(232, 193, 105, 0.1); box-shadow: inset 0 0 0 1px rgba(232, 193, 105, 0.35); opacity: 0; transition: opacity 300ms var(--ease); z-index: -1; }
.tw-board.is-done .tw-cell.is-left::before { opacity: 1; }
.tw-cell.is-lit::before { background: rgba(232, 193, 105, 0.24) !important; box-shadow: inset 0 0 0 1.5px var(--gold) !important; }

.tw-help { flex: none; margin: 0; padding: 2px 0 0; min-height: 22px; font-size: 14px; line-height: 1.45; color: var(--muted); text-align: center; }

/* The list: the day's words, crossing off as they are found. */
.tw-words { flex: none; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 8px 0 0; padding: 0 4px; }
.tw-word { position: relative; font-family: var(--serif); font-size: 18.5px; line-height: 1.5; color: var(--ink); transition: color 260ms var(--ease); }
.tw-words.is-many .tw-word { font-size: 17px; }
.tw-word > span { position: relative; }
.tw-word > span::after { content: ""; position: absolute; left: -3px; right: -3px; top: 54%; height: 1.5px; border-radius: 1px; background: rgb(var(--rgb)); transform: scaleX(0); transform-origin: left center; transition: transform 320ms var(--gm-quart); }
.tw-word.is-found { color: var(--muted); }
.tw-word.is-found > span::after { transform: scaleX(1); }
.tw-word.is-shown > span::after { background: rgba(241, 239, 233, 0.4); }

/* The secret: its empty slots under the list, filled in gold at the end. */
.tw-secret { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0 0; }
.tw-secret-l { font-size: 14px; color: var(--muted); }
.tw-slots { display: inline-flex; gap: 5px; }
.tw-slot { display: flex; align-items: center; justify-content: center; width: 26px; height: 30px; border-radius: 7px; background: rgba(241, 239, 233, 0.035); box-shadow: inset 0 -1.5px 0 rgba(241, 239, 233, 0.22); font-family: var(--serif); font-style: normal; font-weight: 500; font-size: 17px; color: var(--gold); }
.tw-slot.is-in { background: rgba(232, 193, 105, 0.12); box-shadow: inset 0 0 0 1px rgba(232, 193, 105, 0.5); }

.tw-tools { flex: none; display: flex; align-items: center; justify-content: center; gap: 8px 24px; min-height: 58px; margin: auto 0 0; padding-top: 8px; }
.tw-hint-btn { min-height: 44px; padding: 0 26px; font-size: 15px; }
.tw-spell { min-width: 200px; }
.tw-hint-btn.is-glow { border-color: rgba(232, 193, 105, 0.7); color: var(--gold); }

/* ---- the finished day ---- */
.tw-res-secret { display: flex; gap: 6px; margin: 0 0 18px; }
.tw-res-secret span { display: flex; align-items: center; justify-content: center; width: 42px; height: 48px; border-radius: 10px; background: rgba(232, 193, 105, 0.1); box-shadow: inset 0 0 0 1.25px rgba(232, 193, 105, 0.6); font-family: var(--serif); font-weight: 500; font-size: 25px; color: var(--gold); }
.tw-squares { display: flex; align-items: center; gap: 5px; margin: 14px 0 0; }
.tw-sq { display: block; width: 16px; height: 16px; border-radius: 4px; }
.tw-sq.is-g { background: #6fae7c; }
.tw-sq.is-y { background: var(--gold); }
.tw-sq.is-s { background: rgba(241, 239, 233, 0.22); }
.tw-lock { margin-left: 6px; font-size: 15px; line-height: 1; }
.tw-note { min-height: 0; margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-line; }
.tw-note:empty { display: none; }
.tw-src-h { margin: 0 0 4px; font-family: var(--serif); font-weight: 400; font-size: 20px; }
.tw-src { list-style: none; margin: 0; padding: 0; }
.tw-src li { border-bottom: 1px solid var(--line); }
.tw-src-a { display: grid; grid-template-columns: minmax(78px, auto) 1fr; align-items: baseline; gap: 14px; padding: 12px 0; text-decoration: none; color: inherit; }
.tw-src-w { position: relative; padding-left: 16px; font-family: var(--serif); font-size: 18px; color: var(--ink); }
.tw-src-w::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: rgba(var(--rgb), 0.9); }
.tw-src-t { font-size: 15px; line-height: 1.45; color: var(--ink-2); transition: color 160ms var(--ease); }
.tw-src-t mark { background: none; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: rgba(var(--rgb), 0.85); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
@media (hover: hover) { a.tw-src-a:hover .tw-src-t { color: var(--gold); } }
.tw-src-list { margin: 6px 0 0; font-family: var(--serif); font-size: 18px; color: var(--ink-2); }
.tw-figs { margin: 0; }

/* The five second how to: a word gets its pill. */
.tw-demo { position: relative; width: min(100%, 260px); margin: 6px auto 8px; container-type: inline-size; }
.tw-demo-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.tw-demo-grid span { display: flex; align-items: center; justify-content: center; height: 20cqw; font-family: var(--serif); font-weight: 500; font-size: 10cqw; color: var(--ink); }
.tw-demo-pill { position: absolute; left: 1.5cqw; top: 21.5cqw; width: 97cqw; height: 17cqw; border-radius: 999px; background: rgba(232, 193, 105, 0.18); box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.55); transform-origin: 8.5cqw 50%; }
.tw-demo-cap { margin: 0 0 4px; font-size: 14.5px; line-height: 1.5; color: var(--muted); text-align: center; }
.gm-sheet .tw-steps { margin-top: 14px; }

/* ---- the page under the game ---- */
.tw-about { margin: 44px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
.tw-about h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 20px; }
.tw-about p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 60ch; }

/* ---- short screens ---- */
@media (max-height: 760px) {
  .tw-status { padding-top: 10px; }
  .tw-word { font-size: 17px; line-height: 1.4; }
  .tw-words.is-many .tw-word { font-size: 16px; }
  .tw-secret { margin-top: 8px; }
  .tw-slot { width: 23px; height: 27px; font-size: 15.5px; }
  .tw-tools { min-height: 52px; padding-top: 4px; }
}
@media (max-width: 380px) {
  .tw-words { gap: 2px 14px; }
  .tw-res-secret span { width: 36px; height: 42px; font-size: 22px; }
}

/* ---- motion ---- */
@media (prefers-reduced-motion: no-preference) {
  .tw-found-pill.is-new > i { animation: tw-draw 300ms var(--gm-quart) both; }
  .tw-word.is-pop { animation: tw-pop 320ms var(--gm-quart) both; }
  .tw-hint-dot > i { animation: tw-pulse 1600ms ease-in-out infinite; }
  .tw-hint-btn.is-glow { animation: tw-glow 2400ms ease-in-out infinite; }
  .tw-board.is-done .tw-cell.is-left::before { transition-delay: calc(var(--k, 0) * 70ms); }
  .tw-cell.is-lit { animation: tw-lift 360ms var(--gm-quart) both; }
  .tw-slot.is-in { animation: tw-in 280ms var(--gm-quart) both; }
  .tw-secret.is-whole .tw-slots { animation: tw-whole 520ms var(--gm-quart) both; }
  .tw-res-secret.is-fresh span { animation: tw-in 360ms var(--gm-quart) both; animation-delay: calc(var(--k, 0) * 60ms); }
  .tw-demo-pill { animation: tw-demo 4.2s var(--gm-quart) infinite; }
}
@keyframes tw-draw { from { transform: scaleX(0.4); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
@keyframes tw-pop { 40% { transform: translateY(-2px); } }
@keyframes tw-pulse { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes tw-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(232, 193, 105, 0); } 50% { box-shadow: 0 0 0 5px rgba(232, 193, 105, 0.12); } }
@keyframes tw-lift { 50% { transform: scale(1.16); } }
@keyframes tw-in { from { transform: translateY(6px) scale(0.9); opacity: 0; } }
@keyframes tw-whole { 50% { transform: scale(1.06); } }
@keyframes tw-demo { 0%, 12% { transform: scaleX(0.17); opacity: 0; } 18% { opacity: 1; transform: scaleX(0.17); } 44%, 84% { transform: scaleX(1); opacity: 1; } 96%, 100% { transform: scaleX(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- round 9: game feel ---- */
.tw-stage { position: relative; }
/* Hint: a tactile pill with a darker edge it presses onto; gold ring when it glows */
.tw-hint-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; min-width: 120px; padding: 0 26px; border-radius: 999px; border: 1px solid rgba(232, 193, 105, 0.55); background: #1d1d21; box-shadow: 0 3px 0 #0b0b0d; color: var(--ink); font-size: 15.5px; font-weight: 600; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform 80ms ease-out, box-shadow 80ms ease-out, border-color 160ms var(--ease); }
.tw-hint-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0b0b0d; }
@media (hover: hover) { .tw-hint-btn:hover { border-color: var(--gold); } }
.tw-hint-btn.is-glow { border-color: var(--gold); color: var(--gold); }
.tw-help.is-on { color: var(--ink-2); }
/* the letters being dragged, read out above the grid */
.tw-preview { position: absolute; left: 50%; top: 0; z-index: 4; padding: 3px 12px; border-radius: 999px; background: #26262b; box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8); font-family: var(--serif); font-size: 17px; letter-spacing: 0.12em; color: var(--ink); transform: translate(-50%, -40%); opacity: 0; pointer-events: none; transition: opacity 120ms var(--ease); }
.tw-preview.is-on { opacity: 1; }
/* a found word's letters lift one after another as its pill sweeps across */
.tw-found-pill > i { background-image: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.16) 50%, transparent 65%); background-size: 300% 100%; background-repeat: no-repeat; background-position: -40% 0; }
/* the secret, as a moment over the grid */
.tw-rv { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(12, 12, 14, 0.72); border-radius: 18px; pointer-events: none; }
.tw-rv-k { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.tw-rv-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 0 12px; }
.tw-rv-t { display: flex; align-items: center; justify-content: center; width: clamp(34px, 10cqw, 54px); height: clamp(40px, 12cqw, 62px); border-radius: 10px; background: var(--gold); box-shadow: 0 3px 0 #a3823d; color: #171004; font-family: var(--serif); font-weight: 600; font-size: clamp(20px, 6cqw, 32px); background-image: linear-gradient(105deg, transparent 30%, rgba(255, 247, 222, 0.6) 50%, transparent 70%); background-size: 260% 100%; background-repeat: no-repeat; background-position: -30% 0; }
.tw-practice-tag { flex: none; margin: 10px 0 0; font-size: 13.5px; font-weight: 600; color: var(--gold); text-align: center; }
.tw-result .tw-practice-tag { text-align: left; margin: 0 0 10px; }
.tw-keep-row { margin: 6px 0 0; }
.tw-words.is-lots .tw-word { font-size: 16px; }
.tw-words.is-lots { gap: 2px 14px; }

/* a desk: say the mouse and the keys work, desks only */
.tw-deskhint { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 761px) {
  .tw-deskhint { display: block; flex: none; margin: 4px 0 0; font-size: 13.5px; color: var(--muted); text-align: center; }
  .tw-deskhint kbd { padding: 1px 6px; border-radius: 5px; background: #222226; box-shadow: 0 1.5px 0 #111114; font: inherit; font-size: 12.5px; color: var(--ink-2); }
}

/* ---- the first round ever ---- */
.tw-tour-k { margin: 0; font-family: var(--serif); font-size: 18px; color: var(--ink); }
/* the tour: one centred group (the ask, the grid, the line, the word), no gap pooling around it */
.tw-tour-mid { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding: 8px 0; }
.tw-tour-p { flex: none; margin: 0 0 12px; font-family: var(--serif); font-size: clamp(22px, 6.4vw, 28px); line-height: 1.25; color: var(--ink); text-align: center; }
.tw-tour-stage { flex: none; margin: 0; padding: 0; height: min(calc(min(100vw, 552px) - 32px), 52vh, 440px); max-height: none; }
@supports (height: 1dvh) { .tw-tour-stage { height: min(calc(min(100vw, 552px) - 32px), 52dvh, 440px); } }
.tw-tour-msg { flex: none; min-height: 48px; margin: 14px 0 0; font-size: 16px; line-height: 1.45; color: var(--ink); text-align: center; text-wrap: balance; }
.tw-tour .tw-words { margin-top: 2px; }
.tw-tour-foot { flex: none; display: flex; justify-content: center; align-items: center; min-height: 64px; margin: 6px 0 0; padding-top: 8px; }
.tw-tour .tw-status { align-items: center; }
.tw-tour-skip { flex: none; }
.tw-tour-go { min-width: min(280px, 100%); }
.tw-ptr { position: absolute; left: 0; top: 0; z-index: 5; width: 13cqw; height: 13cqw; margin: -6.5cqw 0 0 -6.5cqw; border-radius: 50%; border: 2px solid var(--gold); background: rgba(232, 193, 105, 0.25); pointer-events: none; transform: translate(87.5cqw, 37.5cqw); }

/* ---- How to play: three steps, a demo each ---- */
.tw-steps-v { display: grid; gap: 12px; margin: 2px 0 12px; }
.tw-step { display: grid; justify-items: center; gap: 10px; padding: 14px 12px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.tw-step-t { margin: 0 !important; font-size: 16.5px; line-height: 1.4; color: var(--ink); text-align: center; text-wrap: balance; }
.tw-step .tw-demo { width: min(100%, 220px); margin: 0 auto; }
.tw-demo-list { display: flex; gap: 6px 18px; }
.tw-demo-list .tw-word > span::after { transform: scaleX(1); }
.tw-demo-list .tw-word { color: var(--muted); }
.tw-demo-secret { display: flex; align-items: center; gap: 10px; }
.tw-fold summary { display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(241, 239, 233, 0.25); text-underline-offset: 4px; }

@media (prefers-reduced-motion: no-preference) {
  .tw-found-pill.is-new > i { animation: tw-sweep 420ms cubic-bezier(0.16, 1, 0.3, 1) both, tw-glint 700ms cubic-bezier(0.25, 1, 0.5, 1) 260ms both; }
  .tw-cell.is-sweep { animation: tw-letter 360ms cubic-bezier(0.25, 1, 0.5, 1) both; animation-delay: calc(var(--k, 0) * 45ms); }
  .tw-hint-btn.is-glow { animation: tw-glow 2400ms ease-in-out infinite; }
  .tw-rv { animation: tw-fade 260ms ease-out both; }
  .tw-rv-t { animation: tw-flipin 420ms cubic-bezier(0.25, 1, 0.5, 1) both, tw-shine 900ms cubic-bezier(0.25, 1, 0.5, 1) both; animation-delay: calc(var(--k, 0) * 90ms), calc(var(--k, 0) * 90ms + 500ms); }
  .tw-ptr { animation: tw-ptr 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite; }
  .tw-demo-list .tw-word > span::after { animation: tw-strike 3.6s cubic-bezier(0.25, 1, 0.5, 1) infinite both; animation-delay: calc(var(--k, 0) * 0.6s); }
  .tw-demo-secret .tw-slot { animation: tw-slotin 3.6s cubic-bezier(0.25, 1, 0.5, 1) infinite both; animation-delay: calc(var(--k, 0) * 0.25s); }
}
@keyframes tw-sweep { from { transform: scaleX(0.12); opacity: 0.4; } to { transform: scaleX(1); opacity: 1; } }
@keyframes tw-glint { from { background-position: 140% 0; } to { background-position: -40% 0; } }
@keyframes tw-letter { 40% { transform: translateY(-3px) scale(1.12); color: #fff; } }
@keyframes tw-fade { from { opacity: 0; } }
@keyframes tw-flipin { from { transform: rotateX(90deg) translateY(8px); opacity: 0; } }
@keyframes tw-shine { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes tw-ptr { 0% { transform: translate(12.5cqw, 37.5cqw) scale(1.2); opacity: 0; } 8%, 18% { transform: translate(12.5cqw, 37.5cqw) scale(0.85); opacity: 1; } 70%, 82% { transform: translate(87.5cqw, 37.5cqw) scale(0.85); opacity: 1; } 94%, 100% { transform: translate(87.5cqw, 37.5cqw) scale(1.2); opacity: 0; } }
@keyframes tw-strike { 0%, 20% { transform: scaleX(0); } 36%, 100% { transform: scaleX(1); } }
@keyframes tw-slotin { 0%, 18% { opacity: 0; transform: translateY(6px) scale(0.9); } 30%, 100% { opacity: 1; transform: none; } }

/* a tall phone: the grid is as wide as the screen allows, so the list, the secret and Hint grow
   into the height instead of leaving a gap */
@media (max-width: 600px) and (min-height: 680px) {
  .tw-status { padding-top: 18px; }
  .tw-found b { font-size: 26px; }
  .tw-help { margin-top: 4px; font-size: 15px; }
  .tw-words { gap: 8px 22px; margin-top: 14px; }
  .tw-word, .tw-words.is-many .tw-word { font-size: 21px; }
  .tw-words.is-lots .tw-word { font-size: 18.5px; }
  .tw-secret { margin-top: 20px; }
  .tw-secret-l { font-size: 15px; }
  .tw-slot { width: 29px; height: 36px; font-size: 19px; border-radius: 8px; }
  .tw-tools { min-height: 76px; }
  .tw-hint-btn { min-height: 54px; min-width: 150px; font-size: 16.5px; }
}

/* How to play: the demos sit in the kit's 184px box */
.kt-demo .tw-demo { width: 210px; margin: 0 auto; }

/* spelling the secret: the next empty slot waits in gold; a wrong letter shakes the row */
.tw-secret.is-spelling .tw-slot:not(.is-in) { box-shadow: inset 0 -1.5px 0 rgba(241, 239, 233, 0.22); }
.tw-secret.is-spelling .tw-slot:not(.is-in):first-of-type, .tw-secret.is-spelling .tw-slot.is-in + .tw-slot:not(.is-in) { box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.75); }
.tw-board.is-done { cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  .tw-secret.is-bad .tw-slots { animation: tw-shake 260ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
}
@keyframes tw-shake { 20%, 80% { transform: translateX(-2px); } 40%, 60% { transform: translateX(4px); } 50% { transform: translateX(-4px); } }

/* phones: the play stack sits centred in the height, no dead band at the top */
@media (max-width: 600px) {
  html.gm-play .tw-play:not(.tw-tour) { justify-content: center; }
  html.gm-play .tw-play:not(.tw-tour) .tw-stage { margin-top: 0; flex: 0 1 auto; height: calc(min(100vw, 552px) - 16px); }
  html.gm-play .tw-play:not(.tw-tour) .tw-tools { margin-top: 10px; }
}
@media (max-width: 380px) {
  .tw-secret { gap: 8px; }
  .tw-secret-l { white-space: nowrap; font-size: 13.5px; }
  .tw-slots { gap: 4px; }
  .tw-secret .tw-slot { width: 25px; }
}

/* a wide screen: the column and the grid follow the kit's --gm-col and --gm-board */
html.gm-wide .tw { max-width: var(--gm-col, 552px); }
html.gm-wide .tw-board { width: min(100cqw, 100cqh, var(--gm-board, 520px)); }
@media (min-width: 601px) {
  html.gm-wide .tw-stage { max-height: calc(var(--gm-board, 520px) + 16px); }
}

/* a phone on its side: the grid on the left at the full height, the count, the words, the secret and
   Hint on the right, so the grid is not squeezed to a stamp above them */
@media (orientation: landscape) and (max-height: 520px) {
  html.gm-wide .tw { max-width: min(100%, 860px); }
  html.gm-play .tw-play:not(.tw-tour) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; grid-template-areas: "stage tag" "stage status" "stage help" "stage list" "stage secret" "stage tools"; column-gap: 20px; }
  html.gm-play .tw-play:not(.tw-tour) .tw-stage { grid-area: stage; height: auto; max-height: none; margin: 0; padding: 6px 0; }
  html.gm-play .tw-play:not(.tw-tour) .tw-practice-tag { grid-area: tag; }
  html.gm-play .tw-play:not(.tw-tour) .tw-status { grid-area: status; }
  html.gm-play .tw-play:not(.tw-tour) .tw-help { grid-area: help; }
  html.gm-play .tw-play:not(.tw-tour) .tw-words { grid-area: list; align-content: center; }
  html.gm-play .tw-play:not(.tw-tour) .tw-secret { grid-area: secret; }
  html.gm-play .tw-play:not(.tw-tour) .tw-tools { grid-area: tools; margin: 0; }
  html.gm-play .tw-play:not(.tw-tour) .tw-deskhint { display: none; }
}
