/* 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; }
}

/* =================== Crossword maker =================== */
.cw-stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 340px); gap: 24px; align-items: start; }
.cw-main { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.cw-title { margin: 0 0 8px; text-align: center; color: var(--chalk); font: 700 clamp(1.6rem, 3.4vw, 2.4rem)/1.15 var(--font-hand); overflow-wrap: anywhere; }
.cw-title:empty { display: none; }
.cw-current { box-sizing: border-box; width: 100%; min-height: 2.9em; margin: 0 0 14px; padding: 8px 14px; border-radius: 12px; background: rgba(0,0,0,.22); border: 2px dashed rgba(244,241,232,.25); text-align: center; font: 700 clamp(1.1rem, 2.1vw, 1.55rem)/1.3 var(--font-display); color: var(--chalk); overflow-wrap: anywhere; display: flex; align-items: center; justify-content: center; }
.cw-current > b { flex: none; margin-right: .45em; padding: 1px 10px; border-radius: 8px; background: var(--chalk-y); color: #3b2a00; }
.cw-current em, .cw-clues em { font-style: normal; opacity: .62; font-size: .85em; white-space: nowrap; }
.cw-gridwrap { --cols: 10; --rows: 10; position: relative; width: min(100%, calc(var(--cols) * 58px), calc(66vh * var(--cols) / var(--rows))); aspect-ratio: var(--cols) / var(--rows); container-type: inline-size; user-select: none; -webkit-user-select: none; }
.cw-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); }
.cw-cell { position: relative; display: grid; place-items: center; min-width: 0; cursor: pointer; background: #fdfaf0; box-shadow: 0 0 0 1.5px #24302a; transition: background .12s ease; }
.cw-cell b { position: absolute; top: 3%; left: 6%; font: 700 calc(100cqw / var(--cols) * .25)/1 var(--font-body); color: #5a5446; pointer-events: none; }
.cw-cell span { font: 700 calc(100cqw / var(--cols) * .58)/1 var(--font-display); color: #2b2a33; text-transform: uppercase; padding-top: 8%; }
.cw-cjk .cw-cell span { font-family: "KaiTi", "STKaiti", "Kaiti SC", var(--font-body); font-size: calc(100cqw / var(--cols) * .6); }
.cw-cell.on { background: #fff1a6; }
.cw-cell.cur { background: #ffd25e; }
.cw-gridwrap:focus-within .cw-cell.cur { box-shadow: 0 0 0 1.5px #24302a, inset 0 0 0 calc(100cqw / var(--cols) * .06) #d98a00; }
.cw-cell.rev span { color: #2c63c9; }
.cw-cell.good span { color: #237a35; }
.cw-cell.bad { background: #ffd8cf; }
.cw-cell.bad.on, .cw-cell.bad.cur { background: #ffbfb0; }
.cw-cell.bad span { color: #c0291a; text-decoration: line-through 2px; }
.cw-grid > i { pointer-events: none; }
.tool-panel input.cw-input { position: absolute; z-index: 2; box-sizing: border-box; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: transparent; caret-color: transparent; opacity: 0; font-size: 16px; min-width: 0; outline: none; }
.tool-panel input.cw-input.ime { opacity: 1; color: #2b2a33; background: #fff; width: auto !important; min-width: 7em; height: auto !important; padding: 3px 8px; border: 2px solid #d98a00; border-radius: 8px; transform: translateY(-115%); font: 700 18px var(--font-body); box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.cw-side { padding: 14px 16px 12px; 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(.6deg); }
.cw-clues h3 { margin: 0 0 4px; font: 700 1.45rem/1.1 var(--font-hand); color: #8a5528; }
.cw-clues + .cw-clues { margin-top: 12px; }
.cw-clues ol { list-style: none; margin: 0; padding: 0; }
.tool-panel .cw-clues button { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 0; padding: 5px 8px; text-align: left; background: transparent; border: 0; border-left: 4px solid transparent; border-radius: 6px; color: #3b3320; font: 600 1rem/1.3 var(--font-body); }
.tool-panel .cw-clues button:hover { background: rgba(255,255,255,.5); }
.tool-panel .cw-clues button.on { background: #fff8d6; border-left-color: #d98a00; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.cw-clues button b { flex: none; min-width: 1.5em; font: 700 1.05rem var(--font-display); color: #8a5528; text-align: right; }
.cw-clues button span { min-width: 0; overflow-wrap: anywhere; }
.tool-panel .cw-clues button.filled span { opacity: .55; }
.tool-panel .cw-clues button.right b::after { content: " ✓"; color: #237a35; }
.cw-num { margin: 10px 0 0; font: 700 .85rem var(--font-body); color: rgba(59,51,32,.55); }
#cw-app .tl-warn { margin-top: 12px; }
.cw-print { display: none; }
.tl-panel:fullscreen .cw-stage { grid-template-columns: minmax(0, 1fr) minmax(280px, 30vw); align-items: stretch; min-height: 0; }
.tl-panel:fullscreen .cw-main { min-height: 0; justify-content: center; }
.tl-panel:fullscreen .cw-gridwrap { width: min(100%, calc((100vh - 300px) * var(--cols) / var(--rows))); }
.tl-panel:fullscreen .cw-current { font-size: min(3.4vh, 2.1rem); }
.tl-panel:fullscreen .cw-side { align-self: start; max-height: 100%; overflow: auto; margin-bottom: 10px; transform: none; }
.tl-panel:fullscreen .cw-clues button { font-size: min(2.3vh, 1.45rem); }
.tl-panel:fullscreen .cw-clues h3 { font-size: min(3.4vh, 2rem); }
.tl-panel:fullscreen #cw-setup { display: none !important; }
@media (max-width: 860px) {
  .cw-stage { grid-template-columns: 1fr; gap: 16px; }
  .cw-side { transform: none; }
  .cw-gridwrap { width: min(100%, calc(var(--cols) * 52px)); }
}
:lang(zh) .cw-clues h3 { font-family: var(--font-display); font-size: 1.2rem; }

/* Print: the crossword worksheet (and the answer key page, when ticked). */
@media print {
  body.tool-crossword { background: #fff !important; }
  body.tool-crossword * { animation: none !important; }
  body.tool-crossword main > :not(.tool-stage-wrap), body.tool-crossword .site-header, body.tool-crossword .site-footer { display: none !important; }
  body.tool-crossword .tool-stage-wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; width: auto !important; }
  body.tool-crossword .board-frame { background: none !important; box-shadow: none !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; }
  body.tool-crossword .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-crossword .tool-panel > :not(#cw-print) { display: none !important; }
  body.tool-crossword #cw-print { display: block !important; color: #000; font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; }
  .cw-sheet { break-after: page; page-break-after: always; }
  .cw-sheet:last-child { break-after: auto; page-break-after: auto; }
  .cw-sheet h1 { margin: 0 0 4mm; font: 700 21pt/1.2 Arial, "PingFang SC", "Microsoft YaHei", sans-serif; color: #000; text-align: center; }
  .cw-sheet h1 small { font-size: 12pt; font-weight: 400; }
  .cw-nameline { display: flex; justify-content: space-between; margin: 0 0 5mm; font-size: 12pt; }
  .cw-pgrid { width: 100%; max-width: calc(var(--cols) * 10.5mm); margin: 0 auto 6mm; }
  .cw-psvg { display: block; width: 100%; height: auto; max-height: 125mm; margin: 0 auto; }
  .cw-many .cw-psvg { max-height: 108mm; }
  .cw-psvg rect { fill: #fff; stroke: #000; stroke-width: .045; }
  .cw-psvg text.n { font: 700 .27px Arial, sans-serif; dominant-baseline: hanging; fill: #000; }
  .cw-psvg text.l { font: 700 .56px Arial, sans-serif; text-anchor: middle; dominant-baseline: central; fill: #000; }
  .cw-cjk .cw-psvg text.l { font: 400 .62px "KaiTi", "STKaiti", "Kaiti SC", "SimSun", serif; }
  .cw-pclues { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8mm; font-size: 10.5pt; line-height: 1.38; }
  .cw-many .cw-pclues { font-size: 9.5pt; }
  .cw-pcol h2 { margin: 0 0 2mm; padding-bottom: 1mm; font: 700 13pt Arial, "PingFang SC", "Microsoft YaHei", sans-serif; color: #000; border-bottom: 1pt solid #000; }
  .cw-pcol ol { list-style: none; margin: 0; padding: 0; }
  .cw-pcol li { margin: 0 0 1.5mm; padding-left: 7mm; text-indent: -7mm; break-inside: avoid; }
  .cw-pcol li b { display: inline-block; width: 7mm; text-indent: 0; }
  .cw-pcol li span { color: #555; white-space: nowrap; }
  .cw-foot { margin: 4mm 0 0; font-size: 8.5pt; color: #666; text-align: right; }
}

/* =================== Classroom screen =================== */
.cs-app { --cs-card: rgba(0,0,0,.24); --cs-edge: rgba(244,241,232,.16); --cs-ink: var(--chalk); --cs-soft: rgba(244,241,232,.66); --cs-btn: rgba(255,255,255,.08); --cs-btn-edge: rgba(244,241,232,.3); --cs-on-bg: var(--chalk); --cs-on-ink: #2b4636; --cs-set-bg: #2c4a39;
  --cs-go: #9be38f; --cs-warn: #ffd25e; --cs-hurry: #ff8a7a; --cs-accent: #ffd25e; }
.cs-app[data-bg="cork"], .cs-app[data-bg="plain"] { --cs-card: #fffdf4; --cs-edge: rgba(43,42,51,.1); --cs-ink: #2b2a33; --cs-soft: rgba(43,42,51,.62); --cs-btn: #fff5cf; --cs-btn-edge: rgba(43,42,51,.2); --cs-on-bg: #2b4636; --cs-on-ink: #fff; --cs-set-bg: #fffdf4;
  --cs-go: #3a9a48; --cs-warn: #d99a00; --cs-hurry: #d6402c; --cs-accent: #c2560f; }
.cs-app[data-bg="cork"] { background: radial-gradient(circle at 30% 40%, rgba(0,0,0,.13) 0 1.2px, transparent 1.8px) 0 0/11px 11px, radial-gradient(circle at 70% 70%, rgba(255,226,180,.12) 0 1px, transparent 1.6px) 3px 5px/7px 7px, radial-gradient(ellipse at 30% 20%, #a77140, transparent 70%), #8a5a30; }
.cs-app[data-bg="plain"] { background: #eceee9; color: #2b2a33; --s-line: rgba(43,42,51,.25); --cs-card: #fff; --cs-btn: #f2f3ef; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.cs-app[data-bg="plain"] .tl-bar { border-bottom-color: rgba(43,42,51,.14); }
.tool-panel.cs-app[data-bg="plain"] .tl-bar button, .tool-panel.cs-app[data-bg="plain"] .tl-setup button:not(.primary) { color: #2b2a33; background: #fff; border-color: rgba(43,42,51,.25); }
.tool-panel.cs-app[data-bg="plain"] .tl-bar button:hover, .tool-panel.cs-app[data-bg="plain"] .tl-setup button:not(.primary):hover { background: #f6f3e4; }
.tool-panel.cs-app[data-bg="plain"] .tl-bar button[aria-pressed="true"]:not([data-tfx-mute]), .tool-panel.cs-app[data-bg="plain"] .tl-setup button[aria-pressed="true"], .tool-panel.cs-app[data-bg="plain"] .tl-bar button.tl-edit.on { background: #2b4636; color: #fff; border-color: #2b4636; }
.cs-app[data-bg="plain"] .tl-keys, .cs-app[data-bg="plain"] .tl-setup .small, .cs-app[data-bg="plain"] .tl-label { color: rgba(43,42,51,.68); }
.cs-app[data-bg="plain"] .tl-keys kbd { color: #2b2a33; border-color: rgba(43,42,51,.3); }
.cs-app[data-bg="plain"] .tl-setup { background: rgba(0,0,0,.04); border-color: rgba(43,42,51,.2); }
.tool-panel .cs-picks button { padding: 6px 11px; min-height: 40px; font-size: .92rem; }
.cs-stage { display: flex; flex-direction: column; }
.cs-grid { display: grid; gap: 14px; grid-auto-flow: row dense; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 300px; }
.cs-grid.fill { flex: 1 1 0; min-height: 0; }
.cs-w.wide { grid-column: span 2; }
.cs-grid.one .cs-w.wide { grid-column: auto; }
.cs-empty { grid-column: 1 / -1; margin: 0; padding: 60px 10px; text-align: center; font: 700 clamp(1.4rem, 3vw, 2rem) var(--font-hand); color: var(--cs-soft); }
.cs-w { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-radius: 18px; background: var(--cs-card); border: 2px solid var(--cs-edge); color: var(--cs-ink); box-shadow: 0 10px 18px -12px rgba(0,0,0,.55); }
.cs-app[data-bg="cork"] .cs-w { border-radius: 3px 3px 18px 3px; box-shadow: 0 16px 22px -12px rgba(0,0,0,.75); }
.cs-app[data-bg="cork"] .cs-w::before { content: ""; position: absolute; top: 7px; left: 50%; z-index: 2; width: 15px; height: 15px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffb3a6, #d63a2a 62%); box-shadow: 0 3px 3px rgba(0,0,0,.35); pointer-events: none; }
.cs-w.cs-new { animation: tl-pop .45s cubic-bezier(.2,1.6,.4,1); }
.cs-wh { flex: none; display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 6px 0 14px; }
.cs-wt { flex: 1 1 auto; min-width: 0; font: 700 .95rem var(--font-display); color: var(--cs-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-wtools { flex: none; display: flex; gap: 3px; }
.tool-panel .cs-wtools button { width: 32px; height: 32px; min-height: 0; padding: 0; justify-content: center; border-radius: 8px; font-size: .95rem; background: transparent; border: 1.5px solid transparent; color: var(--cs-soft); }
.tool-panel .cs-wtools button:hover { background: var(--cs-btn); border-color: var(--cs-btn-edge); color: var(--cs-ink); }
.tool-panel .cs-wtools .cs-arr { display: none; }
.tool-panel .arranging .cs-wtools .cs-arr { display: inline-flex; background: var(--cs-btn); border-color: var(--cs-btn-edge); color: var(--cs-ink); }
.arranging .cs-w { outline: 3px dashed var(--chalk-y); outline-offset: -3px; }
.cs-body { position: relative; flex: 1 1 auto; min-height: 0; container-type: size; }
.cs-in { position: absolute; inset: 0; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3cqh; padding: 2px 14px 14px; text-align: center; }
.cs-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.cs-in .cs-row { gap: 2cqmin 2.4cqmin; }
.tool-panel .cs-in button, .tool-panel .cs-set button { justify-content: center; min-height: 0; padding: .35em .85em; border-radius: 12px; background: var(--cs-btn); color: var(--cs-ink); border: 2px solid var(--cs-btn-edge); font: 700 1rem var(--font-display); }
.tool-panel .cs-in button { font-size: clamp(.85rem, 5.6cqmin, 1.7rem); }
.tool-panel .cs-in button:hover, .tool-panel .cs-set button:hover { filter: brightness(1.08); border-style: solid; }
.tool-panel .cs-in button.primary, .tool-panel .cs-set button.primary { background: var(--yellow); color: #3b2a00; border-color: var(--yellow); box-shadow: 0 4px 0 #c99500; }
.cs-app:not([data-bg="board"]) .cs-set input, .cs-app:not([data-bg="board"]) .cs-set select, .cs-app:not([data-bg="board"]) .cs-set textarea, .cs-app:not([data-bg="board"]) .cs-gbar select { color: #2b2a33; background: #fff; border-color: rgba(43,42,51,.25); }
.cs-set { position: absolute; inset: 40px 0 0; z-index: 3; box-sizing: border-box; overflow: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 8px 14px 14px; background: var(--cs-set-bg); color: var(--cs-ink); text-align: left; }
.cs-set label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 700; font-size: .95rem; color: var(--cs-ink); }
.cs-set label.block { display: block; width: 100%; }
.cs-set textarea, .cs-set input[type=url] { display: block; box-sizing: border-box; width: 100%; margin-top: 6px; resize: vertical; }
.cs-set input[type=number] { width: 76px; }
.cs-set input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--yellow); }
.cs-set .small { margin: 0; font-size: .85rem; color: var(--cs-soft); }
.cs-w.setting .cs-body { visibility: hidden; }
/* clock */
.cs-time { font: 700 min(26cqw, 60cqh)/1 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.cs-time small { font-size: .36em; margin-left: .12em; color: var(--cs-soft); }
.cs-time small.cs-ampm { margin: 0 .1em 0 .2em; }
:lang(zh) .cs-time small.cs-ampm { margin: 0 .2em 0 0; }
.cs-time:has(small:not(.cs-ampm)) { font-size: min(20cqw, 52cqh); }
.cs-date { font: 700 min(8cqw, 14cqh)/1.15 var(--font-hand); color: var(--cs-soft); }
:lang(zh) .cs-date { font-family: var(--font-display); font-size: min(6.5cqw, 12cqh); }
/* timer */
.cs-in.cs-timer { flex-direction: row; gap: 5cqw; }
.cs-ring { position: relative; flex: none; height: min(90cqh, 56cqw); aspect-ratio: 1; cursor: pointer; border-radius: 50%; container-type: inline-size; }
.cs-ring:focus-visible { outline: 3px dashed var(--cs-accent); outline-offset: 4px; }
.cs-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.cs-track { fill: rgba(0,0,0,.1); stroke: var(--cs-edge); stroke-width: 16; }
.cs-prog { fill: none; stroke: var(--cs-go); stroke-width: 16; stroke-linecap: round; stroke-dasharray: 1000; stroke-dashoffset: 0; transition: stroke-dashoffset .15s linear, stroke .4s ease; }
.cs-ring.warn .cs-prog { stroke: var(--cs-warn); }
.cs-ring.hurry .cs-prog, .cs-ring.done .cs-prog { stroke: var(--cs-hurry); }
.cs-tnum { position: absolute; inset: 0; display: grid; place-items: center; font: 700 25cqw/1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-tnum.long { font-size: 17cqw; }
.cs-ring.hurry .cs-tnum { color: var(--cs-hurry); animation: tl-pulse 1s ease-in-out infinite; }
.cs-ring.done .cs-tnum { color: var(--cs-hurry); animation: flash 1s steps(2) 5; }
.cs-ring.done { animation: tl-shake .6s ease 3; }
.cs-ring.paused .cs-tnum { opacity: .7; }
.cs-tctl { display: flex; flex-direction: column; align-items: center; gap: 4cqh; min-width: 0; }
.cs-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.6cqmin; max-width: 38cqw; }
.tool-panel .cs-in .cs-chips button { padding: .2em .55em; border-radius: 999px; font-size: clamp(.8rem, 4.6cqmin, 1.35rem); }
.tool-panel .cs-in .cs-chips button.on { background: var(--cs-on-bg); color: var(--cs-on-ink); border-color: var(--cs-on-bg); }
@container (max-aspect-ratio: 5/4) {
  .cs-in.cs-timer { flex-direction: column; gap: 3cqh; }
  .cs-ring { height: min(56cqh, 86cqw); }
  .cs-chips { max-width: 100%; }
  .cs-tctl { gap: 2.4cqh; }
}
/* stopwatch */
.cs-swnum { font: 700 min(22cqw, 50cqh)/1 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-w.running .cs-swnum { color: var(--cs-go); }
/* name picker */
.cs-pname { box-sizing: border-box; width: 100%; font: 700 min(17cqw, 34cqh)/1.15 var(--font-display); white-space: nowrap; overflow: hidden; color: var(--cs-ink); }
.cs-pname.spin { opacity: .55; }
.cs-pname.pop { color: var(--cs-accent); animation: tl-pop .5s cubic-bezier(.2,1.6,.4,1); }
.cs-pinfo { margin: 0; font: 700 clamp(.8rem, 4.2cqmin, 1.2rem) var(--font-body); color: var(--cs-soft); }
/* groups */
.cs-in.cs-groups { justify-content: flex-start; gap: 2.4cqh; }
.cs-gbar { flex: none; }
.tool-panel .cs-gbar select { font: 700 clamp(.85rem, 4.8cqmin, 1.3rem) var(--font-body); padding: .3em .5em; }
.cs-glist { flex: 1 1 0; min-height: 0; width: 100%; overflow: hidden; display: grid; grid-template-columns: repeat(var(--gc, 2), minmax(0, 1fr)); gap: .45em; align-content: start; font-size: 18px; text-align: left; }
.cs-gcard { min-width: 0; padding: 0 0 .25em; border-radius: 10px; background: rgba(0,0,0,.14); overflow: hidden; }
.cs-app:not([data-bg="board"]) .cs-gcard { background: rgba(43,42,51,.05); box-shadow: inset 0 0 0 1.5px rgba(43,42,51,.1); }
.cs-gcard.in { animation: tl-in .35s ease both; }
.cs-gcard b { display: block; padding: .1em .5em; background: var(--tc); color: #2b2a33; font: 700 .8em/1.35 var(--font-display); }
.cs-gcard ul { list-style: none; margin: 0; padding: .15em .5em 0; }
.cs-gcard li { font: 700 1em/1.28 var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-ghint { grid-column: 1 / -1; margin: auto 0; text-align: center; font: 700 1em var(--font-hand); color: var(--cs-soft); }
/* noise meter */
.cs-nface { font-size: min(32cqh, 24cqw); line-height: 1; }
[data-noise="loud"] .cs-nface { animation: tl-shake .5s ease infinite; }
.cs-nbar { position: relative; width: min(92%, 80cqw); height: max(14px, 7cqh); border-radius: 999px; background: rgba(0,0,0,.18); box-shadow: inset 0 2px 4px rgba(0,0,0,.25); }
.cs-nbar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--cs-go); transition: width .1s linear, background .3s; }
[data-noise="warn"] .cs-nbar i { background: var(--cs-warn); }
[data-noise="loud"] .cs-nbar i { background: var(--cs-hurry); }
.cs-nlimit { position: absolute; top: -6px; bottom: -6px; width: 5px; margin-left: -2px; border-radius: 3px; background: var(--cs-ink); box-shadow: 0 0 0 2px rgba(0,0,0,.2); }
.cs-nmsg { margin: 0; font: 700 min(6.4cqw, 10cqh)/1.15 var(--font-display); }
[data-noise="loud"] .cs-nmsg { color: var(--cs-hurry); }
/* work mode */
.cs-in.cs-work { gap: 2cqh; padding-bottom: 12px; }
.tool-panel .cs-in .cs-wbig { flex: 1 1 0; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1cqh; padding: 0; background: transparent; border: 0; box-shadow: none; }
.cs-wemoji { font-size: min(36cqh, 30cqw); line-height: 1; }
.cs-wlabel { display: block; max-width: 100%; font: 700 min(12cqw, 17cqh)/1.1 var(--font-display); white-space: nowrap; overflow: hidden; color: var(--mc); }
.cs-app:not([data-bg="board"]) .cs-wlabel { color: var(--mc2); }
.cs-w-work[data-mode="silent"] { --mc: #ff8a7a; --mc2: #c62f1e; }
.cs-w-work[data-mode="whisper"] { --mc: #ffd25e; --mc2: #a87400; }
.cs-w-work[data-mode="partner"] { --mc: #8fc4ff; --mc2: #2463c4; }
.cs-w-work[data-mode="together"] { --mc: #9be38f; --mc2: #2e8b3a; }
.cs-wopts { flex: none; display: flex; justify-content: center; gap: 1.6cqw; width: 100%; }
.tool-panel .cs-in .cs-wopts button { flex: 0 1 auto; min-width: 0; gap: .3em; padding: .3em .6em; font-size: clamp(.8rem, 4.2cqmin, 1.2rem); }
.tool-panel .cs-in .cs-wopts button[aria-pressed="true"] { background: var(--cs-on-bg); color: var(--cs-on-ink); border-color: var(--cs-on-bg); }
.cs-wol { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container (max-width: 520px) { .cs-wol { display: none; } .tool-panel .cs-in .cs-wopts button { font-size: clamp(1rem, 6cqmin, 1.6rem); } }
/* traffic light */
.cs-in.cs-light { flex-direction: row; gap: 6cqw; }
.cs-lbox { flex: none; box-sizing: border-box; height: 92cqh; aspect-ratio: .4; max-width: 34cqw; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; border-radius: 22px; background: linear-gradient(90deg, #2a2d30, #3c4044 50%, #2a2d30); box-shadow: inset 0 -6px 0 rgba(0,0,0,.35), 0 10px 16px -6px rgba(0,0,0,.45); }
.tool-panel .cs-in .cs-lamp { width: 74%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; box-shadow: inset 0 4px 8px rgba(0,0,0,.6); transition: background .2s, box-shadow .2s; }
.tool-panel .cs-in .cs-lamp[data-l="red"] { background: #4d201b; }
.tool-panel .cs-in .cs-lamp[data-l="amber"] { background: #4d3b14; }
.tool-panel .cs-in .cs-lamp[data-l="green"] { background: #1e3f22; }
.tool-panel .cs-in .cs-lamp[data-l="red"][aria-pressed="true"] { background: radial-gradient(circle at 40% 35%, #ffb0a5, #ff3b2b 55%); box-shadow: 0 0 24px 4px rgba(255,59,43,.7); }
.tool-panel .cs-in .cs-lamp[data-l="amber"][aria-pressed="true"] { background: radial-gradient(circle at 40% 35%, #ffe7a6, #ffb21e 55%); box-shadow: 0 0 24px 4px rgba(255,178,30,.7); }
.tool-panel .cs-in .cs-lamp[data-l="green"][aria-pressed="true"] { background: radial-gradient(circle at 40% 35%, #c9ffc4, #2fd451 55%); box-shadow: 0 0 24px 4px rgba(47,212,81,.7); }
.cs-lcap { min-width: 0; font: 700 min(13cqw, 20cqh)/1.1 var(--font-display); overflow-wrap: anywhere; }
[data-light="red"] .cs-lcap { color: var(--cs-hurry); }
[data-light="amber"] .cs-lcap { color: var(--cs-warn); }
[data-light="green"] .cs-lcap { color: var(--cs-go); }
@container (max-aspect-ratio: 1/1) {
  .cs-in.cs-light { flex-direction: column; gap: 2cqh; }
  .cs-lbox { height: 74cqh; }
}
/* instructions */
.cs-in.cs-text { align-items: stretch; padding: 0 10px 10px; }
.tool-panel #cs-text { flex: 1 1 auto; box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 2px 8px; resize: none; overflow: auto; background: transparent; border: 2px dashed transparent; border-radius: 10px; color: var(--cs-ink); font: 700 30px/1.22 var(--font-hand); }
.tool-panel #cs-text:hover, .tool-panel #cs-text:focus { border-color: var(--cs-btn-edge); outline: none; }
.tool-panel #cs-text::placeholder { color: var(--cs-soft); }
:lang(zh) .tool-panel #cs-text { font-family: var(--font-display); line-height: 1.32; }
/* QR code */
.cs-in.cs-qr { gap: 2cqh; }
.cs-qrimg { box-sizing: border-box; height: min(78cqh, 86cqw); aspect-ratio: 1; padding: 1.4cqmin; border-radius: 10px; background: #fff; color: #2b2a33; font-size: .9rem; display: grid; place-items: center; }
.cs-qrimg svg { display: block; width: 100%; height: 100%; }
.cs-qrurl { max-width: 100%; margin: 0; font: 700 clamp(.75rem, 4.6cqmin, 1.3rem) var(--font-body); color: var(--cs-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* full screen and phones */
.tl-panel:fullscreen .cs-wh { min-height: 3.8vh; }
.tl-panel:fullscreen .cs-wt { font-size: max(.95rem, 1.6vh); }
.tool-panel.tl-panel:fullscreen .cs-picks button { font-size: max(.9rem, 1.5vh); min-height: 0; padding: .5vh 1vh; }
@media (max-width: 560px) {
  .tool-panel .cs-picks button { padding: 5px 9px; min-height: 36px; font-size: .86rem; }
  .cs-grid { gap: 12px; }
}
/* Tool bars: crossword buttons a little tighter; classroom-screen widget buttons flow in the bar row. */
#cw-app .tl-bar { gap: 8px; }
.tool-panel#cw-app .tl-bar button { padding: 8px 12px; }
@media (max-width: 1500px) { #cw-app #cw-clear .tl-btn-text { display: none; } }
.cs-app .cs-picks { display: contents; }
.cs-in { overflow: hidden; }
/* Small timer widgets: drop the quick-time chips (±1 and ⚙ still set the time). */
@container (min-aspect-ratio: 5/4) and (max-width: 430px) { .cs-timer .cs-chips { display: none; } .cs-tctl .cs-row { max-width: 30cqw; } }
@container (max-aspect-ratio: 5/4) and (max-height: 300px) { .cs-timer .cs-chips { display: none; } .cs-ring { height: min(70cqh, 86cqw); } }
.cs-glist { grid-auto-rows: max-content; }
.cs-ring { height: min(90cqh, 56cqw, calc(100cqh - 22px)); }
.cs-lbox { height: min(92cqh, calc(100cqh - 22px)); }
.cs-qrimg { height: min(78cqh, 86cqw, calc(100cqh - 2.4em - 22px)); }
@container (max-aspect-ratio: 1/1) { .cs-lbox { height: min(74cqh, calc(100cqh - 1.6em - 30px)); } }
@container (max-aspect-ratio: 5/4) { .cs-ring { height: min(56cqh, 86cqw); } }
@container (max-aspect-ratio: 5/4) and (max-height: 300px) { .cs-ring { height: min(70cqh, 86cqw, calc(100cqh - 70px)); } }
.cs-app[data-bg="cork"] .cs-wh { padding-top: 16px; }
.cs-app[data-bg="cork"] .cs-w::before { top: 4px; width: 13px; height: 13px; margin-left: -6px; }
.cs-app[data-bg="cork"] .cs-set { inset: 52px 0 0; }
.cs-gcard b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
