.bhb-app {
    --bhb-ink: #17212b;
    --bhb-muted: #5d6875;
    --bhb-line: #dfe5eb;
    --bhb-paper: #fff;
    --bhb-soft: #f4f7fa;
    --bhb-blue: #1769e0;
    --bhb-blue-dark: #0e4ea9;
    --bhb-green: #16824b;
    --bhb-red: #c03535;
    max-width: 920px;
    margin: 30px auto;
    padding: 28px;
    border: 1px solid var(--bhb-line);
    border-radius: 18px;
    background: var(--bhb-paper);
    color: var(--bhb-ink);
    box-shadow: 0 12px 35px rgba(35, 48, 62, .09);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-sizing: border-box;
}
.bhb-app *, .bhb-app *::before, .bhb-app *::after { box-sizing: border-box; }
.bhb-app [hidden] { display: none !important; }
.bhb-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 28px; }
.bhb-header h1 { margin: 3px 0 7px; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1; letter-spacing: -.04em; }
.bhb-header p { margin: 0; max-width: 600px; color: var(--bhb-muted); font-size: 1.04rem; }
.bhb-kicker { color: var(--bhb-blue); font-size: .78rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.bhb-best { min-width: 118px; padding: 12px 16px; text-align: center; border-radius: 12px; background: #eaf2ff; }
.bhb-best span, .bhb-hud span, .bhb-final-score span { display: block; color: var(--bhb-muted); font-size: .77rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.bhb-best strong { font-size: 1.45rem; }
.bhb-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.bhb-rules div { padding: 16px; border-radius: 12px; background: var(--bhb-soft); }
.bhb-rules strong, .bhb-rules span { display: block; }
.bhb-rules span { margin-top: 4px; color: var(--bhb-muted); font-size: .88rem; line-height: 1.35; }
.bhb-settings { border: 1px solid var(--bhb-line); border-radius: 12px; margin: 18px 0; overflow: hidden; }
.bhb-settings summary { padding: 14px 16px; cursor: pointer; font-weight: 750; background: #fafbfd; }
.bhb-settings > p, .bhb-topic-actions, .bhb-topic-grid { margin-left: 16px; margin-right: 16px; }
.bhb-settings > p { color: var(--bhb-muted); }
.bhb-topic-actions { display: flex; gap: 14px; margin-bottom: 12px; }
.bhb-link-button { border: 0; padding: 0; color: var(--bhb-blue); background: transparent; cursor: pointer; text-decoration: underline; }
.bhb-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding-bottom: 18px; }
.bhb-topic-grid label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--bhb-soft); cursor: pointer; }
.bhb-topic-grid input { margin-top: 3px; }
.bhb-selection-note { min-height: 1.2em; color: var(--bhb-red) !important; font-weight: 650; }
.bhb-primary, .bhb-secondary, .bhb-joker { min-height: 44px; padding: 10px 18px; border-radius: 9px; font: inherit; font-weight: 750; cursor: pointer; transition: transform .12s, background .15s, opacity .15s; }
.bhb-primary { border: 1px solid var(--bhb-blue); background: var(--bhb-blue); color: #fff; }
.bhb-primary:hover { background: var(--bhb-blue-dark); border-color: var(--bhb-blue-dark); }
.bhb-secondary { border: 1px solid #b9c3ce; background: #fff; color: var(--bhb-ink); }
.bhb-primary:active, .bhb-secondary:active, .bhb-joker:active { transform: translateY(1px); }
.bhb-primary:disabled, .bhb-secondary:disabled, .bhb-joker:disabled { opacity: .5; cursor: not-allowed; }
.bhb-start-button { display: block; min-width: 210px; margin: 22px auto 0; font-size: 1.07rem; }
.bhb-hud { display: grid; grid-template-columns: repeat(3, 1fr) 110px; gap: 10px; margin-bottom: 12px; }
.bhb-hud > div, .bhb-joker { padding: 10px 12px; border: 1px solid var(--bhb-line); border-radius: 10px; background: #fff; text-align: center; }
.bhb-hud strong { display: block; margin-top: 2px; font-size: 1.2rem; }
.bhb-joker { color: #745600; background: #fff7d8; border-color: #ead58d; }
.bhb-joker span, .bhb-joker strong { display: block; }
.bhb-joker span { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.bhb-progress { height: 6px; margin-bottom: 18px; overflow: hidden; border-radius: 999px; background: #e7edf2; }
.bhb-progress span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #19a866, #1769e0); transition: width .2s linear; }
.bhb-question, .bhb-feedback { padding: 26px; border: 1px solid var(--bhb-line); border-radius: 15px; background: #fff; }
.bhb-question-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.bhb-question-meta span { padding: 5px 9px; border-radius: 999px; background: #eef3f8; color: #465565; font-size: .78rem; font-weight: 700; }
.bhb-question h2, .bhb-feedback h2, .bhb-gameover h2 { margin: 0 0 10px; color: var(--bhb-ink); }
.bhb-prompt { margin: 0 0 22px; font-size: 1.08rem; line-height: 1.55; }
.bhb-booking-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) minmax(105px, .58fr); gap: 9px; align-items: center; margin: 10px 0; }
.bhb-booking-row .bhb-an { text-align: center; color: var(--bhb-muted); font-weight: 700; }
.bhb-booking-row select, .bhb-booking-row input, .bhb-input-line, .bhb-order-row select {
    width: 100%; min-height: 44px; padding: 9px 10px; border: 1px solid #b8c2cd; border-radius: 8px; background: #fff; color: var(--bhb-ink); font: inherit;
}
.bhb-booking-row input:focus, .bhb-booking-row select:focus, .bhb-input-line:focus, .bhb-order-row select:focus { outline: 3px solid rgba(23,105,224,.16); border-color: var(--bhb-blue); }
.bhb-fixed-account { min-height: 44px; display: flex; align-items: center; padding: 9px 11px; border-radius: 8px; background: var(--bhb-soft); font-weight: 650; }
.bhb-entry-label { margin: 15px 0 5px; color: var(--bhb-muted); font-size: .82rem; font-weight: 750; }
.bhb-input-help { margin: 6px 0 14px; color: var(--bhb-muted); font-size: .84rem; }
.bhb-order-row { display: grid; grid-template-columns: 34px 1fr; gap: 9px; align-items: center; margin: 10px 0; }
.bhb-order-row strong { text-align: center; }
.bhb-error { min-height: 1.4em; margin: 10px 0 0; color: var(--bhb-red); font-weight: 650; }
.bhb-question-actions, .bhb-gameover-actions { display: flex; gap: 10px; margin-top: 16px; }
.bhb-feedback.correct { border-color: #9bd4b5; background: #fbfffc; }
.bhb-feedback.skipped { border-color: #ead58d; background: #fffdf5; }
.bhb-feedback.wrong { border-color: #e1aaaa; background: #fffafa; }
.bhb-feedback-heading { display: flex; align-items: center; gap: 14px; }
.bhb-feedback-heading p { margin: 2px 0 0; color: var(--bhb-muted); font-weight: 650; }
.bhb-feedback-icon { display: grid; place-items: center; flex: 0 0 45px; height: 45px; border-radius: 50%; color: #fff; background: var(--bhb-green); font-size: 1.4rem; font-weight: 900; }
.bhb-feedback.skipped .bhb-feedback-icon { background: #c89400; }
.bhb-feedback.wrong .bhb-feedback-icon { background: var(--bhb-red); }
.bhb-solution { display: grid; gap: 8px; margin: 20px 0 14px; }
.bhb-solution-line { padding: 12px 14px; border-radius: 9px; background: #edf3f8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 750; }
.bhb-effects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.bhb-effect { padding: 11px 12px; border-left: 4px solid var(--bhb-blue); border-radius: 7px; background: #f5f8fb; color: #43505d; font-size: .9rem; }
.bhb-effect strong { display: block; color: var(--bhb-ink); margin-bottom: 2px; }
.bhb-explanation { padding-top: 14px; margin: 15px 0; border-top: 1px solid var(--bhb-line); color: #394756; }
.bhb-gameover { padding: 38px 24px; text-align: center; border-radius: 15px; background: #f7f8fa; }
.bhb-final-score { margin: 22px auto 12px; }
.bhb-final-score strong { display: block; font-size: clamp(2.5rem, 8vw, 4.5rem); line-height: 1; }
.bhb-gameover-actions { justify-content: center; }
.bhb-loading { padding: 40px 0; text-align: center; color: var(--bhb-muted); }
.bhb-loading span { display: inline-block; width: 32px; height: 32px; border: 3px solid #d7dee6; border-top-color: var(--bhb-blue); border-radius: 50%; animation: bhb-spin .8s linear infinite; }
@keyframes bhb-spin { to { transform: rotate(360deg); } }

@media (max-width: 700px) {
    .bhb-app { margin: 12px auto; padding: 18px 14px; border-radius: 13px; }
    .bhb-header { align-items: center; }
    .bhb-header p { font-size: .94rem; }
    .bhb-best { min-width: 92px; padding: 9px; }
    .bhb-rules { grid-template-columns: 1fr; }
    .bhb-topic-grid { grid-template-columns: 1fr; }
    .bhb-hud { grid-template-columns: repeat(3, 1fr); }
    .bhb-joker { grid-column: 1 / -1; display: flex; justify-content: center; gap: 7px; min-height: 40px; padding: 7px; }
    .bhb-question, .bhb-feedback { padding: 18px 14px; }
    .bhb-booking-row { grid-template-columns: 1fr 26px 1fr; }
    .bhb-booking-row > input { grid-column: 1 / -1; }
    .bhb-effects { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
    .bhb-header { display: block; }
    .bhb-best { margin-top: 14px; display: inline-block; }
    .bhb-hud strong { font-size: 1rem; }
    .bhb-question-actions, .bhb-gameover-actions { flex-direction: column; }
    .bhb-booking-row { grid-template-columns: 1fr; }
    .bhb-booking-row .bhb-an { padding: 0; }
}

