/* Styles for the newer board tools (data/tools-extra.js): class points, buzzer, word search. */

/* =================== Class points =================== */
.cp-reasons { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; margin: 0 0 12px; }
.tool-panel .cp-reasons button { padding: 6px 14px; min-height: 40px; border-radius: 999px; font: 700 1rem var(--font-body); background: rgba(255,255,255,.06); }
.tool-panel .cp-reasons button[aria-pressed="true"] { background: var(--chalk-y); border: 2px solid var(--chalk-y); color: #3b2a00; transform: translateY(-2px) rotate(-1deg); box-shadow: 0 4px 0 #c99500; }
.cp-stage { min-height: 300px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 16px; padding-top: 14px; }
.cp-grid.cp-small { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 14px 12px; }
.cp-grid.cp-tiny { grid-template-columns: repeat(auto-fill, minmax(min(136px, 100%), 1fr)); }
@media (min-width: 700px) { .cp-grid.cp-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); } }
.cp-card { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 12px 10px 12px; border-radius: 16px; background: rgba(0,0,0,.2); border: 4px solid var(--tc); text-align: center; transition: box-shadow .3s ease, transform .3s ease; }
.cp-card > * { flex-shrink: 0; }
.cp-card.is-lead { box-shadow: 0 0 0 4px rgba(255,255,255,.1), 0 0 26px var(--tc); }
.cp-card.levelup { animation: tl-pulse .5s ease 2; }
.cp-key { position: absolute; top: 7px; left: 9px; font: 700 .8rem var(--font-body); color: rgba(244,241,232,.55); border: 1.5px solid rgba(244,241,232,.3); border-bottom-width: 3px; border-radius: 5px; padding: 0 6px; }
.cp-crown { position: absolute; top: -24px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 2rem; opacity: 0; transition: opacity .3s; pointer-events: none; }
.cp-card.is-lead .cp-crown { opacity: 1; animation: tl-bob 2s ease-in-out infinite; }
.tool-panel .cp-petswap { position: absolute; top: 5px; right: 5px; display: none; width: 36px; height: 36px; min-height: 0; padding: 0; justify-content: center; border-radius: 50%; font-size: 1rem; }
.cp-grid.editing .cp-petswap { display: inline-flex; }
.cp-pet { font-size: clamp(3.2rem, 5.4vw, 4.6rem); line-height: 1.1; margin-top: 6px; cursor: pointer; user-select: none; filter: drop-shadow(0 6px 4px rgba(0,0,0,.35)); }
.cp-pet.hop { animation: cp-hop .5s cubic-bezier(.3,1.6,.5,1); }
.cp-pet.grow { animation: cp-grow .9s cubic-bezier(.2,1.6,.4,1); }
@keyframes cp-hop { 40% { transform: translateY(-16px) rotate(-8deg); } 70% { transform: translateY(0) rotate(4deg) scaleY(.92); } }
@keyframes cp-grow { 0% { transform: scale(.3) rotate(-20deg); } 60% { transform: scale(1.45) rotate(8deg); } }
.tool-panel .cp-card input.cp-name, .cp-card div.cp-name { width: 100%; min-width: 0; text-align: center; font: 700 1.6rem/1.15 var(--font-hand); color: var(--tc); background: transparent; border: 2px solid transparent; padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-panel .cp-card input.cp-name:hover, .tool-panel .cp-card input.cp-name:focus { border-color: rgba(244,241,232,.3); }
.cp-pts { font: 700 clamp(2.6rem, 5vw, 3.6rem)/1 var(--font-display); font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.cp-pts.bump { animation: tl-pulse .35s ease; }
.cp-prog { position: relative; width: 100%; height: 22px; margin: 8px 0 10px; border-radius: 999px; background: rgba(0,0,0,.28); overflow: hidden; }
.cp-prog i { position: absolute; inset: 0 auto 0 0; background: var(--tc); opacity: .55; border-radius: inherit; transition: width .4s ease; }
.cp-prog span { position: relative; display: block; font: 700 .8rem/22px var(--font-body); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; text-shadow: 0 1px 1px rgba(0,0,0,.5); }
.cp-btns { display: flex; justify-content: center; gap: 8px; width: 100%; }
.tool-panel .cp-btns button { flex: 1 1 0; min-width: 0; min-height: 54px; padding: 6px 4px; justify-content: center; font: 700 1.4rem var(--font-display); border-radius: 14px; touch-action: manipulation; }
.tool-panel .cp-btns .cp-plus, .tool-panel .cp-btns .cp-plus2 { background: var(--tc); color: #2b2a33; border: 0; box-shadow: 0 5px 0 rgba(0,0,0,.28); }
.tool-panel .cp-btns .cp-plus2 { filter: saturate(1.2) brightness(.92); }
.tool-panel .cp-btns .cp-minus { flex: .7 1 0; font-size: 1.15rem; }
.cp-small .cp-pet { font-size: clamp(2.6rem, 4vw, 3.4rem); }
.cp-small .cp-pts { font-size: 2.2rem; }
.tool-panel .cp-small .cp-name { font-size: 1.35rem; }
.tool-panel .cp-small .cp-btns button { min-height: 46px; font-size: 1.2rem; }
.cp-tiny .cp-prog span { font-size: .72rem; }
.cp-float { position: absolute; left: 50%; top: 30%; z-index: 3; pointer-events: none; max-width: 150%; overflow: hidden; text-overflow: ellipsis; padding: 2px 12px; border-radius: 10px; white-space: nowrap; font: 700 2.2rem var(--font-hand); color: #2b2a33; background: var(--tc); box-shadow: 0 6px 12px rgba(0,0,0,.35); animation: cp-float 1.3s ease-out forwards; }
.cp-float.neg { background: #fff; color: #8a2a1a; }
@keyframes cp-float { 0% { transform: translate(-50%, 10px) scale(.6); opacity: 0; } 15% { transform: translate(-50%, 0) scale(1.1); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -70px) scale(1); opacity: 0; } }
.cp-log { min-height: 1.4em; margin: 12px 0 0; text-align: center; font: 700 1.3rem var(--font-hand); color: rgba(244,241,232,.7); }
.cp-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; text-align: center; font: 700 1.6rem var(--font-hand); color: rgba(244,241,232,.75); }
.cp-empty p { margin: 0; }
.cp-board { max-width: 900px; margin: 0 auto; }
.cp-board-h { margin: 0 0 12px; text-align: center; color: var(--chalk); font-size: clamp(1.8rem, 4vw, 2.8rem); }
.cp-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cp-rank.cols { grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); column-gap: 18px; }
.cp-rank li { display: grid; grid-template-columns: 2.4em 2.2em minmax(0, 1.2fr) minmax(40px, 2fr) 2.6em; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 12px; background: rgba(0,0,0,.22); border-left: 8px solid var(--tc); font: 700 1.25rem var(--font-display); animation: tl-in .4s ease both; }
.cp-rank li.top { background: rgba(255,255,255,.1); font-size: 1.5rem; }
.cp-medal { text-align: center; font-size: 1.3em; color: rgba(244,241,232,.7); }
.cp-rpet { font-size: 1.5em; text-align: center; }
.cp-rname { color: var(--tc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-hand); font-size: 1.25em; }
.cp-bar { height: 14px; border-radius: 999px; background: rgba(0,0,0,.25); overflow: hidden; }
.cp-bar i { display: block; height: 100%; background: var(--tc); border-radius: inherit; }
.cp-rank b { text-align: right; color: #fff; font-variant-numeric: tabular-nums; }
.cp-lastweek { margin: 14px 0 0; text-align: center; font: 700 1.3rem var(--font-hand); color: var(--chalk-y); }
.cp-file { position: relative; cursor: pointer; }
.cp-file span { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 16px; border-radius: 10px; border: 2px dashed var(--s-line); background: rgba(255,255,255,.07); color: var(--chalk); font: 700 .98rem var(--font-body); }
.cp-file:hover span { background: rgba(255,255,255,.14); border-style: solid; }
.tool-panel .cp-file input { position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0; border: 0; }
.cp-file:focus-within span { outline: 3px solid var(--chalk-y); outline-offset: 2px; }
.tl-panel:fullscreen .cp-stage { overflow: auto; padding: 0 4px; }
.tl-panel:fullscreen .cp-grid.cp-cols { height: 100%; grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); }
.tl-panel:fullscreen .cp-cols .cp-card { justify-content: center; }
.tl-panel:fullscreen .cp-grid:not(.cp-small) .cp-pet { font-size: min(9vh, 8vw); }
.tl-panel:fullscreen .cp-grid:not(.cp-small) .cp-pts { font-size: min(7vh, 6vw); }
.tl-panel:fullscreen .cp-grid:not(.cp-small) .cp-prog { height: 26px; }
.tl-panel:fullscreen .cp-grid:not(.cp-small) .cp-prog span { font-size: .95rem; line-height: 26px; }
.tl-panel:fullscreen .cp-grid:not(.cp-small) .cp-btns button { min-height: 7vh; font-size: 3.2vh; }
.tl-panel:fullscreen .cp-rank li { font-size: min(3.4vh, 1.8rem); padding: 1vh 18px; }
.tl-panel:fullscreen .cp-log { margin-right: 200px; }
@media (max-width: 560px) {
  .cp-grid, .cp-grid.cp-small, .cp-grid.cp-tiny { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; }
  .cp-card { padding: 10px 6px; }
  .cp-pet { font-size: 2.8rem; }
  .cp-pts { font-size: 2.2rem; }
  .tool-panel .cp-card input.cp-name, .cp-card div.cp-name { font-size: 1.3rem; }
  .tool-panel .cp-btns { gap: 5px; }
  .tool-panel .cp-btns button { min-height: 46px; font-size: 1.1rem; padding: 4px 2px; border-radius: 10px; }
  .cp-rank li { grid-template-columns: 2em 1.8em minmax(0, 1fr) 2.4em; font-size: 1.05rem; padding: 6px 10px; gap: 6px; }
  .cp-rank li.top { font-size: 1.15rem; }
  .cp-bar { display: none; }
}

/* Chinese pages: names and counts in the rounder display font (the hand font's digits are tiny next to Chinese). */
:lang(zh) .tool-panel .cp-card input.cp-name, :lang(zh) .cp-card div.cp-name, :lang(zh) .cp-rname, :lang(zh) .cp-log, :lang(zh) .cp-lastweek, :lang(zh) .bz-name, :lang(zh) .ws-count, :lang(zh) .cp-float { font-family: var(--font-display); font-weight: 700; }
:lang(zh) .tool-panel .cp-card input.cp-name, :lang(zh) .cp-card div.cp-name { font-size: 1.35rem; }
:lang(zh) .cp-rname, :lang(zh) .cp-float { font-size: 1.05em; }
:lang(zh) .cp-float { font-size: 1.6rem; }
:lang(zh) .cp-log, :lang(zh) .cp-lastweek, :lang(zh) .ws-count { font-size: 1.1rem; }
:lang(zh) .bz-name { font-size: clamp(1.1rem, 1.8vw, 1.5rem); }

/* =================== Buzzer =================== */
.bz-status { position: relative; display: flex; align-items: center; justify-content: center; gap: 18px; min-height: 92px; margin: 0 0 10px; padding: 8px 16px; border-radius: 16px; border: 3px dashed rgba(244,241,232,.25); text-align: center; }
.bz-msg { display: block; min-width: 0; max-width: 100%; font: 700 clamp(1.8rem, 4.4vw, 3.2rem)/1.1 var(--font-display); color: var(--chalk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bz-status.won { border-style: solid; border-color: var(--tc); background: rgba(0,0,0,.2); box-shadow: 0 0 30px -4px var(--tc); }
.bz-status.won .bz-msg { color: var(--tc); font-size: clamp(2.4rem, 6vw, 4.4rem); animation: tl-pop .45s cubic-bezier(.2,1.6,.4,1); }
.bz-status.reopen .bz-msg { color: var(--chalk-y); }
.bz-status.sad .bz-msg { color: rgba(244,241,232,.7); }
.bz-status.bad .bz-msg { color: var(--chalk-r); }
.bz-status.late .bz-msg { font-size: clamp(1.8rem, 4.4vw, 3.2rem); }
.bz-count { flex: none; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 50%; border: 4px solid var(--chalk); font: 700 2.4rem/1 var(--font-display); color: #fff; font-variant-numeric: tabular-nums; }
.bz-timebar { height: 12px; margin: -2px 0 10px; border-radius: 999px; background: rgba(0,0,0,.28); overflow: hidden; }
.bz-timebar i { display: block; height: 100%; width: 100%; background: var(--chalk-g); border-radius: inherit; }
.bz-timebar.hurry i { background: var(--chalk-r); }
.bz-stage { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.bz-grid { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 22px 4%; width: 100%; padding: 10px 0; }
.bz-team { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; transition: opacity .25s ease, filter .25s ease, transform .25s ease; }
.bz-grid.bz-n4 .bz-team, .bz-grid.bz-n3 .bz-team { flex-basis: 20%; }
.bz-grid.bz-n5 .bz-team, .bz-grid.bz-n6 .bz-team { flex-basis: 27%; }
.bz-grid.bz-n2 .bz-team { flex-basis: 34%; }
.tool-panel .bz-btn { --size: clamp(120px, 13vw, 170px); position: relative; width: var(--size); height: var(--size); padding: 0; justify-content: center; border-radius: 50%; border: 0; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  background: radial-gradient(circle at 50% 50%, #3a3a3a 0 62%, #222 63% 100%); box-shadow: 0 10px 0 #111, 0 16px 24px rgba(0,0,0,.45); transition: transform .08s ease, box-shadow .08s ease; }
.bz-grid.bz-n2 .bz-btn { --size: clamp(140px, 22vw, 260px); }
.tool-panel .bz-btn:hover { background: radial-gradient(circle at 50% 50%, #444 0 62%, #222 63% 100%); }
.bz-cap { position: absolute; inset: 9%; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), transparent 42%), var(--tc); box-shadow: inset 0 -10px 0 rgba(0,0,0,.25), 0 6px 0 rgba(0,0,0,.35); transition: transform .08s ease, box-shadow .08s ease; }
.bz-key { display: grid; place-items: center; width: 40%; aspect-ratio: 1; border-radius: 14px; background: rgba(255,255,255,.85); color: #2b2a33; font: 700 calc(var(--size) * .22)/1 var(--font-display); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.tool-panel .bz-btn:active .bz-cap, .bz-team.pop .bz-cap { transform: translateY(5px); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25), 0 1px 0 rgba(0,0,0,.35); }
.bz-name { max-width: 100%; font: 700 clamp(1.3rem, 2.2vw, 1.8rem)/1.1 var(--font-hand); color: var(--tc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bz-score { font: 700 clamp(1.8rem, 3vw, 2.6rem)/1 var(--font-display); color: #fff; font-variant-numeric: tabular-nums; }
.bz-score.bump { animation: tl-pulse .4s ease 2; }
.bz-noscore .bz-score, .bz-noscore #bz-rightpts, .bz-noscore #bz-wrongpts { display: none; }
.bz-team.is-winner { transform: scale(1.1); z-index: 2; }
.bz-team.is-winner .bz-btn { box-shadow: 0 10px 0 #111, 0 0 0 8px rgba(255,255,255,.18), 0 0 60px 10px var(--tc); animation: bz-glow 1s ease-in-out infinite; }
.bz-team.pop { animation: tl-shake .4s ease; }
.bz-team.is-locked { opacity: .32; filter: grayscale(.7); }
.bz-team.is-out .bz-name { text-decoration: line-through; }
@keyframes bz-glow { 50% { box-shadow: 0 10px 0 #111, 0 0 0 12px rgba(255,255,255,.12), 0 0 90px 20px var(--tc); } }
.bz-order { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; min-height: 2.1em; margin: 8px 0 0; }
.bz-order span { padding: 3px 12px; border-radius: 999px; border: 2px solid var(--tc); color: var(--tc); font: 700 1rem var(--font-body); background: rgba(0,0,0,.2); }
.tool-panel button.bz-right:not(:disabled) { background: #7dd87a; color: #173b17; border: 2px solid #7dd87a; box-shadow: 0 4px 0 #3f8f3c; }
.tool-panel button.bz-wrong:not(:disabled) { background: #ff8a7a; color: #4a1208; border: 2px solid #ff8a7a; box-shadow: 0 4px 0 #b84a3a; }
.tool-panel .tl-controls button.bz-right, .tool-panel .tl-controls button.bz-wrong { min-height: 56px; padding: 10px 22px; font: 700 1.2rem var(--font-display); }
#bz-app button:disabled, #cp-app button:disabled { opacity: .4; cursor: default; }
.bz-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.bz-names label { display: flex; align-items: center; gap: 8px; }
.bz-names kbd { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 8px; background: var(--tc); color: #2b2a33; font: 700 1.1rem var(--font-display); }
.tool-panel .bz-names input { flex: 1 1 auto; min-width: 0; width: auto; border-color: var(--tc); }
.tl-panel:fullscreen .bz-btn { --size: min(26vh, 19vw); }
.tl-panel:fullscreen .bz-grid.bz-n5 .bz-btn, .tl-panel:fullscreen .bz-grid.bz-n6 .bz-btn { --size: min(21vh, 19vw); }
.tl-panel:fullscreen .bz-grid.bz-n2 .bz-btn { --size: min(36vh, 30vw); }
.tl-panel:fullscreen .bz-status { min-height: 14vh; }
.tl-panel:fullscreen .bz-msg { font-size: 6vh; }
.tl-panel:fullscreen .bz-status.won .bz-msg { font-size: 9vh; }
.tl-panel:fullscreen .bz-name { font-size: 4vh; }
.tl-panel:fullscreen .bz-score { font-size: 5vh; }
@media (max-width: 560px) {
  .bz-grid { gap: 18px 6%; }
  .bz-grid .bz-team, .bz-grid.bz-n3 .bz-team, .bz-grid.bz-n4 .bz-team, .bz-grid.bz-n5 .bz-team, .bz-grid.bz-n6 .bz-team { flex-basis: 40%; }
  .tool-panel .bz-btn { --size: 112px; }
  .bz-grid.bz-n2 .bz-btn { --size: 130px; }
  .bz-status { min-height: 70px; }
  .bz-count { width: 54px; height: 54px; font-size: 1.7rem; }
  .tool-panel .tl-controls button.bz-right, .tool-panel .tl-controls button.bz-wrong { padding: 8px 14px; font-size: 1.05rem; }
}

/* =================== Word search =================== */
.ws-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); gap: 26px; align-items: start; }
.ws-main { min-width: 0; }
.ws-title { margin: 0 0 10px; text-align: center; color: var(--chalk); font: 700 clamp(1.6rem, 3.4vw, 2.4rem)/1.15 var(--font-hand); overflow-wrap: anywhere; }
.ws-title:empty { display: none; }
.ws-gridwrap { --n: 12; position: relative; width: min(100%, 640px); aspect-ratio: 1; margin: 0 auto; container-type: inline-size; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; border-radius: 10px; background: rgba(0,0,0,.18); box-shadow: 0 0 0 3px rgba(244,241,232,.12); }
.ws-gridwrap.miss { animation: tl-shake .35s ease; }
.ws-marks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ws-marks line { stroke-width: .74; stroke-linecap: round; }
.ws-marks line.hit { opacity: .6; }
.ws-marks line.key { stroke-width: .6; }
.ws-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); }
.ws-grid span { display: grid; place-items: center; font: 600 calc(100cqw / var(--n) * .56)/1 var(--font-display); color: var(--chalk); text-transform: uppercase; }
.ws-cjk .ws-grid span { font-family: "KaiTi", "STKaiti", "Kaiti SC", var(--font-body); font-weight: 700; font-size: calc(100cqw / var(--n) * .6); }
.ws-grid span.start { border-radius: 50%; box-shadow: inset 0 0 0 3px var(--chalk-y); color: var(--chalk-y); }
.ws-side { padding: 14px 16px; border-radius: 4px 4px 16px 4px; background: linear-gradient(#fff2a8, #ffe57a); color: #3b3320; box-shadow: 0 12px 18px -10px rgba(0,0,0,.6); transform: rotate(.8deg); }
.ws-count { margin: 0 0 8px; font: 700 1.5rem/1.1 var(--font-hand); color: #8a5528; }
.ws-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px 14px; }
.ws-list.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ws-list li { position: relative; font: 700 1.2rem/1.5 var(--font-display); overflow-wrap: anywhere; }
.ws-list li.found { color: rgba(59,51,32,.45); text-decoration: line-through 3px; text-decoration-color: #c0392b; }
.ws-list li.found::before { content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--mc); box-shadow: 0 0 0 2px rgba(0,0,0,.25); }
.ws-list li.just { animation: tl-pulse .5s ease 2; }
.ws-num { margin: 10px 0 0; font: 700 .85rem var(--font-body); color: rgba(59,51,32,.55); }
.ws-dirs { gap: 8px 16px; }
.ws-print { display: none; }
.tl-panel:fullscreen .ws-stage { grid-template-columns: minmax(0, 1fr) minmax(220px, 24vw); align-items: center; }
.tl-panel:fullscreen .ws-gridwrap { width: min(100%, calc(100vh - 210px)); }
.tl-panel:fullscreen .ws-list li { font-size: min(3.2vh, 1.8rem); }
.tl-panel:fullscreen .ws-side { margin-bottom: 40px; }
.tl-panel:fullscreen .ws-count { font-size: min(4vh, 2.2rem); }
.tl-panel:fullscreen #ws-setup { display: none !important; }
@media (max-width: 860px) {
  .ws-stage { grid-template-columns: 1fr; gap: 16px; }
  .ws-side { transform: none; }
  .ws-list { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Print: only the worksheet (and the answer key page, when ticked). */
@media print {
  @page { margin: 14mm; }
  body.tool-word-search { background: #fff !important; }
  body.tool-word-search * { animation: none !important; }
  body.tool-word-search main > :not(.tool-stage-wrap), body.tool-word-search .site-header, body.tool-word-search .site-footer { display: none !important; }
  body.tool-word-search .tool-stage-wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; width: auto !important; }
  body.tool-word-search .board-frame { background: none !important; box-shadow: none !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; }
  body.tool-word-search .tool-panel { background: #fff !important; color: #000 !important; box-shadow: none !important; padding: 0 !important; border: 0 !important; min-height: 0 !important; overflow: visible !important; display: block !important; }
  body.tool-word-search .tool-panel > :not(#ws-print) { display: none !important; }
  body.tool-word-search #ws-print { display: block !important; color: #000; font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; }
  .ws-sheet { break-after: page; page-break-after: always; }
  .ws-sheet:last-child { break-after: auto; page-break-after: auto; }
  .ws-sheet h1 { margin: 0 0 4mm; font: 700 22pt/1.2 Arial, "PingFang SC", "Microsoft YaHei", sans-serif; color: #000; text-align: center; }
  .ws-sheet h1 small { font-size: 13pt; font-weight: 400; }
  .ws-nameline { display: flex; justify-content: space-between; margin: 0 0 6mm; font-size: 12pt; }
  .ws-pgrid { width: 100%; max-width: 170mm; max-height: 170mm; aspect-ratio: 1; margin: 0 auto 6mm; border: 1.5pt solid #000; border-radius: 3mm; padding: 2mm; box-sizing: border-box; }
  .ws-psvg { display: block; width: 100%; height: 100%; }
  .ws-psvg text { font: 700 .56px Arial, "Helvetica Neue", sans-serif; text-anchor: middle; dominant-baseline: central; fill: #000; }
  .ws-pgrid.ws-cjk .ws-psvg text { font: 400 .62px "KaiTi", "STKaiti", "Kaiti SC", "SimSun", serif; }
  .ws-find { margin: 0 0 2mm; font-weight: 700; font-size: 12pt; }
  .ws-pwords { list-style: none; margin: 0; padding: 0; columns: 4; column-gap: 6mm; font-size: 12.5pt; line-height: 1.7; }
  .ws-pwords li::before { content: "☐ "; }
  .ws-keysheet .ws-pwords li::before { content: "☑ "; }
  .ws-foot { margin: 4mm 0 0; font-size: 8.5pt; color: #666; text-align: right; }
}
