/* Spelling Bee board. Tokens from style.css (Moonlit): the centre cell is moon gold, outer cells the neutral cell tone. */
:root { --sb-center: var(--accent); --sb-center-ink: var(--accent-ink); --sb-outer: var(--cell); --sb-outer-ink: var(--ink); --sb-toast: var(--ink); --sb-toast-ink: var(--bg); }
[data-theme='dark'] { --sb-outer: #2b2a5c; }

.sb { width: 100%; position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; display: flex; flex-direction: column; gap: 10px; }
.sb.locked .sb-hive, .sb.locked .sb-acts { opacity: .5; pointer-events: none; }

/* ---------- rank bar ---------- */
.sb-rank { display: flex; align-items: center; gap: 12px; padding: 6px 4px; cursor: pointer; border-radius: 10px; }
.sb-rank:hover, .sb-rank:focus-visible { background: var(--surface-2); outline: none; }
.sb-rank .name { font-family: var(--display); font-weight: 700; font-size: 16px; min-width: 6.2em; white-space: nowrap; }
.sb-rank.genius .name { color: var(--accent-2); } .sb-rank.queen .name { color: var(--accent); }
.sb-rank .bar { position: relative; flex: 1; height: 30px; margin: 0 16px 0 15px; }
.sb-rank .line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-strong); }
.sb-rank .dot { position: absolute; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--line-strong); z-index: 1; transition: background-color .3s ease, transform .3s ease; }
.sb-rank .dot.on { background: var(--accent); transform: scale(1.15); }
.sb-rank.genius .line { background: var(--accent); }
.sb-rank .ball { position: absolute; top: 50%; left: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-family: var(--body); font-weight: 800; font-size: 12px; display: grid; place-items: center; z-index: 2; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); font-variant-numeric: tabular-nums; transition: left .45s cubic-bezier(.3, 1.35, .5, 1); }
.sb-rank .chev { color: var(--ink-faint); font-size: 18px; transition: transform .15s ease; }
.sb-rank[aria-expanded='true'] .chev { transform: rotate(90deg); }
.sb-ranks { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 10px 14px; font-size: 14px; animation: sbin .2s ease; }
.sb-ranks .lede { margin: 0 0 6px; color: var(--ink-soft); font-size: 13px; }
.sb-ranks ul { list-style: none; margin: 0; padding: 0; }
.sb-ranks li { display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 8px; }
.sb-ranks li.cur { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 800; }
.sb-ranks .sub { margin: 8px 0 0; color: var(--ink-soft); font-size: 13px; }
@keyframes sbin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- found words ---------- */
.sb-found { border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); }
.sb-found .head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-align: left; border-radius: var(--r-btn); }
.sb-found .head:focus-visible { outline: 3px solid var(--accent-2); outline-offset: -3px; }
.sb-found .cnt { font-weight: 800; white-space: nowrap; }
.sb-found .row { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); color: var(--ink-soft); }
.sb-found .row span { margin-right: 10px; }
.sb-found .row .ph { color: var(--ink-faint); font-style: italic; }
.sb-found .row .p, .sb-found .list .p a { font-weight: 800; color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.sb-found .rv { color: var(--ink-faint); font-style: italic; }
.sb-found .chev { color: var(--ink-faint); transition: transform .15s ease; }
.sb-found.open .chev { transform: rotate(180deg); }
.sb-found.open .row { display: none; }
.sb-found .body { padding: 0 12px 10px; }
.sb-found .tools { display: flex; justify-content: flex-end; }
.sb-found .sortBtn { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft); border-radius: 999px; font: inherit; font-size: 12px; font-weight: 700; padding: 4px 10px; cursor: pointer; }
.sb-found .list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 2px 12px; font-size: 15px; }
.sb-found .list li { padding: 4px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.sb-found .list a { color: var(--ink); text-decoration: none; }
.sb-found .list a:hover { color: var(--accent-2); }
.sb-found .list .tag { color: var(--accent); font-style: normal; font-size: 12px; }
.sb-found .foot { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); }

