/* Binary Puzzle: the board is HTML (a grid of cells, each line's counts beside it) laid out by game.js between the
   HUD and the tool bar; the coach line, the result card, the panels and the toasts sit over it. A canvas on top draws
   the win's falling digits. Every class is prefixed bp-. */
.bp { display: flex; flex-direction: column; color: #e3ebff; --bp-hud: 54px; --bp-bar: 64px; --bp-0: #55d6ff; --bp-0l: #d4f6ff; --bp-0d: #126ea8; --bp-1: #ffb648; --bp-1l: #fff1cc;
  --bp-1d: #b8610c; --bp-gold: #ffd166; --bp-bad: #ff5c7a; --bp-ok: #7dffcf; --bp-line: #1c2b4a; --bp-glass: rgba(8,13,32,0.86); --bp-muted: #8aa3c4; }
.bp-stage { position: relative; width: 100%; height: min(86vh, 800px); min-height: 500px; overflow: hidden; outline: none; touch-action: manipulation;
  background: radial-gradient(90% 70% at 12% 8%, rgba(85,214,255,0.10), transparent 60%), radial-gradient(80% 70% at 92% 96%, rgba(255,182,72,0.09), transparent 60%), #040817;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
/* a faint field of 0s and 1s behind everything */
.bp-stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23cfe6ff' font-family='monospace' font-size='13' font-weight='700'%3E%3Ctext x='6' y='18'%3E1%3C/text%3E%3Ctext x='46' y='30'%3E0%3C/text%3E%3Ctext x='88' y='14'%3E0%3C/text%3E%3Ctext x='22' y='60'%3E0%3C/text%3E%3Ctext x='70' y='66'%3E1%3C/text%3E%3Ctext x='104' y='54'%3E1%3C/text%3E%3Ctext x='10' y='100'%3E1%3C/text%3E%3Ctext x='54' y='106'%3E0%3C/text%3E%3Ctext x='94' y='96'%3E1%3C/text%3E%3C/g%3E%3C/svg%3E"); }
@media (max-width: 600px) { .bp-stage { height: auto; aspect-ratio: 3 / 4.7; max-height: 88vh; min-height: 0; } }

/* HUD */
.bp-hud { position: absolute; left: 0; right: 0; top: 0; height: var(--bp-hud); display: flex; align-items: center; gap: 14px; padding: 0 8px 0 10px; z-index: 3; pointer-events: none; }
.bp-hud > * { pointer-events: auto; }
.bp-pz { flex: 0 1 auto; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; min-width: 104px; max-width: 48vw; height: 44px; padding: 2px 26px 2px 10px;
  border-radius: 12px; border: 1px solid var(--bp-line); background: var(--bp-glass); color: #fff; cursor: pointer; font: inherit; line-height: 1.05; text-align: left; touch-action: manipulation; transition: border-color .15s; }
.bp-pz-lv { font-size: 10px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; color: var(--lvc, #8aa3c4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bp-pz-n { font-size: 17px; font-weight: 900; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bp-pz-dd { position: absolute; right: 6px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: #8aa3c4; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .bp-pz:hover { border-color: var(--bp-0); } }
.bp-pz:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 2px; }
.bp-stat { display: flex; flex-direction: column; line-height: 1.05; flex: none; }
.bp-k { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bp-muted); }
.bp-stat b { font-size: 19px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.bp-stat small { font-size: 12.5px; font-weight: 700; color: var(--bp-muted); margin-left: 1px; }
.bp-notimer .bp-time { display: none; }
.bp-sp { flex: 1 1 auto; }
.bp-tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--bp-line); background: var(--bp-glass);
  color: #c8d6ff; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s; }
.bp-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bp-tool .spk { fill: currentColor; stroke: none; }
@media (hover: hover) { .bp-tool:hover { border-color: var(--bp-0); color: #fff; } }
.bp-tool:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 2px; }
#bp-sound .off { display: none; } #bp-sound[aria-pressed="true"] { color: #5d6c94; } #bp-sound[aria-pressed="true"] .on { display: none; } #bp-sound[aria-pressed="true"] .off { display: inline; }
.bp-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bp-1); box-shadow: 0 0 8px var(--bp-1); }
.bp-dot[hidden] { display: none; }

/* the coach line: a hint and its reasoning, or a word about a rule that's broken */
.bp-coach[hidden] { display: none; }
.bp-coach { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--bp-hud) + 2px); z-index: 4; width: min(calc(100% - 16px), 560px); padding: 9px 36px 9px 12px; border-radius: 12px;
  background: rgba(8,13,32,0.94); border: 1px solid rgba(85,214,255,0.45); box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 18px rgba(85,214,255,.12); font-size: 13.5px; line-height: 1.42; color: #e3ebff;
  animation: bp-drop .22s ease-out; }
