body.be-page {
    display: block;
    min-height: 100vh;
    margin: 0;
    background: #143028;
    color: #f4efe4;
    font-family: "Segoe UI", system-ui, sans-serif;
    perspective: none;
    justify-content: stretch;
    align-items: stretch;
}

.be-page .btn-primary:disabled {
    background: #9d090c !important;
    color: #fff !important;
    opacity: 0.7;
    cursor: default;
}

.be-shell {
    max-width: 920px;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
}

.be-hud,
.be-toolbar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.be-lcd,
.be-chip {
    background: #0e241c;
    border: 1px solid #c6a15b;
    border-radius: 10px;
    padding: 0.45rem 0.7rem;
    color: #f4c430;
    font-weight: 700;
}

.be-lcd span {
    display: block;
    color: #c6a15b;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.be-layout {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 0.9rem;
    align-items: start;
}

.be-bugs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}

.be-bugs.is-solo {
    grid-template-columns: 1fr;
}

.be-card {
    background: #f7f3e8;
    color: #1a1208;
    border-radius: 16px;
    padding: 0.75rem 0.8rem 0.9rem;
}

.be-card h2 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    color: #c90c0f;
}

.be-card p {
    margin: 0 0 0.35rem;
    font-weight: 700;
}

.be-bug svg {
    width: 100%;
    height: auto;
    display: block;
}

.be-part {
    transform-box: fill-box;
    transform-origin: center;
}

.be-part.is-missing {
    opacity: 0.16;
}

.be-part.is-fresh {
    animation: be-pop 0.45s ease;
}

@keyframes be-pop {
    0% { filter: brightness(2.1); }
    100% { filter: brightness(1); }
}

.be-chart {
    display: grid;
    gap: 0.35rem;
}

.be-chart div {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    background: #0e241c;
    color: #f4efe4;
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
    font-size: 0.88rem;
}

.be-chart strong {
    color: #f4c430;
}

.be-dice.dice-area {
    margin: 0.4rem 0 0.6rem;
    min-height: 7.2rem;
    gap: 1.2rem;
}

.be-page .be-dice .dice-container {
    width: 104px;
    height: 104px;
    margin: 0;
    perspective: 640px;
}

.be-page .be-dice .dice {
    --die-size: 104px;
    width: 104px;
    height: 104px;
}

.be-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.be-status {
    min-height: 1.4rem;
    margin: 0.4rem 0 0;
    color: #d7c7a1;
    font-weight: 600;
}

.be-note {
    margin: 0.8rem 0 0;
    color: #d7c7a1;
}

.be-settings-note {
    margin: 0.75rem 0 0;
    color: #5c3b12;
}

.difficulty-pill {
    padding: 0.45rem 0.75rem;
    min-height: 44px;
    border-radius: 999px;
    border: 2px solid #c90c0f;
    background: #fff !important;
    color: #c90c0f !important;
    font-weight: 700;
    cursor: pointer;
}

.difficulty-pill.is-selected,
.difficulty-pill:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active { display: flex; }

.modal-content {
    background: #fff;
    color: #1a1a1a;
    border-radius: 1rem;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large { max-width: 760px; }

.modal-header,
.modal-footer {
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-header { border-bottom: 2px solid #eee; }

.modal-header h2 {
    margin: 0;
    color: #c90c0f;
    font-size: 1.35rem;
}

.modal-close {
    background: #fff !important;
    border: 2px solid #c90c0f;
    color: #c90c0f !important;
    border-radius: 8px;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
}

.modal-close:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

.modal-body { padding: 1.2rem 1.4rem; }

.modal-footer {
    border-top: 2px solid #eee;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.help-section { margin-bottom: 1.1rem; }

.help-section h3 {
    color: #c90c0f;
    margin: 0 0 0.4rem;
}

.help-section ul {
    margin: 0.3rem 0 0;
    padding-left: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0.85rem;
    text-align: center;
}

.stat-value {
    font-size: 1.6rem;
    color: #c90c0f;
    font-weight: 700;
}

.stat-label,
.win-stat span {
    color: #64748b;
    font-size: 0.85rem;
}

.difficulty-stats { display: grid; gap: 0.45rem; }

.difficulty-stats div {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0.55rem;
    background: #f8fafc;
    border-radius: 8px;
}

.result-message {
    font-size: 1.05rem;
    margin: 0 0 1rem;
}

.win-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    text-align: center;
}

.win-stat strong {
    display: block;
    font-size: 1.35rem;
    color: #c90c0f;
}

.be-page .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    min-height: 44px;
    border-radius: 0.55rem;
    border: 2px solid transparent;
    font-weight: 700;
    cursor: pointer;
}

.be-page .btn-primary {
    background: #c90c0f !important;
    color: #fff !important;
    border-color: #c90c0f;
}

.be-page .btn-secondary {
    background: #fff !important;
    color: #c90c0f !important;
    border-color: #c90c0f;
}

.be-page .btn-secondary:hover,
.be-page .btn-primary:hover {
    background: #9d090c !important;
    color: #fff !important;
    border-color: #9d090c;
}

@media (max-width: 760px) {
    .be-layout,
    .be-bugs {
        grid-template-columns: 1fr;
    }

    body.be-page.with-game-header .be-shell {
        padding-top: 4.6rem;
    }
}
