/* Spelling Bee (public/arcade/bee.js). Arcade tokens come from arcade.css; everything is scoped to its stage.
   The hive is the bold thing: six cool-white tiles round an indigo centre (no yellow: Fam keeps it for changes), 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: bee / size; }
.ag-stage[data-kind="bee"] .bee {
  --felt: #3340a0; --side: #222b73; --tile: #f6f7ff; --lip: #9ea3c6; --ink: #12142e; --pink: #b3bcff; --mute: #9ea3c6;
  --red: #7c8cff; --line: var(--ac-line, #262a52);
  --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"] .bee [hidden] { display: none !important; }
.ag-stage[data-kind="bee"] .bee :is(p, h2, h3, ul) { margin: 0; padding: 0; }
.ag-stage[data-kind="bee"] .bee button { -webkit-tap-highlight-color: transparent; }

/* ---------- the puzzle's date and the clock ---------- */
.ag-stage[data-kind="bee"] .bee-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 0; }
.ag-stage[data-kind="bee"] .bee-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"] .bee-clock { flex: none; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.ag-stage[data-kind="bee"] .bee-clock.low { color: var(--red); animation: bee-blink 1s steps(1) infinite; }
@keyframes bee-blink { 50% { opacity: .35; } }

/* ---------- rank line + word strip ---------- */
.ag-stage[data-kind="bee"] .bee-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"] .bee-rank { display: flex; align-items: center; gap: 14px; height: 30px; }
.ag-stage[data-kind="bee"] .bee-rname { flex: none; min-width: 5.2em; font-weight: 400; font-size: 26px; line-height: 1; }
.ag-stage[data-kind="bee"] .bee-line { position: relative; flex: 1; height: 30px; margin: 0 16px 0 4px; }
.ag-stage[data-kind="bee"] .bee-track { position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px; background: var(--line); }
.ag-stage[data-kind="bee"] .bee-dots { position: absolute; inset: 0; display: flex; justify-content: space-between; align-items: center; }
.ag-stage[data-kind="bee"] .bee-dots i { width: 8px; height: 8px; margin: 0 -4px; background: var(--line); }
.ag-stage[data-kind="bee"] .bee-dots i:last-child { width: 10px; height: 10px; margin: 0 -5px; outline: 2px solid var(--line); outline-offset: 2px; }
.ag-stage[data-kind="bee"] .bee-dots i.past { background: var(--felt); }
.ag-stage[data-kind="bee"] .bee-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"] .bee-line.queen .bee-me { left: 100%; background: var(--tile); color: var(--ink); box-shadow: 3px 3px 0 var(--lip), 0 0 14px #7c8cffaa; }

