/* The Zipper is a paper pattern on a tailor's bench.
   grey for the ghost of the best answer, red for waste. */
:root {
  --paper: #f3ead6;
  --paper-2: #e9dcc0;
  --paper-3: #fbf6ea;
  --ink: #2a2520;
  --ink-soft: #5d544a;
  --warm: #e0701f;
  --warm-dark: #b4530f;
  --ghost: #9a9286;
  --waste: rgb(198 47 38);
  --berry: #4b3a8f;
  --pinned: #a8a196;
  --bronze: #b5753d;
  --silver: #9fa3a8;
  --gold: #d4a72c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --board: min(calc(100vw - 24px), calc(100svh - 380px), 600px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.35;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
button:focus { outline: none; }
button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: max(6px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- top line ---------------------------------------------------------- */
.top {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
}
.boards-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 0 12px 0 10px;
  background: var(--paper-3); border: 1.5px solid var(--ink); border-radius: 4px;
  cursor: pointer; font-size: 15px;
}
.boards-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2; }
.today-btn {
  min-width: 44px; min-height: 44px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper-3); border: 1.5px solid var(--ink); border-radius: 4px; cursor: pointer; font-size: 15px;
}
.today-btn svg { width: 18px; height: 18px; flex: none; }
.today-btn[hidden] { display: none; }
.where { text-align: center; line-height: 1.15; min-width: 0; }
.game-name { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.where strong { font-size: 18px; font-weight: 600; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.badge { display: none; }
.badge svg { width: 30px; height: 30px; }

.hint {
  position: relative;
  margin: 4px 0 8px; width: 100%; max-width: var(--board);
  font-size: 17px; text-align: center; color: var(--ink);
  min-height: 2.7em;
  display: flex; align-items: center; justify-content: center;
}
.hint-text { font-weight: 600; }
.hint.busy .hint-text { opacity: 0; visibility: hidden; }
.hint.busy { min-height: 5em; margin-top: 12px; margin-bottom: 12px; }
.daily-note { width: min(100%, var(--board)); margin: -4px 0 6px; text-align: center; font-size: 15px; color: var(--ink-soft); }
.daily-note[hidden] { display: none; }
.unlock { display: flex; align-items: center; gap: 10px; justify-content: center; text-align: left; line-height: 1.2; }
.unlock > svg { width: 26px; height: 26px; flex: none; }
.unlock strong { font-size: 16px; }
.unlock .go { flex: none; white-space: nowrap; }
.unlock strong { font-weight: 600; }
.go {
  min-height: 44px; padding: 0 16px; border-radius: 4px; border: 1.5px solid var(--ink);
  background: var(--paper-3); color: var(--ink); cursor: pointer; font-size: 16px;
  animation: nudge 1.4s ease-in-out 3;
}

/* ---- key line under the board ----------------------------------------- */
.key {
  width: var(--board); margin: 12px 0 0; font-size: 17px; color: var(--ink);
  display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 12px; line-height: 1.35;
}
.key .k { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.key .key-copy { flex-basis: 100%; justify-content: center; }
.key .k svg { flex: none; }
.key .pairs { gap: 7px; flex-basis: 100%; justify-content: center; color: var(--ink); }
.key .pair { display: inline-flex; align-items: center; gap: 1px; padding: 1px 6px; border: 1px solid rgba(42, 37, 32, .25); border-radius: 3px; }
.key .pair i { font-style: normal; font-size: 15px; line-height: 16px; margin: 0 3px 0 2px; }
.key .pair svg { display: block; }
.key .cycle { flex-basis: 100%; justify-content: center; color: var(--ink); gap: 3px; }
.key .cycle .cy { display: inline-flex; align-items: center; gap: 2px; }
.key .cycle i { font-style: normal; font-size: 15px; }
.key .cycle b { font-weight: 400; color: var(--ink-soft); margin: 0 2px; }

/* ---- the plate (board) -------------------------------------------------- */
.plate {
  position: relative;
  width: var(--board); height: var(--board);
  background: var(--paper-3);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 0 0 5px var(--paper), 0 0 0 6px rgba(42, 37, 32, .55);
}
#board { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#board [tabindex]:focus { outline: none; }
#board [tabindex]:focus-visible .hit { stroke: var(--warm); stroke-width: 5; stroke-dasharray: 10 8; }
#board .grid line { stroke: rgba(42, 37, 32, .07); stroke-width: 2; }

/* forager */
.ghost { fill: none; stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 16 13; stroke-linecap: round; stroke-linejoin: round; }
.route { fill: none; stroke: var(--warm); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.chev { fill: none; stroke: var(--warm-dark); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.berry .body { fill: var(--berry); stroke: var(--ink); stroke-width: 4; }
.berry .shine { fill: rgba(255, 255, 255, .55); }
.berry .leaf { fill: #6f8f3c; stroke: var(--ink); stroke-width: 3; }
.berry.pinned .body { fill: var(--pinned); }
.berry.pinned .pin { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.berry.pinned .pinhead { fill: var(--ink); }
.berry.free { cursor: grab; }
.berry.free.dragging { cursor: grabbing; }
.berry.free.dragging .body { stroke-width: 6; }
.berry .hit { fill: transparent; }
.berry { transition: opacity .2s; }
.berry.eaten { opacity: .18; }
.pulse { fill: none; stroke: var(--berry); stroke-width: 5; transform-box: fill-box; transform-origin: center; animation: pulse 1.6s ease-out infinite; pointer-events: none; }
@keyframes pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.6); opacity: 0; } }
.choice { fill: none; stroke: var(--warm); stroke-width: 4; stroke-dasharray: 10 10; pointer-events: none; }
.choice-dot { fill: var(--warm); stroke: var(--ink); stroke-width: 2; pointer-events: none; }
.berry.rival .body { stroke: var(--warm); stroke-width: 7; }
.finger { fill: rgba(224, 112, 31, .18); stroke: var(--warm); stroke-width: 4; stroke-dasharray: 6 6; pointer-events: none; }
.finger-head { fill: none; stroke: var(--warm); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; opacity: .8; }
.finger-trail { fill: none; stroke: var(--warm); opacity: .7; stroke-width: 4; stroke-dasharray: 2 12; stroke-linecap: round; pointer-events: none; }
.finger-spot { fill: rgba(224, 112, 31, .08); stroke: var(--warm); stroke-width: 4; stroke-dasharray: 8 8; pointer-events: none; }
.readout { opacity: 0; pointer-events: none; transition: opacity .12s; }
.readout.show { opacity: 1; }
.readout rect { fill: var(--paper-3); stroke: var(--ink); stroke-width: 4; }
.readout text { font: 600 50px var(--serif); fill: var(--ink-soft); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.readout.hot text { fill: var(--waste); }
.readout.m1 rect { stroke: var(--bronze); stroke-width: 9; }
.readout.m2 rect { stroke: var(--silver); stroke-width: 9; }
.readout.m3 rect { stroke: var(--gold); stroke-width: 9; }
.art.nope { animation: wiggle .4s ease-in-out; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes wiggle { 20% { transform: rotate(-14deg); } 45% { transform: rotate(12deg); } 70% { transform: rotate(-7deg); } 100% { transform: rotate(0); } }
.look { fill: none; stroke: var(--warm); stroke-width: 4; stroke-dasharray: 6 10; opacity: .8; pointer-events: none; }
.nest .bowl { fill: #a3774a; stroke: var(--ink); stroke-width: 4; }
.nest .twig { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; opacity: .6; }
.bird .b-body, .bird .b-head { fill: var(--warm); stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.bird .b-wing { fill: var(--warm-dark); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; transform-box: fill-box; transform-origin: 50% 90%; }
.bird.flying .b-wing { animation: flap .16s ease-in-out infinite alternate; }
@keyframes flap { from { transform: scaleY(1); } to { transform: scaleY(-.7); } }
.bird .b-ink { fill: var(--ink); }
.bird .b-tail { fill: var(--warm-dark); stroke: var(--ink); stroke-width: 3.5; stroke-linejoin: round; }
.bird { pointer-events: none; }

/* bead worlds */
.bead .shape { stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.bead text { font: 600 30px var(--serif); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.bead .hit { fill: transparent; }
.bead.free { cursor: pointer; }
.bead.pinned .shape { stroke-dasharray: 7 6; fill-opacity: .42; }
.lock .shackle { fill: none; stroke: var(--ink); stroke-width: 5; }
.lock .lock-body { fill: var(--ink); }
.bead.nope-lock .lock { animation: lockpop .4s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes lockpop { 40% { transform: scale(1.5); } }
.bead.suggest .invite { display: block; animation: pulse 1.8s ease-out infinite; }
.bead.guide .shape { stroke: var(--warm); stroke-width: 7; }
.bead.changing .art { animation: bead-change-out .2s ease-in forwards; transform-box: fill-box; transform-origin: center; }
.bead.changed .art { animation: bead-change-in .4s cubic-bezier(.2, .9, .3, 1.35); transform-box: fill-box; transform-origin: center; }
@keyframes bead-change-out { 0% { transform: scale(1); opacity: 1; } 55% { transform: scale(1.28) rotate(12deg); opacity: 1; } 100% { transform: scale(.78) rotate(24deg); opacity: .2; } }
@keyframes bead-change-in { 0% { transform: scale(.72) rotate(-20deg); opacity: .2; } 65% { transform: scale(1.2) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
.cmp { fill: none; stroke: var(--warm); stroke-width: 8; pointer-events: none; opacity: .9; }
.peek { fill: none; stroke: var(--ink-soft); stroke-width: 6; stroke-dasharray: 9 8; pointer-events: none; }
.peek.hit { stroke: var(--warm); }
.peek-line { fill: none; stroke: var(--ink-soft); stroke-width: 5; stroke-dasharray: 2 12; stroke-linecap: round; pointer-events: none; }
.peek-line.hit { stroke: var(--warm-dark); }
.critter .c-art { transition: transform .2s ease-out; }
.critter.parked .c-art { transform: scale(.8); }
.start-arrow { pointer-events: none; }
.start-arrow .arc { fill: none; stroke: var(--warm-dark); stroke-width: 6; stroke-linecap: round; }
.start-arrow .head { fill: none; stroke: var(--warm-dark); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.start-arrow .dot { fill: var(--warm); stroke: var(--ink); stroke-width: 3; }
.ghosts { transition: opacity .35s; }
.ghosts.later { opacity: 0; }
.critter.zip, .critter.fold { transition: transform .2s ease-out; }
.bead .can { fill: none; stroke: var(--ink-soft); stroke-width: 4; stroke-dasharray: 3 7; opacity: 0; transition: opacity .2s; }
.bead.partner .can { opacity: 1; }
.bead .invite { display: none; fill: none; stroke: var(--warm); stroke-width: 5; transform-box: fill-box; transform-origin: center; pointer-events: none; }
#board.inviting .bead .invite { display: block; animation: pulse 1.8s ease-out infinite; }
.bead .skip { fill: none; stroke: var(--waste); stroke-width: 6; opacity: 0; transition: opacity .15s; }
.bead.skipped .skip { opacity: 1; }
.bead.pop .shape { animation: pop .25s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes pop { 0% { transform: scale(.75); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
.zlink { stroke-linecap: round; fill: none; }
.zlink.match { stroke: var(--warm); stroke-width: 28; stroke-dasharray: 9 9; stroke-linecap: butt; }
.zlink.match-core { stroke: var(--warm-dark); stroke-width: 5; }
.zlink.miss { stroke: var(--waste); stroke-width: 6; }
.zlink.stub { stroke: var(--waste); stroke-width: 6; stroke-dasharray: 3 9; }
.zx { stroke: var(--waste); stroke-width: 6; stroke-linecap: round; }
.zghost { stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 14 12; stroke-linecap: round; fill: none; }
.guide-caption { font: 600 24px var(--serif); fill: var(--ink-soft); text-anchor: middle; }
.guide-change { font: 600 26px var(--serif); fill: var(--warm-dark); text-anchor: middle; }
.guide-future-skip { fill: none; stroke: var(--waste); stroke-width: 5; stroke-dasharray: 8 8; opacity: .72; pointer-events: none; }
.guide-next-link { fill: none; stroke: var(--warm); stroke-width: 9; stroke-dasharray: 4 12; stroke-linecap: round; opacity: .85; pointer-events: none; animation: guide-route 1.4s linear infinite; }
.guide-next { fill: none; stroke: var(--warm); stroke-width: 5; stroke-dasharray: 9 8; pointer-events: none; }
@keyframes guide-route { to { stroke-dashoffset: -32; } }
.zipper-lesson .ghosts { opacity: 0; }
.zipper-lesson .bead.lesson-muted,
.zipper-lesson .step.lesson-muted,
.zipper-lesson .backbone { opacity: .2; }
.zipper-lesson .bead.lesson-muted .lock { display: none; }
.zipper-lesson-waiting .links { opacity: 0; }
.zipper-lesson-waiting .critter { opacity: .16; }
.step { transition: opacity .15s; }
.step.later { opacity: 0; }
.backbone { fill: none; stroke: var(--ink); stroke-width: 4; opacity: .55; }
.chord { fill: none; stroke: var(--warm); stroke-width: 11; stroke-linecap: round; }
.chord-ghost { fill: none; stroke: var(--ghost); stroke-width: 5; stroke-dasharray: 14 12; stroke-linecap: round; }
.critter .c-body { fill: var(--warm); stroke: var(--ink); stroke-width: 4; }
.critter .c-hole { fill: var(--paper-3); stroke: var(--ink); stroke-width: 3; }
.critter .c-ink { fill: var(--ink); }
.critter { pointer-events: none; }
.endmark { font: italic 26px var(--serif); fill: var(--ink-soft); text-anchor: middle; }

/* ---- messages: they take the hint line for a moment, never the board ---- */
.toast {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 600; color: var(--ink); text-align: center;
  opacity: 0; pointer-events: none; transform: none;
}
.toast.show { opacity: 1; }
.toast svg { width: 26px; height: 26px; flex: none; }

/* ---- waste meter ------------------------------------------------------- */
.meter { width: var(--board); margin-top: 6px; }
.meter-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; min-height: 46px; }
.meter-label { font-size: 17px; color: var(--ink); }
.meter-value { font-size: 24px; color: var(--waste); font-variant-numeric: tabular-nums; min-width: 3.2em; }
.meter-value.zero { color: var(--ink-soft); }
.best {
  grid-column: 1 / -1; justify-self: end; margin-left: 0; min-height: 38px; padding: 0 10px; border-radius: 4px;
  border: 1.5px dashed var(--ink-soft); background: transparent; cursor: pointer; font-size: 15px; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.best[hidden] { display: none; }
.best svg { width: 18px; height: 18px; }
.track { position: relative; height: 16px; margin: 4px 0 22px; border: 1.5px solid var(--ink); border-radius: 9px; background: var(--paper-3); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--waste); border-radius: 8px 0 0 8px; transition: width .12s linear; }
.fill.full { border-radius: 8px; }
.tick {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  opacity: 0; transition: opacity .3s, transform .2s;
}
.track.ready .tick { opacity: 1; }
.tick svg { width: 22px; height: 22px; display: block; }
.tick[hidden] { display: none; }
.tick b {
  position: absolute; top: 21px; left: 50%; transform: translateX(-50%);
  font-weight: 400; font-size: 16px; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tick.on b { color: var(--ink); font-weight: 600; }
.tick.on { transform: scale(1.12); }

/* ---- buttons ------------------------------------------------------------ */
.actions { width: var(--board); display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; margin-top: 14px; }
.actions.three { grid-template-columns: 1fr .8fr 1.2fr; gap: 8px; }
.btn[hidden] { display: none; }
.btn.nudge { animation: nudge 1.4s ease-in-out 3; }
.btn {
  min-height: 50px; border-radius: 4px; border: 1.5px solid var(--ink);
  background: var(--paper-3); font-size: 17px; cursor: pointer; padding: 0 12px;
}
.btn.primary { background: var(--ink); color: var(--paper-3); }
.btn:active { transform: translateY(1px); }
.btn.primary.nudge { animation: nudge 1.4s ease-in-out 3; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(42, 37, 32, 0); } 50% { box-shadow: 0 0 0 5px rgba(42, 37, 32, .35); } }

/* ---- why fold ----------------------------------------------------------- */
.why { width: var(--board); margin-top: 16px; border-top: 1px solid rgba(42, 37, 32, .25); }
.why summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-style: italic; color: var(--ink-soft); list-style: none; }
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: '+'; display: inline-block; width: 1.2em; font-style: normal; }
.why[open] summary::before { content: '−'; }
.why p { margin: 0 0 10px; font-size: 16px; }
.clear-progress { min-height: 44px; padding: 0; margin: 2px 0 10px; border: 0; background: transparent; color: var(--ink-soft); text-decoration: underline; cursor: pointer; font-size: 15px; }

/* ---- boards sheet ------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(42, 37, 32, .35); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.scrim[hidden] { display: none; }
.sheet-open #app { visibility: hidden; }
.sheet {
  width: min(640px, 100%); min-height: calc(100svh - 20px); max-height: calc(100svh - 20px); overflow-y: auto;
  background: var(--paper-2); border: 2px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0;
  padding: 6px 16px max(18px, env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { min-height: 0; max-height: 88svh; border-radius: 8px; border-bottom: 2px solid var(--ink); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font-size: 22px; font-style: italic; margin: 8px 0; }
.sheet-count { margin: 0 0 10px; font-size: 16px; color: var(--ink-soft); font-variant-caps: small-caps; }
.close { width: 44px; height: 44px; border: 0; background: transparent; font-size: 30px; cursor: pointer; }
.world { margin: 10px 0 16px; }
.world h3 { margin: 0 0 8px; font-size: 18px; font-style: italic; display: flex; align-items: baseline; gap: 8px; }
.world h3 small { font-weight: 400; font-size: 15px; color: var(--ink-soft); font-variant-caps: small-caps; font-style: normal; }
.world-state { font-style: normal; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--ink-soft); border-radius: 2px; padding: 1px 4px; color: var(--ink-soft); }
.world-state.open { border-color: var(--warm-dark); color: var(--warm-dark); }
.world-state.locked { border-style: dashed; }
.dots { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.dot {
  position: relative; min-width: 48px; min-height: 48px; border-radius: 4px; border: 1.5px solid var(--ink); background: var(--paper-3);
  cursor: pointer; font-size: 16px; display: grid; place-items: center; font-variant-numeric: tabular-nums; width: 100%;
}
.dot > svg { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; }
.dot.here { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.dot:disabled { opacity: .35; cursor: default; }
.daily-btn {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper-3); padding: 0 14px; cursor: pointer; font-size: 17px; text-align: left;
}
.daily-btn small { color: var(--ink-soft); font-size: 14px; display: block; }
.daily-btn .dl { min-width: 0; }
.daily-btn .dm { flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.daily-btn .dm svg { width: 34px; height: 34px; }
.week-label { margin: 12px 0 4px; color: var(--ink-soft); font-size: 15px; font-style: italic; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(44px, 1fr)); gap: 5px; margin: 10px 0 14px; }
.day-cell { min-width: 44px; min-height: 44px; padding: 2px; border: 1px solid var(--ink); border-radius: 4px; background: var(--paper-3); display: grid; place-items: center; cursor: pointer; }
.day-cell svg { width: 22px; height: 22px; }
.day-cell small { font-size: 13px; line-height: 1; color: var(--ink-soft); }
.day-cell.here { box-shadow: 0 0 0 2px var(--paper-3), 0 0 0 4px var(--ink); }
.world-summary .dots { margin-bottom: 16px; }
.summary-next, .summary-back { width: 100%; margin: 5px 0; }
.world h3 .new { font-style: normal; font-weight: 400; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--paper-3); border-radius: 2px; padding: 1px 5px; }
.boards-btn { position: relative; }
.boards-btn.news { box-shadow: inset 0 -4px 0 var(--warm); }
.boards-btn.news::after { content: none; }
.locked-note { font-style: italic; color: var(--ink-soft); font-size: 15px; margin: 0; }

@media (max-width: 359px) {
  .boards-btn span { display: none; }
  .boards-btn { padding: 0; justify-content: center; }
  .game-name { display: none; }
  .where strong { font-size: 16px; }
  .top { gap: 5px; }
  .sheet { padding-left: 4px; padding-right: 4px; }
  .week-strip { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse, .bird.flying .b-wing, #board.inviting .bead .invite, .bead.suggest .invite, .btn.primary.nudge, .btn.nudge, .go, .art.nope, .bead.changing .art, .bead.changed .art, .guide-next-link, .guide-pointer path { animation: none; }
  .critter .c-art, .hint-text { transition: none; }
  .critter.zip, .critter.fold, .ghosts { transition: none; }
  .fill, .tick, .toast, .step { transition: none; }
}

/* The Zipper: tailor's pattern paper. */
:root { --paper: #d9c3a0; --ink: #27221d; --brass: #b08d3e; --shortest: #736b60; --waste: #9d432c; --cream: #f2e6cc; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #b99f78; font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif; }
button, summary { font: inherit; }
button { color: inherit; }
#app { width: min(100%, 660px); min-height: 100vh; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 14px 28px; align-items: stretch; background-color: var(--paper); }
.top { min-height: 58px; display: grid; grid-template-columns: 92px 1fr auto; gap: 8px; align-items: center; border-bottom: 2px solid rgba(39,34,29,.55); }
.boards-btn, .btn, .close, .daily-btn, .pattern-cells button { min-height: 44px; border: 2px solid var(--ink); border-radius: 4px; background: var(--cream); font-weight: 800; cursor: pointer; }
.boards-btn { width: 92px; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 5px; font-size: 12px; }
.boards-btn svg { width: 19px; stroke: var(--ink); fill: none; stroke-width: 2; }
.where { min-width: 0; display: grid; line-height: 1.04; }
.game-name { font-size: 20px; font-weight: 900; letter-spacing: -.03em; }
.where small { margin-top: 3px; color: #5b5043; font-size: 11px; font-weight: 700; }
#where { overflow: hidden; margin-top: 4px; color: #58442d; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.badge { min-width: 45px; text-align: right; color: #6d4313; font-size: 12px; font-weight: 900; }
.hint { width: 100%; max-width: none; min-height: 47px; display: grid; align-content: center; margin: 7px 0 3px; font-size: 15px; font-weight: 800; line-height: 1.2; }
#hint-text { color: #332b22; }
.toast { min-height: 18px; margin-top: 2px; color: #7c2f22; font-size: 13px; font-weight: 800; }
.daily-note { display: none; }
.plate { width: 100%; height: auto; overflow: hidden; border: 2px solid var(--ink); border-radius: 5px; background: #e4d1ae; box-shadow: 3px 3px 0 rgba(39,34,29,.26); }
#board { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 650; touch-action: manipulation; }
.pattern-grid path { stroke: rgba(39,34,29,.12); stroke-width: 2; stroke-dasharray: 3 10; }
.strand-labels text { fill: #5d5244; font-size: 26px; font-weight: 900; letter-spacing: 3px; }
.tape { fill: none; stroke: #443b31; stroke-width: 15; stroke-linecap: round; stroke-dasharray: 4 14; opacity: .8; }
.bead { outline: none; cursor: pointer; }
.bead.fixed { cursor: default; opacity: .68; }
.zipper-lesson .bead.lesson-muted { opacity: .22; }
.zipper-lesson .bead-number { opacity: 0; }
.bead-hit { fill: transparent; stroke: transparent; }
.bead.free:hover .bead-hit, .bead.free:focus .bead-hit { stroke: var(--ink); stroke-width: 5; fill: rgba(255,255,255,.23); }
.bead.suggest .bead-hit { fill: rgba(176,141,62,.23); stroke: var(--brass); stroke-width: 9; animation: zipper-glow 1.25s ease-in-out infinite; }
.bead-letter { fill: #191611; font-size: 32px; font-weight: 900; pointer-events: none; }
.bead-number { fill: #665a4b; font-size: 16px; font-weight: 800; pointer-events: none; }
.stitch { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 4 7; }
.best-link { fill: none; stroke: var(--shortest); stroke-width: 10; stroke-dasharray: 13 10; opacity: .9; }
.greedy-link { fill: none; stroke: var(--brass); stroke-width: 16; stroke-linecap: round; }
.greedy-link.match { stroke: var(--brass); }
.greedy-link.miss { stroke: var(--waste); }
.miss-mark { fill: none; stroke: var(--waste); stroke-width: 7; stroke-linecap: round; }
.skipped-ring { fill: none; stroke: var(--waste); stroke-width: 7; stroke-dasharray: 9 7; }
.pull rect { fill: var(--brass); stroke: var(--ink); stroke-width: 7; }
.pull circle { fill: #e9dbbc; stroke: var(--ink); stroke-width: 6; }
.pull-label { fill: #5d5244; font-size: 18px; font-weight: 900; letter-spacing: 2px; }
.guide-pointer text { fill: var(--warm-dark); font-size: 25px; font-weight: 900; letter-spacing: 2px; text-anchor: middle; }
.guide-pointer path { fill: none; stroke: var(--brass); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; animation: guide-point 1.1s ease-in-out infinite; }
.route-note { fill: var(--waste); font-size: 19px; font-weight: 900; letter-spacing: 1px; }
.target-zone circle { fill: rgba(176,141,62,.08); stroke: var(--brass); stroke-width: 5; stroke-dasharray: 7 8; pointer-events: none; animation: target-zone 1.35s ease-in-out infinite; }
.target-zone text { fill: #66522f; font-size: 23px; font-weight: 900; pointer-events: none; }
@keyframes target-zone { 50% { opacity: .42; } }
@keyframes guide-point { 50% { transform: translateY(9px); } }
@keyframes zipper-glow { 50% { opacity: .46; } }
@media (prefers-reduced-motion: reduce) { .target-zone circle { animation: none; } }
.key { width: 100%; min-height: 27px; display: flex; flex-wrap: wrap; gap: 4px 9px; margin: 7px 0 5px; color: #504638; font-size: 11px; line-height: 1.15; font-weight: 800; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend-mark { width: 14px; height: 14px; display: inline-block; border: 2px solid var(--ink); }
.legend-mark.match { width: 19px; border: 2px solid #b08d3e; background: #b08d3e; }
.legend-mark.changed { background: #a95ca8; transform: rotate(45deg); }
.legend-mark.best { width: 18px; height: 0; border: 0; border-top: 4px dashed var(--shortest); }
.legend-mark.current { width: 18px; height: 5px; border: 0; border-radius: 4px; background: var(--brass); }
.legend-mark.fixed { border-style: dashed; border-radius: 2px; background: #bdb09a; }
.meter { width: 100%; margin: 3px 0 10px; padding: 7px 9px 8px; border: 2px solid rgba(39,34,29,.7); background: rgba(242,230,204,.75); }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.meter-label { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.meter-value { font-size: 19px; }
.route-summary { margin: 4px 0 0; color: #574a3c; font-size: 12px; font-weight: 900; }
.track { position: relative; height: 12px; margin: 12px 3px 20px; background: #97866d; border: 1px solid var(--ink); overflow: visible; }
.fill { height: 100%; background: var(--waste); transition: width .16s ease-out; }
.tick { position: absolute; top: -6px; width: 2px; height: 24px; background: var(--ink); }
.tick b { position: absolute; top: 25px; left: 50%; transform: translateX(-50%); white-space: nowrap; color: #4e4335; font-size: 10px; }
.tick.gold { background: #9c6a0d; }
.medal-words { margin: 4px 3px 0; color: #4e4335; font-size: 12px; font-weight: 800; line-height: 1.25; text-align: center; }
.actions { width: 100%; display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; }
.actions .btn { padding: 8px 6px; font-size: 14px; }
.actions .primary { border-color: #63420d; background: var(--brass); color: var(--ink); }
#b-share { grid-column: span 2; order: 1; }
.result { margin: 9px 0; padding: 11px; border: 3px solid var(--ink); background: var(--cream); box-shadow: 4px 4px 0 var(--brass); scroll-margin-top: 12px; }
.result[hidden] { display: none; }
.eyebrow { margin: 0 0 2px; color: #72531d; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.result h2 { margin: 0; font-size: 21px; line-height: 1.08; }
.result p { margin: 5px 0; font-size: 15px; line-height: 1.2; }
.result .btn { width: 100%; min-height: 42px; padding: 7px; }
.more-games { padding-top: 5px; border-top: 1px dashed #776855; color: #4f4437; font-size: 11px !important; }
.more-games a { color: #563512; font-weight: 900; }
.why { width: 100%; margin-top: 15px; border-top: 1px dashed #6e604d; padding-top: 8px; font-size: 13px; line-height: 1.35; }
.why summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 900; }
.why p { margin: 7px 0; }
.clear-progress { min-height: 44px; margin-top: 7px; border: 1px solid #7c6d57; border-radius: 3px; background: transparent; }
.scrim { position: fixed; inset: 0; z-index: 10; display: grid; align-items: end; background: rgba(31,25,18,.56); }
.scrim[hidden] { display: none; }
.sheet { width: min(100%, 660px); min-height: 0; max-height: 86vh; margin: auto; overflow: auto; border: 3px solid var(--ink); border-radius: 0; background: var(--paper); box-shadow: 0 -4px 0 var(--brass); padding: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-bottom: 2px solid var(--ink); }
.sheet-head h2 { margin: 0; font-style: normal; }
.close { width: 44px; height: 44px; font-size: 26px; line-height: 1; }
#sheet-body { padding: 12px; }
.daily-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 10px; text-align: left; }
.daily-btn span { display: grid; gap: 2px; }
.daily-btn small { font-size: 12px; font-weight: 700; }
.sheet-count { margin: 15px 0 8px; font-size: 13px; font-weight: 900; text-transform: uppercase; }
.pattern-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pattern-cells button { min-height: 68px; display: grid; align-content: center; gap: 3px; padding: 5px; background: #e9d9ba; }
.pattern-cells b { font-size: 20px; }
.pattern-cells small { font-size: 10px; }
@media (min-width: 700px) { #app { padding-top: 20px; } .plate { max-height: 530px; } }

/* L1: tailor's pattern paper. The last rules intentionally replace the
   inherited three-world field-guide skin above. */
:root {
  --paper: #d9c3a0;
  --paper-light: #ecd8b6;
  --paper-deep: #b89970;
  --ink: #201d17;
  --ink-soft: #625748;
  --brass: #b08d3e;
  --brass-light: #c8aa5a;
  --thread-top: #315e61;
  --thread-bottom: #804e4b;
  --label: Impact, "Arial Narrow", "Franklin Gothic Condensed", sans-serif;
  --body: "Avenir Next", "Trebuchet MS", Arial, sans-serif;
}
body { min-height: 100svh; background: #a98761; color: var(--ink); font-family: var(--body); }
#app {
  display: block;
  width: min(100%, 720px);
  max-width: 720px;
  min-height: 100svh;
  padding: max(10px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='4' cy='4' r='.7' fill='%23201d17' fill-opacity='.16'/%3E%3Cpath d='M16 0V32M0 16H32' stroke='%23201d17' stroke-opacity='.035' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 32px 32px;
}
.top { min-height: 58px; grid-template-columns: 94px minmax(0, 1fr) auto auto; gap: 8px; border-bottom: 2px solid var(--ink); }
.boards-btn, .btn, .close, .daily-btn, .pattern-cells button {
  min-height: 44px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper-light);
  font-family: var(--label);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.boards-btn { width: 94px; padding: 5px 7px; }
.boards-btn svg { stroke: var(--ink); stroke-width: 2.2; }
.where { display: grid; align-content: center; text-align: left; }
.game-name { font-family: var(--label); font-size: 24px; font-weight: 400; letter-spacing: .025em; }
.where small { margin-top: 4px; color: var(--ink-soft); font-family: var(--label); font-size: 11px; font-weight: 400; letter-spacing: .09em; text-transform: uppercase; }
#where { margin-top: 5px; color: var(--ink-soft); font-family: var(--label); font-size: 13px; font-style: normal; font-weight: 400; letter-spacing: .07em; text-transform: uppercase; }
.badge { display: block; min-width: 38px; color: var(--ink-soft); font-family: var(--label); font-size: 12px; font-weight: 400; letter-spacing: .06em; text-align: right; text-transform: uppercase; }
.play-lab { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); font-family: var(--label); font-size: 12px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; }
.play-lab:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.hint { min-height: 54px; margin: 8px 0 6px; padding: 6px 10px; border-left: 5px solid var(--brass); display: grid; align-content: center; font-size: 15px; font-weight: 700; line-height: 1.25; text-align: left; }
#hint-text { color: var(--ink); }
.toast { min-height: 17px; margin-top: 3px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.plate { width: 100%; height: auto; overflow: hidden; border: 2px solid var(--ink); border-radius: 0; outline: 4px solid rgba(32, 29, 23, .16); outline-offset: 3px; background: var(--paper-light); box-shadow: none; }
#board { width: 100%; height: auto; aspect-ratio: 1000 / 650; touch-action: manipulation; }
.pattern-grid .cut-line { fill: none; stroke: rgba(32, 29, 23, .55); stroke-width: 2.2; stroke-dasharray: 3 10; }
.pattern-grid .cut-mark { fill: none; stroke: rgba(32, 29, 23, .42); stroke-width: 2; }
.strand-labels text { fill: var(--ink-soft); font-family: var(--label); font-size: 28px; font-weight: 400; letter-spacing: 3px; }
.thread { fill: none; stroke-width: 14; stroke-linecap: round; stroke-dasharray: 3 12; }
.thread-top { stroke: var(--thread-top); }
.thread-bottom { stroke: var(--thread-bottom); }
.bead.fixed { opacity: .64; }
.bead.free:hover .bead-hit, .bead.free:focus .bead-hit { fill: rgba(176, 141, 62, .16); stroke: var(--ink); stroke-width: 4; }
.bead.suggest .bead-hit { fill: rgba(176, 141, 62, .25); stroke: var(--brass); stroke-width: 9; animation: zipper-glow 1.1s ease-in-out 3; }
.bead.next-suggest .bead-hit { fill: rgba(176, 141, 62, .12); stroke: var(--brass); stroke-width: 7; stroke-dasharray: 10 7; animation: zipper-glow 1.35s ease-in-out infinite; }
.next-cue path { fill: none; stroke: var(--brass); stroke-width: 4; stroke-dasharray: 3 7; }
.next-cue rect { fill: var(--paper-light); stroke: var(--brass); stroke-width: 3; }
.next-cue text { fill: var(--ink); font-family: var(--label); font-size: 24px; font-weight: 400; letter-spacing: .05em; }
.tooth-body { fill: var(--brass); stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; }
.tooth-mark { fill: none; stroke: rgba(32, 29, 23, .6); stroke-width: 3; stroke-linecap: round; }
.bead-letter { fill: var(--ink); font-family: var(--label); font-size: 34px; font-weight: 400; letter-spacing: .04em; }
.bead-number { fill: var(--ink-soft); font-family: var(--label); font-size: 18px; font-weight: 400; letter-spacing: .08em; }
.stitch { stroke: var(--ink); stroke-width: 4; stroke-dasharray: 3 6; }
.best-link { stroke: var(--ink); stroke-width: 9; stroke-dasharray: 12 9; opacity: .78; }
.greedy-link { stroke: var(--brass); stroke-width: 15; }
.greedy-link.miss { stroke: var(--brass-light); }
.miss-mark, .skipped-ring { stroke: var(--ink); stroke-width: 6; }
.skipped-ring { stroke-dasharray: 8 7; }
.pull rect { fill: var(--brass); stroke: var(--ink); stroke-width: 7; }
.pull circle { fill: var(--paper-light); stroke: var(--ink); stroke-width: 5; }
.pull-label, .route-note { fill: var(--ink); font-family: var(--label); font-size: 19px; font-weight: 400; letter-spacing: .1em; }
.guide-pointer text, .target-zone text { fill: var(--ink); font-family: var(--label); font-weight: 400; }
.guide-pointer text { font-size: 20px; letter-spacing: .055em; }
.guide-pointer path { stroke: var(--brass); animation: guide-point 1.1s ease-in-out 3; }
.target-zone circle { fill: rgba(176, 141, 62, .08); stroke: var(--brass); }
.key { width: 100%; min-height: 27px; margin: 9px 0 6px; gap: 5px 11px; color: var(--ink-soft); font-family: var(--label); font-size: 13px; font-weight: 400; letter-spacing: .035em; line-height: 1.2; text-transform: uppercase; }
.legend-item { gap: 5px; }
.legend-mark { border-radius: 0; border-color: var(--ink); }
.legend-mark.match { width: 18px; height: 14px; border: 2px solid var(--brass); background: var(--brass); }
.legend-mark.changed { background: var(--thread-bottom); }
.legend-mark.best { border-top: 4px dashed var(--ink); }
.legend-mark.current { border-radius: 0; background: var(--brass); }
.legend-mark.fixed { border-radius: 0; background: var(--paper-deep); }
.meter { margin: 3px 0 10px; padding: 8px 10px 9px; border: 2px solid var(--ink); background: rgba(236, 216, 182, .83); }
.meter[hidden], .actions[hidden] { display: none; }
.meter-label, .meter-value { font-family: var(--label); font-weight: 400; letter-spacing: .06em; text-transform: uppercase; }
.meter-label { font-size: 14px; }
.meter-value { font-size: 20px; }
.route-summary { color: var(--ink-soft); font-size: 13px; }
.track { height: 12px; margin: 11px 3px 22px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper-deep); }
.fill { background: var(--brass); }
.tick { background: var(--ink); }
.tick b { color: var(--ink-soft); font-family: var(--label); font-size: 11px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; }
.tick.gold { background: var(--brass); }
.medal-words { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.actions { width: 100%; }
.actions .primary { border-color: var(--ink); background: var(--brass); color: var(--ink); }

/* The pull never has to outrun a player.  These controls stay below the
   board, so pausing a link does not shift the board or a tooth under a thumb. */
.zip-controls { width: 100%; margin: 10px 0 0; padding: 8px 10px; border: 2px solid var(--ink); background: var(--paper-light); }
.zip-controls[hidden] { display: none; }
.zip-controls p { margin: 0 0 7px; min-height: 20px; font-size: 15px; font-weight: 700; line-height: 1.25; }
.zip-controls > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zip-controls .btn { min-height: 48px; }
.result { margin: 10px 0; padding: 12px; border: 3px solid var(--ink); background: var(--paper-light); box-shadow: 5px 5px 0 var(--brass); }
.eyebrow { color: var(--ink-soft); font-family: var(--label); font-size: 12px; font-weight: 400; letter-spacing: .1em; }
.result h2 { font-family: var(--label); font-size: 26px; font-weight: 400; letter-spacing: .015em; text-transform: uppercase; }
.more-games { border-top-color: var(--ink-soft); color: var(--ink-soft); }
.more-games a { color: var(--ink); }
.why { border-top: 2px dotted var(--ink-soft); }
.why summary { font-family: var(--label); font-size: 15px; font-weight: 400; letter-spacing: .07em; text-transform: uppercase; }
.clear-progress { border-radius: 0; }
.sheet { width: min(100%, 720px); border-color: var(--ink); background-color: var(--paper); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='4' cy='4' r='.7' fill='%23201d17' fill-opacity='.16'/%3E%3C/svg%3E"); box-shadow: 0 -5px 0 var(--brass); }
.sheet-head h2, .sheet-count { font-family: var(--label); font-weight: 400; letter-spacing: .07em; text-transform: uppercase; }
.close { border-radius: 0; font-family: var(--body); }
.daily-btn small, .pattern-cells small { font-family: var(--body); letter-spacing: 0; text-transform: none; }
.pattern-cells button { background: var(--paper-light); }
@media (max-width: 359px) {
  #app { padding-left: 9px; padding-right: 9px; }
  .top { grid-template-columns: 44px minmax(0, 1fr) auto auto; }
  .boards-btn { width: 44px; padding: 0; }
  .game-name { font-size: 21px; }
  .key { gap: 4px 7px; font-size: 11px; }
}
@media (min-width: 700px) { #app { padding-top: 16px; } .top { min-height: 62px; } .hint { min-height: 48px; } .plate { max-height: none; } }
@media (prefers-reduced-motion: reduce) { .bead.suggest .bead-hit, .guide-pointer path { animation: none; } }

/* V1: the pull is the little actor.  The route reads from its movement,
   so the play surface can stay nearly wordless. */
.pull { transform-box: fill-box; transform-origin: center; }
.pull-body { fill: var(--brass); stroke: var(--ink); stroke-width: 7; stroke-linejoin: round; }
.pull-throat { fill: #725926; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.pull-tab { fill: var(--brass-light); stroke: var(--ink); stroke-width: 6; stroke-linejoin: round; }
.pull-eye { fill: var(--ink); }
.pull-spiral { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.pull-sweat { fill: var(--thread-top); stroke: var(--ink); stroke-width: 3; }
.pull.pleased .pull-tab { animation: tab-swing .42s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: top center; }
.pull.gold .pull-body, .pull.gold .pull-throat { animation: pull-wobble .32s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
.greedy-links.ghost-route { opacity: .46; }
.ghost-route .greedy-link { stroke-dasharray: 8 10; }
.open-tooth .tooth-body { animation: tooth-spring .32s cubic-bezier(.18, .9, .27, 1.4); transform-box: fill-box; transform-origin: center; }
.ghosting .open-tooth { opacity: .48; }
.ghost-letter { fill: var(--ink); font-family: var(--label); font-size: 26px; font-weight: 400; opacity: .48; }
.action-tile rect { fill: var(--paper-light); stroke: var(--ink); stroke-width: 3; }
.action-tile text { fill: var(--ink); font-family: var(--label); font-size: 24px; font-weight: 400; letter-spacing: .05em; }
.demo-hand { fill: var(--paper-light); stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; animation: hand-tap 4s ease-in-out 2; transform-box: fill-box; transform-origin: bottom center; pointer-events: none; }
.demo-hand circle { fill: var(--ink); stroke: none; }
.demo-hand.resting { animation: none; }
@keyframes tooth-spring { 0% { opacity: .1; } 55% { transform: translateY(-12px); } 100% { opacity: 1; } }
@keyframes hand-tap { 0%, 35%, 100% { transform: translate(0, 0) rotate(0); } 46% { transform: translate(-32px, 55px) rotate(-11deg); } 55% { transform: translate(-32px, 66px) rotate(-11deg); } 67% { transform: translate(0, 0) rotate(0); } }
@keyframes tab-swing { from { transform: rotate(-11deg); } to { transform: rotate(12deg); } }
@keyframes pull-wobble { from { transform: rotate(-11deg); } to { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) {
  .demo-hand, .pull.pleased .pull-tab, .pull.gold .pull-body, .pull.gold .pull-throat, .open-tooth .tooth-body { animation: none; }
}

/* Review pass: explain one real choice at a time, and keep the score scale
   readable even when all three milestones land on a narrow phone. */
.key { font-size: 14px; justify-content: center; text-align: center; }
.route-summary { margin: 5px 0 0; font-size: 14px; }
.meter { padding: 10px 12px 11px; }
.meter-head { align-items: baseline; }
.meter-label { font-size: 15px; }
.meter-value { font-size: 23px; }
.track { margin-bottom: 10px; }
.tick b { display: none; }
.medal-words { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 0 3px; font-family: var(--label); font-size: 12px; font-weight: 400; letter-spacing: .04em; text-align: center; text-transform: uppercase; }
.medal-words span { min-width: 0; white-space: nowrap; }
.medal-words b { display: block; color: var(--ink); font-weight: 400; }
.ghosting .bead:not(.pressing) { opacity: .72; }
@media (max-width: 359px) { .medal-words { font-size: 11px; gap: 1px; } .key, .route-summary { font-size: 13px; } }

/* First-minute legibility.  These rules deliberately sit after the older
   shared skin so the Zipper keeps one stable, phone-first presentation. */
#badge { display: none; }
.top { grid-template-columns: 94px minmax(0, 1fr) auto; }
.best-link { stroke: var(--ink-soft); stroke-width: 6; opacity: .38; }
.bead-letter { font-size: 44px; }
.strand-name { fill: var(--ink-soft); font-family: var(--label); font-size: 20px; font-weight: 400; letter-spacing: .11em; }
.bead.opening-muted { opacity: .2; }
.bead.opening-muted .tooth-body { fill: var(--paper-deep); }
.open-tooth .tooth-body { fill: var(--paper-light); stroke: var(--thread-bottom); stroke-width: 6; }
.open-tooth .tooth-mark { stroke: var(--thread-bottom); stroke-width: 4; }
.miss-mark, .skipped-ring { stroke: var(--thread-bottom); }
.action-aim { fill: none; stroke: var(--brass); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 3 9; }
.pull-tether { fill: none; stroke: var(--brass); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 4 9; }
.tap-cue { fill: none; stroke: var(--brass); stroke-width: 4; stroke-dasharray: 5 8; pointer-events: none; }
.tap-cue circle:first-child { opacity: .8; animation: tap-cue 1.1s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.tap-cue circle:last-child { opacity: .42; }
.open-count {
  min-height: 31px; margin: 12px 0 0; color: var(--ink-soft); font-family: var(--label); font-size: 17px;
  font-weight: 400; letter-spacing: .055em; line-height: 1.2; text-align: center; text-transform: uppercase;
}
.open-count[hidden] { display: none; }
.result {
  margin: 12px 0 0; padding: 0; border: 0; background: transparent; box-shadow: none; text-align: center;
}
.result h2 { margin: 0; color: var(--ink); font-size: 18px; line-height: 1.2; }
.result #result-copy { display: block; margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.result #b-again { display: none; }
.action-tile text { font-size: 20px; }
@keyframes tap-cue { 0% { opacity: .9; transform: scale(.72); } 100% { opacity: 0; transform: scale(1.2); } }
@media (max-width: 359px) {
  .top { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .bead-letter { font-size: 42px; }
}
@media (prefers-reduced-motion: reduce) { .tap-cue circle:first-child { animation: none; } }

/* Feel pass: the board is a small machine.  These effects attach to the
   existing tooth, route, score and lock state rather than adding decoration. */
.top { grid-template-columns: 94px minmax(0, 1fr) auto; }
.top.has-medal { grid-template-columns: 94px minmax(0, 1fr) 58px auto; }
#badge {
  display: none;
  width: 58px;
  min-height: 44px;
  align-content: center;
  color: var(--ink-soft);
  font-family: var(--label);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .055em;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}
.top.has-medal #badge { display: grid; }
.hint { height: 60px; min-height: 60px; overflow: hidden; }

.bead { transform-box: fill-box; transform-origin: center; }
.bead.pressing {
  transform: scale(.9);
  animation: tooth-press 60ms ease-out both;
}
.bead.pressing .tooth-body { stroke-width: 6; }
@keyframes tooth-press { from { transform: scale(1); } to { transform: scale(.9); } }
.bead.flipping { animation: tooth-flip 190ms cubic-bezier(.24, .76, .31, 1.12) both; }
.bead.flipping .bead-letter:not(.flip-letter) { animation: letter-away 80ms ease-in both; }
.flip-letter { opacity: 0; animation: letter-arrive 190ms ease-out both; }
@keyframes tooth-flip {
  0% { transform: rotateY(0); }
  42% { transform: rotateY(90deg); }
  78% { transform: rotateY(-6deg); }
  100% { transform: rotateY(0); }
}
@keyframes letter-away { to { opacity: 0; } }
@keyframes letter-arrive { 0%, 42% { opacity: 0; } 54% { opacity: 1; } 100% { opacity: 1; } }

.greedy-link.running-route {
  stroke-dasharray: 270;
  stroke-dashoffset: 270;
  animation: route-draw var(--zip-duration, 600ms) ease-in-out var(--route-delay, 0ms) both;
}
@keyframes route-draw { to { stroke-dashoffset: 0; } }
.zip-match .tooth-body, .zip-match .tooth-mark, .zip-match .bead-letter {
  animation: zip-click 90ms ease-out both;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes zip-click { 0% { transform: scaleY(1); } 45% { transform: scaleY(.85); } 100% { transform: scaleY(1); } }
.zip-skip { animation: skip-shake 120ms ease-in-out both; }
@keyframes skip-shake { 0%, 100% { transform: translateX(0); } 33% { transform: translateX(-2px); } 66% { transform: translateX(2px); } }
.skip-puff { fill: var(--thread-bottom); animation: puff-out 160ms ease-out both; }
@keyframes puff-out { from { opacity: .9; transform: translate(0, 0) scale(.5); } to { opacity: 0; transform: translate(8px, -11px) scale(1); } }

.tooth-lock path, .tooth-lock rect { fill: var(--paper-deep); stroke: var(--ink); stroke-width: 4; }
.tooth-lock path { fill: none; stroke-linecap: round; }
.tooth-lock.lockpop { transform-box: fill-box; transform-origin: center; animation: lockpop 250ms ease-out both; }
.tooth-lock.wiggle { animation: lockpop 250ms ease-out both, lock-wiggle 250ms ease-in-out both; }
@keyframes lockpop { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.5); } }
@keyframes lock-wiggle { 0%, 100% { rotate: 0deg; } 28% { rotate: -4deg; } 58% { rotate: 4deg; } }

.fill { transition: none; }
.fill.filling { transition: width 400ms cubic-bezier(.2, .8, .28, 1); }
.tick.stamp { animation: medal-stamp 200ms ease-out both; transform-origin: center bottom; }
@keyframes medal-stamp { 0% { transform: scale(1); } 48% { transform: scale(1.4); } 100% { transform: scale(1); } }
#badge.medal-typing { animation: medal-type 200ms steps(6, end) both; }
@keyframes medal-type { from { opacity: 0; } to { opacity: 1; } }
.spark { fill: var(--brass-light); stroke: var(--ink); stroke-width: 2; animation: brass-spark 500ms ease-out both; }
@keyframes brass-spark { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(34px) scale(.3); } }

.plate.board-leaving { animation: board-out 250ms ease-in both; }
.plate.board-entering { animation: board-in 250ms ease-out both; }
.pull.new-pull > * { animation: pull-hop 200ms ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes board-out { to { opacity: 0; transform: translateX(-18%); } }
@keyframes board-in { from { opacity: 0; transform: translateX(18%); } to { opacity: 1; transform: translateX(0); } }
@keyframes pull-hop { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-6px); } }

@media (max-width: 359px) {
  .top { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .top.has-medal { grid-template-columns: 44px minmax(0, 1fr) 52px auto; }
  #badge { width: 52px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .bead.flipping { animation: none; }
  .bead.flipping .bead-letter:not(.flip-letter) { animation: letter-away 150ms ease-out both; }
  .flip-letter { animation: letter-arrive 150ms ease-out both; }
  .greedy-link.running-route { animation-name: route-fade; stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0; }
  @keyframes route-fade { to { opacity: 1; } }
  .bead.pressing, .zip-match .tooth-body, .zip-match .tooth-mark, .zip-match .bead-letter, .zip-skip, .skip-puff, .tick.stamp, #badge.medal-typing, .spark, .pull.new-pull > * { animation: none; }
  .zip-skip .tooth-body { stroke-width: 8; }
  .fill.filling { transition: none; }
  .plate.board-leaving { animation: board-fade-out 300ms ease-out both; }
  .plate.board-entering { animation: board-fade-in 300ms ease-out both; }
  @keyframes board-fade-out { to { opacity: 0; } }
  @keyframes board-fade-in { from { opacity: 0; } to { opacity: 1; } }
}

/* Improvement round 2026-10-16: Play Lab top bar, How to play card,
   stitched teeth that keep their letters, pair hint, result share. */
.top {
  position: relative; z-index: 12; background: var(--paper);
  grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px;
}
.top.has-medal { grid-template-columns: auto minmax(0, 1fr) auto auto; }
#badge, .top.has-medal #badge { display: none !important; }
.play-lab { white-space: nowrap; text-decoration: none; padding: 0 2px; }
.boards-btn { width: auto; min-width: 44px; padding: 5px 8px; }
.howto-btn {
  min-height: 44px; min-width: 44px; padding: 5px 8px; border: 2px solid var(--ink); border-radius: 4px;
  background: var(--paper-light); color: var(--ink); font-family: var(--label); font-size: 12px; font-weight: 400;
  letter-spacing: .06em; text-transform: uppercase; cursor: pointer; white-space: nowrap;
}
.howto-btn .short { display: none; font-size: 20px; }
.howto-btn:focus-visible, .boards-btn:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.scrim { top: calc(58px + env(safe-area-inset-top, 0px)); }
@media (max-width: 389px) {
  .game-name { font-size: 20px; }
  .boards-btn span { display: none; }
  .boards-btn { width: 44px; padding: 0; }
}
@media (max-width: 359px) {
  .top { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 4px; }
  .howto-btn { width: 44px; padding: 0; }
  .howto-btn .long { display: none; }
  .howto-btn .short { display: inline; }
}

/* Stitched teeth: full-ink letter, lock as a corner badge. */
.bead.fixed { opacity: 1; }
.bead.fixed .tooth-body { fill: var(--paper-deep); }
.bead.fixed .bead-letter { fill: var(--ink); }
.tooth-lock path, .tooth-lock rect { stroke-width: 3; }
.bead.pair-suggest .bead-hit { stroke-dasharray: none; }
.pair-cue text { font-size: 22px; }

/* How to play card. */
.howto-scrim {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 12px;
  background: rgba(31, 25, 18, .62); overscroll-behavior: contain; touch-action: none;
}
.howto-scrim[hidden] { display: none; }
.howto-card {
  width: min(100%, 380px); max-height: calc(100svh - 24px); overflow: auto; padding: 14px 14px 12px;
  border: 3px solid var(--ink); background: var(--paper); box-shadow: 5px 5px 0 var(--brass); touch-action: auto;
}
.howto-card h2 { margin: 0 0 8px; font-family: var(--label); font-size: 22px; font-weight: 400; letter-spacing: .06em; text-transform: uppercase; }
.howto-pictures { display: grid; grid-template-columns: 1fr 26px 1fr; align-items: center; gap: 4px; }
.howto-pictures .mini svg { display: block; width: 100%; height: auto; min-height: 90px; }
.mini-arrow { width: 26px; height: 26px; fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.mini-plate { fill: var(--paper-light); stroke: var(--ink); stroke-width: 4; stroke-dasharray: 14 10; }
.mini-tooth { fill: var(--paper-light); stroke: var(--ink); stroke-width: 6; }
.mini-tooth.mini-fixed { fill: var(--paper-deep); }
.mini-letter { fill: var(--ink); font-family: var(--label); font-size: 50px; }
.mini-stitch { stroke: var(--ink); stroke-width: 5; stroke-dasharray: 3 6; }
.mini-glow { fill: rgba(176, 141, 62, .3); stroke: var(--brass); stroke-width: 10; }
.mini-hand { fill: var(--paper-light); stroke: var(--ink); stroke-width: 4; }
.mini-pull { stroke: var(--brass); stroke-width: 14; stroke-linecap: round; }
.mini-best { stroke: var(--ink-soft); stroke-width: 8; stroke-dasharray: 4 14; stroke-linecap: round; }
.howto-lines { margin: 12px 0 10px; padding: 0 0 0 20px; font-size: 16px; line-height: 1.3; }
.howto-lines li { margin: 0 0 4px; }
.howto-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.howto-foot .toggle {
  min-height: 44px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper-light); color: var(--ink);
  font-family: var(--label); font-size: 13px; letter-spacing: .05em; text-transform: uppercase; cursor: pointer;
}
.howto-foot .toggle[aria-pressed="false"] { background: transparent; color: var(--ink-soft); border-style: dashed; }
.howto-start { width: 100%; min-height: 48px; }
.result .share-result { width: auto; min-width: 160px; margin-top: 8px; padding: 8px 16px; }
html.still *, html.still *::before, html.still *::after { animation: none !important; transition: none !important; }

/* Top bar fit: the game name stays whole beside the three controls. */
.top { gap: 4px; }
.top .where { overflow: hidden; }
.top .game-name { font-size: 15px; line-height: 1.05; letter-spacing: .02em; }
.top #where { margin-top: 2px; font-size: 11px; letter-spacing: .05em; }
.top .boards-btn { font-size: 12px; gap: 4px; padding: 4px 6px; }
.top .boards-btn svg { width: 16px; height: 16px; }
.top .howto-btn { font-size: 11px; padding: 4px 6px; letter-spacing: .04em; }
.top .play-lab { font-size: 11px; letter-spacing: .04em; }
#key[hidden], #route-summary[hidden], #meter[hidden], #result[hidden], #hint[hidden] { display: none !important; }
/* The win's beat: result text waits a moment after the chime. */
#result.held { opacity: 0; visibility: hidden; }
/* The tooth that just changed. */
.bead.just-changed .tooth-body { stroke: var(--ink); stroke-width: 9; filter: drop-shadow(0 0 7px var(--brass)); }
.howto-pictures .mini img { display: block; width: 100%; height: auto; }
/* Levels and How to play both sit in the right half of the bar. */
@media (min-width: 390px) and (max-width: 480px) { .top .boards-btn svg { display: none; } }

/* Clarity pass: the game owns its doorway and names both routes before the
   first touch. */
.game-brand {
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 2px;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.game-brand:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.brand-mark {
  width: 27px; height: 27px; display: inline-grid; place-items: center; flex: none;
  border: 2px solid var(--ink); background: var(--brass); color: var(--ink);
  font-family: var(--label); font-size: 20px; line-height: 1;
}
.brand-mark rect { fill: var(--brass); stroke: var(--ink); stroke-width: 2; }
.brand-mark text { fill: var(--ink); font-family: var(--label); font-size: 22px; }
.brand-title { display: inline !important; font-family: var(--label); font-size: 16px !important; font-weight: 400; letter-spacing: .02em; }
.briefing { margin: 9px 0 7px; padding: 2px 10px 3px; border-left: 5px solid var(--brass); }
.briefing p { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.28; }
.briefing p + p { margin-top: 2px; }
.score-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 5px; color: var(--ink); font-family: var(--label); font-size: 14px; letter-spacing: .04em; }
.score-pair span:last-child { text-align: right; color: var(--ink-soft); }
.preview-note { margin: 4px 0 0; color: var(--brass); font-size: 13px; font-weight: 800; }
.skip-word { fill: var(--thread-bottom); font-family: var(--label); font-size: 18px; letter-spacing: .04em; text-transform: uppercase; }
.bead.letter-A .tooth-body { fill: #d1495b; }
.bead.letter-C .tooth-body { fill: #30638e; }
.bead.letter-G .tooth-body { fill: #00798c; }
.bead.letter-T .tooth-body { fill: #edae49; }
.bead.fixed .bead-letter { fill: var(--paper-light); }
.best-link { stroke: #6f6f6f; opacity: .92; }
.greedy-link { stroke: var(--ink); }
.greedy-link.miss { stroke: var(--ink-soft); }
.skipped-ring { stroke: #b23a48; }
.miss-mark { stroke: #b23a48; }
@media (max-width: 359px) {
  .top { grid-template-columns: 112px minmax(0, 1fr) 44px 44px; gap: 4px; }
  .top #where { display: none; }
  .brand-title { font-size: 13px !important; }
  .brand-mark { width: 24px; height: 24px; font-size: 18px; }
  .briefing { margin-top: 7px; padding-left: 8px; }
  .briefing p { font-size: 13px; }
  .score-pair { font-size: 12px; gap: 4px; }
}
