/* Spelling Bii (public/arcade/bee.js). Arcade tokens come from arcade.css; everything is scoped to its stage.
   The hive is the bold thing: six warm-white tiles round a felt-red centre, each with the cabinets' hard darker side
   (a press pushes the tile down onto it), ink Jersey letters, white on the centre. Around it only black, Jersey and
   cabinet keys. */
.ag-stage[data-kind="bee"] { container: sb / size; }
.ag-stage[data-kind="bee"] .sb {
  --felt: #b8111b; --side: #7c0a12; --tile: #fff5f5; --lip: #c69ea3; --ink: #1a070a; --pink: #ff9aa2; --mute: #c69ea3;
  --red: #ff3b44; --line: var(--ac-line, #3d1a20);
  --hv: min(86cqw, calc((100cqh - 300px) * 1.08), 330px);
  position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "top" "side" "play";
  color: var(--tile); font-family: var(--ac-pixel, "Jersey 10");
}
.ag-stage[data-kind="bee"] .sb [hidden] { display: none !important; }
.ag-stage[data-kind="bee"] .sb :is(p, h2, h3, ul) { margin: 0; padding: 0; }
.ag-stage[data-kind="bee"] .sb button { -webkit-tap-highlight-color: transparent; }

/* ---------- the puzzle's date and the clock ---------- */
.ag-stage[data-kind="bee"] .sb-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 0; }
.ag-stage[data-kind="bee"] .sb-date { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 14px/1.3 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .sb-clock { flex: none; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.ag-stage[data-kind="bee"] .sb-clock.low { color: var(--red); animation: sb-blink 1s steps(1) infinite; }
@keyframes sb-blink { 50% { opacity: .35; } }

/* ---------- rank line + word strip ---------- */
.ag-stage[data-kind="bee"] .sb-side { grid-area: side; position: relative; min-width: 0; padding: 8px 16px 0; display: flex; flex-direction: column; gap: 10px; }
.ag-stage[data-kind="bee"] .sb-rank { display: flex; align-items: center; gap: 14px; height: 30px; }
.ag-stage[data-kind="bee"] .sb-rname { flex: none; min-width: 5.2em; font-weight: 400; font-size: 26px; line-height: 1; }
.ag-stage[data-kind="bee"] .sb-line { position: relative; flex: 1; height: 30px; margin: 0 16px 0 4px; }
.ag-stage[data-kind="bee"] .sb-track { position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; background: var(--line); }
.ag-stage[data-kind="bee"] .sb-dots { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; }
.ag-stage[data-kind="bee"] .sb-dots i { width: 8px; height: 8px; margin: 0 -4px; background: var(--line); }
.ag-stage[data-kind="bee"] .sb-dots i:last-child { width: 10px; height: 10px; margin: 0 -5px; outline: 2px solid var(--line); outline-offset: 2px; }
.ag-stage[data-kind="bee"] .sb-dots i.past { background: var(--felt); }
.ag-stage[data-kind="bee"] .sb-me { position: absolute; top: 50%; left: calc(var(--at, 0) * 100%); display: grid; place-items: center;
  min-width: 30px; height: 28px; padding: 0 5px 2px; transform: translate(-50%, -50%); background: var(--felt); box-shadow: 3px 3px 0 var(--side);
  color: #fff; font-size: 22px; line-height: 1; transition: left .4s steps(6, end); }
.ag-stage[data-kind="bee"] .sb-line.queen .sb-me { left: 100%; background: var(--tile); color: var(--ink); box-shadow: 3px 3px 0 var(--lip), 0 0 14px #ff3b44aa; }

.ag-stage[data-kind="bee"] .sb-box { position: relative; z-index: 3; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  border: 0; background: #000; color: var(--tile); text-align: left; font: inherit; cursor: pointer; }
/* its frame is drawn, not a border (buttons.css clears button borders) */
.ag-stage[data-kind="bee"] .sb-box::before { content: ""; position: absolute; inset: 0; border: 2px solid var(--line); pointer-events: none; }
.ag-stage[data-kind="bee"] .all-open .sb-box::before { border-bottom-color: #000; }
.ag-stage[data-kind="bee"] .sb-sum { flex: none; font: 400 15px/1 var(--font); }
.ag-stage[data-kind="bee"] .sb-sum:empty { display: none; }
.ag-stage[data-kind="bee"] .sb-sum.ph { color: var(--mute); }
.ag-stage[data-kind="bee"] .sb-tick { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; font-size: 22px; line-height: 1;
  -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent); mask-image: linear-gradient(90deg, #000 80%, transparent); }
.ag-stage[data-kind="bee"] .sb-tick span { margin-right: 14px; }
.ag-stage[data-kind="bee"] .sb .pg { color: var(--pink); }
.ag-stage[data-kind="bee"] .sb-car { flex: none; width: 12px; height: 8px; color: var(--mute); }
.ag-stage[data-kind="bee"] .all-open .sb-car { transform: rotate(180deg); }
.ag-stage[data-kind="bee"] .all-open .sb-tick { visibility: hidden; }
/* open: the whole list drops over the hive, alphabetical in columns */
.ag-stage[data-kind="bee"] .sb-all { position: absolute; z-index: 2; left: 16px; right: 16px; top: calc(100% - 2px); height: calc(100cqh - 100% - 54px);
  overflow: auto; padding: 12px 14px 20px; border: 2px solid var(--line); border-top: 0; background: #000; -webkit-overflow-scrolling: touch; }
.ag-stage[data-kind="bee"] .sb-allh { font: 400 14px/1.3 var(--font); color: var(--mute); margin-bottom: 8px !important; }
.ag-stage[data-kind="bee"] .sb-cols { list-style: none; columns: 2; column-gap: 18px; }
.ag-stage[data-kind="bee"] .sb-cols li { padding: 5px 0 4px; border-bottom: 2px solid var(--line); font-size: 22px; line-height: 1.1; break-inside: avoid; }

/* ---------- the message, the word, the hive, the keys ---------- */
.ag-stage[data-kind="bee"] .sb-play { grid-area: play; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 0 12px; }
.ag-stage[data-kind="bee"] .sb-msgw { height: 34px; display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; }
.ag-stage[data-kind="bee"] .sb-msgw.on { opacity: 1; }
.ag-stage[data-kind="bee"] .sb-msg { font-size: 30px; line-height: 1; }
.ag-stage[data-kind="bee"] .sb-msgw.bad .sb-msg { font: 400 15px/1.2 var(--font); color: var(--pink); }
.ag-stage[data-kind="bee"] .sb-msgw:is(.ok, .pg) .sb-msg { color: var(--tile); text-shadow: 0 0 6px #ff3b44, 0 0 18px #d3121c; }
.ag-stage[data-kind="bee"] .sb-msgw.pg .sb-msg { font-size: 36px; }
.ag-stage[data-kind="bee"] .sb-msgw.on:is(.ok, .pg) .sb-msg { animation: sb-pop .4s steps(3, end); }
@keyframes sb-pop { from { transform: scale(1.5); color: var(--red); } }
.ag-stage[data-kind="bee"] .sb-plus { font-size: 26px; color: var(--red); }
.ag-stage[data-kind="bee"] .sb-msgw.on:is(.ok, .pg) .sb-plus { animation: sb-up 1.2s steps(8, end) both; }
@keyframes sb-up { from { transform: translateY(6px); opacity: 0; } 20% { transform: none; opacity: 1; } 75% { opacity: 1; } to { transform: translateY(-14px); opacity: 0; } }

.ag-stage[data-kind="bee"] .sb-input { display: flex; align-items: center; justify-content: center; max-width: 92cqw; height: 50px; margin: 2px 0 10px;
  font-size: 48px; line-height: 1; letter-spacing: .08em; white-space: nowrap; }
.ag-stage[data-kind="bee"] .sb-input.long { font-size: 34px; }
.ag-stage[data-kind="bee"] .sb-typed .c { color: var(--red); }
.ag-stage[data-kind="bee"] .sb-typed .x { color: var(--line); }
.ag-stage[data-kind="bee"] .sb-caret { width: .3em; height: 4px; margin: .5em 0 0 2px; align-self: center; background: var(--red); animation: sb-blink 1s steps(1) infinite; }
.ag-stage[data-kind="bee"] .sb-input.shake { animation: sb-shake .3s steps(4); }
@keyframes sb-shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }

/* the hive: a tile above and below the centre, two either side (tiles are 40% wide, a third tall) */
.ag-stage[data-kind="bee"] .sb-hive { position: relative; flex: none; width: var(--hv); height: calc(var(--hv) * .923); margin: 0 auto 14px; touch-action: manipulation; }
.ag-stage[data-kind="bee"] .sb-cell { position: absolute; top: calc(100% / 3); left: 30%; width: 40%; height: calc(100% / 3); overflow: visible; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.ag-stage[data-kind="bee"] .sb-cell:not(:focus-visible) { outline-color: transparent !important; } /* the tile's own push is the press */
.ag-stage[data-kind="bee"] .sb-cell:nth-child(2) { transform: translate(0, -100%); }
.ag-stage[data-kind="bee"] .sb-cell:nth-child(3) { transform: translate(75%, -50%); }
.ag-stage[data-kind="bee"] .sb-cell:nth-child(4) { transform: translate(75%, 50%); }
.ag-stage[data-kind="bee"] .sb-cell:nth-child(5) { transform: translate(0, 100%); }
.ag-stage[data-kind="bee"] .sb-cell:nth-child(6) { transform: translate(-75%, 50%); }
.ag-stage[data-kind="bee"] .sb-cell:nth-child(7) { transform: translate(-75%, -50%); }
.ag-stage[data-kind="bee"] .sb-hex { fill: var(--tile); }
.ag-stage[data-kind="bee"] .sb-side { fill: var(--lip); }
.ag-stage[data-kind="bee"] .sb-cell.center .sb-hex { fill: var(--felt); }
.ag-stage[data-kind="bee"] .sb-cell.center .sb-side { fill: var(--side); }
.ag-stage[data-kind="bee"] .sb-cell.push .sb-face { transform: translate(2.5px, 2.5px); }
.ag-stage[data-kind="bee"] .sb-cell text { font: 400 34px/1 var(--ac-pixel, "Jersey 10"); text-anchor: middle; fill: var(--ink); pointer-events: none; user-select: none; }
.ag-stage[data-kind="bee"] .sb-cell.center text { fill: #fff; }
.ag-stage[data-kind="bee"] .sb-hive.fade .sb-cell:not(.center) text { opacity: 0; }

.ag-stage[data-kind="bee"] .sb-btns { display: flex; align-items: center; gap: 14px; }
.ag-stage[data-kind="bee"] .sb-btn { height: 52px; min-width: 96px; font-size: 24px; touch-action: manipulation; }
.ag-stage[data-kind="bee"] .sb-shuf { min-width: 52px; width: 52px; }
.ag-stage[data-kind="bee"] .sb-shuf svg { width: 24px; height: 24px; fill: none; }

/* ---------- time's up: rank, both lists, the rest of the answers (the result card covers the bottom, so this scrolls clear of it) ---------- */
.ag-stage[data-kind="bee"] .is-over .sb-side, .ag-stage[data-kind="bee"] .is-over .sb-play { display: none; }
.ag-stage[data-kind="bee"] .sb.is-over { grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top" "res"; grid-template-columns: minmax(0, 1fr); }
.ag-stage[data-kind="bee"] .sb-res { grid-area: res; min-height: 0; overflow: auto; padding: 14px 16px 360px; -webkit-overflow-scrolling: touch; }
.ag-stage[data-kind="bee"] .sb-badge { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ag-stage[data-kind="bee"] .sb-bhex { position: relative; flex: none; width: 70px; height: 61px; display: grid; place-items: center; }
.ag-stage[data-kind="bee"] .sb-bhex svg { position: absolute; inset: 0; fill: var(--felt); filter: drop-shadow(3px 3px 0 var(--side)); }
.ag-stage[data-kind="bee"] .sb-bhex b { position: relative; font-weight: 400; font-size: 30px; color: #fff; }
.ag-stage[data-kind="bee"] .sb-badge h2 { font-weight: 400; font-size: 40px; line-height: 1; }
.ag-stage[data-kind="bee"] .sb-badge p { font: 400 14px/1.3 var(--font); color: var(--mute); margin-top: 4px; }
.ag-stage[data-kind="bee"] .sb-rcols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ag-stage[data-kind="bee"] .sb-rcols.one { grid-template-columns: 1fr; }
.ag-stage[data-kind="bee"] .sb-col h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 4px; margin-bottom: 2px;
  border-bottom: 2px solid var(--line); font-weight: 400; font-size: 26px; line-height: 1; }
.ag-stage[data-kind="bee"] .sb-col h3 span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-stage[data-kind="bee"] .sb-rcols .sb-col:first-child h3 span { color: var(--red); }
.ag-stage[data-kind="bee"] .sb-col h3 b { font-weight: 400; font-size: 34px; }
.ag-stage[data-kind="bee"] .sb-col ul { list-style: none; }
.ag-stage[data-kind="bee"] .sb-rcols.one ul, .ag-stage[data-kind="bee"] .sb-missed ul { columns: 2; column-gap: 18px; }
.ag-stage[data-kind="bee"] .sb-col li { padding: 4px 0 3px; font-size: 22px; line-height: 1.1; break-inside: avoid; }
.ag-stage[data-kind="bee"] .sb-col s { color: var(--pink); text-decoration-thickness: 2px; }
.ag-stage[data-kind="bee"] .sb-none { padding: 6px 0 !important; font: italic 400 15px/1.3 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .sb-note { margin-top: 10px !important; font: 400 14px/1.35 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .sb-missed { margin-top: 18px; }
.ag-stage[data-kind="bee"] .sb-missed h3 span { font: 400 13px/1.2 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .sb-missed li { color: var(--mute); }
.ag-stage[data-kind="bee"] .sb-missed li.pg { color: var(--pink); }

/* short screens: less air */
@container sb (max-height: 600px) {
  .ag-stage[data-kind="bee"] .sb { --hv: min(86cqw, calc((100cqh - 262px) * 1.08), 330px); }
  .ag-stage[data-kind="bee"] .sb-msgw { height: 28px; }
  .ag-stage[data-kind="bee"] .sb-input { height: 40px; margin: 0 0 6px; font-size: 40px; }
  .ag-stage[data-kind="bee"] .sb-hive { margin-bottom: 8px; }
  .ag-stage[data-kind="bee"] .sb-btn { height: 46px; }
  .ag-stage[data-kind="bee"] .sb-shuf { width: 46px; min-width: 46px; }
}
/* landscape: the hive on the left, rank and words on the right */
@container sb (min-aspect-ratio: 5/4) {
  .ag-stage[data-kind="bee"] .sb { --hv: min(40cqw, calc((100cqh - 200px) * 1.08), 330px); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top" "play side"; }
  .ag-stage[data-kind="bee"] .sb-side { align-self: start; padding: 14px 16px 0 0; }
  .ag-stage[data-kind="bee"] .sb-all { left: 0; right: 16px; height: calc(100cqh - 140px); }
}

@media (prefers-reduced-motion: reduce) {
  .ag-stage[data-kind="bee"] .sb-input.shake, .ag-stage[data-kind="bee"] .sb-caret, .ag-stage[data-kind="bee"] .sb-clock.low,
  .ag-stage[data-kind="bee"] .sb-msgw.on .sb-plus, .ag-stage[data-kind="bee"] .sb-msgw.on .sb-msg { animation: none; }
  .ag-stage[data-kind="bee"] .sb-me { transition: none; }
}