.ag-stage[data-kind="bee"] .bee-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"] .bee-box::before { content: ""; position: absolute; inset: 0; border: 2px solid var(--line); pointer-events: none; }
.ag-stage[data-kind="bee"] .all-open .bee-box::before { border-bottom-color: #000; }
.ag-stage[data-kind="bee"] .bee-sum { flex: none; font: 400 15px/1 var(--font); }
.ag-stage[data-kind="bee"] .bee-sum:empty { display: none; }
.ag-stage[data-kind="bee"] .bee-sum.ph { color: var(--mute); }
.ag-stage[data-kind="bee"] .bee-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"] .bee-tick span { margin-right: 14px; }
.ag-stage[data-kind="bee"] .bee .pg { color: var(--pink); }
.ag-stage[data-kind="bee"] .bee-car { flex: none; width: 12px; height: 8px; color: var(--mute); }
.ag-stage[data-kind="bee"] .all-open .bee-car { transform: rotate(180deg); }
.ag-stage[data-kind="bee"] .all-open .bee-tick { visibility: hidden; }
/* open: the whole list drops over the hive, alphabetical in columns */
.ag-stage[data-kind="bee"] .bee-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"] .bee-allh { font: 400 14px/1.3 var(--font); color: var(--mute); margin-bottom: 8px !important; }
.ag-stage[data-kind="bee"] .bee-cols { list-style: none; columns: 2; column-gap: 18px; }
.ag-stage[data-kind="bee"] .bee-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"] .bee-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"] .bee-msgw { height: 34px; display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; }
.ag-stage[data-kind="bee"] .bee-msgw.on { opacity: 1; }
.ag-stage[data-kind="bee"] .bee-msg { font-size: 30px; line-height: 1; }
.ag-stage[data-kind="bee"] .bee-msgw.bad .bee-msg { font: 400 15px/1.2 var(--font); color: var(--pink); }
.ag-stage[data-kind="bee"] .bee-msgw:is(.ok, .pg) .bee-msg { color: var(--tile); text-shadow: 0 0 6px #7c8cff, 0 0 18px #4a5ad6; }
.ag-stage[data-kind="bee"] .bee-msgw.pg .bee-msg { font-size: 36px; }
.ag-stage[data-kind="bee"] .bee-msgw.on:is(.ok, .pg) .bee-msg { animation: bee-pop .4s steps(3, end); }
@keyframes bee-pop { from { transform: scale(1.5); color: var(--red); } }
.ag-stage[data-kind="bee"] .bee-plus { font-size: 26px; color: var(--red); }
.ag-stage[data-kind="bee"] .bee-msgw.on:is(.ok, .pg) .bee-plus { animation: bee-up 1.2s steps(8, end) both; }
@keyframes bee-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"] .bee-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"] .bee-input.long { font-size: 34px; }
.ag-stage[data-kind="bee"] .bee-typed .c { color: var(--red); }
.ag-stage[data-kind="bee"] .bee-typed .x { color: var(--line); }
.ag-stage[data-kind="bee"] .bee-caret { width: .3em; height: 4px; margin: .5em 0 0 2px; align-self: center; background: var(--red); animation: bee-blink 1s steps(1) infinite; }
.ag-stage[data-kind="bee"] .bee-input.shake { animation: bee-shake .3s steps(4); }
@keyframes bee-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"] .bee-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"] .bee-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"] .bee-cell:not(:focus-visible) { outline-color: transparent !important; } /* the tile's own push is the press */
.ag-stage[data-kind="bee"] .bee-cell:nth-child(2) { transform: translate(0, -100%); }
.ag-stage[data-kind="bee"] .bee-cell:nth-child(3) { transform: translate(75%, -50%); }
.ag-stage[data-kind="bee"] .bee-cell:nth-child(4) { transform: translate(75%, 50%); }
.ag-stage[data-kind="bee"] .bee-cell:nth-child(5) { transform: translate(0, 100%); }
.ag-stage[data-kind="bee"] .bee-cell:nth-child(6) { transform: translate(-75%, 50%); }
.ag-stage[data-kind="bee"] .bee-cell:nth-child(7) { transform: translate(-75%, -50%); }
.ag-stage[data-kind="bee"] .bee-hex { fill: var(--tile); }
.ag-stage[data-kind="bee"] .bee-lip { fill: var(--lip); }
.ag-stage[data-kind="bee"] .bee-cell.center .bee-hex { fill: var(--felt); }
.ag-stage[data-kind="bee"] .bee-cell.center .bee-lip { fill: var(--side); }
.ag-stage[data-kind="bee"] .bee-cell.push .bee-face { transform: translate(2.5px, 2.5px); }
.ag-stage[data-kind="bee"] .bee-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"] .bee-cell.center text { fill: #fff; }
.ag-stage[data-kind="bee"] .bee-hive.fade .bee-cell:not(.center) text { opacity: 0; }

