:root {
  --bg: #14161c; --panel: #1e212b; --line: #2f3442; --tile: #343a4a; --agar: #3a2c16;
  --ink: #f2efe6; --dim: #9197a8; --c1: #ff5d73; --c2: #ffd34d; --c3: #a384ff; --c0: #6f7689;
  --cell: 40px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "DejaVu Serif", serif;
  --hand: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
body { font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#app { height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; position: relative;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.screen { height: 100%; display: flex; flex-direction: column; padding: 12px 14px 14px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; }
h1 { font-size: 40px; margin: 14px 0 6px; letter-spacing: 0; }
h2 { font-size: 22px; margin: 0; }
h3 { font-size: 24px; margin: 0 0 6px; }
.num { font-variant-numeric: tabular-nums; }
.tag { color: var(--dim); margin: 0; max-width: 30ch; }

/* buttons */
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 8px 16px;
  border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; width: 100%; }
.btn small { font-weight: 400; color: var(--dim); font-size: 12px; font-family: var(--mono); letter-spacing: -0.2px; }
.btn.primary { background: var(--ink); color: #14161c; border-color: var(--ink); }
.btn.primary small { color: #555b69; }
.btn.ghost { background: transparent; font-weight: 500; font-size: 14px; padding: 8px 4px; }
.btn.small { min-height: 44px; flex-direction: row; gap: 6px; }
.btn[aria-pressed="true"] { background: var(--ink); color: #14161c; }
.btn:active, .icon:active { transform: scale(0.97); }
.icon { width: 44px; height: 44px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 15px; }
.icon-pause { width: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1; }
.icon-pause small { color: var(--dim); font: 10px/1.1 var(--mono); }

/* menu */
.menu-top { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; }
.menu-btns { display: flex; flex-direction: column; gap: 0; }
.menu-btns > .btn.primary { margin-bottom: 14px; }
.rule { margin: 14px 0 0; max-width: 31ch; padding: 8px 10px; border: 1px solid #465061; border-radius: 7px; color: #d8dce6; background: #1d222c; font-size: 14px; line-height: 1.35; }
/* Secondary choices are still plainly tappable, not just headings in a list. */
.menu-btns > .btn:not(.primary):not(.ghost) { align-items: flex-start; text-align: left; padding: 10px 12px; min-height: 58px; border-radius: 7px; }
.menu-btns > .btn:not(.primary):not(.ghost) + .btn:not(.primary):not(.ghost) { margin-top: 8px; }
.menu-btns > .btn:not(.primary):not(.ghost) + .row3 { margin-top: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 6px; }
.row3 .btn.ghost { border: 0; color: #c5c9d6; font-size: 14px; min-height: 44px; }
.play-lab-link { align-self: center; display: grid; place-items: center; min-height: 44px; color: var(--dim); font-size: 14px; }
#logo-plate { --cell: 26px; display: grid; grid-template-columns: repeat(6, var(--cell)); padding: 22px; border-radius: 50%; }
#logo-plate .cell { cursor: default; }

/* bars */
.bar { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 8px; }
.bar .spacer { width: 44px; }
.bar h2 { flex: 1; text-align: center; }
.bar-mid { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
#g-label { font-size: 13px; color: var(--dim); }
#g-timer { font-size: 16px; font-weight: 500; font-family: var(--mono); }
.hearts { min-width: 62px; text-align: right; font-size: 18px; letter-spacing: 2px; color: var(--c1); white-space: nowrap; }
.heart { display: inline-grid; width: 18px; height: 24px; place-items: center; position: relative; letter-spacing: 0; }
.heart.lost { color: var(--line); }
.heart.crack { color: var(--c1); animation: heart-crack 0.3s ease-in both; }
.heart-half { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; overflow: hidden; }
.heart-half.left { clip-path: polygon(0 0, 62% 0, 47% 50%, 62% 100%, 0 100%); animation: heart-left 0.3s ease-in both; }
.heart-half.right { clip-path: polygon(38% 0, 100% 0, 100% 100%, 38% 100%, 53% 50%); animation: heart-right 0.3s ease-in both; }
@keyframes heart-crack { 0% { transform: scale(1); } 20% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes heart-left { to { transform: rotate(-15deg) translate(-4px, 16px); opacity: 0; } }
@keyframes heart-right { to { transform: rotate(15deg) translate(4px, 16px); opacity: 0; } }

/* levels */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.tabs .btn { min-height: 52px; padding: 6px 2px; font-size: 14px; }
.tabs .btn small { font-size: 11px; letter-spacing: -0.4px; }
#tier-note { margin: 0 0 10px; text-align: center; color: var(--dim); font-size: 13px; font-family: var(--mono); }
.level-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; overflow-y: auto; align-content: start; flex: 1; padding-bottom: 8px; }
.lvl { aspect-ratio: 1; border-radius: 8px; background: #20242d; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; position: relative; }
.lvl .st { font-size: 12px; letter-spacing: 1px; color: var(--c2); min-height: 16px; }
.lvl.done { border-color: #56506b; }
.frozen-card { width: 100%; height: 100%; display: grid; place-items: center; position: relative; padding: 8px; }
.plate-preview { --p: 8px; width: 72%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 1px; padding: 5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #f8efce44 0 2%, transparent 8%), linear-gradient(145deg, #cabf9e55, #fff1b91c 18%, #493716 23%, #2e2415 100%);
  border: 2px solid #e9e7df77; box-shadow: inset 2px 2px 3px #fff8, inset -2px -2px 3px #0009, 0 2px 4px #0007; }
.preview-dot { min-width: 0; min-height: 0; border-radius: 50%; background: transparent; }
.preview-dot.c1 { background: var(--c1); } .preview-dot.c2 { background: var(--c2); border-radius: 20%; } .preview-dot.c3 { background: var(--c3); border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.lid { position: absolute; inset: 14% 12%; border-radius: 50%; border: 2px solid #cbd4e04d; background: linear-gradient(145deg, #dceaff18, #7c99b90b); box-shadow: inset 2px 2px 2px #fff2; }
.frost { position: absolute; inset: 5px; border-radius: 7px; pointer-events: none; background: linear-gradient(135deg, #dff3ff45, transparent 35%, #f5fcff35 70%); box-shadow: inset 0 0 9px #e9fbff88; }
.lid-label { position: absolute; bottom: 5px; left: 4px; right: 4px; min-height: 19px; padding: 1px 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; transform: rotate(-2deg); color: #2a2118; background: #e3d8bd; border-radius: 2px; font: 10px/17px var(--hand); text-align: center; box-shadow: 0 1px 2px #0008; }
.empty-label { position: absolute; color: var(--dim); font: 18px var(--hand); transform: rotate(-3deg); }

/* the plate */
.plate { background: radial-gradient(circle at 27% 18%, #ffe8a51c 0 2%, transparent 14%), radial-gradient(circle at 70% 82%, #0b080355, transparent 58%), linear-gradient(135deg, #725222, var(--agar) 28%, #2b2112 100%); border-radius: 22px; border: 2px solid #d7e3e06b; outline: 3px solid #b9d4dd20; outline-offset: -6px; box-shadow: inset 3px 3px 4px #fff4, inset -4px -5px 12px #0008, 0 7px 15px #0006; }
#board-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
#board { display: grid; padding: 6px; gap: 0; position: relative; isolation: isolate; overflow: hidden; }
#board::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit; opacity: 0; background: radial-gradient(circle at 18% 20%, #ffffff35 0 1px, transparent 1.5px) 0 0 / 31px 31px, linear-gradient(125deg, #dff6ff00 5%, #e9fbff38 48%, #c8ebff18 100%); }
#board.frosting::after { opacity: 1; animation: frost-creep 0.82s ease-out both; }
@keyframes frost-creep { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0); } }
.hd { display: flex; gap: var(--gap, 4px); align-items: center; justify-content: flex-end; min-width: 0; min-height: 0; padding: 0; }
.hd > .chip { flex: none; }
button.hd { cursor: pointer; border-radius: 5px; }
button.hd:active { transform: scale(0.94); }
.hd.col { flex-direction: column; padding-bottom: var(--hpad, 7px); }
.hd.hrow { padding-right: var(--hpad, 7px); }
.chip { width: var(--chip, 22px); height: var(--chip, 22px); border-radius: 50%; display: grid; place-items: center;
  font-size: calc(var(--chip, 22px) * 0.66); font-weight: 700; color: #17130f; line-height: 1; font-variant-numeric: tabular-nums;
  transition: opacity 0.25s, filter 0.25s; }
.chip.c1 { background: var(--c1); --cc: var(--c1); } .chip.c2 { background: var(--c2); --cc: var(--c2); } .chip.c3 { background: var(--c3); --cc: var(--c3); }
.chip.zero { background: #17130f99; color: var(--cc); box-shadow: inset 0 0 0 3px var(--cc); }
/* a diamond cannot carry an inset ring, so cut a hollow diamond out of a filled one */
.sym .c3.chip.zero { background: var(--cc); color: var(--cc); isolation: isolate; position: relative; }
.sym .c3.chip.zero::before { content: ""; position: absolute; inset: 3px; background: var(--agar); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); z-index: -1; }
.hd .line-clue { outline: var(--ring, 2px) solid #21190e; outline-offset: 1px; }
.chip.done { opacity: 0.5; filter: saturate(0.6) brightness(0.9); }
/* a hollow zero reads as a bright ring until its line is settled, then fades like any met count */
.chip.zero.done { opacity: 0.4; }
.tick { animation: tick 0.45s ease-out; }
@keyframes tick { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }
.flash { animation: chip-flash 0.3s ease-out; }
@keyframes chip-flash { 0%, 100% { opacity: 0.5; } 45% { opacity: 1; } }
.cell { width: var(--cell); height: var(--cell); position: relative; display: grid; place-items: center; transition: transform 0.06s ease-out; }
.cell::before { content: ""; position: absolute; inset: 1.5px; border-radius: 22%; background: var(--tile); transition: background 0.15s; }
.cell.k::before { background: transparent; }
.cell.pressed { transform: scale(0.94); }
.cell.pressed::before { filter: brightness(0.85); }
.cell .blob { transition: transform .16s ease-out; transform-origin: 50% 72%; }
.cell .blob.plate-press { transform: scale(.92) !important; }
.cell .blob.shy { transform: scale(.95) !important; }
.cell .blob.happy-wobble { animation: colony-happy .24s ease-out; }
@keyframes colony-happy { 0%,100% { transform: rotate(0) scale(1); } 30% { transform: rotate(-5deg) scale(1.05); } 65% { transform: rotate(4deg) scale(.98); } }
.cell.k0::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #4a4438; position: relative; }
.blob { position: absolute; inset: 7%; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: calc(var(--cell) * 0.5); color: #17130f;
  font-variant-numeric: tabular-nums; line-height: 1; box-shadow: inset -2px -3px 0 #0002, inset 2px 2px 0 #fff3; animation: pop 0.22s cubic-bezier(.34,1.56,.64,1); }
.blob.c1 { background: radial-gradient(circle at 30% 25%, #fff8 0 7%, #ff8393 9%, var(--c1) 55%, #b82e47); } .blob.c2 { background: radial-gradient(circle at 30% 25%, #fff9 0 7%, #ffe888 9%, var(--c2) 55%, #c58d08); } .blob.c3 { background: radial-gradient(circle at 30% 25%, #fff8 0 7%, #cdbbff 9%, var(--c3) 55%, #684eb8); }
.blob::after { content: ""; position: absolute; inset: 18%; opacity: .32; border-radius: inherit; background: radial-gradient(circle at 22% 40%, #fff 0 5%, transparent 7%), radial-gradient(circle at 70% 26%, #3a182a 0 4%, transparent 6%), radial-gradient(circle at 66% 70%, #fff 0 4%, transparent 6%); pointer-events: none; }
.blob.done { color: #17130f55; }
.blob.tick { animation: tick 0.45s ease-out; }
.blob.wave { animation: wave 0.06s ease-out both; }
@keyframes wave { 0% { transform: scale(1); } 50% { transform: scale(1.18); filter: brightness(1.25); } 100% { transform: scale(1); } }
.cell.fade::after { animation: fadein 0.4s ease-out both; }
@keyframes fadein { from { opacity: 0; transform: scale(3); } }
@keyframes pop { 0% { transform: scale(0.3); } 60% { transform: scale(1.12, 0.9); } 100% { transform: scale(1); } }
.blob.finish-last { animation: finish-hold 0.12s linear both; }
@keyframes finish-hold { from, to { transform: scale(1.25); } }
.sym .c2.blob, .sym .c2.chip, .sym .tool.c2 i, .sym .c2.wilt { border-radius: 18%; }
.sym .c3.blob, .sym .c3.chip, .sym .tool.c3 i, .sym .c3.wilt { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.sym .c3.blob { inset: 0; font-size: calc(var(--cell) * 0.42); box-shadow: none; }
/* rule-out notes: small coloured crosses, one fixed corner per colour */
.nt { position: absolute; font-size: max(13px, calc(var(--cell) * 0.36)); font-weight: 800; line-height: 1; z-index: 1; }
.nt.n1 { left: 10%; top: 6%; color: var(--c1); } .nt.n2 { right: 10%; top: 6%; color: var(--c2); }
.nt.n3 { left: 10%; bottom: 6%; color: var(--c3); }
/* wrong guesses: a faded shape of that colour with a slash, same corner as its note */
.wr { position: absolute; width: max(12px, calc(var(--cell) * 0.4)); height: max(12px, calc(var(--cell) * 0.4)); border-radius: 50%; z-index: 1; }
.wr::after { content: ""; position: absolute; left: -22%; right: -22%; top: 50%; height: 3px; margin-top: -1.5px; background: #fff; transform: rotate(-45deg); box-shadow: 0 0 0 1.5px #14161c; border-radius: 2px; }
.wr.w1 { left: 6%; top: 6%; background: var(--c1); } .wr.w2 { right: 6%; top: 6%; background: var(--c2); }
.wr.w3 { left: 6%; bottom: 6%; background: var(--c3); }
/* the colony a wrong tap would have been: a short held beat, then it withers */
.wilt { position: absolute; inset: 7%; border-radius: 50%; z-index: 2; pointer-events: none; animation: wither 0.75s ease-in both; }
.wilt.c1 { background: var(--c1); } .wilt.c2 { background: var(--c2); } .wilt.c3 { background: var(--c3); }
@keyframes wither { 0%, 11% { opacity: 0.95; transform: scale(1); } 48% { opacity: 0.9; transform: scale(1.05); } 100% { opacity: 0; transform: scale(0.3); } }
.sym .wr.w2 { border-radius: 18%; } .sym .wr.w3 { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
/* empty mark: a reversible note that nothing grew here */
.cell.em::before { background: #262a35; }
.emk { width: 34%; height: 34%; position: relative; }
.emk::before, .emk::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #7d8496; border-radius: 1px; }
.emk::before { transform: rotate(45deg); } .emk::after { transform: rotate(-45deg); }
#board.ruling .cell:not(.k)::before { outline: 2px dashed #7d8496; outline-offset: -4px; }
.cell.shake { animation: shake 0.3s 0.08s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.cell.tgt::before { background: #40495d; box-shadow: inset 0 0 0 3px var(--ink); z-index: 2; animation: tgt 0.9s infinite alternate; }
.cell.tgt > .nt, .cell.tgt > .wr, .cell.tgt > .emk { z-index: 3; }
/* Hint, first tap: the squares a clue counts (dashed) and the ones it already has (solid, thin). */
.cell.scope::after { content: ""; position: absolute; inset: 2px; border-radius: 22%; border: 2.5px dashed var(--ink); pointer-events: none; z-index: 3; }
.cell.counted::after { content: ""; position: absolute; inset: 2px; border-radius: 22%; border: 2px solid var(--ink); opacity: .55; pointer-events: none; z-index: 3; }
@keyframes tgt { to { box-shadow: inset 0 0 0 3px #f2efe680; } }
.chip.src, .tool.src, .hd.src { outline: 3px solid var(--ink); outline-offset: 2px; animation: pulse 0.9s infinite alternate; }
.chip.src { opacity: 1; filter: none; }
.cell.src::after { content: ""; position: absolute; inset: 1px; border-radius: 22%; border: 3px solid var(--ink); animation: pulse2 0.9s infinite alternate; pointer-events: none; z-index: 3; }
/* outlines pulse but never vanish, so a glance at any moment finds them */
@keyframes pulse { to { outline-color: #f2efe670; } }
@keyframes pulse2 { to { border-color: #f2efe670; } }

#msg { margin: 4px 2px 16px; font-size: 16px; line-height: 1.3; color: #e3e6ee; text-align: center; text-wrap: balance; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* tools */
#palette { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 10px; }
.tool { position: relative; --tc: #c5c9d6; min-height: 70px; border-radius: 8px; background: var(--panel); border: 2px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: #c5c9d6; line-height: 1.15; transition: transform 0.06s ease-out, box-shadow 0.06s ease-out; }
.tool em { font-style: normal; font-size: 12px; color: var(--ink); font-family: var(--mono); }
.tool { padding: 0 5px; text-align: center; }
.tool[aria-pressed="true"] em, .tool.all[aria-pressed="true"] em { color: var(--ink); }
.tool.c0 span { font-size: 12px; white-space: nowrap; }
.tool.all em { color: var(--dim); }
.tool.all i { opacity: 0.35; }
/* "pick this one": a soft glow in the button's own colour; the words live in the message line */
.tool.pulse { border-color: var(--tc); animation: tool-glow 0.8s ease-in-out infinite alternate; }
@keyframes tool-glow { from { box-shadow: 0 0 0 0 transparent; } to { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 45%, transparent); } }
@keyframes bob { to { transform: translateY(-6px); } }
@keyframes toolpulse { to { border-color: var(--ink); box-shadow: 0 0 0 4px #f2efe633; } }
.btn.nudge { animation: toolpulse 0.8s 4 alternate; border-color: var(--ink); }
.tool i { width: 24px; height: 24px; border-radius: 50%; display: block; }
.tool.c1 i { background: var(--c1); } .tool.c2 i { background: var(--c2); } .tool.c3 i { background: var(--c3); }
.tool.c0 i { background: #262a35; border-radius: 22%; position: relative; }
.tool.c0 i::before, .tool.c0 i::after { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: #7d8496; }
.tool.c0 i::before { transform: rotate(45deg); } .tool.c0 i::after { transform: rotate(-45deg); }
/* the held tool keeps its colour and gains a light ring and a tinted ground */
.tool.c1 { --tc: var(--c1); } .tool.c2 { --tc: var(--c2); } .tool.c3 { --tc: var(--c3); }
.tool[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: color-mix(in srgb, var(--tc) 24%, var(--panel)); font-weight: 700; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--tc); }
.tool.pressed { transform: translateY(2px); box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px var(--tc); }
.tool[aria-pressed="true"] i { opacity: 1; transform: scale(1.12); }
/* Mark empty has no colour of its own, so when held it turns light: a filled X tile and a white ring. */
.tool.c0[aria-pressed="true"] { --tc: var(--ink); background: #3a4152; }
.tool.c0[aria-pressed="true"] i { background: var(--ink); }
.tool.c0[aria-pressed="true"] i::before, .tool.c0[aria-pressed="true"] i::after { background: #14161c; }
.tool i.tool-squash { animation: tool-squash 0.06s ease-out; }
@keyframes tool-squash { 0% { transform: scale(1); } 50% { transform: scale(1.16, 0.82); } 100% { transform: scale(1); } }
.tool-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* modal */
#modal { position: absolute; inset: 0; background: #0b0c10cc; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { width: 100%; max-height: 92%; overflow-y: auto; background: var(--panel); border-radius: 10px 10px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); animation: up 0.2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet p { color: #c5c9d6; margin: 6px 0 12px; }
.sheet .btn { margin-top: 8px; background: #2a2e3b; }
.sheet .btn.primary { background: var(--ink); }
.stars { font-size: 40px; letter-spacing: 6px; color: var(--c2); margin: 4px 0; }
.stars .off { color: var(--line); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 10px 0; }
.kv span:nth-child(odd) { color: var(--dim); }
.kv span:nth-child(even) { font-weight: 500; font-family: var(--mono); text-align: right; }
.opt { display: flex; align-items: center; justify-content: space-between; min-height: 50px; border-bottom: 1px solid var(--line); }
.sw { width: 52px; height: 30px; border-radius: 15px; background: var(--line); position: relative; }
.sw::after { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); left: 3px; top: 3px; transition: left 0.15s; }
.sw[aria-checked="true"] { background: var(--ink); }
.sw[aria-checked="true"]::after { background: var(--bg); }
.sw[aria-checked="true"]::after { left: 25px; }
.how { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; margin: 12px 0; }
.how p { margin: 0; font-size: 15px; }
.mini { --cell: 30px; --chip: 18px; display: grid; padding: 5px; border-radius: 12px; }
.species { font-size: 13px; color: var(--dim); }
.species b { font-weight: 600; font-style: italic; }
.species .c1 { color: var(--c1); } .species .c2 { color: var(--c2); } .species .c3 { color: var(--c3); }

@media (min-height: 760px) { .screen { padding-top: 18px; } }

/* Short phones still show the promise and the first tap together. The rest of
   the menu remains available below it without squeezing its touch targets. */
@media (max-height: 680px) {
  .menu-top { flex: 0 0 auto; min-height: 0; justify-content: flex-start; }
  #logo-plate { --cell: 20px; padding: 16px; }
  h1 { margin: 8px 0 4px; font-size: 34px; }
  .tag { font-size: 14px; max-width: 30ch; white-space: normal; }
  .menu-btns > .btn.primary { margin-bottom: 10px; }
  #s-game.lesson .tools { flex-basis: 168px; min-height: 168px; }
  #s-game.lesson #msg { height: 56px; font-size: 14px; line-height: 1.22; }
}

#g-progress { font-size: 12px; color: var(--dim); margin-top: 3px; font-family: var(--mono); }
.challenge-line { margin: -3px 4px 5px; min-height: 28px; display: flex; align-items: center; justify-content: center; text-align: center; color: #e5edf4; background: #273441; border: 1px solid #597385; border-radius: 5px; font-size: 13px; }
button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; z-index: 3; }
.cell:focus-visible { outline-offset: -2px; border-radius: 22%; }
.screen { overflow-y: auto; }
.menu-top { min-height: 260px; }
/* A fixed message height: a longer line never takes room from the plate, so tools never move it. */
#msg { height: 64px; min-height: 0; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#s-game #msg.tight { font-size: 14px; line-height: 1.2; }
#s-game #msg.tighter { font-size: 14px; line-height: 1.08; }
#b-notes { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .blob { animation: blob-fade 0.15s ease-out both !important; }
  .blob.finish-last { animation: none !important; transform: scale(1.25); }
  .chip.flash { animation: chip-flash 0.3s ease-out both !important; }
  .cell.fade::after { animation: finish-fade 0.4s ease-out both !important; }
  .wilt { animation: wrong-fade 0.75s ease-in both !important; }
  #board.frosting::after { opacity: 1; animation: frost-fade 0.4s ease-out both !important; }
  .result-star.stamp { animation: star-fade 0.22s ease-out both !important; }
}
@keyframes blob-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes finish-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wrong-fade { from { opacity: 0.95; } to { opacity: 0; } }
@keyframes frost-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes star-fade { from { opacity: 0; } to { opacity: 1; } }

#share-text { width: 100%; min-height: 112px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #12151b; color: var(--ink); font: 13px/1.35 var(--mono); user-select: text; -webkit-user-select: text; }

h3:focus { outline: none; }
#g-timer { display: none; }
#app.timed #g-timer { display: inline; }
#g-label { font-size: 18px; color: var(--ink); font-weight: 500; font-family: var(--serif); }
/* Reserve a result shelf from the start. The finish panel overlays it, so the plate never jumps. */
#s-game .tools { flex: 0 0 190px; min-height: 190px; position: relative; }
#done { position: absolute; inset: 0 4px 0; min-height: 132px; display: flex; flex-direction: column; gap: 6px; animation: up 0.25s ease-out; }
#done h3 { margin: 0; font-size: 24px; }
#done .done-top { display: flex; align-items: center; justify-content: space-between; }
#done .stars { font-size: 30px; letter-spacing: 3px; margin: 0; }
#done .sub { margin: 0; color: var(--dim); font-size: 14px; }
.result-star { display: inline-block; color: var(--c2); }
.result-star.off { color: var(--line); }
.result-star.stamp { animation: star-stamp 0.22s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes star-stamp { from { transform: scale(1.6); } to { transform: scale(1); } }
.agar-dots { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.agar-dots i { position: absolute; left: var(--x); top: var(--y); width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: var(--c2); box-shadow: 0 0 0 1px #fff4; animation: agar-burst 0.5s ease-out both; }
.agar-dots i:nth-child(3n) { background: var(--c1); } .agar-dots i:nth-child(3n + 2) { background: var(--c3); }
@keyframes agar-burst { from { opacity: 1; transform: translate(0, 0) scale(1); } to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.35); } }
.done-btns { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 4px; }
.done-btns .btn:only-child { grid-column: 1 / -1; }
.done-btns:has(> :nth-child(3)) { grid-template-columns: 1fr 1fr 1fr; }
.why { margin: 6px 0 2px; color: var(--dim); font-size: 14px; }
.why summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: #c5c9d6; list-style: none; }
.why summary::before { content: "?"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--dim); margin-right: 8px; font-size: 13px; }
.why p { font-size: 14px; color: var(--dim); margin: 4px 0 8px; }
.why .c1 { color: var(--c1); } .why .c2 { color: var(--c2); } .why .c3 { color: var(--c3); }
.why b { font-weight: 600; font-style: italic; }
.keys { font-size: 14px; }
.tool-row:has(#b-notes[hidden]) { grid-template-columns: 1fr; }

/* the game screen gives the plate the full width */
#s-game { padding-left: 8px; padding-right: 8px; }
#s-game .tools { padding: 0 4px; }
.whybtn { min-height: 44px; display: flex; align-items: center; gap: 8px; color: #c5c9d6; font-size: 14px; align-self: flex-start; }
.whybtn::before { content: "?"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--dim); font-size: 13px; }
.chip.zero.src { opacity: 1; }
.mini .chip.zero { opacity: 1; }

/* How to play: a round ? with a caption, on every screen */
.how-btn { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; padding-top: 2px; }
.how-btn span { font: 600 17px/1 var(--serif); }
.how-btn small { color: var(--dim); font: 9px/1.1 var(--mono); margin-top: 1px; }
.how-btn:active { transform: scale(0.95); }
#s-menu { position: relative; }
.menu-how { position: absolute; top: 12px; right: 14px; z-index: 2; }
@media (min-height: 760px) { .menu-how { top: 18px; } }
.bar-mid { min-width: 0; }
.bar-mid > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#s-game .bar { gap: 8px; }

/* the rules card */
.rules { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 10px; }
.rule-row { display: grid; grid-template-columns: 126px 1fr; gap: 12px; align-items: center; }
.rule-pic { justify-self: center; display: flex; align-items: center; min-height: 28px; }
.rule-text { font-size: 15px; line-height: 1.3; color: #d8dce6; }
.rule-pic .mini { --cell: 22px; --chip: 16px; padding: 4px; border-radius: 9px; border-width: 1px; outline: 0; }
.rule-pic .mini .hd.hrow { padding-right: 4px; }
.rule-pic .mini .chip { flex: none; }
.rule-pic .mini.line3 { --cell: 19px; --chip: 15px; }
.rule-pic .mini.line3 .hd.hrow { padding-right: 2px; gap: 1px; }
.rp-tools { display: flex; gap: 6px; }
.rp-tool { width: 30px; height: 30px; border-radius: 6px; background: var(--bg); border: 2px solid var(--line); display: grid; place-items: center; position: relative; }
.rp-tool i:first-child { width: 14px; height: 14px; border-radius: 50%; display: block; }
.rp-tool.c1 { --tc: var(--c1); } .rp-tool.c2 { --tc: var(--c2); } .rp-tool.c3 { --tc: var(--c3); }
.rp-tool i:first-child { background: var(--tc); }
.rp-tool.on { background: color-mix(in srgb, var(--tc) 24%, var(--bg)); border-color: var(--ink); box-shadow: 0 0 0 2px var(--tc); }
.sym .rp-tool.c2 i:first-child { border-radius: 18%; }
.sym .rp-tool.c3 i:first-child { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.rp-tap { display: flex; align-items: center; gap: 4px; }
.rp-arrow { color: var(--dim); font-size: 18px; }
.rp-hearts { margin-left: 6px; color: var(--c1); font-size: 14px; letter-spacing: 1px; }
.rp-hearts i { font-style: normal; color: var(--dim); }
.fold summary::before { content: "+"; }
.fold p { margin: 2px 0 8px; }
.fold p b { font-style: normal; color: #c5c9d6; }
.rules-btns .btn { margin-top: 8px; }
#rules h3, #newhere h3 { margin-bottom: 0; }
#newhere h3 { font-size: 22px; margin-bottom: 6px; }

/* the rules card fades in rather than sliding, so it never pokes past the screen bottom */
.sheet:has(#rules) { animation: sheet-fade 0.18s ease-out; }
@keyframes sheet-fade { from { opacity: 0; } }
.rules-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rules-btns .btn { padding: 8px 6px; }
#newhere .rules-btns { grid-template-columns: 1fr; gap: 0; }

/* narrow phones: every tool stays on screen; the colour name gives way to the icon and a short count */
.tool em .short { display: inline; }
.tool em .long { display: none; } /* "4 left" at every width: one line, so the colour bar stays short */
@media (max-width: 360px) {
  #palette { gap: 6px; }
  .tool { padding: 0 2px; }
  #palette:not(.few) .tool:not(.c0) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tool.c0 span { white-space: normal; line-height: 1.1; }
  .tool em .long { display: none; }
  .tool em .short { display: inline; }
  #msg { font-size: 15px; line-height: 1.25; }
}

/* short phones: a slimmer tool shelf leaves the plate more room */
@media (max-height: 680px) {
  #s-game .tools { flex-basis: 150px; min-height: 150px; }
  #palette { margin-bottom: 8px; }
  .tool { min-height: 56px; }
  #msg { height: 56px; margin-bottom: 6px; } /* three short lines fit at 320 x 568 */
}

/* one top bar on every screen: Play Lab on the left, Levels and How to play on the right */
#app { display: flex; flex-direction: column; }
#app > .screen { flex: 1; height: auto; min-height: 0; }
.topbar { flex: 0 0 56px; min-height: 56px; margin: 0; padding: 0 10px; gap: 6px; }
.topbar .back { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: var(--ink); text-decoration: none; font-size: 15px; white-space: nowrap; }
.topbar .back:active { transform: scale(0.97); }
.top-btn { flex: 0 0 auto; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); font-size: 14px; white-space: nowrap; color: var(--ink); }
.top-btn:active { transform: scale(0.96); }
.topbar .how-btn { width: auto; flex: 0 0 auto; border-radius: 22px; display: inline-flex; flex-direction: row; padding: 0 12px; }
.topbar .how-btn span { font: 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.topbar .how-short { display: none; font-weight: 600; font-size: 17px; }
#bar-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
#app.no-game #bar-mid > * { visibility: hidden; }
#bar-mid #g-label { font: 500 15px/1.15 var(--serif); color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-line { display: flex; align-items: center; gap: 6px; }
.bar-line .hearts { min-width: 0; font-size: 16px; }
.bar-line .heart { width: 16px; height: 20px; }
#bar-mid #g-timer { font-size: 13px; color: var(--dim); }
.screen-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.screen-title .home-btn { width: auto; padding: 0 14px; }
@media (max-width: 359px) {
  .topbar { padding: 0 6px; gap: 4px; }
  .topbar .how-long { display: none; }
  .topbar .how-short { display: inline; }
  .topbar .how-btn { width: 44px; padding: 0; justify-content: center; }
  .topbar .back { font-size: 14px; }
  .top-btn { padding: 0 8px; }
}
/* the rules card footer carries the game's own controls */
.rules-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.rules-foot .btn { padding: 8px 6px; min-height: 48px; }
.rules-foot .btn.primary { grid-column: 1 / -1; }
#app > .screen { padding-top: 4px; }
.rules-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rules-head h3 { margin: 0; }
.rules-pic { flex: 0 0 auto; display: flex; }
.rules-foot { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rules-foot .btn { margin-top: 0; min-height: 44px; padding: 4px; font-size: 13px; line-height: 1.15; }

/* the first visit: Lesson 1 on the real board, a hand on the spot, a quiet way out */
.lesson-head { display: flex; justify-content: flex-end; margin: -2px 0 2px; }
.text-link { min-height: 44px; padding: 0 4px; color: var(--dim); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.newhere-link { align-self: center; display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; color: #c5c9d6; font-size: 14px; text-underline-offset: 3px; text-decoration-color: var(--line); }
.lesson-dots { display: flex; gap: 6px; }
.lesson-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.lesson-dots i.on { background: var(--ink); }
.hand { position: absolute; left: 50%; top: 56%; width: 40%; height: 40%; border-radius: 50%; background: #f2efe6d9; box-shadow: 0 0 0 5px #f2efe640; z-index: 3; pointer-events: none; transform: translate(-50%, -50%); animation: hand-tap 1.2s ease-in-out infinite; }
@keyframes hand-tap { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 45% { transform: translate(-50%, -50%) scale(0.82); } }
@media (prefers-reduced-motion: reduce) { .hand { animation: none !important; } }
#app.in-lesson #g-hearts { display: none; }
#app.in-lesson #g-label { display: none; }
@media (max-height: 680px) {
  #s-game.lesson .tools { flex-basis: 136px; min-height: 136px; }
  .lesson-head { height: 34px; align-items: center; }
}
/* a friend's run beside yours on the result card */
#done .vs { display: grid; gap: 2px; margin: 0; }
#done .vs p { margin: 0; display: grid; grid-template-columns: 4.2em 1fr; gap: 8px; font-size: 14px; color: var(--dim); }
#done .vs b { color: var(--ink); font-weight: 600; }
@media (max-width: 360px) {
  .done-btns:has(> :nth-child(3)) { grid-template-columns: 1fr 1fr; }
  .done-btns:has(> :nth-child(3)) > :first-child { grid-column: 1 / -1; }
}
@media (max-height: 680px) { #done .btn small { display: none; } #done .btn { min-height: 46px; } }

/* How to play: one rule per page, a pager under it; each lesson's first line carries a New tag */
.rule-page-pic { display: flex; justify-content: center; margin: 4px 0 10px; }
ol.rules.one .rule-row { display: block; text-align: center; }
.rules-head + ol.rules .rule-row { grid-template-columns: 1fr; }
.rule-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0 12px; }
.rule-pager .btn { width: 48px; min-height: 44px; padding: 0; font-size: 22px; }
.rule-pager .btn[disabled] { opacity: .35; }
.new-tag { display: inline-block; margin-right: 4px; padding: 0 7px; border-radius: 9px; background: var(--c1, #ff5a6e); color: #17130f; font-size: .78em; font-weight: 800; line-height: 1.5; vertical-align: .08em; }
.hearts.teach { animation: chip-flash .9s ease-in-out 3; }
@media (prefers-reduced-motion: reduce) { .hearts.teach { animation: none; outline: 2px solid var(--c1, #ff5a6e); outline-offset: 3px; border-radius: 8px; } }

/* ---------- Endless: a friend's plate code ---------- */
.code-form { display: grid; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.code-form label { font-size: 14px; color: var(--dim); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--ink);
  font: 700 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px; text-transform: uppercase; }
.code-row .btn { width: auto; flex: none; margin: 0; }
.code-err { min-height: 18px; font-size: 14px; color: var(--c1); }
.challenge-line { font-variant-numeric: tabular-nums; }

/* ---------- the fourth colony: blue, a triangle (Four colours tier) ---------- */
:root { --c4: #5ce1e6; --tri: polygon(50% 4%, 98% 94%, 2% 94%); }
.preview-dot.c4 { background: var(--c4); clip-path: var(--tri); border-radius: 0; }
.chip.c4 { background: var(--c4); --cc: var(--c4); }
/* A count's triangle is drawn behind its number, so a small triangle never clips the digit. */
.sym .c4.chip { background: none; position: relative; isolation: isolate; border-radius: 0; outline: 0; box-shadow: none;
  box-sizing: border-box; flex: none; padding-top: calc(var(--chip, 22px) * 0.26); font-size: calc(var(--chip, 22px) * 0.56); }
.sym .c4.chip::before { content: ""; position: absolute; inset: -3px -4px -1px; background: var(--cc); clip-path: var(--tri); z-index: -2; }
.sym .c4.chip.zero { color: var(--cc); }
.sym .c4.chip.zero::after { content: ""; position: absolute; inset: 3px 1px 2px; background: var(--agar); clip-path: var(--tri); z-index: -1; }
.blob.c4 { background: radial-gradient(circle at 40% 45%, #fff8 0 6%, #a6f2f4 9%, var(--c4) 55%, #2a9aa0); }
.sym .c4.blob, .sym .tool.c4 i, .sym .c4.wilt, .sym .wr.w4, .sym .rp-tool.c4 i:first-child { border-radius: 0; clip-path: var(--tri); }
.sym .c4.blob { inset: 0; padding-top: 30%; font-size: calc(var(--cell) * 0.38); box-shadow: none; }
.nt.n4 { right: 10%; bottom: 6%; color: var(--c4); }
.wr.w4 { right: 6%; bottom: 6%; background: var(--c4); }
.wilt.c4 { background: var(--c4); }
.tool.c4 i { background: var(--c4); }
.tool.c4, .rp-tool.c4 { --tc: var(--c4); }
.why .c4, .species .c4 { color: var(--c4); }
/* the first four-colour plate: the blue button and the given blue colonies breathe until a blue lands */
.tool.new { animation: tool-glow 0.8s ease-in-out infinite alternate; border-color: var(--tc); }
.cell.teach4 .blob { animation: teach4 1.2s ease-in-out infinite; }
@keyframes teach4 { 0%, 100% { transform: scale(1); filter: none; } 50% { transform: scale(1.14); filter: brightness(1.3); } }
.four-card { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 10px; }
.four-card .rp-tool.new { animation: tool-glow 0.8s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) {
  .cell.teach4 .blob { animation: none; outline: 2px solid var(--c4); outline-offset: 2px; }
  .tool.new, .four-card .rp-tool.new { animation: none; box-shadow: 0 0 0 3px var(--c4); }
}

/* Today's puzzle in three sizes, one tap each */
.daily-box { margin-top: 8px; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.daily-h { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; align-items: baseline; }
.daily-h small { font: 12px var(--mono); color: var(--dim); font-weight: 400; }
.daily-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.daily-row .btn { min-height: 52px; padding: 6px 4px; background: #252a36; }
.daily-row .btn.done { border-color: #6f8f5f; }
.endless-pace { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.endless-pace .btn { min-height: 46px; padding: 4px 2px; font-size: 14px; background: #252a36; }
.endless-pace .btn small { font-size: 11px; }
.endless-pace .btn[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
#app[class*="look-"] .endless-pace .btn { background: var(--bg); border-color: var(--line); }
.daily-row .btn.done small { color: #b9d7a6; }
.daily-box + .btn { margin-top: 8px; }
/* A short phone keeps three result buttons on one row, so none falls below the screen. */
@media (max-height: 680px) {
  .done-btns:has(> :nth-child(3)) { grid-template-columns: 1fr 1fr 1fr; }
  .done-btns:has(> :nth-child(3)) > :first-child { grid-column: auto; }
  .done-btns:has(> :nth-child(3)) .btn { padding: 6px 4px; font-size: 14px; line-height: 1.15; }
}

/* ---------- looks (cosmetic only: the same plates, numbers, colours and saves) ---------- */
/* Each look swaps the colony art, the plate and the tiles. Clue chips, tools, notes and wrong marks keep the
   game colours, so every rule reads the same in every look. Pieces keep their shape (circle, square, diamond,
   triangle) in the silhouette, so they stay apart without colour. */
#app[class*="look-"] .blob { inset: 4%; border-radius: 0; clip-path: none; box-shadow: none; background-color: transparent;
  background-position: center; background-size: contain; background-repeat: no-repeat; place-items: start center; padding: 0; }
#app[class*="look-"] .blob::after { content: none; }
#app[class*="look-"] .blob.done { color: #17130f8c; }
#app[class*="look-"] .cell.em .emk { display: none; }
#app[class*="look-"] .cell.em::before { background-size: cover; }
#app[class*="look-"] .cell::before { background-size: cover; background-position: center; }
#app[class*="look-"] .cell.k::before { background: transparent; }
#app[class*="look-"] .tool i, #app[class*="look-"] .rp-tool i, #app[class*="look-"] .pk { border-radius: 0; clip-path: none; background-color: transparent; background-size: contain; background-position: center; background-repeat: no-repeat; }

#app.look-kitten .plate { background: #3b2a1f; border-color: #5a4030; }
#app.look-kitten .cell:not(.k)::before { background: #57402e; }
#app.look-kitten .cell.em::before { background: url(themes/kitten/empty.svg) center / 78% no-repeat, #271a12; }
#app.look-kitten .blob.c1 { background-image: url(themes/kitten/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); }
#app.look-kitten #board.frosting .blob.c1, #app.look-kitten .plate.solved-look .blob.c1 { background-image: url(themes/kitten/piece_1_win.svg); }
#app.look-kitten .tool.c1 i, #app.look-kitten .rp-tool.c1 i, #app.look-kitten .pk.c1 { background-image: url(themes/kitten/piece_1.svg); }
#app.look-kitten .blob.c2 { background-image: url(themes/kitten/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); }
#app.look-kitten #board.frosting .blob.c2, #app.look-kitten .plate.solved-look .blob.c2 { background-image: url(themes/kitten/piece_2_win.svg); }
#app.look-kitten .tool.c2 i, #app.look-kitten .rp-tool.c2 i, #app.look-kitten .pk.c2 { background-image: url(themes/kitten/piece_2.svg); }
#app.look-kitten .blob.c3 { background-image: url(themes/kitten/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); }
#app.look-kitten #board.frosting .blob.c3, #app.look-kitten .plate.solved-look .blob.c3 { background-image: url(themes/kitten/piece_3_win.svg); }
#app.look-kitten .tool.c3 i, #app.look-kitten .rp-tool.c3 i, #app.look-kitten .pk.c3 { background-image: url(themes/kitten/piece_3.svg); }
#app.look-kitten .blob.c4 { background-image: url(themes/kitten/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); }
#app.look-kitten #board.frosting .blob.c4, #app.look-kitten .plate.solved-look .blob.c4 { background-image: url(themes/kitten/piece_4_win.svg); }
#app.look-kitten .tool.c4 i, #app.look-kitten .rp-tool.c4 i, #app.look-kitten .pk.c4 { background-image: url(themes/kitten/piece_4.svg); }
#app.look-duckling .plate { background: #2b4326; border-color: #5c7a4c; }
#app.look-duckling .cell:not(.k)::before { background: #3f5d36; }
#app.look-duckling .cell.em::before { background: url(themes/duckling/empty.svg) center / 78% no-repeat, #1d301d; }
#app.look-duckling .blob.c1 { background-image: url(themes/duckling/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); }
#app.look-duckling #board.frosting .blob.c1, #app.look-duckling .plate.solved-look .blob.c1 { background-image: url(themes/duckling/piece_1_win.svg); }
#app.look-duckling .tool.c1 i, #app.look-duckling .rp-tool.c1 i, #app.look-duckling .pk.c1 { background-image: url(themes/duckling/piece_1.svg); }
#app.look-duckling .blob.c2 { background-image: url(themes/duckling/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); }
#app.look-duckling #board.frosting .blob.c2, #app.look-duckling .plate.solved-look .blob.c2 { background-image: url(themes/duckling/piece_2_win.svg); }
#app.look-duckling .tool.c2 i, #app.look-duckling .rp-tool.c2 i, #app.look-duckling .pk.c2 { background-image: url(themes/duckling/piece_2.svg); }
#app.look-duckling .blob.c3 { background-image: url(themes/duckling/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); }
#app.look-duckling #board.frosting .blob.c3, #app.look-duckling .plate.solved-look .blob.c3 { background-image: url(themes/duckling/piece_3_win.svg); }
#app.look-duckling .tool.c3 i, #app.look-duckling .rp-tool.c3 i, #app.look-duckling .pk.c3 { background-image: url(themes/duckling/piece_3.svg); }
#app.look-duckling .blob.c4 { background-image: url(themes/duckling/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); }
#app.look-duckling #board.frosting .blob.c4, #app.look-duckling .plate.solved-look .blob.c4 { background-image: url(themes/duckling/piece_4_win.svg); }
#app.look-duckling .tool.c4 i, #app.look-duckling .rp-tool.c4 i, #app.look-duckling .pk.c4 { background-image: url(themes/duckling/piece_4.svg); }
#app.look-penguin .plate { background: url(themes/penguin/ground.svg) 0 0 / 120px 120px, #123049; border-color: #28506f; }
#app.look-penguin .cell:not(.k)::before { background: #42708f; }
#app.look-penguin .cell.em::before { background: url(themes/penguin/empty.svg) center / 78% no-repeat, #0b2234; }
#app.look-penguin .blob.c1 { background-image: url(themes/penguin/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.368)); }
#app.look-penguin #board.frosting .blob.c1, #app.look-penguin .plate.solved-look .blob.c1 { background-image: url(themes/penguin/piece_1_win.svg); }
#app.look-penguin .tool.c1 i, #app.look-penguin .rp-tool.c1 i, #app.look-penguin .pk.c1 { background-image: url(themes/penguin/piece_1.svg); }
#app.look-penguin .blob.c2 { background-image: url(themes/penguin/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.368)); }
#app.look-penguin #board.frosting .blob.c2, #app.look-penguin .plate.solved-look .blob.c2 { background-image: url(themes/penguin/piece_2_win.svg); }
#app.look-penguin .tool.c2 i, #app.look-penguin .rp-tool.c2 i, #app.look-penguin .pk.c2 { background-image: url(themes/penguin/piece_2.svg); }
#app.look-penguin .blob.c3 { background-image: url(themes/penguin/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.331)); }
#app.look-penguin #board.frosting .blob.c3, #app.look-penguin .plate.solved-look .blob.c3 { background-image: url(themes/penguin/piece_3_win.svg); }
#app.look-penguin .tool.c3 i, #app.look-penguin .rp-tool.c3 i, #app.look-penguin .pk.c3 { background-image: url(themes/penguin/piece_3.svg); }
#app.look-penguin .blob.c4 { background-image: url(themes/penguin/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.331)); }
#app.look-penguin #board.frosting .blob.c4, #app.look-penguin .plate.solved-look .blob.c4 { background-image: url(themes/penguin/piece_4_win.svg); }
#app.look-penguin .tool.c4 i, #app.look-penguin .rp-tool.c4 i, #app.look-penguin .pk.c4 { background-image: url(themes/penguin/piece_4.svg); }
#app.look-mushroom .plate { background: url(themes/mushroom/ground.svg) 0 0 / 120px 120px, #1a2519; border-color: #34452f; }
#app.look-mushroom .cell:not(.k)::before { background: #30442a; }
#app.look-mushroom .cell.em::before { background: url(themes/mushroom/empty.svg) center / 78% no-repeat, #110c08; }
#app.look-mushroom .blob.c1 { background-image: url(themes/mushroom/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.368)); }
#app.look-mushroom #board.frosting .blob.c1, #app.look-mushroom .plate.solved-look .blob.c1 { background-image: url(themes/mushroom/piece_1_win.svg); }
#app.look-mushroom .tool.c1 i, #app.look-mushroom .rp-tool.c1 i, #app.look-mushroom .pk.c1 { background-image: url(themes/mushroom/piece_1.svg); }
#app.look-mushroom .blob.c2 { background-image: url(themes/mushroom/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.368)); }
#app.look-mushroom #board.frosting .blob.c2, #app.look-mushroom .plate.solved-look .blob.c2 { background-image: url(themes/mushroom/piece_2_win.svg); }
#app.look-mushroom .tool.c2 i, #app.look-mushroom .rp-tool.c2 i, #app.look-mushroom .pk.c2 { background-image: url(themes/mushroom/piece_2.svg); }
#app.look-mushroom .blob.c3 { background-image: url(themes/mushroom/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.304)); }
#app.look-mushroom #board.frosting .blob.c3, #app.look-mushroom .plate.solved-look .blob.c3 { background-image: url(themes/mushroom/piece_3_win.svg); }
#app.look-mushroom .tool.c3 i, #app.look-mushroom .rp-tool.c3 i, #app.look-mushroom .pk.c3 { background-image: url(themes/mushroom/piece_3.svg); }
#app.look-mushroom .blob.c4 { background-image: url(themes/mushroom/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.331)); }
#app.look-mushroom #board.frosting .blob.c4, #app.look-mushroom .plate.solved-look .blob.c4 { background-image: url(themes/mushroom/piece_4_win.svg); }
#app.look-mushroom .tool.c4 i, #app.look-mushroom .rp-tool.c4 i, #app.look-mushroom .pk.c4 { background-image: url(themes/mushroom/piece_4.svg); }
/* the frost belongs to the colony plate; looks get a softer settle instead */
#app[class*="look-"] #board.frosting::after { opacity: 0 !important; animation: none !important; }
#app[class*="look-"] #board.frosting .blob { animation: look-settle 0.5s ease-out both; }
@keyframes look-settle { 0% { transform: scale(1); } 40% { transform: scale(1.08, 0.9); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { #app[class*="look-"] #board.frosting .blob { animation: none; } }
/* the look picker */
.looks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 4px; }
.look-card { display: grid; justify-items: center; gap: 4px; padding: 10px 6px; min-height: 96px; border-radius: 8px; border: 1px solid var(--line); background: #252a36; color: var(--ink); font: inherit; font-weight: 600; font-size: 15px; }
.look-card[aria-pressed="true"] { border: 2px solid var(--ink); background: #333949; }
.look-card .trio { display: flex; gap: 2px; height: 34px; }
.look-card .trio i { width: 34px; height: 34px; background-size: contain; background-repeat: no-repeat; background-position: center; }
.look-card .trio .dot { border-radius: 50%; width: 26px; height: 26px; margin: 4px; }
.look-card small { font: 12px/1.25 var(--mono); color: var(--dim); font-weight: 400; text-align: center; }
.look-card[disabled] { opacity: 1; color: var(--dim); }
.look-card[disabled] .trio { filter: saturate(0.8) brightness(0.8); opacity: 0.85; } /* 2026-10-19: a locked set still shows how it looks (rule 16) */
.unlock-line { margin: 6px 0 0; font-size: 14px; color: #e3e6ee; }

@media (max-height: 680px) { .look-card { min-height: 76px; padding: 6px; } .look-card .trio, .look-card .trio i { height: 26px; } .look-card .trio i { width: 26px; } }
/* Home screen: the hero never shrinks below its own content, so it cannot slide under the top bar or behind
   Continue; when the screen is short the whole menu scrolls instead. The plate gets smaller on short screens. */
#s-menu .menu-top { flex: 1 0 auto; min-height: auto; padding: 4px 0 12px; }
#s-menu { overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
#s-menu .tag { margin-top: 2px; }
@media (max-height: 760px) { #logo-plate { --cell: 20px; padding: 16px; } #s-menu h1 { font-size: 34px; margin: 8px 0 4px; } }
@media (max-height: 600px) { #logo-plate { --cell: 16px; padding: 12px; } }

/* ---------- theme scenes (2026-10-18): page, plate, clue frames, buttons and two small decorations ---------- */
/* Colonies keeps the petri dish. Page colours stay dark so every text and clue keeps its contrast. */
html.look-kitten   { --bg: #1d1712; --panel: #2b2119; --line: #4d3a29; --agar: #3b2a1f; --frame: #8a5a2b; }
html.look-duckling { --bg: #121b14; --panel: #1c2a1d; --line: #35503a; --agar: #2b4326; --frame: #6f9a52; }
html.look-penguin  { --bg: #0d1d2d; --panel: #15304a; --line: #2a5272; --agar: #123049; --frame: #cfe2ee; }
html.look-mushroom { --bg: #121a11; --panel: #1d291b; --line: #36472f; --agar: #1a2519; --frame: #7a5c3a; }
html[class*="look-"] body { background: var(--bg); }
#app[class*="look-"] .chip.c1:not(.zero), #app[class*="look-"] .chip.c2:not(.zero) { box-shadow: 0 0 0 2px var(--frame), 0 1px 0 3px #0005; }
#app[class*="look-"] .tool { background: var(--panel); border-color: var(--line); }
#app[class*="look-"] .tool[aria-pressed="true"] { border-color: var(--ink); }
#app[class*="look-"] .daily-box, #app[class*="look-"] .menu-btns > .btn:not(.primary):not(.ghost) { background: var(--panel); border-color: var(--line); }
/* the plates */
#app.look-kitten .plate { /* a woven basket rim around a wooden floor in window light */
  border: 5px solid #b07a42; outline: 2px dashed #7a4f26; outline-offset: -9px; background: #3b2a1f; }
/* r4: the resting window light no longer lies over the squares and kittens (it made open squares look like two
   kinds). It shows on the rim between squares only; the full sunbeam comes out when the plate is solved. */
#app.look-duckling .plate { /* a pond corner with reeds, then grass */
  border: 4px solid #5c7a4c; outline: 0;
  background: #2b4326; }
#app.look-penguin .plate { /* an ice floe at night */
  border: 4px solid #cfe2ee; outline: 2px solid #86b6d6; outline-offset: -8px; background: #123049; }
#app.look-mushroom .plate { /* a ring of moss on the forest floor */
  border: 4px solid #4c6a3c; outline: 3px dotted #8fb06a; outline-offset: -9px;
  background: #1a2519; }
/* decoration 1: the empty corner where the clue rows meet the clue columns */
#board .corner { position: relative; pointer-events: none; }
#app[class*="look-"] #board .corner::after { content: ""; position: absolute; inset: 10%; background: center / contain no-repeat; opacity: 0.95; }
#app.look-kitten #board .corner::after { background-image: url(themes/kitten/deco.svg); }
#app.look-duckling #board .corner::after { background-image: url(themes/duckling/deco.svg); }
#app.look-penguin #board .corner::after { background-image: url(themes/penguin/deco.svg); }
#app.look-mushroom #board .corner::after { background-image: url(themes/mushroom/deco.svg); }
/* decoration 2: something resting on the rim of the home-screen plate */
#logo-plate { position: relative; }
#app[class*="look-"] #logo-plate::after { content: ""; position: absolute; width: 28%; height: 28%; right: -4%; bottom: -2%; background: center / contain no-repeat; pointer-events: none; }
#app.look-kitten #logo-plate::after { background-image: url(themes/kitten/hero.svg); }
#app.look-duckling #logo-plate::after { background-image: url(themes/duckling/hero.svg); }
#app.look-penguin #logo-plate::after { background-image: url(themes/penguin/hero.svg); }
#app.look-mushroom #logo-plate::after { background-image: url(themes/mushroom/hero.svg); }
#app[class*="look-"] #logo-plate { border-radius: 50%; }
/* a piece that turns toward its neighbours gives a small shuffle; reduced motion keeps only the final pose */
#app[class*="look-"] .blob.turning { animation: face-turn 0.22s ease-out; }
@keyframes face-turn { 0% { transform: scaleX(1); } 45% { transform: scaleX(0.9) translateY(1px); } 100% { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) { #app[class*="look-"] .blob.turning { animation: none; } }
#app[class*="look-"] .daily-row .btn { background: var(--bg); border-color: var(--line); }
#app[class*="look-"] .sheet .look-card { background: var(--bg); }
#app[class*="look-"] .chip.zero { background: #17130f; } /* opaque, so a hollow 0 reads the same over pond, ice or moss */

/* Short phones (2026-10-18): the tool shelf is only as tall as the tools. The result card rises over the message
   line instead of reserving its own height all game, so the plate gets that room (8 x 8 at 320 x 568: 24 -> 32 px). */
@media (max-height: 680px) {
  #s-game:not(.lesson) .tools { flex-basis: 112px; min-height: 112px; }
  #s-game:not(.lesson) #done { inset: auto 4px 0; min-height: 0; height: 174px; background: var(--bg); z-index: 4; }
}
@media (max-height: 680px) {
  #s-game:not(.lesson) { padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  #s-game:not(.lesson) #msg { margin: 2px 2px 4px; }
  #s-game .challenge-line { min-height: 24px; margin: -3px 4px 3px; font-size: 12px; }
}
/* 2026-10-18: mushrooms carry the number on the cap (the face moved to a stouter stem); the cone penguin's number
   sits lower, clear of its beak. */
#app.look-mushroom .blob.c1 { font-size: max(11px, calc(var(--cell) * 0.36)); }
#app.look-mushroom .blob.c2 { font-size: max(11px, calc(var(--cell) * 0.36)); }
#app.look-mushroom .blob.c3 { font-size: max(11px, calc(var(--cell) * 0.3)); }
#app.look-mushroom .blob.c4 { font-size: max(11px, calc(var(--cell) * 0.3)); }
#app.look-penguin .blob.c4 { font-size: max(11px, calc(var(--cell) * 0.31)); }
/* the triangle 0 draws its own hollow; the opaque square above left a dark box beside it in every theme */
#app.sym[class*="look-"] .c4.chip.zero { background: none; }
#app.sym[class*="look-"] .c4.chip.zero::after { background: #17130f; }

/* ---------- the solved moment per theme (2026-10-18) ---------- */
#board .finale { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; overflow: visible; }
.finale .thread { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: thread-grow 0.7s ease-out forwards; filter: drop-shadow(0 0 3px currentColor); opacity: 0.95; }
.finale .thread.c1 { stroke: #ffc2cc; color: #ff5d73; } .finale .thread.c2 { stroke: #fff0b0; color: #ffd34d; }
.finale .thread.c3 { stroke: #ddd2ff; color: #a384ff; } .finale .thread.c4 { stroke: #c4fbfc; color: #5ce1e6; }
@keyframes thread-grow { to { stroke-dashoffset: 0; } }
/* kitten sunbeam (r4): clearly visible, slow, and it stays. Warm pool + one broad soft beam + drifting motes; kittens glow. */
.finale .sun { mix-blend-mode: screen; }
.finale .warm { opacity: 0; animation: sun-warm 1.6s ease-out forwards; }
@keyframes sun-warm { to { opacity: 1; } }
.finale .beam { opacity: 0; transform: translateX(-60%); animation: beam-slide 1.8s cubic-bezier(.25,.7,.3,1) forwards; }
@keyframes beam-slide { 0% { opacity: 0; transform: translateX(-60%); } 35% { opacity: 1; } 100% { opacity: 0.9; transform: translateX(0); } }
.finale .mote { fill: #fff3cf; opacity: 0; animation: mote 3.2s ease-in-out forwards; }
@keyframes mote { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 0.9; } 100% { opacity: 0.55; transform: translate(6px, -16px); } }
#app.look-kitten #board:has(.finale-kitten) .blob { filter: drop-shadow(0 0 5px rgba(255, 206, 110, 0.9)); transition: filter 1.2s ease-out; }
.finale .ripple { fill: none; stroke: #cfeeff; stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: ripple 1.1s ease-out forwards; }
@keyframes ripple { 0% { opacity: 0.8; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.5); } }
.finale .flake { fill: #f4fbff; opacity: 0; animation: flake 2.4s linear forwards; }
@keyframes flake { 0% { opacity: 0.9; transform: translate(0, 0); } 85% { opacity: 0.9; } 100% { opacity: 0; transform: translate(var(--drift), var(--fall)); } }
/* reduced motion: the end state, no movement (threads drawn, beam resting, no ripples or snow) */
.finale.still .thread { animation: none; stroke-dashoffset: 0; }
.finale.still .beam { animation: none; opacity: 0.9; transform: none; } .finale.still .warm { animation: none; opacity: 1; } .finale.still .mote { animation: none; opacity: 0.55; }
.finale.still .ripple, .finale.still .flake { display: none; }
@media (prefers-reduced-motion: reduce) { .finale .thread { animation: none !important; stroke-dashoffset: 0; } .finale .beam { animation: none !important; opacity: 0.9; transform: none; } .finale .warm, .finale .mote { animation: none !important; opacity: 0.9; } #app.look-kitten #board:has(.finale-kitten) .blob { transition: none; } }
/* every finale runs under the pieces and above the ground */
#app[class*="look-"] #board .finale { z-index: 1; }
#app[class*="look-"] #board .blob { z-index: 2; }
#app.look-penguin #board .finale { z-index: 3; } /* snow falls in front */

/* ---------- Bare spots tier (2026-10-18): an empty square showing how many colonies touch it ---------- */
.cell.bare::after { content: none; }
.bare-n { position: relative; z-index: 1; display: grid; place-items: center; width: 72%; height: 72%; border-radius: 50%;
  border: 2px dashed #e9e4d6; color: #f6f2e6; background: #17130fcc; font-weight: 700; font-size: max(12px, calc(var(--cell) * 0.42)); font-variant-numeric: tabular-nums; }
.bare-n.done { opacity: 0.45; }
.mini .bare-n { width: 80%; height: 80%; font-size: 14px; }
.cell.bare.src .bare-n { border-style: solid; border-color: var(--ink); }
/* seven tiers fit two tab rows; plate tiles keep their square size (they used to squash into each other on short phones) */
.tabs:has(> :nth-child(7)) { grid-template-columns: repeat(4, 1fr); }
.tabs:has(> :nth-child(7)) .btn { font-size: 13px; line-height: 1.15; }
.level-grid { grid-auto-rows: max-content; }

/* ---------- Zoom (r4, 2026-10-18): bigger squares on a 10 x 10 plate on a narrow phone ---------- */
/* The plate scrolls inside its own frame; clue rows and columns stay pinned so they never scroll away. */
/* r5: Zoom lives in the tool row beside Hint, never on the plate, so it can never cover a clue chip. */
.tool-row:has(#b-zoom:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.tool-row:has(#b-notes[hidden]):has(#b-zoom:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; }
#b-zoom { padding: 4px 12px; gap: 4px; }
/* a narrow phone: Zoom shows its magnifier only (its name stays in the label), Hint takes its word's width, and
   Rule out keeps the longest colour name on one line */
@media (max-width: 359px) {
  .tool-row:has(#b-zoom:not([hidden])) { grid-template-columns: minmax(0, 1fr) 72px 50px; gap: 6px; }
  .tool-row:has(#b-notes[hidden]):has(#b-zoom:not([hidden])) { grid-template-columns: minmax(0, 1fr) 50px; }
  .tool-row:has(#b-zoom:not([hidden])) #b-notes { font-size: 14px; padding: 8px 6px; }
  .tool-row:has(#b-zoom:not([hidden])) #b-hint { padding: 8px 4px; }
  #b-zoom { padding: 4px; }
  #b-zoom span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
#b-zoom svg { width: 20px; height: 20px; flex: none; }
#b-zoom.on { background: var(--ink); color: #14161c; border-color: var(--ink); }
#b-zoom.on .zv { display: none; }
#board-wrap.zoomed { display: block; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y; border-radius: 16px; }
#board-wrap.zoomed #board { width: max-content; margin: 0 auto; overflow: clip; }
#board-wrap { --hd-bg: #2f2513; }
#app.look-kitten #board-wrap { --hd-bg: #3b2a1f; }
#app.look-duckling #board-wrap { --hd-bg: #2b4326; }
#app.look-penguin #board-wrap { --hd-bg: #123049; }
#app.look-mushroom #board-wrap { --hd-bg: #1a2519; }
#board-wrap.zoomed #board .hd.hrow { position: sticky; left: 0; z-index: 5; background: var(--hd-bg); box-shadow: 4px 0 6px -3px #0009; }
#board-wrap.zoomed #board .hd.col { position: sticky; top: 0; z-index: 5; background: var(--hd-bg); box-shadow: 0 4px 6px -3px #0009; }
#board-wrap.zoomed #board .corner { position: sticky; left: 0; top: 0; z-index: 6; background: var(--hd-bg); }

/* ---------- Quiet board (2026-10-18, r5) ---------- */
/* Open squares are plain soft tiles; the texture lives on the plate rim only. A square marked empty sinks a step
   darker and shows the theme's empty sign, so open and marked-empty never look alike. No resting light over the
   board: the kitten sunbeam comes only with the solve. */
#app[class*="look-"] .cell:not(.k):not(.em)::before { box-shadow: inset 0 1px 0 #ffffff12; }
#app[class*="look-"] .cell.em::before { box-shadow: inset 0 2px 4px #000a; }
/* The number has its own spot on each piece (faces.js NUM / SMALL), below the face or, on mushrooms, on the cap. */
#app[class*="look-"] .blob .nv { position: absolute; left: 50%; top: var(--ny, 66%); transform: translate(-50%, -44%); line-height: 1; font: inherit; } /* -44%: a digit sits on its baseline, so this centres its ink, not its line box */
.blob .nv { font: inherit; }
/* small squares: eyes-only pieces, the number on a clean round patch */
#app[class*="look-"] .blob.sm { font-size: max(10px, calc(var(--cell) * 0.42)); }
/* the solved moment on small squares shows full faces again; the (met) number shrinks with the square to stay under the face */
#app[class*="look-"] .blob.sleep-sm { font-size: calc(var(--cell) * 0.34); }
/* the number spot on a full-size piece where no face code runs (rules cards, minis); same values as faces.js NUM, checked in quiet_acceptance */
#app.look-kitten .blob.c1 { --ny: 68%; } #app.look-kitten .blob.c2 { --ny: 68%; } #app.look-kitten .blob.c3 { --ny: 68%; } #app.look-kitten .blob.c4 { --ny: 72%; }
#app.look-duckling .blob.c1 { --ny: 68%; } #app.look-duckling .blob.c2 { --ny: 68%; } #app.look-duckling .blob.c3 { --ny: 68%; } #app.look-duckling .blob.c4 { --ny: 72%; }
#app.look-penguin .blob.c1 { --ny: 71%; } #app.look-penguin .blob.c2 { --ny: 71%; } #app.look-penguin .blob.c3 { --ny: 68%; } #app.look-penguin .blob.c4 { --ny: 72%; }
#app.look-mushroom .blob.c1 { --ny: 33%; } #app.look-mushroom .blob.c2 { --ny: 30%; } #app.look-mushroom .blob.c3 { --ny: 35%; } #app.look-mushroom .blob.c4 { --ny: 47%; }

/* Hidden colours tier (2026-10-18): a colony whose colour is not shown. Plain grey with a dashed ring in
   every theme, so it never looks like one of the real colours. */
.blob.hid { background: radial-gradient(circle at 32% 28%, #ffffff66 0 7%, #c9ccd4 10%, #9aa0ad 60%, #6c7280) !important; background-image: radial-gradient(circle at 32% 28%, #ffffff66 0 7%, #c9ccd4 10%, #9aa0ad 60%, #6c7280) !important; outline: 2px dashed #ffffffaa; outline-offset: -5px; }
.blob.hid::after { display: none; }
.cell.hid > .nt, .cell.hid > .wr { z-index: 3; }

/* Antibiotic discs: a white paper disc on a colony carries the number of clear (empty) squares around it,
   inside a faint clear zone. The colony's colour stays visible around the disc. */
.cell.halo .blob { box-shadow: 0 0 0 2px rgba(255,255,255,.22), 0 0 0 6px rgba(255,255,255,.10); }
.cell.halo .blob .nv { width: 64%; height: 64%; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  background: radial-gradient(circle at 35% 30%, #ffffff 0 40%, #eceae2 75%, #d6d3c8); color: #1d2430;
  font-size: calc(var(--cell) * 0.36); box-shadow: 0 1px 2px #0007, inset 0 0 0 1px #0002; position: relative; z-index: 2; }

/* Rule out by dragging: with Rule out on, a finger on the plate marks squares instead of scrolling the page. */
#board.ruling, #board.ruling .cell { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* New-rule steps: one sentence beside one small picture; the ringed square is the one the sentence is about. */
ol.steps { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 10px; text-align: left; }
.step { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; }
.step-pic { justify-self: center; display: flex; align-items: center; }
.step-pic .mini { --cell: 24px; --chip: 16px; padding: 3px; border-radius: 9px; }
.step-pic .rp-tap .mini { --cell: 22px; }
.step-pic .rp-tap { gap: 2px; }
.step-text { font-size: 15px; line-height: 1.35; }
.mini .cell.pt { outline: 2.5px solid #ffe08a; outline-offset: -1px; border-radius: 26%; z-index: 2; }
/* A hidden colony still waiting for its colour: a gold question mark in its corner, so the plate never looks done. */
.cell.hid .hid-q { position: absolute; top: 0; right: 1px; z-index: 3; font: 700 calc(var(--cell) * 0.42)/1 system-ui, sans-serif; font-style: normal; color: #ffd36b; text-shadow: 0 1px 2px #000c; pointer-events: none; }
.blob.hid { outline-color: #ffd36b !important; }
.step.wide { grid-template-columns: 1fr; gap: 6px; }
.step.wide .step-text { text-align: center; }
.step-pic .mini { width: max-content; justify-self: center; }
.endless-pace .btn[aria-pressed="true"] { color: var(--ink); }

/* ---------- 2026-10-19 unlockable sets: dumplings, cakes, boba tea, Halloween, Christmas (pieces from docs/faces.js) ---------- */
html.look-dumpling { --bg: #17130e; --panel: #261e15; --line: #4a3a26; --agar: #5a4428; --frame: #c9a46a; }
#app.look-dumpling .plate { /* a bamboo steamer */ border: 5px solid #c9a46a; outline: 2px solid #9c7a45; outline-offset: -9px; background: #5a4428; }
#app.look-dumpling .cell:not(.k)::before { background: #6e5534; }
#app.look-dumpling .cell.em::before { background: url(themes/dumpling/empty.svg) center / 78% no-repeat, #17130e; }
#app.look-dumpling .blob.c1 { background-image: url(themes/dumpling/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-dumpling #board.frosting .blob.c1, #app.look-dumpling .plate.solved-look .blob.c1 { background-image: url(themes/dumpling/piece_1_win.svg); }
#app.look-dumpling .tool.c1 i, #app.look-dumpling .rp-tool.c1 i, #app.look-dumpling .pk.c1 { background-image: url(themes/dumpling/piece_1.svg); }
#app.look-dumpling .blob.c2 { background-image: url(themes/dumpling/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-dumpling #board.frosting .blob.c2, #app.look-dumpling .plate.solved-look .blob.c2 { background-image: url(themes/dumpling/piece_2_win.svg); }
#app.look-dumpling .tool.c2 i, #app.look-dumpling .rp-tool.c2 i, #app.look-dumpling .pk.c2 { background-image: url(themes/dumpling/piece_2.svg); }
#app.look-dumpling .blob.c3 { background-image: url(themes/dumpling/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); --ny: 68%; }
#app.look-dumpling #board.frosting .blob.c3, #app.look-dumpling .plate.solved-look .blob.c3 { background-image: url(themes/dumpling/piece_3_win.svg); }
#app.look-dumpling .tool.c3 i, #app.look-dumpling .rp-tool.c3 i, #app.look-dumpling .pk.c3 { background-image: url(themes/dumpling/piece_3.svg); }
#app.look-dumpling .blob.c4 { background-image: url(themes/dumpling/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); --ny: 72%; }
#app.look-dumpling #board.frosting .blob.c4, #app.look-dumpling .plate.solved-look .blob.c4 { background-image: url(themes/dumpling/piece_4_win.svg); }
#app.look-dumpling .tool.c4 i, #app.look-dumpling .rp-tool.c4 i, #app.look-dumpling .pk.c4 { background-image: url(themes/dumpling/piece_4.svg); }
#app.look-dumpling #board .corner::after { background-image: url(themes/dumpling/deco.svg); }
#app.look-dumpling #logo-plate::after { background-image: url(themes/dumpling/hero.svg); }
#app.look-dumpling #board-wrap { --hd-bg: #5a4428; }
html.look-cake { --bg: #1b1418; --panel: #2a1e24; --line: #4d3440; --agar: #3f2833; --frame: #f1c6d3; }
#app.look-cake .plate { /* a cake stand */ border: 5px solid #f1c6d3; outline: 2px dotted #fff3f6; outline-offset: -9px; background: #3f2833; }
#app.look-cake .cell:not(.k)::before { background: #553845; }
#app.look-cake .cell.em::before { background: url(themes/cake/empty.svg) center / 78% no-repeat, #1b1418; }
#app.look-cake .blob.c1 { background-image: url(themes/cake/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-cake #board.frosting .blob.c1, #app.look-cake .plate.solved-look .blob.c1 { background-image: url(themes/cake/piece_1_win.svg); }
#app.look-cake .tool.c1 i, #app.look-cake .rp-tool.c1 i, #app.look-cake .pk.c1 { background-image: url(themes/cake/piece_1.svg); }
#app.look-cake .blob.c2 { background-image: url(themes/cake/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-cake #board.frosting .blob.c2, #app.look-cake .plate.solved-look .blob.c2 { background-image: url(themes/cake/piece_2_win.svg); }
#app.look-cake .tool.c2 i, #app.look-cake .rp-tool.c2 i, #app.look-cake .pk.c2 { background-image: url(themes/cake/piece_2.svg); }
#app.look-cake .blob.c3 { background-image: url(themes/cake/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); --ny: 68%; }
#app.look-cake #board.frosting .blob.c3, #app.look-cake .plate.solved-look .blob.c3 { background-image: url(themes/cake/piece_3_win.svg); }
#app.look-cake .tool.c3 i, #app.look-cake .rp-tool.c3 i, #app.look-cake .pk.c3 { background-image: url(themes/cake/piece_3.svg); }
#app.look-cake .blob.c4 { background-image: url(themes/cake/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); --ny: 72%; }
#app.look-cake #board.frosting .blob.c4, #app.look-cake .plate.solved-look .blob.c4 { background-image: url(themes/cake/piece_4_win.svg); }
#app.look-cake .tool.c4 i, #app.look-cake .rp-tool.c4 i, #app.look-cake .pk.c4 { background-image: url(themes/cake/piece_4.svg); }
#app.look-cake #board .corner::after { background-image: url(themes/cake/deco.svg); }
#app.look-cake #logo-plate::after { background-image: url(themes/cake/hero.svg); }
#app.look-cake #board-wrap { --hd-bg: #3f2833; }
html.look-boba { --bg: #16120f; --panel: #251d17; --line: #47372a; --agar: #3a291d; --frame: #e8d3b5; }
#app.look-boba .plate { /* a cafe tray */ border: 5px solid #e8d3b5; outline: 2px dashed #b89a72; outline-offset: -9px; background: #3a291d; }
#app.look-boba .cell:not(.k)::before { background: #4d3828; }
#app.look-boba .cell.em::before { background: url(themes/boba/empty.svg) center / 78% no-repeat, #16120f; }
#app.look-boba .blob.c1 { background-image: url(themes/boba/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-boba #board.frosting .blob.c1, #app.look-boba .plate.solved-look .blob.c1 { background-image: url(themes/boba/piece_1_win.svg); }
#app.look-boba .tool.c1 i, #app.look-boba .rp-tool.c1 i, #app.look-boba .pk.c1 { background-image: url(themes/boba/piece_1.svg); }
#app.look-boba .blob.c2 { background-image: url(themes/boba/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-boba #board.frosting .blob.c2, #app.look-boba .plate.solved-look .blob.c2 { background-image: url(themes/boba/piece_2_win.svg); }
#app.look-boba .tool.c2 i, #app.look-boba .rp-tool.c2 i, #app.look-boba .pk.c2 { background-image: url(themes/boba/piece_2.svg); }
#app.look-boba .blob.c3 { background-image: url(themes/boba/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); --ny: 68%; }
#app.look-boba #board.frosting .blob.c3, #app.look-boba .plate.solved-look .blob.c3 { background-image: url(themes/boba/piece_3_win.svg); }
#app.look-boba .tool.c3 i, #app.look-boba .rp-tool.c3 i, #app.look-boba .pk.c3 { background-image: url(themes/boba/piece_3.svg); }
#app.look-boba .blob.c4 { background-image: url(themes/boba/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); --ny: 72%; }
#app.look-boba #board.frosting .blob.c4, #app.look-boba .plate.solved-look .blob.c4 { background-image: url(themes/boba/piece_4_win.svg); }
#app.look-boba .tool.c4 i, #app.look-boba .rp-tool.c4 i, #app.look-boba .pk.c4 { background-image: url(themes/boba/piece_4.svg); }
#app.look-boba #board .corner::after { background-image: url(themes/boba/deco.svg); }
#app.look-boba #logo-plate::after { background-image: url(themes/boba/hero.svg); }
#app.look-boba #board-wrap { --hd-bg: #3a291d; }
html.look-halloween { --bg: #110c18; --panel: #1d1528; --line: #3b2b4f; --agar: #24183a; --frame: #ff9a3c; }
#app.look-halloween .plate { /* a haunted night */ border: 4px solid #ff9a3c; outline: 2px dashed #7b4fa8; outline-offset: -8px; background: #24183a; }
#app.look-halloween .cell:not(.k)::before { background: #352650; }
#app.look-halloween .cell.em::before { background: url(themes/halloween/empty.svg) center / 78% no-repeat, #110c18; }
#app.look-halloween .blob.c1 { background-image: url(themes/halloween/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-halloween #board.frosting .blob.c1, #app.look-halloween .plate.solved-look .blob.c1 { background-image: url(themes/halloween/piece_1_win.svg); }
#app.look-halloween .tool.c1 i, #app.look-halloween .rp-tool.c1 i, #app.look-halloween .pk.c1 { background-image: url(themes/halloween/piece_1.svg); }
#app.look-halloween .blob.c2 { background-image: url(themes/halloween/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-halloween #board.frosting .blob.c2, #app.look-halloween .plate.solved-look .blob.c2 { background-image: url(themes/halloween/piece_2_win.svg); }
#app.look-halloween .tool.c2 i, #app.look-halloween .rp-tool.c2 i, #app.look-halloween .pk.c2 { background-image: url(themes/halloween/piece_2.svg); }
#app.look-halloween .blob.c3 { background-image: url(themes/halloween/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); --ny: 68%; }
#app.look-halloween #board.frosting .blob.c3, #app.look-halloween .plate.solved-look .blob.c3 { background-image: url(themes/halloween/piece_3_win.svg); }
#app.look-halloween .tool.c3 i, #app.look-halloween .rp-tool.c3 i, #app.look-halloween .pk.c3 { background-image: url(themes/halloween/piece_3.svg); }
#app.look-halloween .blob.c4 { background-image: url(themes/halloween/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); --ny: 72%; }
#app.look-halloween #board.frosting .blob.c4, #app.look-halloween .plate.solved-look .blob.c4 { background-image: url(themes/halloween/piece_4_win.svg); }
#app.look-halloween .tool.c4 i, #app.look-halloween .rp-tool.c4 i, #app.look-halloween .pk.c4 { background-image: url(themes/halloween/piece_4.svg); }
#app.look-halloween #board .corner::after { background-image: url(themes/halloween/deco.svg); }
#app.look-halloween #logo-plate::after { background-image: url(themes/halloween/hero.svg); }
#app.look-halloween #board-wrap { --hd-bg: #24183a; }
html.look-xmas { --bg: #0e1712; --panel: #18271e; --line: #2f4a39; --agar: #1d3727; --frame: #e6e0d0; }
#app.look-xmas .plate { /* a snowy windowsill */ border: 5px solid #e6e0d0; outline: 3px dotted #ff5d73; outline-offset: -9px; background: #1d3727; }
#app.look-xmas .cell:not(.k)::before { background: #2b4a37; }
#app.look-xmas .cell.em::before { background: url(themes/xmas/empty.svg) center / 78% no-repeat, #0e1712; }
#app.look-xmas .blob.c1 { background-image: url(themes/xmas/piece_1.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-xmas #board.frosting .blob.c1, #app.look-xmas .plate.solved-look .blob.c1 { background-image: url(themes/xmas/piece_1_win.svg); }
#app.look-xmas .tool.c1 i, #app.look-xmas .rp-tool.c1 i, #app.look-xmas .pk.c1 { background-image: url(themes/xmas/piece_1.svg); }
#app.look-xmas .blob.c2 { background-image: url(themes/xmas/piece_2.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.4)); --ny: 68%; }
#app.look-xmas #board.frosting .blob.c2, #app.look-xmas .plate.solved-look .blob.c2 { background-image: url(themes/xmas/piece_2_win.svg); }
#app.look-xmas .tool.c2 i, #app.look-xmas .rp-tool.c2 i, #app.look-xmas .pk.c2 { background-image: url(themes/xmas/piece_2.svg); }
#app.look-xmas .blob.c3 { background-image: url(themes/xmas/piece_3.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.36)); --ny: 68%; }
#app.look-xmas #board.frosting .blob.c3, #app.look-xmas .plate.solved-look .blob.c3 { background-image: url(themes/xmas/piece_3_win.svg); }
#app.look-xmas .tool.c3 i, #app.look-xmas .rp-tool.c3 i, #app.look-xmas .pk.c3 { background-image: url(themes/xmas/piece_3.svg); }
#app.look-xmas .blob.c4 { background-image: url(themes/xmas/piece_4.svg); place-items: center; font-size: max(11px, calc(var(--cell) * 0.32)); --ny: 72%; }
#app.look-xmas #board.frosting .blob.c4, #app.look-xmas .plate.solved-look .blob.c4 { background-image: url(themes/xmas/piece_4_win.svg); }
#app.look-xmas .tool.c4 i, #app.look-xmas .rp-tool.c4 i, #app.look-xmas .pk.c4 { background-image: url(themes/xmas/piece_4.svg); }
#app.look-xmas #board .corner::after { background-image: url(themes/xmas/deco.svg); }
#app.look-xmas #logo-plate::after { background-image: url(themes/xmas/hero.svg); }
#app.look-xmas #board-wrap { --hd-bg: #1d3727; }
/* the seasonal set offered on the home screen, and the hats row on the Theme card */
.btn.season-offer { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; font-size: 15px; background: var(--panel, #20232c); border: 1px dashed var(--line, #3a3f4b); flex-direction: row; }
.btn.season-offer small { display: block; font-size: 12px; opacity: .8; }
.btn.season-offer .trio i { width: 24px; height: 24px; }

.btn.season-offer .trio, .look-hats .trio { display: inline-flex; gap: 2px; }
.btn.season-offer .trio i, .look-hats .trio i { display: inline-block; width: 26px; height: 26px; background-size: contain; background-repeat: no-repeat; background-position: center; }

/* 2026-10-19 round 2: each set has its own colours, so clue counts and buttons follow the set */
html.look-dumpling { --c1: #e8607a; --c2: #f4c64e; --c3: #a98be0; --c4: #7cc47f; }
html.look-cake { --c1: #c8374a; --c2: #f6d26b; --c3: #9b6fd6; --c4: #a9764f; }
html.look-boba { --c1: #f37fa0; --c2: #d9a56a; --c3: #b597e6; --c4: #8ec46e; }
html.look-halloween { --c1: #ff7a3a; --c2: #f2df9b; --c3: #8f6ad6; --c4: #bfeff2; }
html.look-xmas { --c1: #e84a5f; --c2: #d8a457; --c3: #9a7ae0; --c4: #d9f3f5; }
/* hats and costumes, one per colour */
.hats-box { margin: 10px 0 8px; }
.hats-head, .hats-locked { margin: 4px 0 6px; font-size: 14px; color: var(--dim); }
.hat-who { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }
.hat-k { min-height: 56px; border-radius: 8px; border: 1px solid var(--line); background: #252a36; padding: 4px; }
.hat-k[aria-pressed="true"] { border: 2px solid var(--ink); background: #333949; }
.hat-k i, .hat-opt i { display: block; width: 100%; height: 44px; background: center / contain no-repeat; }
.hat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.hat-opt { border-radius: 8px; border: 1px solid var(--line); background: #252a36; color: var(--ink); padding: 3px 2px; font: 11px/1.2 system-ui, sans-serif; min-height: 44px; }
.hat-opt i { height: 34px; }
.hat-opt[aria-pressed="true"] { border: 2px solid var(--ink); background: #333949; }
.hat-opt[disabled] { opacity: 0.55; }
.hat-opt small { display: block; font-size: 10px; color: var(--dim); }

a.btn { text-decoration: none; color: inherit; }

/* the game's own logo and title, top-left (house rule 22) */
.brand { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 16px; white-space: nowrap; }
button.brand { background: none; border: 0; padding: 0 4px; cursor: pointer; font-weight: 400; }
.brand-dish { width: 28px; height: 28px; border-radius: 50%; position: relative; background: radial-gradient(circle at 30% 20%, #725222, var(--agar, #8a6a30) 60%); border: 1.5px solid #d7e3e06b; flex: 0 0 auto; }
.brand-dish i { position: absolute; width: 8px; height: 8px; border-radius: 50%; }
.brand-dish .c1 { left: 5px; top: 5px; background: var(--c1); } .brand-dish .c2 { right: 5px; top: 8px; background: var(--c2); border-radius: 2px; } .brand-dish .c3 { left: 10px; bottom: 4px; background: var(--c3); border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
@media (max-width: 340px) { .brand-name { font-size: 13px; } }

/* ---- 2026-10-20 home, plates, endless, settings (P1c11): rows with hairlines, tape labels, one big button ---- */
:root { --tape: #e8dfc6; --tape-ink: #2a251c; --tape-edge: #cfc4a6; }
.tape { display: inline-block; align-self: flex-start; background: var(--tape); color: var(--tape-ink); font: 600 12px/1 var(--mono); letter-spacing: .8px; text-transform: uppercase;
  padding: 6px 10px 5px; border-left: 1px dashed var(--tape-edge); border-right: 1px dashed var(--tape-edge); transform: rotate(-1.5deg); white-space: nowrap; }
.tape.r { transform: rotate(1.2deg); }
.tape.dim { background: #3a3d47; color: #c9cbd3; border-color: #50545f; }
#s-menu, #s-settings, #s-endless, #s-sets, #s-maker { overflow-y: auto; }
#s-menu { padding: 0 16px 12px; }
.hero { display: flex; flex-direction: column; align-items: center; position: relative; margin: 0 0 12px; }
.dishwrap { position: relative; width: min(224px, 56vw); }
.home-plate { display: block; position: relative; width: 100%; min-height: 44px; border-radius: 50%; transform-origin: center; transition: transform 120ms ease-out, filter 120ms ease-out; touch-action: manipulation; }
.home-plate.pressed, .home-plate:active { transform: scale(.96); filter: brightness(.85); }
.home-plate:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; }
.dishwrap svg.dish { display: block; width: 100%; height: auto; }
.dishwrap .tape { position: absolute; top: 4%; left: -12%; }
.dishwrap .date-tape { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 11px; border: 1px solid var(--tape-edge); border-radius: 3px; box-shadow: 0 3px 0 #0005, 0 5px 12px #0005; font-size: 11px; letter-spacing: .25px; transform: rotate(-1.5deg); }
.date-arrow { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--tape-ink); color: var(--tape); font: 10px/1 system-ui, sans-serif; }
.home-plate.pressed .date-tape, .home-plate:active .date-tape { box-shadow: 0 1px 0 #0006; }
.dishwrap .tape.streak { top: auto; bottom: 8%; left: auto; right: -14%; }
@media (prefers-reduced-motion: reduce) { .home-plate { transition: none; } .home-plate.pressed, .home-plate:active { transform: none; } }
.hero h1 { font-size: 28px; margin: 8px 0 0; align-self: stretch; text-align: left; }
.hero .goal { color: var(--dim); margin: 2px 0 0; font-size: 15px; align-self: stretch; max-width: 34ch; }
.sizes { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 0 0 10px; flex: 0 0 auto; }
.sizes button { background: none; color: var(--ink); min-height: 54px; font: 600 15px/1.2 system-ui, sans-serif; border-right: 1px solid var(--line); display: grid; align-content: center; justify-items: center; }
.sizes button:last-child { border-right: 0; }
.sizes button small { font: 12px/1.3 var(--mono); color: var(--dim); }
.sizes button[aria-pressed="true"] { background: #262a35; box-shadow: inset 0 -3px 0 var(--ink); }
.sizes button.done b::after { content: " \2713"; color: #8fd18b; }
.btn-main { display: block; flex: 0 0 auto; width: 100%; min-height: 54px; border-radius: 6px; background: var(--ink); color: #14161c; font: 600 17px/1.2 system-ui, sans-serif; padding: 15px 10px; }
.btn-main:active { transform: scale(0.98); }
.season { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; min-height: 44px; margin: 8px 0 0; color: var(--dim); font-size: 13px; text-align: left; }
.season .trio { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.season .trio i { width: 24px; height: 24px; display: inline-block; background-size: contain; background-repeat: no-repeat; background-position: center; }
.rows { border-top: 1px solid var(--line); margin-top: 8px; flex: 0 0 auto; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 8px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font: 500 19px/1.2 var(--serif); }
.row .t > span { display: block; color: var(--dim); font: 13px/1.3 var(--mono); margin-top: 3px; }
.row .go { color: var(--dim); font: 16px/1 var(--mono); white-space: nowrap; }
.row:active { background: #1a1d26; }
.foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 6px; flex: 0 0 auto; }
.foot button { min-height: 44px; min-width: 44px; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; padding: 0 2px; }
.foot .trio { display: inline-flex; gap: 2px; }
.foot .trio i { width: 18px; height: 18px; display: inline-block; background-size: contain; background-repeat: no-repeat; background-position: center; }
.foot .trio .dot { width: 14px; height: 14px; margin: 2px; border-radius: 50%; }
.screen-title { align-items: center; margin: 4px 0 10px; }
.screen-title .tape { align-self: center; }
.screen > .sub { color: var(--dim); font-size: 15px; margin: 0 0 12px; }
.plates-more { flex: 0 0 auto; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.plates-more > .btn { background: none; justify-content: flex-start; width: auto; justify-self: start; }
.plates-more .code-form { margin-top: 4px; padding-top: 0; border-top: 0; }
.e-head { font-size: 21px; line-height: 1.2; margin: 0 0 8px; }
.e-line { margin: 0 0 4px; color: var(--dim); font-size: 14px; line-height: 1.35; }
.e-line b { color: var(--ink); font: 600 12px/1 var(--mono); letter-spacing: .6px; text-transform: uppercase; margin-right: 8px; }
.e-pick { margin: 10px 0 8px; font-size: 14px; }
.paces { border-top: 1px solid var(--line); flex: 0 0 auto; }
.pcard { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 88px; padding: 10px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.pcard:active { background: #1a1d26; }
.pcard .part { flex: 0 0 64px; width: 64px; height: 64px; }
.pcard .part svg { display: block; }
.pcard .t { flex: 1; min-width: 0; display: block; }
.pcard .t b { display: block; font: 500 19px/1.2 var(--serif); }
.pcard[aria-pressed="true"] .t b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-right: 8px; vertical-align: middle; }
.pcard .prule { display: block; color: var(--ink); font-size: 14px; line-height: 1.3; margin-top: 2px; }
.pcard .isnew { display: block; color: #e8c97a; font-size: 13px; line-height: 1.3; margin-top: 3px; }
.pcard .meta { display: flex; align-items: center; gap: 10px; margin-top: 5px; color: var(--dim); font: 12px/1.2 var(--mono); flex-wrap: wrap; }
.pcard .go { align-self: center; color: var(--ink); font: 600 13px/1 var(--mono); border: 1px solid var(--line); border-radius: 6px; padding: 12px 10px; min-height: 44px; display: flex; align-items: center; background: var(--panel); }
.pdots { display: inline-flex; align-items: flex-end; gap: 3px; height: 16px; }
.pdots i { width: 7px; height: 7px; border-radius: 50%; border: 1px solid #6a7080; display: block; }
.pdots i.on { background: var(--ink); border-color: var(--ink); }
.pdots i.ramp { border-radius: 2px; background: var(--ink); border-color: var(--ink); }
.pa-tile { fill: #4a3920; }
.pa-agar { fill: var(--agar); stroke: #5a4724; stroke-width: 1; }
.pa-grid path { stroke: #7d6a45; stroke-width: 1; fill: none; }
.pa-c1 { fill: var(--c1); } .pa-c2 { fill: var(--c2); } .pa-c3 { fill: var(--c3); }
.pa-ring { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-opacity: .8; }
.pa-empty { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 2; stroke-opacity: .7; }
.e-note { color: var(--dim); font-size: 13px; margin: 14px 0 6px; line-height: 1.35; }
/* settings */
.set-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding-bottom: 8px; }
.set-body .tape { margin: 16px 0 6px; }
.set-body .tape:first-child { margin-top: 4px; }
.opt { gap: 12px; padding: 6px 0; text-align: left; width: 100%; }
.opt-t { flex: 1; min-width: 0; display: block; }
.opt-t b { display: block; font-weight: 500; font-size: 16px; }
.opt-t small { display: block; color: var(--dim); font-size: 13px; line-height: 1.3; }
.sw { flex: 0 0 52px; }
.opt-go .trio { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.opt-go .trio i { width: 26px; height: 26px; display: inline-block; background-size: contain; background-repeat: no-repeat; background-position: center; }
.opt-go .trio .dot { width: 20px; height: 20px; margin: 3px; border-radius: 50%; }
.opt-go .go { color: var(--dim); font: 20px/1 var(--serif); }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin: 2px 0 4px; }
.seg button { min-height: 72px; display: grid; justify-items: center; align-content: center; gap: 8px; font: 500 15px/1.2 system-ui, sans-serif; color: var(--dim); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: #262a35; color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.pv { display: inline-flex; gap: 10px; }
.pv i { width: 15px; height: 15px; display: inline-block; }
.pv .p1 { border-radius: 50%; } .pv .p2 { border-radius: 3px; } .pv .p3 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); } .pv .p4 { clip-path: polygon(50% 4%, 98% 94%, 2% 94%); }
.pal-std .p1 { background: #ff5d73; } .pal-std .p2 { background: #ffd34d; } .pal-std .p3 { background: #a384ff; } .pal-std .p4 { background: #5aa9ff; }
.pal-oi .p1 { background: #D55E00; } .pal-oi .p2 { background: #F0E442; } .pal-oi .p3 { background: #CC79A7; } .pal-oi .p4 { background: #0072B2; }
.opt-note { color: var(--dim); font-size: 13px; margin: 2px 0 6px; }
.erase { color: #ff8a8a; font: 500 16px/1.2 system-ui, sans-serif; min-height: 44px; text-align: left; padding: 0; }
.erase-sub { display: block; color: var(--dim); font-size: 13px; }
.erase-ask { color: #ffb3b3; margin: 0 0 8px; font-size: 15px; }
.erase-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.erase-yes { color: #ff8a8a; border-color: #6b3039; }
/* the game bar: logo and name left, the plate name and hearts in the middle, "?" right */
.topbar { padding: 0 12px; }
.topbar .how-btn { width: 44px; padding: 0; justify-content: center; }
.topbar .how-long { display: none; }
.topbar .how-short { display: inline; }
#bar-mid #g-label { font-size: 15px; }
/* colour-blind safe palette: Okabe-Ito, on pieces, counts, the palette bar and the share card */
html.pal-cb, html.pal-cb[class*="look-"] { --c1: #D55E00; --c2: #F0E442; --c3: #CC79A7; --c4: #0072B2; }
html.pal-cb .blob.c1 { background: radial-gradient(circle at 30% 25%, #fff8 0 7%, #f0914d 9%, var(--c1) 55%, #8f3f00); }
html.pal-cb .blob.c2 { background: radial-gradient(circle at 30% 25%, #fff9 0 7%, #f8f19b 9%, var(--c2) 55%, #b5a80c); }
html.pal-cb .blob.c3 { background: radial-gradient(circle at 30% 25%, #fff8 0 7%, #e6b4d3 9%, var(--c3) 55%, #8c4a72); }
html.pal-cb .blob.c4 { background: radial-gradient(circle at 40% 45%, #fff8 0 6%, #68aedb 9%, var(--c4) 55%, #00436b); color: #fff; }
.set-body > * { flex: 0 0 auto; }
.goal-line { flex: 0 0 auto; margin: 0; padding: 2px 0 0; min-height: 26px; white-space: nowrap; text-align: center; color: var(--dim); font-size: 15px; line-height: 1.3; }
.goal-line b { color: var(--ink); font-weight: 600; }
#s-game.lesson .goal-line { display: none; }

/* Place by dragging: a finger on the plate paints squares instead of scrolling the page (a zoomed plate still pans). */
#board-wrap:not(.zoomed) #board, #board-wrap:not(.zoomed) #board .cell { touch-action: none; -webkit-touch-callout: none; }
.cell.prev { outline: 3px solid var(--pv, var(--ink)); outline-offset: -3px; z-index: 3; }
.cell.prev-erase { outline-style: dashed; }
.undo-link { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; border-bottom: 2px solid currentColor; padding: 6px 2px; margin-left: 6px; min-height: 44px; }
/* 2026-10-20: the piece is the label. .pk is a piece drawn inline in a sentence or on a button; the sets restyle it above. */
.pk { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin: 0 0.08em; border-radius: 50%; flex: none; }
.pk.c1 { background: var(--c1); } .pk.c2 { background: var(--c2); } .pk.c3 { background: var(--c3); } .pk.c4 { background: var(--c4); }
.sym .pk.c2 { border-radius: 18%; }
.sym .pk.c3 { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.sym .pk.c4 { border-radius: 0; clip-path: var(--tri); }
.pk.none { visibility: hidden; }
#b-notes .pk { width: 18px; height: 18px; vertical-align: -4px; }
#msg .pk { width: 1.35em; height: 1.35em; vertical-align: -0.3em; }
/* palette: big piece, only the count in a small badge; the name is for screen readers */
.tool:not(.c0) i { width: 38px; height: 38px; }
.tool:not(.c0) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tool:not(.c0) em { position: absolute; top: 4px; right: 4px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; line-height: 1; }
.tool:not(.c0) em:empty { display: none; }
@media (max-width: 360px) { .tool:not(.c0) i { width: 34px; height: 34px; } .tool:not(.c0) em { top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 11px; } }

/* ---------- Sets screen ---------- */
.sets-top { display: flex; gap: 14px; align-items: flex-start; flex: 0 0 auto; }
.tryon-wrap { flex: 0 0 148px; }
.tryon { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 7px; border-radius: 10px; border: 2px solid #5a4724; background: radial-gradient(circle at 50% 40%, #7a5a26, #2b2112); width: 148px; }
.tryon .tc { aspect-ratio: 1; border-radius: 4px; background: rgba(20,14,6,.42); display: block; position: relative; }
.tryon .tc i { position: absolute; inset: 0; background: center / contain no-repeat; display: block; }
.tryon .tc i.dot { inset: 18%; border-radius: 50%; background: var(--c1); }
.tryon .tc i.dot.k2 { border-radius: 18%; background: var(--c2); }
.tryon .tc i.dot.k3 { border-radius: 0; background: var(--c3); clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); inset: 12%; }
.tryon .tc i.dot.k4 { border-radius: 0; background: #5ce1e6; clip-path: polygon(50% 0,100% 100%,0 100%); inset: 14%; }
.tryon.small { width: 96px; flex: 0 0 96px; margin: 0; padding: 4px; gap: 2px; }
.set-card { flex: 1; min-width: 0; }
.set-card .tape { margin-bottom: 6px; }
.set-name { margin: 2px 0 4px; font-size: 24px; }
.set-need { margin: 0 0 8px; color: var(--dim); font-size: 14px; line-height: 1.3; }
.set-prog { margin: 6px 0 0; color: var(--dim); font: 12px/1.3 var(--mono); }
.pbar { height: 6px; background: #2b303c; border-radius: 3px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--ink); }
.sets-act { margin: 12px 0 8px; flex: 0 0 auto; }
.sets-act .btn { width: 100%; }
.sets-act .btn:not(.primary) { background: transparent; }
.set-list { border-top: 1px solid var(--line); flex: 0 0 auto; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.set-row[aria-pressed="true"] { background: #1a1d26; }
.set-row .trio { display: inline-flex; gap: 2px; flex: 0 0 auto; width: 84px; }
.set-row .trio i { width: 26px; height: 26px; display: block; background: center / contain no-repeat; flex: 0 0 26px; }
.set-row .trio i.dot { margin: 4px; width: 18px; height: 18px; flex-basis: 18px; border-radius: 50%; background: var(--c1); }
.set-row .trio i.dot.k2 { border-radius: 18%; background: var(--c2); }
.set-row .trio i.dot.k3 { border-radius: 0; background: var(--c3); clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); }
.set-row .trio.dim { opacity: .65; }
.set-row .t { flex: 1; min-width: 0; }
.set-row .t b { display: block; font: 500 18px/1.2 var(--serif); }
.set-row .t b.worn { text-decoration: underline; text-underline-offset: 4px; }
.set-row .t > span { display: block; color: var(--dim); font: 12px/1.3 var(--mono); margin-top: 2px; }
.set-row .st { font: 600 11px/1 var(--mono); letter-spacing: .8px; text-transform: uppercase; color: var(--dim); }
.set-row .st.wearing { background: var(--ink); color: #14161c; padding: 5px 7px; }
.sets-hats { margin: 16px 0 10px; flex: 0 0 auto; }
#b-sets-done { flex: 0 0 auto; margin-top: 6px; }
.unlock-set { display: flex; gap: 12px; align-items: center; margin: 4px 0 10px; }
.unlock-set .us-t { flex: 1; min-width: 0; }
.unlock-set .us-t .tape { margin-bottom: 4px; }
.unlock-set .unlock-line { margin: 0 0 6px; }
.unlock-set .btn { width: 100%; min-height: 44px; }
@media (max-height: 680px) { .unlock-set { margin: 0 0 6px; } .unlock-set .tryon.small { width: 64px; flex-basis: 64px; } .unlock-set .tape { display: none; } .unlock-set .unlock-line { font-size: 13px; margin: 0 0 4px; } #done:has(.unlock-set, .bk-new) > .sub { display: none; } }
@media (max-height: 680px) { #done:has(.unlock-set, .bk-new) .whybtn { display: none; } #done:has(.unlock-set, .bk-new) .done-top h3 { font-size: 20px; } #done:has(.unlock-set, .bk-new) .stars { font-size: 24px; } }
#app[class*="look-"] #board .corner::after { display: none; } /* the yarn ball and the other corner props sat in the count corner and read as a clue */

/* ---------- character maker ---------- */
.stage { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: #2b2112; }
.stage-back { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-char { position: absolute; left: 18%; top: 18%; width: 64%; height: 64%; background: center / contain no-repeat; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); transition: transform .12s ease-out; }
.stage-char.frost { filter: saturate(.3) brightness(1.3) drop-shadow(0 0 6px #cfeaff); }
@media (prefers-reduced-motion: reduce) { .cell .blob, .stage-char { transition: none; transform: none !important; animation: none !important; } }
/* reduced motion keeps the 150 ms fade that tells a player the placement landed (the character rule above had removed it) */
@media (prefers-reduced-motion: reduce) { .cell .blob:not(.finish-last) { animation: blob-fade 0.15s ease-out both !important; } }
.stage.big .stage-ring { position: absolute; inset: 4%; border: 2px dashed rgba(242,239,230,.7); border-radius: 50%; pointer-events: none; }
#mk-stage-wrap { flex: 0 0 auto; display: flex; justify-content: center; }
#mk-stage { width: min(100%, 36vh, 300px); }
.mk-name { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 6px; flex: 0 0 auto; }
.mk-name b { display: block; font: 500 22px/1.2 var(--serif); }
.mk-name small { display: block; color: var(--dim); font: 12px/1.3 var(--mono); }
.mk-name .btn { width: auto; flex: 0 0 auto; }
.mk-tabs { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.mk-tabs button { min-height: 44px; font-size: 14px; color: var(--dim); border-bottom: 3px solid transparent; }
.mk-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.mk-tray { flex: 0 0 auto; padding: 8px 0; }
.mk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mk-grp { margin: 8px 0 4px; }
.mk-item { min-height: 76px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; padding: 4px 2px; text-align: center; color: var(--ink); }
.mk-item[aria-pressed="true"] { border: 2px solid var(--ink); background: #333949; }
.mk-item i { display: block; width: 100%; height: 44px; background: center / contain no-repeat; }
.mk-item i.bk { border-radius: 6px; overflow: hidden; width: 44px; align-self: center; }
.mk-item i.bk svg { width: 100%; height: 100%; display: block; }
.mk-item b { font: 500 11px/1.15 system-ui, sans-serif; }
.mk-item small { font: 10px/1.2 var(--mono); color: var(--dim); }
.mk-item.locked i { filter: brightness(0) opacity(.35); }
.mk-item.locked { color: var(--dim); }
.mk-note, .mk-msg { color: var(--dim); font-size: 14px; margin: 6px 0; min-height: 20px; }
.mk-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 0 0 auto; margin: 4px 0 10px; }
.mk-shelf { flex: 0 0 auto; margin-bottom: 10px; }
.mk-shelf-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; margin-top: 6px; }
.mk-mini { min-height: 44px; border-radius: 8px; overflow: hidden; padding: 0; border: 1px solid var(--line); }
.mk-mini .stage { border-radius: 0; }
#b-maker-done { flex: 0 0 auto; margin-bottom: 4px; }
.unlock-set.meet .tryon.small.one { padding: 0; border: 0; background: none; width: 84px; flex-basis: 84px; display: block; }
.unlock-set.meet .stage { border-radius: 10px; }
@media (max-height: 680px) { .unlock-set.meet .tryon.small.one { width: 56px; flex-basis: 56px; } .unlock-set.meet .tape { display: none; } }

#s-game.big-done #msg, #s-game.has-done:not(.lesson) #msg { visibility: hidden; } /* its slot stays, so the result card can rise into it and the plate does not move */
@media (max-height: 680px) { .unlock-set .tryon.small, .unlock-set.meet .tryon.small.one { display: none; } .unlock-set { margin: 0 0 4px; } .unlock-set .btn { min-height: 44px; } }

/* ---- the Book ---- */
#s-book { padding-bottom: 0; }
.book-sub { font: 13px/1.3 var(--mono); color: var(--dim); margin: 0 0 12px; }
.bk-shelf { flex: 0 0 auto; }
.bk-shelf-row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 10px; scrollbar-width: none; }
.bk-circ { flex: 0 0 64px; width: 64px; min-height: 44px; color: var(--dim); font: 11px/1.3 var(--mono); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bk-circ .stage, .bk-add { width: 56px; height: 56px; border-radius: 50%; }
.bk-circ .stage { aspect-ratio: auto; }
.bk-circ .stage-char { left: 12%; top: 12%; width: 76%; height: 76%; }
.bk-add { display: grid; place-items: center; border: 1px dashed var(--dim); font: 400 28px/1 var(--serif); color: var(--dim); }
.bk-circ span:last-child { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-tabs { display: flex; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.bk-tabs button { flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--dim); font-size: 15px; border-bottom: 2px solid transparent; }
.bk-tabs button small { font: 12px var(--mono); }
.bk-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.bk-set { border-bottom: 1px solid var(--line); padding: 10px 0 12px; }
.bk-set h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font: 500 18px/1.2 var(--serif); }
.bk-set h3 span { font: 12px var(--mono); color: var(--dim); margin-left: auto; white-space: nowrap; }
.bk-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bk-slot { aspect-ratio: 1; min-height: 44px; display: grid; place-items: center; background: #1b1e26; border-radius: 6px; padding: 0; }
.bk-slot[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: -2px; }
.bk-slot i { display: block; width: 72%; height: 72%; background: center / contain no-repeat; }
.bk-slot i.bk, .bk-th i.bk { border-radius: 6px; overflow: hidden; }
.bk-slot i.bk svg, .bk-th i.bk svg { width: 100%; height: 100%; display: block; }
.bk-slot.lock i:not(.bk), .bk-th.lock i:not(.bk) { filter: brightness(0) invert(1) opacity(.17); }
.bk-slot.lock i.bk, .bk-th.lock i.bk { opacity: .4; filter: grayscale(1); }
.bk-detail { position: sticky; bottom: 0; z-index: 3; background: #1c1f28; border-top: 1px solid var(--line); margin: 0 -14px; padding: 10px 14px 12px; display: flex; gap: 12px; align-items: center; flex: 0 0 auto; }
.bk-th { flex: 0 0 40px; width: 40px; height: 40px; display: block; }
.bk-th i { display: block; width: 100%; height: 100%; background: center / contain no-repeat; }
.bk-detail .t { flex: 1; min-width: 0; }
.bk-detail b { display: block; font: 500 17px/1.2 var(--serif); }
.bk-detail b em { font: normal 12px var(--mono); color: var(--dim); margin-left: 6px; }
.bk-detail .t span { display: block; font: 12px/1.4 var(--mono); color: var(--dim); margin-top: 3px; }
.bk-detail .btn.go { flex: 0 0 auto; width: auto; max-width: 124px; min-height: 44px; padding: 4px 8px; font-size: 14px; text-align: center; }
#b-book-done { flex: 0 0 auto; margin: 10px 0 14px; }
/* the win card: one line for what this plate added to the Book */
.bk-new { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 4px 6px 4px 4px; margin: 2px 0 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); text-align: left; font-size: 14px; }
.bk-new .th { flex: 0 0 44px; width: 44px; height: 44px; display: block; }
.bk-new .th .stage { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 8px; }
.bk-new .th .stage i { display: block; width: 100%; height: 100%; background: center / contain no-repeat; }
.bk-new .tx { flex: 1; min-width: 0; line-height: 1.25; }
.bk-new .go { flex: 0 0 auto; color: var(--dim); font-size: 22px; padding-right: 4px; }
@media (max-height: 680px) {
  .unlock-set:not(.meet) .us-t { display: flex; align-items: center; gap: 10px; }
  .unlock-set:not(.meet) .unlock-line { margin: 0; flex: 1; }
  .unlock-set:not(.meet) .btn { width: auto; flex: none; padding: 0 16px; }
  .bk-new { min-height: 48px; margin: 0 0 4px; }
  .bk-circ { flex-basis: 56px; width: 56px; }
}
@media (max-height: 680px) { #s-game.big-done:not(.lesson) #done { inset: 0 4px 0; height: auto; } }

/* ---- a picture of a character ---- */
.ex-pic { display: grid; place-items: center; margin: 2px 0 6px; flex: 0 0 auto; }
.ex-square { position: relative; width: min(220px, 58vw, 32vh); aspect-ratio: 1; border-radius: 4px; }
.ex-square.clear { background: conic-gradient(#2a2e3a 25%, #1d2029 0 50%, #2a2e3a 0 75%, #1d2029 0) 0 0 / 16px 16px; }
.ex-square img { display: block; width: 100%; height: 100%; }
.ex-square .stage-ring { position: absolute; inset: 0; border: 1.5px dashed rgba(242,239,230,.7); border-radius: 50%; pointer-events: none; }
.ex-where { display: grid; grid-template-columns: 1fr 1fr; margin: 6px -14px 2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.ex-where > div { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 2px; }
.ex-where .light { background: #f4f4f2; } .ex-where .dark { background: #111; }
.ex-circ { display: block; border-radius: 50%; overflow: hidden; flex: none; }
.ex-circ img { display: block; width: 100%; height: 100%; }
.ex-where small { font: 11px/1.3 var(--mono); }
.ex-where .light small { color: #555; } .ex-where .dark small { color: #9197a8; }
#ex-opts { flex: 0 0 auto; }
.opt { display: flex; align-items: center; width: 100%; min-height: 48px; border-bottom: 1px solid var(--line); gap: 10px; text-align: left; color: var(--ink); }
.opt span { flex: 1; font-size: 16px; } .opt em { font: normal 12px var(--mono); color: var(--dim); display: block; }
.sw { width: 46px; height: 28px; border-radius: 14px; background: #2f3442; position: relative; flex: none; }
.sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #9197a8; }
.sw.on { background: var(--ink); } .sw.on::after { left: 21px; background: #14161c; }
.ex-acts { display: grid; gap: 8px; margin: 4px 0 0; flex: 0 0 auto; }
.ex-code { font: 12px/1.4 var(--mono); color: var(--dim); text-align: center; margin: 8px 0 10px; flex: 0 0 auto; }
#b-ex-done, #s-view .btn { flex: 0 0 auto; margin-bottom: 8px; }
#s-view { overflow-y: auto; }
#vw-stage { display: flex; justify-content: center; margin: 4px 0; flex: 0 0 auto; }
#vw-stage .stage { width: min(100%, 38vh, 320px); }

/* ---- the lab ---- */
.lab-list { border-top: 1px solid var(--line); margin: 10px 0 14px; flex: 0 0 auto; }
.lab-row { display: flex; align-items: center; gap: 14px; min-height: 88px; padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.lab-row:active { background: #1a1d26; }
.lab-pic { flex: 0 0 72px; width: 72px; height: 72px; display: block; }
.lab-row .t { flex: 1; min-width: 0; }
.lab-row .t b { display: block; font: 500 19px/1.2 var(--serif); }
.lab-row .t > span { display: block; color: #c5c9d6; font-size: 14px; line-height: 1.3; margin-top: 3px; }
.lab-row .t small { display: block; color: var(--dim); font: 12px/1.3 var(--mono); margin-top: 4px; }
.lab-row .go { color: var(--dim); font: 22px/1 var(--mono); }
#s-lab .btn { flex: 0 0 auto; }
@media (max-width: 340px) { .lab-pic { flex-basis: 60px; width: 60px; height: 60px; } .lab-row { gap: 10px; } }
/* ---------- achievements: toast, sticker page, list, shelf props, the daily visit (P1CC32) ---------- */
.ach-toast { position: fixed; left: 50%; top: calc(62px + env(safe-area-inset-top)); z-index: 60; width: min(360px, calc(100% - 20px)); transform: translate(-50%, calc(-100% - 90px));
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 14px 8px 8px; text-align: left; color: var(--ink);
  background: #2a2419; border: 1px solid #5a4a2f; border-radius: 14px; box-shadow: 0 10px 24px rgba(0,0,0,.45); transition: transform .32s cubic-bezier(.2,1.3,.4,1), opacity .2s; }
.ach-toast.in { transform: translate(-50%, 0); }
.ach-toast .stk { flex: 0 0 52px; width: 52px; height: 52px; }
.ach-toast .stk svg { width: 100%; height: 100%; display: block; }
.ach-toast.in .stk svg { animation: stk-pop .5s .18s cubic-bezier(.2,1.6,.4,1) both; }
.ach-toast .tx { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ach-toast .tx small { font: 600 11px/1.2 var(--mono); letter-spacing: .8px; text-transform: uppercase; color: #e8c97a; }
.ach-toast .tx b { font: 500 18px/1.2 var(--serif); }
.ach-toast .tx span { font-size: 13px; color: var(--dim); }
@keyframes stk-pop { from { transform: scale(.4) rotate(-20deg); } }
@media (prefers-reduced-motion: reduce) { .ach-toast { transition: opacity .25s; opacity: 0; transform: translate(-50%, 0); } .ach-toast.in { opacity: 1; } .ach-toast.in .stk svg { animation: none; } }

.stk-page { position: relative; margin: 12px 0 4px; padding: 14px 12px 12px 30px; border-radius: 4px; background: #efe6cf;
  background-image: repeating-linear-gradient(transparent 0 27px, #d9cba7 27px 28px), linear-gradient(90deg, transparent 20px, #e7a2a2 20px 21.5px, transparent 21.5px); }
.stk-page .tape { position: absolute; top: -10px; left: 36px; }
.stk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stk-slot { aspect-ratio: 1; min-height: 44px; padding: 4px; border-radius: 50%; display: grid; place-items: center; }
.stk-slot svg { width: 100%; height: 100%; display: block; }
.stk-slot.empty svg circle { stroke: #c9b98f; }
.stk-slot[aria-pressed="true"] { outline: 3px solid #2b1d16; outline-offset: -2px; }
.stk-note { margin: 6px 0 0; font: 12px/1.3 var(--mono); color: #6b5a3a; }
.ach-next h3, .ach-grp h3 { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 6px; font: 500 18px/1.2 var(--serif); }
.ach-next h3 span, .ach-grp h3 span { font: 12px var(--mono); color: var(--dim); margin-left: auto; }
.ach-row { display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; width: 100%; min-height: 60px; padding: 6px 2px; text-align: left; border-bottom: 1px solid var(--line); color: var(--ink); }
.ach-row[aria-pressed="true"] { background: #232733; }
.ach-row .stk { width: 48px; height: 48px; }
.ach-row .stk svg { width: 100%; height: 100%; display: block; }
.ach-row .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach-row .t b { font: 500 16px/1.2 var(--serif); }
.ach-row .t b small { font: 12px var(--mono); color: var(--dim); margin-left: 6px; }
.ach-row .t span { font-size: 13px; color: var(--dim); line-height: 1.3; }
.ach-row .t em { font-style: normal; font-size: 12px; color: #b9a46e; }
.ach-bar { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font: 11px var(--mono); color: var(--dim); }
.ach-bar i { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.ach-bar i b { display: block; height: 100%; background: #e8c97a; border-radius: 3px; }
.bk-prop { flex: 0 0 52px; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--dim); font: 10px/1.2 var(--mono); text-align: center; }
.bk-prop svg { width: 48px; height: 48px; display: block; }
.visit { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; margin: 6px 0 0; padding: 4px 2px; text-align: left; color: var(--ink); }
.visit .v-av { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; background: #f2e8cf; display: grid; place-items: center; }
.visit .v-av i { width: 78%; height: 78%; background: center / contain no-repeat; }
.visit .t { display: flex; flex-direction: column; gap: 1px; font-size: 13px; line-height: 1.3; }
.visit .t b { font-weight: 500; }
.visit .t span { color: var(--dim); font-size: 12px; }
@media (max-height: 700px) { #visit { display: none; } }
.bk-th.stk-th { display: grid; place-items: center; } .bk-th.stk-th svg { width: 100%; height: 100%; display: block; }
.ach-next h3 .zh, .ach-grp h3 .zh { font: 13px var(--mono); color: var(--dim); }
.ach-row .t em.dim { color: var(--dim); }
@media (max-width: 359px) { .bk-tabs button { font-size: 13px; } .bk-tabs button small { font-size: 11px; } .stk-page { padding-left: 26px; } }
#book-visit { margin: 2px 0 14px; }
.ach-row .t span.zh { font-size: 12px; color: #8a8f9e; }


/* Rule out in How to play (docs/ruleout.js), the same picture on every page: a square with two colours ruled out. */
.ro-how { display: flex; gap: 12px; align-items: center; }
.ro-how .ro-pic { position: relative; flex: 0 0 auto; width: 52px; height: 52px; --cell: 52px; border-radius: 8px; background: var(--panel, #232733); }
.ro-how p { margin: 0; }

/* One screen (P1FS16): a play page that fits is locked, so a drag on the plate never fights the page. onescreen-fit.js sets the class. */
html.one-screen-fit, html.one-screen-fit body { overflow: hidden; overscroll-behavior: none; }
html.one-screen-fit body { position: fixed; inset: 0; width: 100%; }

/* While a plate is on screen the top bar is the game's own: brand, title, hearts, timer, How to play. The studio's
   'Why this exists' text button beside How to play took the width of the title (it showed "To…"), so it waits for the menu. */
#app:not(.no-game) #topbar .why-exists-btn { display: none !important; }

/* Result card on a short phone (320x568): the new-set row and the book nudge together pushed the buttons off the bottom.
   The book nudge waits for the home screen there, so Wear it and the three buttons stay on screen. */
@media (max-height: 600px) { #done .bk-new { display: none; } #s-game.big-done:not(.lesson) #done { gap: 2px; } #done .unlock-set { margin-bottom: 0; } }
