:root {
  --bg: #f6f4fb;
  --ink: #2a2733;
  --muted: #6f6a7e;
  --paper: #ffffff;
  --divider: #e3e0ec;
  --pip: #dedce8;
  --green: #62c25a;   /* design tokens for the chrome (streak dots, the sheet's bar); the BOARD keeps the engine's palette */
  --blue: #4da3f5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.app { max-width: 520px; margin: 0 auto; padding: 20px 16px 20px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Header (v23, design 1b): the icon mark at the left, the title centred, Stats / Share / About as
   34px icon buttons at the right. */
.brand { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.mark { width: 30px; height: 30px; display: block; }
.title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: .02em; text-align: center; }
.tools { display: flex; gap: 4px; justify-self: end; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; color: var(--muted); }
.glyph { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.pick { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 0; }
.sub { margin: 0; text-align: center; color: var(--muted); font-weight: 600; font-size: 15px; }
.arrow {
  font: inherit; font-size: 18px; line-height: 1; font-weight: 700; width: 30px; height: 30px;
  border-radius: 50%; border: 0; background: var(--paper); color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 16, 40, .15); cursor: pointer; padding: 0 0 2px;
}
.arrow:disabled { opacity: .25; cursor: default; }

/* ?debug=1 only: the board's phrases and tier mix, for checking boards without solving them. */
.debug { text-align: center; color: var(--muted); font-size: .78rem; margin: 8px 0 0; line-height: 1.5; }

/* FOUND pips (v23): one dot per phrase in the board, lit in the phrase's colour in the order found. */
.found { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 14px; min-height: 36px; }
body[data-mode="free"] .found { margin: 12px 0 10px; }
.found-label { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pips { display: inline-flex; gap: 5px; align-items: center; }
.pip { width: 12px; height: 12px; border-radius: 999px; background: var(--pip); display: inline-block; transition: background .2s; }
.pips.big .pip { width: 16px; height: 16px; }

/* Solved phrases fill below the board so new rows never move the letters. */
.phrases {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-content: flex-start;
}
.chip {
  --c: #999;
  display: inline-flex; align-items: center;
  padding: .45em .9em; border-radius: 999px;
  background: var(--c); color: #fff;
  box-shadow: 0 1px 2px rgba(20, 16, 40, .12);
  font-weight: 700; font-size: .95rem; letter-spacing: .06em;
  animation: chipIn .35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes chipIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.board-wrap { display: flex; justify-content: center; }
.board {
  width: 100%; max-width: 480px; aspect-ratio: 1 / 1; display: block;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.cell { transition: fill .15s, fill-opacity .15s; }
.cell.nope { animation: nope .22s ease; transform-box: fill-box; transform-origin: center; }
@keyframes nope {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
}
.tube {
  fill: none; stroke-width: 54; stroke-linecap: round; stroke-linejoin: round;
  stroke-opacity: .92; pointer-events: none;
}
.tube.done { animation: tubePop .45s ease; }
@keyframes tubePop {
  0% { stroke-width: 54; }
  45% { stroke-width: 70; stroke-opacity: 1; }
  100% { stroke-width: 54; }
}
.dot, .ring { pointer-events: none; }
.letter {
  font-size: 44px; font-weight: 600; fill: var(--ink);
  text-anchor: middle; dominant-baseline: central; pointer-events: none; font-family: inherit;
}
.letter.end { font-weight: 900; font-size: 54px; }
.letter.on { fill: #fff; }
.letter.blank { fill: #b7b3c6; }
.halo { pointer-events: none; fill-opacity: .25; }

/* The hint sits BELOW the board (v23) and shows only while nothing is found and no line is drawn. */
.hint { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.45; margin: 14px auto 0; max-width: 480px; }  /* 14px: two lines on every phone width (15px wraps to three at 375) */
.hint strong { color: var(--ink); }
.bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.btn {
  font: inherit; font-size: 15px; font-weight: 700; padding: 10px 20px; border-radius: 999px; border: 0;
  background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 16, 40, .15); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: normal;
}
.btn.primary { background: var(--ink); color: #fff; }
.btn.soft { background: var(--bg); box-shadow: none; }
.btn.wide { width: 100%; font-size: 17px; padding: 14px; gap: 8px; }
.btn:disabled { background: var(--divider); color: var(--muted); cursor: default; box-shadow: none; }

/* The copyright line is the About button, as on Word Turf and Word Ridge (v21). */
.site-footer { text-align: center; padding: 28px 12px 8px; }
.site-footer button {
  font: inherit; font-size: .78rem; letter-spacing: .03em; color: var(--muted);
  background: none; border: 0; padding: 4px 10px; cursor: pointer;
}
.site-footer button:hover { color: var(--ink); }

/* Overlays: the win card, the About card and the stats sheet share the dim backdrop. */
.banner {
  position: fixed; inset: 0; background: rgba(30, 24, 50, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10;
}
.card {
  background: var(--paper); border-radius: 22px; padding: 24px 22px 20px; text-align: center;
  box-shadow: 0 12px 40px rgba(20, 16, 40, .3); animation: cardIn .3s ease; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; align-items: center;
}
@keyframes cardIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card h2 { margin: 0; font-size: 24px; font-weight: 800; }
.card p { margin: 0 0 16px; color: var(--muted); line-height: 1.4; width: 100%; }
.card .sub-line { margin: 4px 0 0; font-size: 15px; }
.card .pips { margin-bottom: 12px; }
.card .slot { width: 100%; margin-top: 12px; }
.card .bar { margin-top: 10px; }
.card .count { margin: 14px 0 0; font-size: 13px; }
/* The win card (v23, design 1d/1e): the streak strip on the daily, the free-play progress bar on free play. */
.strip { display: grid; grid-template-columns: 1fr 1fr 1fr; width: 100%; margin: 18px 0 6px; background: var(--bg); border-radius: 16px; padding: 14px 8px; }
.strip > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.strip > div + div { border-left: 1px solid var(--divider); }
.strip b, .tile b { font-size: 28px; font-weight: 800; line-height: 1; }
.strip span, .tile span { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.progress { width: 100%; margin: 18px 0 6px; background: var(--bg); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.progress-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.progress-head span { color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.track { width: 100%; height: 8px; border-radius: 999px; background: var(--divider); overflow: hidden; }
.track.thin { height: 6px; margin-top: 8px; }
.fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #f0a020, #5cb848, #e8476a, #3d9df0, #9b5de5); transition: width .4s; }
.fill.blue { background: var(--blue); }
.about-card h2 { margin-bottom: 6px; }
.about-card .tagline { font-style: italic; }
.about-card a { color: var(--ink); font-weight: 700; }
.about-card .credits { font-size: .9rem; line-height: 1.5; }
.about-card .count { margin: 0 0 10px; font-size: .85rem; }

/* The stats sheet (v23, design 1f): a bottom sheet over the same backdrop. */
.sheet-wrap { align-items: flex-end; padding: 0; }
.sheet {
  background: var(--paper); border-radius: 26px 26px 0 0; padding: 12px 22px calc(28px + env(safe-area-inset-bottom));
  width: 100%; max-width: 520px; margin: 0 auto; max-height: 100%; overflow: auto;
  box-shadow: 0 -12px 40px rgba(20, 16, 40, .3); display: flex; flex-direction: column; align-items: center; animation: sheetIn .3s ease;
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.handle { width: 40px; height: 5px; border-radius: 999px; background: var(--divider); margin-bottom: 18px; flex-shrink: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.sheet h2 { margin: 0; font-size: 22px; font-weight: 800; }
.x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--bg); font: inherit; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0; }
.hero { width: 100%; margin-top: 18px; display: flex; flex-direction: column; align-items: center; background: var(--bg); border-radius: 20px; padding: 22px 16px 18px; }
.hero .big { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.hero .lbl { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.week { display: flex; gap: 6px; margin-top: 16px; }
.week > span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week i { display: block; width: 22px; height: 22px; border-radius: 999px; background: var(--divider); }
.week i.on { background: var(--green); }
.week small { font-size: 10px; font-weight: 700; color: var(--muted); }
.hero .cap { font-size: 12px; color: var(--muted); margin-top: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 10px; }
.tile { background: var(--bg); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.free-line { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 14px; padding: 0 4px; font-size: 14px; }
.free-line span { color: var(--muted); font-weight: 600; }
.sheet .btn.wide { margin-top: 20px; }
.sheet .count { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* The welcome (v23, design 1a): a full-screen first visit. */
.welcome { position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow: auto; display: flex; justify-content: center; }
.welcome-inner {
  width: 100%; max-width: 420px; min-height: 100%; padding: 56px 28px calc(36px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.welcome .big-mark { width: 120px; height: 120px; flex-shrink: 0; }
.welcome h2 { margin: 22px 0 4px; font-size: 34px; font-weight: 800; letter-spacing: .01em; }
.welcome .tagline { margin: 0; color: var(--muted); font-size: 17px; font-weight: 600; }
.howto { margin: 34px 0 0; display: flex; flex-direction: column; gap: 18px; width: 100%; text-align: left; }
.howto > div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; }
.howto svg { width: 120px; height: 48px; display: block; }
.howto text { text-anchor: middle; dominant-baseline: central; fill: var(--ink); font-size: 44px; font-weight: 600; font-family: inherit; }
.howto text.end { font-size: 54px; font-weight: 900; }
.howto text.w { fill: #fff; }
.howto p { margin: 0; font-size: 15px; line-height: 1.4; }
.welcome-actions { margin-top: auto; padding-top: 32px; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.welcome-actions .btn { width: 100%; font-size: 17px; padding: 15px; }
.welcome-actions p { margin: 10px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .03em; }

/* The share toast (v23, design 1g): the desktop fallback after a copy. */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 12px 20px; font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(20, 16, 40, .25); z-index: 30; opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .tube.done, .cell.nope, .card, .sheet, .chip { animation: none; }
}

/* v24 (2026-10-30): the crawlable links. A quiet "How to play" line above the copyright, the About card's rules and
   sister-game lines, and the no-JS note (the how-to page is the no-JS experience). */
.site-footer .footer-links { margin: 0 0 2px; font-size: .78rem; letter-spacing: .03em; }
.site-footer .footer-links a { color: var(--muted); text-decoration: none; padding: 4px 10px; }
.site-footer .footer-links a:hover { color: var(--ink); text-decoration: underline; }
.about-card .about-more { font-size: .85rem; line-height: 1.6; }
.noscript { max-width: 360px; margin: 16px auto 0; padding: 0 12px; text-align: center; font-size: 15px; line-height: 1.45; color: var(--muted); }
.noscript a { color: var(--ink); font-weight: 700; }

/* v25 (2026-10-30): the header mark is a button that opens the welcome. */
.mark-btn { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; display: block; line-height: 0; }
.mark-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
