/* ============================================================================
   Word Cube — focused clubhouse play screen (gamesy). Wraps the legacy cube
   engine; the .wc-* class names / #wc* IDs are engine hooks and must stay.
   Shares the sp-* shell shape with the Sudoku / Crossword play screens. Mode
   accent injected via --c on .sp-page (regular green / powerplay magenta).
   ============================================================================ */

.sp-page { max-width: 1040px; margin: 0 auto; color: #2b2620;
  font-family: Georgia, 'Times New Roman', serif; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.sp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sp-back { font-family: system-ui, sans-serif; font-weight: 700; font-size: 16px; letter-spacing: 1px; color: var(--c, #1f4a33); text-decoration: none; }
.sp-back:hover { filter: brightness(1.12); }
.sp-header-actions { display: flex; gap: 10px; }
.sp-iconbtn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid #d8cdb2; background: #fffdf7; color: #4a443b; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 2px rgba(60,50,30,.06); transition: background .12s; }
.sp-iconbtn:hover { background: #f3ecd9; }
.sp-dd { position: relative; }
.sp-dd-panel { position: absolute; top: calc(100% + 6px); right: 0; min-width: 210px; background: #fffdf7; border: 1px solid #e6ddc6; border-radius: 10px; box-shadow: 0 8px 24px rgba(40,30,15,.18); padding: 8px; z-index: 30; display: none; }
.sp-dd.open .sp-dd-panel { display: block; }
.sp-dd-item { display: flex; align-items: center; width: 100%; padding: 10px; background: none; border: 0; border-radius: 7px; font-family: system-ui, sans-serif; font-size: 14px; color: #2b2620; cursor: pointer; text-decoration: none; text-align: left; }
.sp-dd-item:hover { background: #f3ecd9; }

/* ── Stats live inside the menu now (game-first page) ───────────────────── */
.sp-dd-stats { display: flex; align-items: center; gap: 4px; padding: 8px 6px 10px; margin-bottom: 6px; border-bottom: 1px solid #ece3cb; }
.sp-dd-stats .sp-badge { margin-right: 8px; }
.sp-dd-stats .sp-stat { padding: 0 8px; }
.sp-dd-stats .sp-stat-v { font-size: 19px; }
.sp-badge { font-family: system-ui, sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 1px; color: #fff; padding: 7px 16px; border-radius: 8px; background: linear-gradient(180deg, color-mix(in srgb, var(--c, #4e7d3a), #fff 16%), var(--c, #4e7d3a)); margin-right: 16px; box-shadow: 0 2px 5px rgba(60,50,30,.18), inset 0 1px 0 rgba(255,255,255,.25); white-space: nowrap; }
.sp-stat { flex: 1; text-align: center; border-left: 1px solid #ece3cb; padding: 0 10px; }
.sp-stat-l { font-family: system-ui, sans-serif; font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: #7a7468; }
.sp-stat-v { font-family: Georgia, serif; font-size: 24px; font-weight: 700; color: #2b2620; margin-top: 2px; }

/* ── Rank ladder — slim strip in the RIGHT column (above the catch), label
      stacked over the dot train so the strip works at column width ───────── */
.wc-rank-bar { margin: 0 0 14px; padding: 10px 16px 13px; background: linear-gradient(180deg, #fffdf8, #faf4e6); border: 1px solid #e0d4b6; border-radius: 12px; box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(60,50,30,.07); }
.wc-rank-bar-label { font-family: Georgia, serif; font-weight: 700; font-size: clamp(15px, 2vw, 19px); line-height: 1; color: var(--c, #4e7d3a); margin-bottom: 10px; text-align: center; }
.wc-rank-line { list-style: none; padding: 0 6px; margin: 0; display: grid; grid-template-columns: repeat(10, 1fr); align-items: center; position: relative; }
.wc-rank-line::before { content: ''; position: absolute; top: 50%; left: calc(100% / 20); right: calc(100% / 20); height: 2px; background: #e0d6bd; transform: translateY(-50%); z-index: 0; }
.wc-rank-step { position: relative; z-index: 1; display: flex; justify-content: center; }
.wc-rank-step .dot { width: 14px; height: 14px; border: 2px solid #d8cdb2; border-radius: 50%; background: #fffdf7; transition: background .15s, border-color .15s, box-shadow .15s; }
.wc-rank-step.is-reached .dot { background: #2b2620; border-color: #2b2620; }
.wc-rank-step.is-current .dot { background: var(--c, #4e7d3a); border-color: var(--c, #4e7d3a); box-shadow: 0 0 0 4px color-mix(in oklab, var(--c, #4e7d3a) 22%, transparent); width: 18px; height: 18px; }

/* ── Main play grid — cube left; rank + catch stack in the right column.
      On single-column widths .wc-right dissolves (display:contents) and the
      rank floats above the cube via order. ─────────────────────────────────── */
.wc-play { display: grid; grid-template-columns: minmax(300px, 440px) minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 24px; }
.wc-right { display: contents; }
@media (min-width: 901px) { .wc-right { display: flex; flex-direction: column; min-width: 0; } }
@media (max-width: 900px) { .wc-play { grid-template-columns: 1fr; gap: 18px; } .wc-right .wc-rank-bar { order: -1; margin-bottom: 0; } }
@media (max-width: 560px) { .wc-cube-frame { padding: 9px; border-radius: 14px; } }

/* ── Cube panel ─────────────────────────────────────────────────────────── */
.wc-cube-panel { background: linear-gradient(180deg, #fffdf8, #f7f0df); border: 1px solid #e0d4b6; border-radius: 14px; box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(60,50,30,.09); padding: 18px 18px 22px; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Velvet gold-edged frame around the cube — the clubhouse premium treatment. */
/* max-width also caps by viewport HEIGHT (min()) — a 440px column on a
   768px-tall tablet otherwise builds a cube the screen can't hold. The max()
   floor stops the calc going NEGATIVE on very short viewports (which
   collapsed the frame entirely on landscape phones). */
.wc-cube-frame { width: 100%; max-width: min(404px, max(200px, calc(100vh - 450px))); padding: 12px; border-radius: 18px; background: linear-gradient(160deg, #3d342a, #241e16); box-shadow: 0 12px 28px rgba(40,30,15,.32), inset 0 0 0 1.5px #b08a35; }
@media (min-width: 901px) { .wc-cube-panel { position: sticky; top: 14px; } }
.wc-eyebrow { width: 100%; display: flex; align-items: center; justify-content: space-between; font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; color: #7a7468; border-bottom: 1px solid #ece3cb; padding-bottom: 8px; }
.wc-eyebrow .tag { font-weight: 700; color: var(--c, #4e7d3a); letter-spacing: .08em; }

.wc-flash { font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 11.5px; font-weight: 700; height: 18px; text-align: center; }
.wc-flash.ok  { color: #2f7a4a; }
.wc-flash.err { color: #b3261e; }

.wc-current { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; font-family: system-ui, sans-serif; font-weight: 800; font-size: clamp(26px, 5vw, 36px); letter-spacing: 0.06em; color: #2b2620; border-bottom: 2px solid #e6ddc6; padding-bottom: 8px; text-transform: uppercase; }
.wc-current:empty::before { content: 'tap tiles or type…'; font-family: Georgia, serif; font-style: italic; font-weight: 400; font-size: 15px; color: #a59c88; letter-spacing: 0; text-transform: none; }
.wc-current.shake { animation: wc-shake .4s; }
.wc-current.win { color: #2f7a4a; animation: wc-pop .4s ease-out; }
@keyframes wc-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@keyframes wc-pop { 0% { transform: scale(1); } 50% { transform: scale(1.15); } 100% { transform: scale(1); } }

.wc-cube { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: none; aspect-ratio: 1; perspective: 900px; }
@keyframes wc-tile-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.wc-tile.is-flipping { animation: wc-tile-flip .5s ease; transform-style: preserve-3d; }
.wc-tile { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-family: system-ui, sans-serif; font-weight: 800; font-size: clamp(26px, 6vw, 48px); color: #fff; border: none; border-radius: 12px; cursor: pointer; user-select: none; text-transform: uppercase; transition: transform .1s, opacity .15s, box-shadow .12s; position: relative; box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 3px 6px rgba(20,12,4,.4); }
.wc-tile:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 5px 12px rgba(20,12,4,.5); }
.wc-tile:active { transform: scale(.95); }
.wc-tile.used { opacity: .32; cursor: default; box-shadow: none; }
.wc-tile.t0, .wc-tile.t6 { background: #b8501f; }
.wc-tile.t1, .wc-tile.t8 { background: #6a7a2a; }
.wc-tile.t2, .wc-tile.t7 { background: #8a2820; }
.wc-tile.t3, .wc-tile.t5 { background: #2d6a64; }
.wc-tile.t4 { background: #e7d49b; color: #2b2620; box-shadow: 0 2px 4px rgba(60,50,30,.18), 0 0 0 3px #fffdf7 inset; }

.wc-actions { display: grid; grid-template-columns: 1fr 1fr 1.6fr 1fr; gap: 8px; width: 100%; max-width: 380px; }
.wc-btn { appearance: none; border: none; border-radius: 10px; padding: 13px 0; font-family: system-ui, sans-serif; font-weight: 800; font-size: 15px; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 2px 4px rgba(60,50,30,.18); transition: filter .12s, transform .08s; }
.wc-btn.clr     { background: #e9c463; color: #3a3320; }
.wc-btn.shuffle { background: #2d6a64; color: #fff; }
.wc-btn.submit  { background: var(--c, #4e7d3a); color: #fff; }
.wc-btn.del     { background: #8a2820; color: #fff; }
.wc-btn:hover  { filter: brightness(1.08); }
.wc-btn:active { transform: translateY(1px); }

.wc-score-bar { width: 100%; max-width: 380px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-top: 2px solid #e6ddc6; padding-top: 12px; margin-top: 2px; }
.wc-score-bar .side { font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; color: #7a7468; }
.wc-score-bar .side b { display: block; font-family: Georgia, serif; font-size: 22px; color: #2b2620; margin-bottom: 2px; }
.wc-score-bar .side.left { text-align: left; padding-left: 6px; }
.wc-score-bar .side.right { text-align: right; padding-right: 6px; }
.wc-score-bar .total { font-family: Georgia, serif; font-weight: 700; font-size: clamp(34px, 5vw, 44px); color: var(--c, #4e7d3a); line-height: 1; padding: 0 18px; }

/* ── Found-words panel ──────────────────────────────────────────────────── */
.wc-finds-panel { background: linear-gradient(180deg, #fffdf8, #faf4e6); border: 1px solid #e0d4b6; border-radius: 14px; box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(60,50,30,.07); padding: 16px 18px 18px; }
.wc-finds-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid #ece3cb; padding-bottom: 10px; margin-bottom: 12px; }
.wc-finds-head h3 { margin: 0; font-family: Georgia, serif; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: clamp(16px, 2.4vw, 20px); color: #2b2620; line-height: 1; }
.wc-finds-head .tally { font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; color: #7a7468; }
.wc-finds-head .tally b { font-family: Georgia, serif; color: var(--c, #4e7d3a); font-size: 16px; margin-right: 3px; }
.wc-finds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 5px; }
.wc-finds-grid span { padding: 5px 8px; background: #f6efdb; border: 1px solid #e6ddc6; border-radius: 6px; color: #2b2620; font-family: system-ui, sans-serif; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; text-align: center; line-height: 1.3; }
.wc-finds-grid:empty::before { content: 'No words yet — tap tiles or type to begin!'; grid-column: 1 / -1; color: #a59c88; font-family: Georgia, serif; font-style: italic; font-size: 14px; text-align: left; padding: 2px 0; }

.wc-no-puzzle { text-align: center; padding: 40px 20px; border: 1px dashed #d8cdb2; border-radius: 12px; background: #fffdf7; font-family: Georgia, serif; font-style: italic; color: #6b6357; margin: 20px 0; }

/* ── Yesterday's solution — collapsible ─────────────────────────────────── */
.wc-yesterday-strip { margin: 4px 0 20px; }
.wc-yesterday-strip__toggle { appearance: none; width: 100%; display: flex; align-items: center; justify-content: space-between; background: #fffdf7; border: 1px solid #e6ddc6; border-radius: 10px; padding: 12px 16px; cursor: pointer; text-align: left; font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 11px; font-weight: 700; color: #4a443b; box-shadow: 0 1px 2px rgba(60,50,30,.05); }
.wc-yesterday-strip__toggle:hover { background: #f8f2e2; }
.wc-yesterday-strip__toggle .chev { display: inline-block; margin-right: 8px; transition: transform .25s; }
.wc-yesterday-strip.is-open .wc-yesterday-strip__toggle .chev { transform: rotate(180deg); }
.wc-yesterday-strip__toggle .open-hint { color: var(--c, #4e7d3a); }
.wc-yesterday-strip.is-open .wc-yesterday-strip__toggle { border-radius: 10px 10px 0 0; }
.wc-yesterday-strip__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.wc-yesterday-strip__panel > .panel-inner { overflow: hidden; min-height: 0; }
.wc-yesterday-strip.is-open .wc-yesterday-strip__panel { grid-template-rows: 1fr; }
.ys-banner { display: flex; align-items: center; gap: 18px; background: #fffdf7; border: 1px solid #e6ddc6; border-top: none; padding: 16px 18px; flex-wrap: wrap; }
.ys-banner .ys-cube { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; width: 96px; aspect-ratio: 1; flex-shrink: 0; }
.ys-banner .ys-cube .tile { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-family: system-ui, sans-serif; font-weight: 800; font-size: 14px; color: #fff; border-radius: 4px; text-transform: uppercase; line-height: 1; }
.ys-banner .ys-cube .tile.t0, .ys-banner .ys-cube .tile.t6 { background: #b8501f; }
.ys-banner .ys-cube .tile.t1, .ys-banner .ys-cube .tile.t8 { background: #6a7a2a; }
.ys-banner .ys-cube .tile.t2, .ys-banner .ys-cube .tile.t7 { background: #8a2820; }
.ys-banner .ys-cube .tile.t3, .ys-banner .ys-cube .tile.t5 { background: #2d6a64; }
.ys-banner .ys-cube .tile.t4 { background: #e7d49b; color: #2b2620; }
.ys-banner .ys-info { flex: 1; min-width: 0; }
.ys-banner .ys-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.ys-banner .ys-row .lbl { font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; color: #7a7468; }
.ys-banner .ys-row .word { font-family: system-ui, sans-serif; font-weight: 800; font-size: clamp(20px, 2.6vw, 28px); letter-spacing: 0.06em; color: var(--c, #4e7d3a); text-transform: uppercase; line-height: 1; }
.ys-banner .ys-player { display: flex; gap: 18px; flex-wrap: wrap; font-family: Georgia, serif; font-size: 13px; color: #4a443b; margin-top: 4px; }
.ys-banner .ys-player b { color: #2b2620; }
.ys-banner .ys-empty { font-family: Georgia, serif; font-style: italic; color: #6b6357; font-size: 13px; margin: 0; }
.ys-words { background: #fffdf7; border: 1px solid #e6ddc6; border-top: none; border-radius: 0 0 10px 10px; padding: 14px 18px 16px; }
.ys-words h4 { margin: 0 0 6px; font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; color: #7a7468; }
.ys-words .ys-words-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 4px; margin-bottom: 10px; }
.ys-words-grid span { padding: 4px 8px; background: #f6efdb; border: 1px solid #e6ddc6; border-radius: 5px; color: #7a7468; font-family: system-ui, sans-serif; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; text-align: center; line-height: 1.3; }
.ys-words-grid span.is-found { background: var(--c, #4e7d3a); color: #fff; border-color: var(--c, #4e7d3a); font-weight: 700; }
.ys-words-len { margin-top: 10px; }
.ys-words-len:first-child { margin-top: 0; }

/* ── Find celebrations — toast + confetti, tiered by length ─────────────── */
.wc-find-toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.5) rotate(-3deg); color: #fff; border-radius: 16px; z-index: 10000; opacity: 0; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .3s; text-align: center; pointer-events: none; max-width: 92vw; }
.wc-find-toast.show { transform: translate(-50%, -50%) scale(1) rotate(-3deg); opacity: 1; }
.wc-find-toast.fade { transform: translate(-50%, -55%) scale(1) rotate(-3deg); opacity: 0; }
.wc-find-toast--pangram { background: linear-gradient(135deg, #6a7a2a, #c9942b); padding: 26px 44px 22px; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.wc-find-toast--big { background: #6a7a2a; padding: 20px 36px 18px; box-shadow: 0 14px 32px rgba(0,0,0,.3); }
.wc-find-toast--nice { background: #2d6a64; padding: 16px 28px 14px; box-shadow: 0 12px 26px rgba(0,0,0,.28); }
.wc-find-toast .tag { font-family: system-ui, sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .3em; font-size: 12px; display: block; margin-bottom: 6px; color: rgba(255,255,255,.85); }
.wc-find-toast--pangram .tag { font-size: 13px; margin-bottom: 8px; }
.wc-find-toast .word { font-family: system-ui, sans-serif; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; display: block; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,.25); line-height: 1; }
.wc-find-toast--pangram .word { font-size: clamp(34px, 6vw, 56px); }
.wc-find-toast--big     .word { font-size: clamp(28px, 5vw, 44px); }
.wc-find-toast--nice    .word { font-size: clamp(22px, 4vw, 32px); }
.wc-find-toast .pts { font-family: system-ui, sans-serif; font-weight: 800; color: #3a3320; background: #fff; border-radius: 6px; padding: 3px 12px; display: inline-block; margin-top: 10px; }
.wc-find-toast--pangram .pts { font-size: 22px; padding: 4px 14px; margin-top: 12px; }
.wc-find-toast--big     .pts { font-size: 18px; }
.wc-find-toast--nice    .pts { font-size: 15px; padding: 2px 10px; margin-top: 8px; }
.wc-confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

/* ── Powerplay tile decoration ──────────────────────────────────────────── */
.wc-tile .pp-secondary { position: absolute; bottom: 6px; right: 8px; font-family: system-ui, sans-serif; font-weight: 800; font-size: clamp(11px, 1.8vw, 16px); line-height: 1; opacity: .55; pointer-events: none; display: none; text-transform: uppercase; }
.wc-tile .pp-reversal { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; border-radius: 50%; background: #e9c463; border: 1px solid #2b2620; display: none; align-items: center; justify-content: center; font-size: 11px; color: #2b2620; cursor: pointer; line-height: 1; }
.wc-tile .pp-reversal:hover { transform: rotate(180deg); }
.wc-cube.is-pp2 .wc-tile .pp-secondary,
.wc-cube.is-pp2 .wc-tile .pp-reversal { display: flex; }


/* Landscape-only score mirror — hidden everywhere else. Must precede the
   media block below (equal specificity: later rule wins). */
.wc-side-score { display: none; }
.ch-content { padding-bottom: 16px; }   /* the shell's 60px is dead weight under a game */

/* ── Landscape phones (short + wide): cube left, catch right, everything
      trimmed so the whole game sits in one screen — same doctrine (and the
      same trigger) as Solitaire's side-rail. The cube sizes from HEIGHT here
      (aspect-ratio keeps it square), not from the column width. ──────────── */
@media (max-height: 520px) and (min-aspect-ratio: 3/2) {
  /* The clubhouse mobile bar duplicates this page's own back link + menu —
     hide it in game-landscape and reclaim its 54px content offset. */
  .ch-mobilebar { display: none; }
  .ch-main { padding-top: 0; }
  .ch-content { padding: 8px 12px 8px; }
  .sp-header { margin-bottom: 6px; }
  .sp-iconbtn { width: 32px; height: 32px; }
  .wc-rank-bar { margin-bottom: 8px; padding: 5px 12px 8px; }
  .wc-rank-bar-label { font-size: 14px; margin-bottom: 6px; }
  .wc-play { grid-template-columns: auto minmax(0, 1fr); gap: 12px; margin-bottom: 0; }
  /* right column always stacks rank-over-catch here, even below 901px wide */
  .wc-right { display: flex; flex-direction: column; min-width: 0; }
  .wc-right .wc-rank-bar { order: 0; }
  .wc-cube-panel { padding: 8px 12px 10px; gap: 5px; position: static; }
  /* Chrome outside+inside the cube column ≈ 215px; the cube takes the rest.
     The tile font caps by HEIGHT too — a vw-based font taller than the grid
     row breaks the cube's square ratio and inflates the column. */
  /* rank moved into the right column → the cube budget gains its ~38px */
  /* svh (STABLE small-viewport height — what iOS media queries measure), NOT
     dvh: dvh changes when Safari's toolbar hides, and WebKit re-resolves the
     cube width without re-running the grid track sizing around it, so the
     cube outgrew its panel and overlapped the catch column. */
  .wc-cube { width: calc(100vh - 194px); width: calc(100svh - 194px); min-width: 150px; max-width: 300px; }
  .wc-tile { font-size: min(7.5vh, 34px); }
  /* max-width:none — the base height-cap goes negative at these heights */
  .wc-cube-frame { width: auto; max-width: none; padding: 8px; }
  .wc-eyebrow { display: none; }              /* puzzle no. is nonessential here */
  .wc-current { min-height: 30px; font-size: 20px; padding-bottom: 3px; }
  .wc-flash { height: 11px; font-size: 10px; }
  .wc-actions { max-width: none; gap: 6px; }
  .wc-btn { padding: 7px 0; font-size: 12px; }
  /* score lives in the catch header (mirrored) — the bar costs ~45px */
  .wc-score-bar { display: none; }
  .wc-side-score { display: inline-flex; align-items: baseline; gap: 4px; font-family: system-ui, sans-serif; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7a7468; }
  .wc-side-score b { font-family: Georgia, serif; font-size: 19px; color: var(--c, #4e7d3a); }
  .wc-finds-panel { max-height: calc(100vh - 150px); max-height: calc(100svh - 150px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #cfc3a4 #f3ecd9; }
}

/* Safari-with-toolbar heights (~310px visible): shave the remaining chrome
   so the whole game still fits without a scroll. */
@media (max-height: 340px) and (min-aspect-ratio: 3/2) {
  .ch-content { padding: 4px 12px 4px; }
  .sp-header { margin-bottom: 2px; }
  .sp-iconbtn { width: 28px; height: 28px; }
  .wc-cube-panel { padding: 6px 10px 8px; gap: 4px; }
  .wc-current { min-height: 24px; font-size: 16px; }
  .wc-cube { width: calc(100vh - 168px); width: calc(100svh - 168px); min-width: 132px; }
  .wc-btn { padding: 5px 0; font-size: 11px; }
}

/* ── Trims shared by every orientation (game fills one screen) ──────────── */
.sp-header { margin-bottom: 12px; }
.wc-play { margin-bottom: 12px; }

/* ── Tall tablets: same generosity by height. Two-column portrait (iPad Pro
      1024×1366) grows the cube column; single-column portrait (820×1180)
      just raises the frame cap. Landscape tablets (height < 1000) unaffected. */
@media (min-width: 901px) and (max-width: 1399px) and (min-height: 1100px) {
  .wc-play { grid-template-columns: minmax(300px, 52%) minmax(0, 1fr); }
  .wc-cube-frame { max-width: min(520px, calc(100vh - 500px)); }
  .wc-actions { max-width: 480px; }
  .wc-score-bar { max-width: 480px; }
  .wc-tile { font-size: clamp(26px, 6vw, 60px); }
  .wc-current { min-height: 58px; }
}
@media (max-width: 900px) and (min-height: 1000px) {
  .wc-cube-frame { max-width: min(460px, calc(100vh - 500px)); }
  .wc-tile { font-size: clamp(26px, 7vw, 56px); }
}

/* ── Large screens: stop being stingy — the page and the cube scale up.
      Height still governs via the min(), so short-wide monitors stay safe. ── */
@media (min-width: 1400px) {
  .sp-page { max-width: 1280px; }
  .wc-play { grid-template-columns: minmax(300px, 580px) minmax(0, 1fr); gap: 28px; }
  .wc-cube-frame { max-width: min(580px, calc(100vh - 470px)); }
  .wc-actions { max-width: 540px; }
  .wc-score-bar { max-width: 540px; }
  .wc-tile { font-size: clamp(26px, 4.5vw, 68px); }
  .wc-current { min-height: 60px; font-size: clamp(26px, 2.6vw, 42px); }
}

/* ── Portrait ALWAYS stacks (rank → cube → catch), whatever the width —
      side-by-side is reserved for screens wider than tall. Last block in the
      file on purpose: it must win the grid/order arguments above. ─────────── */
@media (orientation: portrait) {
  .wc-play { grid-template-columns: 1fr; }
  .wc-right { display: contents; }
  .wc-right .wc-rank-bar { order: -1; margin-bottom: 0; }
  .wc-cube-panel { position: static; }
}
@media (max-width: 560px) {
  .ch-content { padding-bottom: 8px; }
  .sp-header { margin-bottom: 8px; }
  .wc-rank-bar { margin-bottom: 8px; padding: 6px 12px 9px; }
  .wc-rank-bar-label { margin-bottom: 6px; font-size: 14px; }
  .wc-play { margin-bottom: 8px; gap: 14px; }
  .wc-cube-panel { padding: 14px 14px 16px; gap: 10px; }
  .wc-current { min-height: 44px; }
  .wc-score-bar { padding-top: 8px; }
}
