/* Daily Word Search — "highlighter on paper" (the approved mockup, docs in index.html): a warm paper
   desk, the puzzle printed on a white sheet in Courier Prime, found words marked with translucent
   highlighter capsules that multiply over the letters, a dark ink timer pill and a yellow primary
   button. Headings Bricolage Grotesque, body Nunito. Layout basics come from cb-arcade.css. */
.wsp-page {
  --ink: #1f2430; --ink-2: #3d4250; --ink-3: #5b5346; --muted: #8a8478; --amber: #8a5a12; --amber-2: #5b4310;
  --paper: #fffdf8; --cream: #fff8e6; --yellow: #ffd60a; --orange: #c2410c;
  --head: 'Bricolage Grotesque', system-ui, sans-serif; --mono: 'Courier Prime', ui-monospace, monospace;
  --cbx-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --cell: 33px;
  color: var(--ink);
  background: radial-gradient(120% 50% at 50% 0%, #fbf6ec, #f1e8d6 70%, #e9dec8) fixed, #efe5d1;
}
.wsp-page [hidden] { display: none !important; }
.wsp-page .cbx-read h2, .wsp-page .cbx-read h3 { font-family: var(--head); font-weight: 800; }

.wsp-wrap { max-width: 480px; margin: 0 auto; padding: 8px 16px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; box-sizing: border-box; }
.wsp-wrap button { font-family: 'Nunito', system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ---- top row: back link + date ---- */
.wsp-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.wsp-back { display: flex; align-items: center; min-height: 44px; font-weight: 800; font-size: 14px; text-decoration: none; color: var(--ink-3) !important; white-space: nowrap; }
.wsp-back:hover { color: var(--ink) !important; }
.wsp-meta { font-size: 13px; font-weight: 800; color: var(--ink-3); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- theme + timer ---- */
.wsp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.wsp-titles { min-width: 0; }
.wsp-kicker { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.wsp-title { margin: 2px 0 0; font: 800 30px/1 var(--head); letter-spacing: -.01em; color: var(--ink); overflow-wrap: anywhere; }
.wsp-clock { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--ink); color: var(--cream); font: 700 17px var(--mono); font-variant-numeric: tabular-nums; }
.wsp-page.is-done .wsp-clock { color: var(--yellow); font-size: 18px; }
.wsp-page.is-done .wsp-clock svg { display: none; }
.wsp-clock.bump { animation: wspBump .5s ease; }
@keyframes wspBump { 30% { transform: scale(1.12); background: #b45309; } }

/* ---- size tabs ---- */
.wsp-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: 14px; background: rgba(31, 36, 48, .07); }
.wsp-tabs button { min-height: 44px; border: 0; border-radius: 11px; background: transparent; font: 800 14px 'Nunito', sans-serif; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 4px; white-space: nowrap; }
.wsp-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 900; box-shadow: 0 1px 0 rgba(0, 0, 0, .08), 0 4px 10px -4px rgba(60, 40, 10, .35); }
.wsp-tabs button:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }

.wsp-banner { margin: 0; padding: 10px 13px; border-radius: 12px; background: rgba(255, 214, 10, .18); border: 1.5px solid rgba(138, 90, 18, .3); font-size: 14px; font-weight: 800; line-height: 1.4; color: var(--amber-2); }
.wsp-easy { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--ink-2); line-height: 1.3; }
.wsp-easy svg { flex: none; }

/* ---- the paper sheet ---- */
.wsp-sheet { position: relative; align-self: center; width: 100%; max-width: 440px; padding: 14px; border-radius: 6px; background: var(--paper); box-sizing: border-box;
  box-shadow: 0 1px 0 #fff inset, 0 0 0 1px rgba(120, 95, 50, .18), 0 18px 30px -16px rgba(70, 45, 10, .45), 0 3px 0 #e8dcc4, 0 4px 0 rgba(120, 95, 50, .25); }
.wsp-board { position: relative; width: 100%; }
.wsp-grid { display: grid; grid-template-columns: repeat(var(--n, 10), 1fr); position: relative; z-index: 1; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; outline: none; }
.wsp-row { display: contents; }
.wsp-cell { display: grid; place-items: center; height: var(--cell); font: 700 calc(var(--cell) * .61) / 1 var(--mono); color: var(--ink); position: relative; border-radius: 50%; }
.wsp-n8 .wsp-cell { font-size: calc(var(--cell) * .64); }
.wsp-n12 .wsp-cell { font-size: calc(var(--cell) * .62); }
.wsp-cell:focus { outline: none; }
.wsp-grid.kbd .wsp-cell:focus::after { content: ''; position: absolute; inset: 6%; border-radius: 50%; box-shadow: 0 0 0 2.5px var(--ink); }
.wsp-cell.start::before { content: ''; position: absolute; inset: 10%; border-radius: 50%; background: rgba(31, 36, 48, .14); box-shadow: 0 0 0 2px var(--ink) inset; }
.wsp-cell.lo { color: var(--orange); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.wsp-cell.flash::before { content: ''; position: absolute; inset: 4%; border-radius: 50%; background: rgba(255, 214, 10, .6); box-shadow: 0 0 0 3px #e8b800; animation: wspFlash .6s ease-in-out 4 alternate; }
@keyframes wspFlash { from { transform: scale(.8); opacity: .6; } to { transform: scale(1.12); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .wsp-cell.flash::before, .wsp-clock.bump, .wsp-cap.new, .wsp-cap.bad { animation: none !important; } }

/* highlighter capsules sit over the letters and multiply, so the ink shows through */
.wsp-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.wsp-cap { position: absolute; border-radius: 999px; mix-blend-mode: multiply; transform-origin: 50% 50%; }
.wsp-cap.new { animation: wspSwipe .35s ease-out both; }
@keyframes wspSwipe { from { clip-path: inset(0 100% 0 0 round 999px); } to { clip-path: inset(0 0 0 0 round 999px); } }
.wsp-cap.live { border: 2px dashed var(--ink); background: rgba(31, 36, 48, .10); mix-blend-mode: normal; box-sizing: border-box; }
.wsp-cap.bad { border-color: #b91c1c; background: rgba(220, 38, 38, .12); animation: wspShake .35s ease; }
@keyframes wspShake { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.k0 { background: rgba(255, 214, 10, .55); } .k1 { background: rgba(255, 111, 165, .45); } .k2 { background: rgba(62, 214, 160, .45); }
.k3 { background: rgba(84, 170, 255, .45); } .k4 { background: rgba(255, 152, 48, .5); } .k5 { background: rgba(176, 132, 255, .45); }
.wsp-bubble { position: absolute; z-index: 3; padding: 5px 11px; border-radius: 10px; background: var(--ink); color: var(--cream); font: 700 16px var(--mono); letter-spacing: .12em; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .5); transform: translate(-50%, -100%); }

/* ---- found count + hint ---- */
.wsp-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wsp-count { font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.wsp-hint { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid rgba(31, 36, 48, .25); background: var(--paper); font: 800 14px 'Nunito', sans-serif; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.wsp-hint:disabled { opacity: .45; cursor: default; }
.wsp-hint:not(:disabled):active { transform: translateY(1px); }

/* ---- the word list ---- */
.wsp-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 10px; font: 800 15px 'Nunito', sans-serif; color: var(--ink); }
.wsp-list.easy { grid-template-columns: repeat(4, minmax(0, 1fr)); font-weight: 900; font-size: 16px; gap: 8px 10px; }
.wsp-list li { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
.wsp-list li.got { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: rgba(31, 36, 48, .55); }
.wsp-list li.hinted { color: #92400e; }
@media (max-width: 359px) { .wsp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wsp-list.easy { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.wsp-lock { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 12px; border: 1.5px dashed rgba(138, 90, 18, .45); background: rgba(255, 214, 10, .10); font-size: 14px; font-weight: 800; line-height: 1.35; color: var(--amber-2); }
.wsp-lock svg { flex: none; }
.wsp-lock.race { border: 0; background: rgba(31, 36, 48, .06); color: var(--ink-2); line-height: 1.4; }

/* ---- race panel ---- */
.wsp-race { padding: 12px 14px; border-radius: 14px; background: var(--ink); color: var(--cream); display: flex; flex-direction: column; gap: 10px; }
.wsp-race-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.wsp-race-name { font: 800 20px var(--head); }
.wsp-race-beat { font-size: 14px; font-weight: 800; color: #d8d2c4; }
.wsp-race-beat b { font: 700 17px var(--mono); color: var(--yellow); }
.wsp-race-rows { display: flex; flex-direction: column; gap: 6px; }
.wsp-race-row { display: flex; align-items: center; gap: 10px; }
.wsp-race-row .who { width: 40px; font-size: 13px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsp-race-row.them .who, .wsp-race-row.them .num { color: #d8d2c4; }
.wsp-race-row .bar { flex: 1; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.wsp-race-row .bar i { display: block; width: 0; height: 100%; border-radius: 6px; background: var(--yellow); transition: width .4s ease; }
.wsp-race-row.them .bar i { background: repeating-linear-gradient(45deg, #ff8fb3 0 6px, #e46a93 6px 12px); }
.wsp-race-row .num { width: 78px; text-align: right; font: 700 15px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wsp-race-pace { margin: 0; font-size: 13px; font-weight: 800; color: var(--yellow); }
.wsp-page.is-race .wsp-head, .wsp-page.is-race .wsp-tabs { display: none; }
.wsp-page.is-race.is-done .wsp-head { display: flex; }
.wsp-page.is-race.is-done .wsp-race { display: none; }

/* ---- finished ---- */
.wsp-page.is-done .wsp-bar, .wsp-page.is-done .wsp-list, .wsp-page.is-done .wsp-lock, .wsp-page.is-done .wsp-easy { display: none; }
.wsp-done { display: flex; flex-direction: column; gap: 12px; }
.wsp-secret { padding: 12px 14px; border-radius: 12px; background: var(--ink); color: var(--cream); }
.wsp-secret .lab { margin: 0; font-size: 12px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--yellow); }
.wsp-secret .msg { margin: 4px 0 0; font: 700 19px/1.3 var(--mono); letter-spacing: .06em; overflow-wrap: anywhere; }
.wsp-result { padding: 12px 14px; border-radius: 12px; background: rgba(255, 214, 10, .2); border: 1.5px solid rgba(138, 90, 18, .35); text-align: center; }
.wsp-result .big { margin: 0; font: 800 21px/1.2 var(--head); color: var(--ink); }
.wsp-result .sub { margin: 4px 0 0; font: 700 15px var(--mono); color: var(--ink-2); }
.wsp-result.lose { background: rgba(31, 36, 48, .06); border-color: rgba(31, 36, 48, .2); }
.wsp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; text-align: center; }
.wsp-stats > div { padding: 8px 4px; border-radius: 12px; background: rgba(31, 36, 48, .06); min-width: 0; }
.wsp-stats b { display: block; font: 800 20px var(--head); color: var(--ink); }
.wsp-stats small { display: block; font-size: 12px; font-weight: 800; color: var(--ink-3); }
.wsp-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.wsp-primary { min-height: 52px; border: 0; border-radius: 14px; background: linear-gradient(180deg, #ffe066, #ffd60a 40%, #e8b800); color: #2b2205; font: 900 16px 'Nunito', sans-serif; box-shadow: 0 4px 0 #a37f00; padding: 0 14px; }
.wsp-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #a37f00; }
.wsp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wsp-two.one { grid-template-columns: 1fr; }
.wsp-ghost { min-height: 46px; border-radius: 12px; border: 1.5px solid rgba(31, 36, 48, .25); background: var(--paper); font: 800 14px 'Nunito', sans-serif; color: var(--ink); padding: 0 8px; }
.wsp-ghost:active { transform: translateY(1px); }
.wsp-name { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 800; color: var(--ink-3); }
.wsp-name input { min-height: 44px; border-radius: 10px; border: 1.5px solid rgba(31, 36, 48, .25); background: var(--paper); padding: 0 12px; font: 800 16px 'Nunito', sans-serif; color: var(--ink); }
.wsp-note { margin: 0; text-align: center; font-size: 13px; font-weight: 800; color: var(--ink-3); line-height: 1.4; }
.wsp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the how-to card under the game */
.wsp-read-wrap { padding-top: 0; }
.wsp-read { background: var(--paper); }
#postGameLinks { max-width: 480px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }

/* wide screens: the sheet and the list side by side would split the eye; keep one column, just roomier */
@media (min-width: 720px) { .wsp-wrap { padding-top: 16px; } .wsp-title { font-size: 34px; } }
