/* Zip board. Tokens come from style.css (Moonlit). The path is a gradient from --zp-a (start) to --zp-b (head). */
:root { --zp-a: #b0aaff; --zp-b: #4f47c9; --zp-tint: rgba(109, 102, 224, .13); --zdot: #1b1a3f; --zdot-ink: #f4f2fb; --zdot-on: #4f47c9; --zwall: #1b1a3f; --grid-line: rgba(27, 26, 63, .16); --zghost: #6d66e0; }
[data-theme='dark'] { --zp-a: #6b64d6; --zp-b: #cfcbff; --zp-tint: rgba(154, 148, 255, .16); --zdot: #efedff; --zdot-ink: #0f0e24; --zdot-on: #6d66e0; --zwall: #efedff; --grid-line: rgba(239, 237, 255, .16); --zghost: #9a94ff; }

.zip { width: 100%; position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; --cs: 52px; }
.zip-stage { position: relative; width: fit-content; margin: 0 auto; }
.zip-board { display: grid; position: relative; touch-action: none; border-radius: 14px; overflow: hidden; cursor: pointer; background: var(--surface); outline: none; }
.zip-board:focus-visible { box-shadow: 0 0 0 3px var(--accent-2); }
.zc { width: var(--cs); height: var(--cs); position: relative; background: transparent; transition: background-color .18s ease; }
.zc.on { background: var(--zp-tint); }
@media (hover: hover) { .zip-board:not(.locked) .zc:hover { background: color-mix(in srgb, var(--zp-tint) 50%, transparent); } .zip-board:not(.locked) .zc.on:hover { background: var(--zp-tint); } }

/* layers: lines (grid + frame) under the path, walls above it, dots on top */
.zip-svg { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.zip-lines { z-index: 1; } .zip-path { z-index: 2; } .zip-walls { z-index: 3; }
.zip-lines .thin { stroke: var(--grid-line); stroke-width: 1; }
.zip-lines .frame { fill: none; stroke: var(--line-strong); stroke-width: 2; }
.zip-walls .wall { stroke: var(--zwall); stroke-width: 4; stroke-linecap: round; transition: stroke .3s ease; }
.zip-walls .wall.flash { stroke: var(--bad); transition: none; }

/* path segments: one line per step, coloured by progress (set inline with color-mix) */
.zip-path .seg { stroke-linecap: round; fill: none; stroke-width: calc(var(--cs) * .62); }
.zip-path .seg.grow { animation: zgrow .14s cubic-bezier(.3, 1.1, .5, 1) both; }
@keyframes zgrow { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.zip-path .head { fill: none; stroke: var(--accent-2); stroke-width: 3; opacity: .45; animation: zbreathe 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes zbreathe { 0%, 100% { opacity: .2; transform: scale(.96); } 50% { opacity: .55; transform: scale(1.06); } }
.zip-path .head.bump { animation: zbump .16s ease-out; }
@keyframes zbump { 0% { transform: translate(0, 0); } 40% { transform: translate(var(--bx, 0), var(--by, 0)); } 100% { transform: translate(0, 0); } }
.zip-path .ghost { fill: none; stroke: var(--zghost); stroke-width: calc(var(--cs) * .2); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: calc(var(--cs) * .28) calc(var(--cs) * .24); opacity: .55; animation: zghostin .25s ease both, zmarch 1.4s linear infinite; }
@keyframes zghostin { from { opacity: 0; } to { opacity: .55; } }
@keyframes zmarch { to { stroke-dashoffset: calc(var(--cs) * -.52); } }
.zip-path .sol { fill: none; stroke: var(--ink-faint); stroke-width: calc(var(--cs) * .5); stroke-linecap: round; stroke-linejoin: round; opacity: .5; }

/* dots */
.zd { position: absolute; z-index: 4; width: calc(var(--cs) * .62); height: calc(var(--cs) * .62); border-radius: 50%; background: var(--zdot); color: var(--zdot-ink); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: calc(var(--cs) * .3); line-height: 1; pointer-events: none; transition: background-color .2s ease, color .2s ease, transform .22s cubic-bezier(.3, 1.6, .5, 1), box-shadow .2s ease; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.zd.on { background: var(--zdot-on); color: #fff; }
.zd.pop { animation: zpop .26s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes zpop { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
.zd.start { box-shadow: 0 0 0 2.5px var(--accent); }
.zd.next { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-2); }
.zd.next.start { box-shadow: 0 0 0 2.5px var(--accent), 0 0 0 4.5px var(--surface), 0 0 0 6.5px var(--accent-2); }
.zip-board.won .zd.last { background: var(--accent); color: var(--accent-ink); animation: zgold 1.4s ease-in-out infinite; }
@keyframes zgold { 0%, 100% { box-shadow: 0 0 0 0 rgba(233, 181, 74, .55); } 50% { box-shadow: 0 0 0 9px rgba(233, 181, 74, 0); } }

/* win: grid fades, the path lights up in order (JS sets .lit per segment), final dot turns gold */
.zip-board.won .zip-lines { transition: opacity .35s ease; opacity: 0; }
.zip-board.won .zc.on { background: transparent; }
.zip-path .shine-full, .zip-path .shine-sweep { stroke: #fff; fill: none; stroke-width: calc(var(--cs) * .62); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.zip-path .shine-full { opacity: 0; }
.zip-path .shine-sweep { opacity: .8; }
[data-theme='dark'] .zip-path .shine-sweep { opacity: .55; }
.zip-board.won.quiet .zd.last { animation: none; }
.zip-board.locked { cursor: default; }
.zip-confetti { position: absolute; inset: -40px -20px 0; width: calc(100% + 40px); height: calc(100% + 40px); pointer-events: none; z-index: 30; }

/* progress + hint toast + help */
.zip-progress { display: flex; align-items: center; gap: 10px; margin: 10px auto 0; max-width: 100%; font-size: 12px; font-weight: 700; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.zip-progress .bar { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.zip-progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--zp-a), var(--zp-b)); border-radius: 999px; transition: width .2s ease; }
.zip-progress.full .bar i { background: var(--good); }
.zip-toast { margin: 10px auto 0; max-width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 8px 12px; font-size: 13px; color: var(--ink); display: flex; gap: 8px; align-items: center; line-height: 1.4; animation: hintin .25s cubic-bezier(.3, 1.2, .5, 1); }
.zip-toast[hidden] { display: none; }
.zip-toast .ic { width: 20px; height: 20px; flex: none; color: var(--accent-2); }
.zip-toast .ic svg { width: 20px; height: 20px; }
.zip-toast p { margin: 0; flex: 1; }
@keyframes hintin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.zip-help { text-align: center; font-size: 12px; color: var(--ink-faint); margin: 10px 0 0; }

/* page bits (shared look with Queens) */
.zip-page .board-wrap { padding: 14px; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon { position: relative; }
.btn-icon .cnt { position: absolute; right: -5px; top: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.btn-icon .cnt:empty { display: none; }
.snd-off .ic-on, .btn-icon:not(.snd-off) .ic-off { display: none; }
.q-settings { position: relative; }
.q-pop { position: absolute; right: 0; top: 46px; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); box-shadow: var(--shadow-hover); padding: 6px 4px; min-width: 230px; }
.q-pop[hidden] { display: none; }
.q-pop label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.q-pop .sw { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background .15s ease; }
.q-pop .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.q-pop input { position: absolute; opacity: 0; pointer-events: none; }
.q-pop input:checked + .sw { background: var(--good); }
.q-pop input:checked + .sw::after { transform: translateX(16px); }
.q-pop input:focus-visible + .sw { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.q-meta { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.q-meta .pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.q-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
.q-pick button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.q-pick button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (max-width: 480px) { .zip-page .board-wrap { padding: 6px; } .zip-page .wrap-game, .wrap-game.zip-page { padding: 0 10px; } }
@media (prefers-reduced-motion: reduce) { .zip-path .seg.grow, .zip-path .head, .zip-path .ghost, .zd.pop { animation: none !important; } }

/* how-to-play practice boards */
.zip-demos { display: grid; gap: 18px; margin: 18px 0 26px; }
.zip-demo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 16px; }
.zip-demo h2 { font-size: 18px; margin: 0 0 4px; }
.zip-demo p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; }
.zip-demo-board { max-width: 260px; margin: 0 auto; }
.zip-demo-board .zip-help, .zip-demo-board .zip-progress { display: none; }
.zip-demo-note { text-align: center; margin: 8px 0 0; color: var(--good); font-weight: 700; }