@keyframes bp-drop { from { opacity: 0; transform: translate(-50%, -6px); } }
@keyframes bp-rise { from { opacity: 0; transform: translate(-50%, 6px); } }
.bp-coach b { color: #9fe6ff; font-weight: 800; margin-right: 6px; }
.bp-coach.hint { border-color: rgba(255,209,102,0.6); box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 18px rgba(255,209,102,.14); }
.bp-coach.hint b { color: var(--bp-gold); }
.bp-coach.warn { border-color: rgba(255,92,122,0.6); }
.bp-coach.warn b { color: #ff9aae; }
.bp-coach small { display: block; color: var(--bp-muted); font-size: 12px; margin-top: 3px; }
.bp-coach em { font-style: normal; font-weight: 800; }
.bp-coach .z { color: var(--bp-0); } .bp-coach .o { color: var(--bp-1); }
.bp-coach-acts { display: flex; align-items: center; gap: 6px 10px; margin-top: 7px; }
.bp-coach-acts:empty { display: none; }
.bp-coach-acts small { flex: 1 1 auto; min-width: 0; margin: 0; }
.bp-coach-acts button { flex: none; white-space: nowrap; }
/* over the HUD on a phone, while a tall coach shows (game.js) */
.bp-coach.over-hud { background: #080d20; }
/* beside the board on a wide stage (game.js places it) */
.bp-coach.at-side { transform: none; overflow: auto; overscroll-behavior: contain; animation-name: bp-drop-side; }
.bp-coach.at-side > b { display: block; margin: 0 0 3px; }
@keyframes bp-drop-side { from { opacity: 0; transform: translateY(-6px); } }
.bp-coach-acts button { font: inherit; font-size: 12.5px; font-weight: 800; min-height: 32px; padding: 4px 12px; border-radius: 9px; border: 1px solid var(--bp-line); background: #0d1735; color: #e3ebff; cursor: pointer; touch-action: manipulation; }
.bp-coach-acts button.pri { background: var(--bp-gold); color: #1a1200; border-color: transparent; }
@media (hover: hover) { .bp-coach-acts button:hover { border-color: var(--bp-0); } .bp-coach-acts button.pri:hover { filter: brightness(1.06); } }
.bp-coach-acts button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bp-coach-close { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--bp-muted); font-size: 19px; line-height: 1; cursor: pointer; }
@media (hover: hover) { .bp-coach-close:hover { color: #fff; background: rgba(255,255,255,.08); } }
@media (pointer: coarse) { .bp-coach { padding-right: 40px; } .bp-coach-close { top: 2px; right: 2px; width: 38px; height: 38px; } .bp-coach-acts button { min-height: 38px; padding: 4px 16px; } }

/* the board: the grid, each row's counts to its right and each column's below it (game.js sets the geometry) */
.bp-board { position: absolute; left: 0; top: 0; z-index: 1; outline: none; touch-action: none; --cs: 40px; --sw: 24px; --gap: 3px; --n: 8; }
.bp-board:focus-visible .bp-grid { box-shadow: 0 0 0 2px rgba(85,214,255,0.55), 0 18px 50px rgba(0,0,0,.45); }
.bp-grid { position: absolute; left: 0; top: 0; width: calc(var(--cs) * var(--n)); height: calc(var(--cs) * var(--n)); box-sizing: border-box; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr); gap: var(--gap); padding: var(--gap); border-radius: calc(var(--cs) * 0.22 + 4px); background: rgba(6,11,28,0.92); border: 1px solid var(--bp-line);
  box-shadow: 0 18px 50px rgba(0,0,0,.45), inset 0 0 0 1px rgba(85,214,255,0.04); cursor: pointer; }
.bp-row { display: contents; }
.bp-c { position: relative; min-width: 0; min-height: 0; border-radius: calc(var(--cs) * 0.2); background: #0c1532; box-shadow: inset 0 0 0 1px rgba(120,150,220,0.07); display: grid; place-items: center;
  transition: background-color .14s ease, box-shadow .14s ease; }
.bp-c::before { content: ""; position: absolute; width: 12%; height: 12%; border-radius: 50%; background: #1b2852; }
.bp-c.v0::before, .bp-c.v1::before { display: none; }
@media (hover: hover) { .bp-c:not(.g):hover { background: #121e45; } }
.bp-c.g { background: #16224a; box-shadow: inset 0 0 0 1px rgba(160,190,255,0.12), inset 0 -2px 0 rgba(0,0,0,0.25); cursor: default; }
/* crossing lines of the keyboard cursor */
.bp-kb .bp-c.xl { background: #101c40; }
.bp-kb .bp-c.g.xl { background: #1a2852; }
.bp-kb .bp-c.cur { box-shadow: inset 0 0 0 2px var(--bp-0), 0 0 12px rgba(85,214,255,0.4); z-index: 1; }

/* the value: a digit, or a glowing token (a round one for 0, a square one for 1) */
.bp-t { position: relative; display: grid; place-items: center; pointer-events: none; font-style: normal; line-height: 1; }
.bp-digits .bp-t { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace; font-weight: 800; font-size: calc(var(--cs) * 0.56); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bp-digits .v0 .bp-t::after { content: "0"; color: var(--bp-0); text-shadow: 0 0 calc(var(--cs) * 0.28) rgba(85,214,255,0.55); }
.bp-digits .v1 .bp-t::after { content: "1"; color: var(--bp-1); text-shadow: 0 0 calc(var(--cs) * 0.28) rgba(255,182,72,0.55); }
.bp-digits .g.v0 .bp-t::after { color: var(--bp-0l); text-shadow: none; }
.bp-digits .g.v1 .bp-t::after { color: var(--bp-1l); text-shadow: none; }
.bp-tokens .v0 .bp-t, .bp-tokens .v1 .bp-t { width: 64%; height: 64%; }
.bp-tokens .v0 .bp-t { border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff 0 6%, var(--bp-0l) 14%, var(--bp-0) 46%, var(--bp-0d) 100%);
  box-shadow: 0 0 calc(var(--cs) * 0.32) rgba(85,214,255,0.55), inset 0 calc(var(--cs) * -0.04) calc(var(--cs) * 0.08) rgba(0,30,70,0.5); }
.bp-tokens .v0 .bp-t::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; box-shadow: inset 0 0 0 calc(var(--cs) * 0.035) rgba(0,40,80,0.45); }
.bp-tokens .v1 .bp-t { width: 58%; height: 58%; border-radius: 22%; background: radial-gradient(circle at 32% 28%, #fff 0 6%, var(--bp-1l) 14%, var(--bp-1) 48%, var(--bp-1d) 100%);
  box-shadow: 0 0 calc(var(--cs) * 0.32) rgba(255,182,72,0.55), inset 0 calc(var(--cs) * -0.04) calc(var(--cs) * 0.08) rgba(80,30,0,0.45); }
.bp-tokens .v1 .bp-t::after { content: ""; position: absolute; inset: 28%; border-radius: 18%; box-shadow: inset 0 0 0 calc(var(--cs) * 0.035) rgba(90,40,0,0.4); }
.bp-tokens .g.v0 .bp-t, .bp-tokens .g.v1 .bp-t { filter: saturate(0.75) brightness(0.92); box-shadow: inset 0 calc(var(--cs) * -0.04) calc(var(--cs) * 0.08) rgba(0,0,0,0.35); }
.bp-t.pop { animation: bp-pop .2s cubic-bezier(.3,1.7,.5,1); }
@keyframes bp-pop { from { transform: scale(0.55); opacity: 0.4; } }

/* rule breaks: three in a row, and twin lines */
.bp-c.bad { background: #2a0f24; box-shadow: inset 0 0 0 2px var(--bp-bad), 0 0 12px rgba(255,92,122,0.35); }
.bp-c.bad.g { background: #33142e; }
.bp-c.twin { box-shadow: inset 0 0 0 1.5px rgba(255,92,122,0.85); }
.bp-t.shake { animation: bp-shake .32s ease-in-out; }
@keyframes bp-shake { 25% { transform: translateX(-3px); } 50% { transform: translateX(3px); } 75% { transform: translateX(-2px); } }
.bp-t.knock { animation: bp-knock .22s ease-out; }
@keyframes bp-knock { 50% { transform: scale(0.92); } }
/* a line finished without breaking a rule: a sweep of light along it */
.bp-l { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; }
.bp-l.on { background: radial-gradient(circle, rgba(255,255,255,0.5), rgba(125,255,207,0.2) 55%, transparent 78%); animation: bp-lit .62s ease-out both; animation-delay: var(--d, 0ms); }
@keyframes bp-lit { 25% { opacity: 1; } 100% { opacity: 0; } }
/* hints: the cells to fill (gold), the cells that show why (cyan), and what would break (red, dashed) */
.bp-c.ht { box-shadow: inset 0 0 0 2.5px var(--bp-gold), 0 0 16px rgba(255,209,102,0.55); z-index: 2; animation: bp-glow 1.3s ease-in-out infinite; }
.bp-c.hw { box-shadow: inset 0 0 0 2px rgba(85,214,255,0.9), 0 0 10px rgba(85,214,255,0.35); z-index: 1; }
.bp-c.hx { outline: 2px dashed rgba(255,92,122,0.9); outline-offset: -3px; }
.bp-c.hl { background: #13204a; }
@keyframes bp-glow { 50% { box-shadow: inset 0 0 0 2.5px var(--bp-gold), 0 0 24px rgba(255,209,102,0.85); } }
/* the solved board's wave */
.bp-won .bp-c .bp-t { animation: bp-wave .7s cubic-bezier(.3,1.5,.5,1) both; animation-delay: var(--w, 0ms); }
@keyframes bp-wave { 30% { transform: scale(1.28); filter: brightness(1.5); } }
.bp-won .bp-grid { border-color: rgba(125,255,207,0.5); box-shadow: 0 0 0 1px rgba(125,255,207,0.25), 0 0 46px rgba(125,255,207,0.22), 0 18px 50px rgba(0,0,0,.45); transition: box-shadow .6s, border-color .6s; }

/* each line's counts: how many 0s and 1s it still needs */
.bp-rc, .bp-cc { position: absolute; display: flex; pointer-events: none; }
.bp-rc { flex-direction: column; padding: var(--gap) 0; gap: var(--gap); box-sizing: border-box; }
.bp-cc { flex-direction: row; padding: 0 var(--gap); gap: var(--gap); box-sizing: border-box; }
.bp-ct { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 2px; font: 800 calc(var(--sw) * 0.47)/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.bp-rc .bp-ct { flex-direction: row; padding-left: 3px; }
.bp-cc .bp-ct { flex-direction: column; padding-top: 3px; }
.bp-ct i { font-style: normal; min-width: 1.1em; text-align: center; border-radius: 4px; transition: color .15s, opacity .15s, background .15s; }
.bp-ct .z { color: var(--bp-0); } .bp-ct .o { color: var(--bp-1); }
.bp-ct i.done { opacity: 0.28; }
.bp-ct i.over { color: #fff; background: var(--bp-bad); opacity: 1; }
.bp-ct.cur i:not(.done) { text-shadow: 0 0 8px currentColor; }
.bp-nocounts .bp-rc, .bp-nocounts .bp-cc { display: none; }

/* the tool bar */
.bp-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; height: calc(var(--bp-bar) - 12px); z-index: 3; display: flex; gap: 6px; padding: 0 6px; width: min(calc(100% - 12px), 540px); }
.bp-btn { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 14px; border: 1px solid var(--bp-line);
  background: rgba(8,13,32,0.88); color: #d4e0ff; font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; touch-action: manipulation; padding: 0 2px;
  transition: border-color .15s, color .15s, opacity .15s, background .15s, transform .08s; }
.bp-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bp-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (hover: hover) { .bp-btn:hover:not(:disabled) { border-color: var(--bp-0); color: #fff; } }
.bp-btn:active:not(:disabled) { transform: translateY(1px); }
.bp-btn:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 2px; }
.bp-btn:disabled { opacity: 0.36; cursor: default; }
.bp-hint { color: #ffe3a3; }
@media (hover: hover) { .bp-hint:hover:not(:disabled) { border-color: var(--bp-gold); } }
.bp-next.ready { background: var(--bp-gold); color: #1a1200; border-color: transparent; box-shadow: 0 6px 22px rgba(255,209,102,0.3); }
@media (hover: hover) { .bp-next.ready:hover:not(:disabled) { color: #1a1200; filter: brightness(1.06); } }
.bp-side .bp-bar { left: auto; right: 8px; top: calc(var(--bp-hud) + 4px); bottom: 8px; transform: none; height: auto; width: 76px; flex-direction: column; padding: 0; }
.bp-side .bp-btn { font-size: 10.5px; }

.bp-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

/* the result card: a strip over the bottom of the board, so the solved grid stays in view */
.bp-card[hidden] { display: none; }
.bp-card { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 5; width: min(calc(100% - 16px), 460px); padding: 14px 14px 12px; border-radius: 18px;
  background: rgba(8,13,32,0.95); border: 1px solid rgba(125,255,207,0.35); box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 40px rgba(85,214,255,.12); animation: bp-up .35s cubic-bezier(.2,.9,.25,1.1);
  max-height: calc(100% - var(--bp-hud) - 20px); overflow: auto; overscroll-behavior: contain; }
@keyframes bp-up { from { opacity: 0; transform: translate(-50%, 24px); } }
.bp-card h2 { margin: 0; font-size: 22px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.15; text-shadow: 0 0 22px rgba(125,255,207,.45); }
.bp-card p { margin: 3px 0 0; font-size: 13px; color: var(--bp-muted); line-height: 1.4; }
.bp-card .bp-stats { margin-top: 10px; }
.bp-card .bp-actions { margin-top: 12px; }
.bp-card .bp-lb { margin-top: 8px; }
.bp-card h3 { margin: 12px 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bp-muted); }

/* panels */
.bp-overlay[hidden] { display: none; }
.bp-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 6; overflow: auto;
  background: radial-gradient(ellipse at center, rgba(4,8,22,0.5), rgba(3,5,14,0.86)); animation: bp-fade .18s ease-out; }
.bp-panel { position: relative; width: min(100%, 440px); margin: auto; padding: 20px 18px 18px; border: 1px solid var(--bp-line); border-radius: 18px; text-align: left; outline: none;
  background: rgba(8,13,32,0.96); box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(85,214,255,0.05) inset; animation: bp-in .26s cubic-bezier(.2,.9,.25,1.1); }
.bp-panel.wide { width: min(100%, 560px); }
@keyframes bp-in { from { opacity: 0; transform: scale(.95) translateY(8px); } }
@keyframes bp-fade { from { opacity: 0; } }
.bp-panel h2 { margin: 0 36px 12px 0; font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.25; }
.bp-panel h3 { margin: 16px 0 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--bp-muted); }
.bp-panel p, .bp-panel li { font-size: 13.5px; line-height: 1.55; color: #bccbea; }
.bp-panel p { margin: 0 0 9px; }
.bp-panel ul { margin: 0 0 8px; padding-left: 18px; }
.bp-panel kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 5px; border: 1px solid #2a3a66; background: #0b1230; color: #fff; font: 700 12px/1.6 system-ui, sans-serif; text-align: center; }
.bp-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: #d4e0ff; cursor: pointer; padding: 0; z-index: 2; }
.bp-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .bp-x:hover { background: rgba(255,255,255,.14); color: #fff; } }
.bp-x:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 2px; }
.bp-fine { font-size: 12px !important; color: #6d7ea8 !important; margin: 8px 0 0 !important; }

.bp-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.bp-row2 { display: flex; gap: 8px; } .bp-row2 > * { flex: 1 1 0; }
.bp-b { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 14px; min-height: 46px; border-radius: 12px; cursor: pointer; touch-action: manipulation; text-decoration: none;
  border: 1px solid var(--bp-line); background: #0c1430; color: #e3ebff; transition: background .15s, border-color .15s, transform .1s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) { .bp-b:hover:not(:disabled) { border-color: var(--bp-0); } }
.bp-b:active { transform: translateY(1px); }
.bp-b:disabled { opacity: .45; cursor: default; }
.bp-b:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bp-b svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bp-b span { white-space: nowrap; }
.bp-b-primary { background: var(--bp-gold); color: #1a1200; border-color: transparent; font-size: 16px; font-weight: 800; box-shadow: 0 6px 24px rgba(255,209,102,0.28); }
@media (hover: hover) { .bp-b-primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.06); } }
.bp-b-sm { min-height: 40px; padding: 6px 10px; font-size: 13px; }

.bp-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; vertical-align: middle; margin-left: 8px;
  color: #1a1200; background: linear-gradient(90deg, #ffd166, #fff1b8, #ffd166); background-size: 200% 100%; animation: bp-shine 1.6s linear infinite; box-shadow: 0 0 18px rgba(255,209,102,0.5); }
@keyframes bp-shine { to { background-position: -200% 0; } }
.bp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.bp-stats.three { grid-template-columns: repeat(3, 1fr); }
.bp-stats div { padding: 8px 4px; border-radius: 10px; background: #060b1e; border: 1px solid #151f40; text-align: center; min-width: 0; }
.bp-stats span { display: block; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #6d7ea8; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-stats b { display: block; margin-top: 2px; font-size: 17px; color: #e3ebff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-stats .gold b { color: var(--bp-gold); } .bp-stats .ok b { color: var(--bp-ok); } .bp-stats .cy b { color: var(--bp-0); }

/* the new-puzzle picker */
.bp-seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #060b1e; border: 1px solid var(--bp-line); }
.bp-seg button { flex: 1 1 0; min-width: 0; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--bp-muted); font: 700 13px system-ui, sans-serif; cursor: pointer; padding: 0 2px; font-variant-numeric: tabular-nums; touch-action: manipulation; }
.bp-seg button[aria-pressed="true"] { background: #15204a; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,.5), 0 0 14px rgba(85,214,255,.15); }
.bp-seg button:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 1px; }
.bp-list { display: flex; flex-direction: column; gap: 6px; }
.bp-li { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 13px; border: 1px solid #151f40; background: #060b1e; color: #e3ebff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: border-color .15s; }
@media (hover: hover) { .bp-li:hover { border-color: var(--lc, var(--bp-0)); } }
.bp-li:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 2px; }
.bp-li.cur { border-color: color-mix(in srgb, var(--lc, #55d6ff) 55%, transparent); }
.bp-li-ic { width: 38px; height: 38px; flex: none; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 9px 8px; box-sizing: border-box; border-radius: 11px; background: color-mix(in srgb, var(--lc, #55d6ff) 14%, transparent); }
.bp-li-ic i { width: 4px; border-radius: 2px; background: #2a3a66; }
.bp-li-ic i.on { background: var(--lc, #55d6ff); box-shadow: 0 0 6px var(--lc, #55d6ff); }
.bp-li-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.bp-li-t b { font-size: 15px; color: #fff; } .bp-li-t small { font-size: 12px; color: var(--bp-muted); line-height: 1.35; }
.bp-li-s { font-size: 12px; font-weight: 800; color: #6d7ea8; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.bp-li-s.ok { color: var(--bp-ok); }
.bp-li-s small { display: block; font-weight: 700; color: #6d7ea8; font-size: 11px; }
.bp-dcard { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border-radius: 15px; border: 1px solid rgba(255,182,72,0.35); color: #e3ebff; font: inherit; text-align: left; cursor: pointer;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,182,72,0.16), transparent 60%), #060b1e; touch-action: manipulation; }
.bp-dcard svg { width: 30px; height: 30px; flex: none; fill: none; stroke: var(--bp-1); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(255,182,72,.5)); }
.bp-dcard b { display: block; font-size: 15px; color: #fff; } .bp-dcard small { display: block; font-size: 12px; line-height: 1.4; color: var(--bp-muted); margin-top: 2px; }
.bp-dcard em { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 800; color: var(--bp-1); white-space: nowrap; }
@media (hover: hover) { .bp-dcard:hover { border-color: var(--bp-1); } }
.bp-dcard:focus-visible { outline: 2px solid var(--bp-1); outline-offset: 2px; }

/* leaderboard rows */
.bp-lb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.bp-lb h3 { margin-top: 10px; }
.bp-lb li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; background: #060b1e; font-size: 13px; }
.bp-lb li span { color: #6d7ea8; font-weight: 800; font-variant-numeric: tabular-nums; }
.bp-lb li b { color: #e3ebff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.bp-lb li em { font-style: normal; color: var(--bp-gold); font-weight: 800; font-variant-numeric: tabular-nums; }
.bp-lb li.me { background: rgba(85,214,255,0.12); box-shadow: inset 0 0 0 1px rgba(85,214,255,0.4); }

/* calendar */
.bp-cal-head { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; }
.bp-cal-head b { flex: 1 1 auto; text-align: center; color: #fff; font-size: 15px; }
.bp-step { width: 42px; height: 42px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid #22305c; background: #0c1430; color: #e3ebff; cursor: pointer; }
.bp-step svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bp-step:disabled { opacity: .35; cursor: default; }
.bp-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.bp-cal-w { text-align: center; font-size: 10.5px; font-weight: 800; color: #6d7ea8; padding: 2px 0; }
.bp-cal-d { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; border: 1px solid #151f40; background: #060b1e; color: #d4e0ff; font: 700 13px system-ui, sans-serif; cursor: pointer; padding: 0; }
.bp-cal-d.off { opacity: .28; cursor: default; }
.bp-cal-d.ok { background: rgba(125,255,207,0.12); border-color: rgba(125,255,207,0.55); color: var(--bp-ok); }
.bp-cal-d.part { border-color: rgba(255,182,72,0.55); }
.bp-cal-d.today { box-shadow: 0 0 0 2px var(--bp-1), 0 0 14px rgba(255,182,72,.45); }
.bp-cal-pad { aspect-ratio: 1; }
@media (hover: hover) { .bp-cal-d:not(.off):hover { border-color: var(--bp-0); } }
.bp-cal-d:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 1px; }

/* settings, tabs, help */
.bp-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #141d3c; cursor: pointer; }
.bp-set > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .bp-set b { font-size: 14px; color: #fff; } .bp-set small { font-size: 12px; color: var(--bp-muted); }
.bp-set input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bp-sw { position: relative; width: 46px; height: 27px; flex: none; border-radius: 14px; border: 1px solid #22305c; background: #0c1430; transition: background .15s, border-color .15s; }
.bp-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #5d6c94; transition: transform .15s, background .15s; }
.bp-set input:checked + .bp-sw { background: #0e2a44; border-color: var(--bp-0); }
.bp-set input:checked + .bp-sw::after { transform: translateX(19px); background: var(--bp-0); box-shadow: 0 0 10px rgba(85,214,255,.7); }
.bp-set input:focus-visible + .bp-sw { outline: 2px solid var(--bp-0); outline-offset: 2px; }
.bp-set.seg { cursor: default; flex-wrap: wrap; }
.bp-set.seg > span { flex: 1 1 170px; }
.bp-set.seg .bp-seg { flex: 0 0 auto; min-width: 150px; }
.bp-set.seg .bp-seg button { min-height: 34px; padding: 0 10px; }
.bp-seg .tk { display: inline-flex; gap: 4px; align-items: center; }
.bp-seg .tk i { width: 11px; height: 11px; display: inline-block; }
.bp-seg .tk i.a { border-radius: 50%; background: var(--bp-0); box-shadow: 0 0 6px var(--bp-0); }
.bp-seg .tk i.b { border-radius: 2px; background: var(--bp-1); box-shadow: 0 0 6px var(--bp-1); }
.bp-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 13px; background: #060b1e; border: 1px solid var(--bp-line); margin: 0 0 12px; }
.bp-tab { font: inherit; font-size: 13.5px; font-weight: 700; color: var(--bp-muted); background: transparent; border: 0; border-radius: 9px; min-height: 38px; cursor: pointer; }
.bp-tab[aria-selected="true"] { background: #15204a; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,0.5), 0 0 16px rgba(85,214,255,0.15); }
.bp-tab:focus-visible { outline: 2px solid var(--bp-0); outline-offset: 1px; }
.bp-rule { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; margin: 0 0 10px; }
.bp-rule svg { width: 84px; height: 40px; }
.bp-rule p { margin: 0; }
.bp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bp-table th, .bp-table td { padding: 6px 4px; text-align: right; border-bottom: 1px solid #141d3c; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-table th:first-child, .bp-table td:first-child { text-align: left; }
.bp-table thead th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #6d7ea8; }
.bp-table tbody th { color: #fff; font-weight: 700; }
.bp-table td { color: #d4e0ff; } .bp-table td.dim { color: #4a5a85; }
.bp-tscroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

.bp-toast[hidden] { display: none; }
.bp-toast { position: absolute; left: 50%; bottom: calc(var(--bp-bar) + 10px); transform: translateX(-50%); z-index: 7; padding: 8px 14px; border-radius: 999px; background: #e3ebff; color: #050a1c; font-size: 13px; font-weight: 800;
  animation: bp-rise .2s ease-out; pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.bp-side .bp-toast { bottom: 14px; }
.bp-loading[hidden] { display: none; }
.bp-loading { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(3,5,14,0.55); color: #d4e0ff; font-size: 14px; pointer-events: none; }
.bp-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(85,214,255,.2); border-top-color: var(--bp-0); animation: bp-rot .9s linear infinite; }
@keyframes bp-rot { to { transform: rotate(360deg); } }
.bp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.bp-help { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px; }
.bp-help .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .bp-help .hint-kb { display: none; } .bp-help .hint-touch { display: inline; } }
.stage .bp-help { padding: 10px 14px 12px; }

/* narrow phones */
@media (max-width: 560px) { .bp-hud { gap: 10px; } }
@media (max-width: 460px) {
  .bp-hud { gap: 8px; padding-left: 8px; padding-right: 6px; }
  .bp-pz { padding-right: 22px; padding-left: 8px; }
  .bp-pz-n { font-size: 15px; }
  .bp-stat b { font-size: 17px; }
  .bp-tool { width: 36px; height: 36px; border-radius: 11px; }
  .bp-btn { font-size: 10.5px; border-radius: 12px; }
  .bp-coach { font-size: 13px; line-height: 1.4; padding-top: 8px; padding-bottom: 8px; }
  .bp-panel { padding: 18px 14px 14px; }
  .bp-stats b { font-size: 15px; }
  .bp-seg button { font-size: 12px; }
}
@media (max-width: 400px) {
  .bp-fill { display: none; }
  .bp-pz { max-width: 58vw; }
  .bp-tab { font-size: 12.5px; padding: 0 2px; }
  .bp-stats span { letter-spacing: 0.05em; font-size: 9px; }
}
@media (max-width: 380px) { #bp-sound { display: none; } }

/* full screen: the board takes the screen */
.stage.is-immersive .stage-body > .bp { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .bp-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; }
.stage.is-immersive .bp-help { display: none; }
@media (prefers-reduced-motion: reduce) {
  .bp-panel, .bp-toast, .bp-coach, .bp-overlay, .bp-card, .bp-tag, .bp-t.pop, .bp-t.shake, .bp-t.knock, .bp-won .bp-c .bp-t, .bp-c.ht { animation: none; }
  .bp-l.on { display: none; }
}
.bp-calm .bp-panel, .bp-calm .bp-toast, .bp-calm .bp-coach, .bp-calm .bp-overlay, .bp-calm .bp-card, .bp-calm .bp-tag, .bp-calm .bp-t.pop, .bp-calm .bp-t.shake, .bp-calm .bp-t.knock,
.bp-calm.bp-won .bp-c .bp-t, .bp-calm .bp-c.ht { animation: none; }
.bp-calm .bp-l.on { display: none; }