/* ---------- input + toast ---------- */
.sb-top { position: relative; padding-top: 44px; }
.sb-msg { position: absolute; left: 0; right: 0; top: 4px; display: flex; justify-content: center; pointer-events: none; }
.sb-toast { position: relative; display: inline-block; padding: 6px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 700; box-shadow: var(--shadow); animation: sbpop .9s cubic-bezier(.375, .25, .315, .89) both; white-space: nowrap; }
.sb-toast.err { background: var(--sb-toast); color: var(--sb-toast-ink); border-color: transparent; animation: sbfade 1.1s cubic-bezier(.375, .25, .315, .89) both; }
.sb-toast.pangram { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-size: 16px; }
.sb-toast.bonus { border-color: var(--accent); }
.sb-toast.rv { background: var(--surface-2); animation-duration: 1.4s; }
.sb-toast .pts { position: absolute; left: calc(100% + 8px); bottom: 4px; font-size: 15px; color: var(--ink-soft); animation: sbfly .8s cubic-bezier(.375, .25, .315, .89) both; }
.sb-toast.pangram .pts { color: var(--accent-2); font-weight: 900; font-size: 18px; }
@keyframes sbpop { 0% { opacity: 0; transform: translateY(6px); } 18% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes sbfade { 0% { opacity: 0; } 12% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes sbfly { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.sb-input { display: flex; justify-content: center; align-items: center; height: 44px; font-family: var(--display); font-weight: 800; font-size: 30px; letter-spacing: .04em; text-transform: uppercase; line-height: 1; }
.sb-input.long { font-size: 22px; letter-spacing: .02em; }
.sb-input .word { display: inline-flex; }
.sb-input .c { color: var(--accent); }
.sb-input .x { color: var(--ink-faint); }
.sb-input .ph { font-family: var(--body); font-weight: 500; font-size: 22px; letter-spacing: 0; text-transform: none; color: var(--ink-faint); }
.sb-input .caret { width: 2px; height: 34px; margin-left: 3px; background: var(--accent); animation: sbblink 1s step-end infinite; }
.sb-input.empty .caret { margin-left: -1px; }
@keyframes sbblink { 50% { opacity: 0; } }
.sb-input.shake .word { animation: sbshake .7s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes sbshake { 20% { transform: translate3d(-2px, 0, 0); } 40% { transform: translate3d(3px, 0, 0); } 60% { transform: translate3d(-2px, 0, 0); } 80% { transform: translate3d(3px, 0, 0); } }

/* ---------- hive ---------- */
.sb-hive-wrap { position: relative; width: min(100%, 300px); margin: 0 auto; }
.sb-hive { display: block; width: 100%; height: auto; overflow: visible; }
.sb-hive .cell { cursor: pointer; transition: transform .1s ease; outline: none; }
.sb-hive .cell polygon { fill: var(--sb-outer); transition: fill .15s ease; }
.sb-hive .cell.center polygon { fill: var(--sb-center); }
.sb-hive .cell text { font-family: var(--display); font-weight: 800; font-size: 58px; fill: var(--sb-outer-ink); pointer-events: none; }
.sb-hive .cell.center text { fill: var(--sb-center-ink); }
.sb-hive .cell.press { transform: scale(.92); }
@media (hover: hover) { .sb-hive .cell:hover polygon { filter: brightness(.96); } }
.sb-hive.fade .outer text { opacity: 0; transition: opacity .3s ease; }
.sb-hive .outer text { transition: opacity .3s ease; }
.sb-fx { position: absolute; inset: -60px -30px -30px; width: calc(100% + 60px); height: calc(100% + 90px); pointer-events: none; z-index: 30; }
.sb-acts { display: flex; justify-content: center; gap: 10px; }
.sb-acts .btn { min-width: 96px; border-radius: 999px; }
.sb-acts .btn-icon { min-width: 0; width: 44px; height: 44px; }
.sb-acts .btn-icon svg { width: 20px; height: 20px; }

/* ---------- hints ---------- */
.sb-hints { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 12px 14px 14px; animation: sbin .2s ease; font-size: 14px; }
.sb-hints .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.sb-hints h2 { margin: 0; font-size: 18px; }
.sb-hints h3 { margin: 14px 0 6px; font-size: 14px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.sb-hints .facts { margin: 8px 0 0; color: var(--ink-soft); }
.sb-hints .tbl-wrap { overflow-x: auto; }
.sb-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; min-width: 100%; }
.sb-grid th, .sb-grid td { text-align: center; padding: 5px 6px; border-bottom: 1px solid var(--line); min-width: 30px; }
.sb-grid thead th { color: var(--ink-faint); font-size: 12px; }
.sb-grid tbody th { font-family: var(--display); font-weight: 800; }
.sb-grid tbody th.c { color: var(--accent); }
.sb-grid td.sum, .sb-grid tr.sum td, .sb-grid tr.sum th { font-weight: 800; background: var(--surface-2); }
.sb-two { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 4px 8px; }
.sb-two li { display: flex; justify-content: space-between; padding: 3px 6px; border-bottom: 1px solid var(--line); }
.sb-two li span { font-weight: 700; letter-spacing: .06em; }
.sb-hints .rv-row { margin: 14px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sb-hints .rv-row small { font-weight: 600; opacity: .8; margin-left: 4px; }
.sb-hints .rv-step { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-weight: 700; }

/* ---------- page bits ---------- */
.sb-page .board-wrap { padding: 14px; align-items: stretch; }
.sb-page .board-wrap #game { min-height: 580px; }
.sb-page .solved .btn { white-space: nowrap; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon { position: relative; }
.btn-icon .cnt { position: absolute; right: -5px; top: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.btn-icon .cnt:empty { display: none; }
.snd-off .ic-on, .btn-icon:not(.snd-off) .ic-off { display: none; }
.q-settings { position: static; }
.gp-bar { position: relative; }
.q-pop { position: absolute; right: 0; top: calc(100% - 4px); max-width: calc(100vw - 32px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); box-shadow: var(--shadow-hover); padding: 6px 4px; min-width: 240px; }
.q-pop label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.q-pop .sw { width: 38px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background .15s ease; }
.q-pop .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.q-pop input { position: absolute; opacity: 0; pointer-events: none; }
.q-pop input:checked + .sw { background: var(--good); }
.q-pop input:checked + .sw::after { transform: translateX(16px); }
.q-pop input:focus-visible + .sw { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.q-meta { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.q-meta .pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-variant-numeric: tabular-nums; }
.q-pick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
.q-pick button { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.q-pick button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sb-status { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 14px; color: var(--ink-soft); margin: 0 0 12px; }
.sb-status b { color: var(--ink); }

/* answers (archive pages) */
.sb-answers { margin: 16px 0; }
.sb-answers summary { cursor: pointer; font-weight: 700; }
.sb-answers ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px 12px; }
.sb-answers li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.sb-answers li.p { font-weight: 800; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.sb-answers a { color: var(--ink); text-decoration: none; }
.sb-answers a:hover { color: var(--accent-2); }
.sb-mini { display: inline-block; width: 84px; height: auto; vertical-align: middle; }
.sb-mini polygon { fill: var(--sb-outer); } .sb-mini .c polygon { fill: var(--sb-center); }
.sb-mini text { font-family: var(--display); font-weight: 800; font-size: 58px; fill: var(--ink); } .sb-mini .c text { fill: var(--accent-ink); }

@media (max-width: 480px) {
  .sb-rank .name { min-width: 5.4em; font-size: 15px; }
  .sb-input { font-size: 26px; }
  .sb-acts .btn { min-width: 84px; padding-inline: 14px; }
}