.ag-stage[data-kind="bee"] .bee-btns { display: flex; align-items: center; gap: 14px; }
.ag-stage[data-kind="bee"] .bee-btn { height: 52px; min-width: 96px; font-size: 24px; touch-action: manipulation; }
.ag-stage[data-kind="bee"] .bee-shuf { min-width: 52px; width: 52px; }
.ag-stage[data-kind="bee"] .bee-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 .bee-side, .ag-stage[data-kind="bee"] .is-over .bee-play { display: none; }
.ag-stage[data-kind="bee"] .bee.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"] .bee-res { grid-area: res; min-height: 0; overflow: auto; padding: 14px 16px 360px; -webkit-overflow-scrolling: touch; }
.ag-stage[data-kind="bee"] .bee-badge { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ag-stage[data-kind="bee"] .bee-bhex { position: relative; flex: none; width: 70px; height: 61px; display: grid; place-items: center; }
.ag-stage[data-kind="bee"] .bee-bhex svg { position: absolute; inset: 0; fill: var(--felt); filter: drop-shadow(3px 3px 0 var(--side)); }
.ag-stage[data-kind="bee"] .bee-bhex b { position: relative; font-weight: 400; font-size: 30px; color: #fff; }
.ag-stage[data-kind="bee"] .bee-badge h2 { font-weight: 400; font-size: 40px; line-height: 1; }
.ag-stage[data-kind="bee"] .bee-badge p { font: 400 14px/1.3 var(--font); color: var(--mute); margin-top: 4px; }
.ag-stage[data-kind="bee"] .bee-rcols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ag-stage[data-kind="bee"] .bee-rcols.one { grid-template-columns: 1fr; }
.ag-stage[data-kind="bee"] .bee-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"] .bee-col h3 span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-stage[data-kind="bee"] .bee-rcols .bee-col:first-child h3 span { color: var(--red); }
.ag-stage[data-kind="bee"] .bee-col h3 b { font-weight: 400; font-size: 34px; }
.ag-stage[data-kind="bee"] .bee-col ul { list-style: none; }
.ag-stage[data-kind="bee"] .bee-rcols.one ul, .ag-stage[data-kind="bee"] .bee-missed ul { columns: 2; column-gap: 18px; }
.ag-stage[data-kind="bee"] .bee-col li { padding: 4px 0 3px; font-size: 22px; line-height: 1.1; break-inside: avoid; }
.ag-stage[data-kind="bee"] .bee-col s { color: var(--pink); text-decoration-thickness: 2px; }
.ag-stage[data-kind="bee"] .bee-none { padding: 6px 0 !important; font: italic 400 15px/1.3 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .bee-note { margin-top: 10px !important; font: 400 14px/1.35 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .bee-missed { margin-top: 18px; }
.ag-stage[data-kind="bee"] .bee-missed h3 span { font: 400 13px/1.2 var(--font); color: var(--mute); }
.ag-stage[data-kind="bee"] .bee-missed li { color: var(--mute); }
.ag-stage[data-kind="bee"] .bee-missed li.pg { color: var(--pink); }

/* short screens: less air */
@container bee (max-height: 600px) {
  .ag-stage[data-kind="bee"] .bee { --hv: min(86cqw, calc((100cqh - 262px) * 1.08), 330px); }
  .ag-stage[data-kind="bee"] .bee-msgw { height: 28px; }
  .ag-stage[data-kind="bee"] .bee-input { height: 40px; margin: 0 0 6px; font-size: 40px; }
  .ag-stage[data-kind="bee"] .bee-hive { margin-bottom: 8px; }
  .ag-stage[data-kind="bee"] .bee-btn { height: 46px; }
  .ag-stage[data-kind="bee"] .bee-shuf { width: 46px; min-width: 46px; }
}
/* landscape: the hive on the left, rank and words on the right */
@container bee (min-aspect-ratio: 5/4) {
  .ag-stage[data-kind="bee"] .bee { --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"] .bee-side { align-self: start; padding: 14px 16px 0 0; }
  .ag-stage[data-kind="bee"] .bee-all { left: 0; right: 16px; height: calc(100cqh - 140px); }
}

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