:root {
    --game-primary: #c90c0f;
    --game-secondary: #f4c430;
}

body.ac-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #eef4fb;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 14% 8%, rgba(96, 165, 250, 0.16), transparent 42%),
        radial-gradient(circle at 88% 8%, rgba(201, 12, 15, 0.18), transparent 46%),
        linear-gradient(180deg, #0b1724 0%, #163044 48%, #0b1724 100%);
}

body.ac-page.game-menu-active {
    overflow-y: auto;
    overflow-x: hidden;
}

body.ac-page.game-menu-active #game-header {
    display: none !important;
}

.ac-page .game-screen {
    display: none;
    min-height: 100vh;
}

.ac-page .game-screen.active {
    display: block;
}

body.ac-page.with-game-header .ac-shell {
    padding-top: 5.5rem;
}

.ac-shell {
    max-width: min(920px, 96vw);
    margin: 0 auto;
    padding: 1.1rem 0.75rem 2.5rem;
}

.ac-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: 640px;
    margin: 0 auto 0.85rem;
    padding: 0.55rem 0.7rem;
    background: linear-gradient(180deg, #1c4558, #102834);
    border: 3px solid #07141d;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.ac-lcd {
    min-width: 4.6rem;
    padding: 0.2rem 0.45rem;
    background: #041016;
    color: #f5c518;
    font-family: "Courier New", ui-monospace, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px #7f1d1d, inset 0 8px 16px rgba(0, 0, 0, 0.45);
}

.ac-lcd span {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7dd3fc;
}

.ac-chip {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fde68a;
    font-weight: 700;
}

.ac-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    margin: 0 auto 0.85rem;
    max-width: 640px;
}

.ac-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    background: rgba(7, 20, 29, 0.7);
    color: #f4f7fb !important;
    font-weight: 700;
    cursor: pointer;
}

.ac-tool-btn:hover:not(:disabled) {
    border-color: #f5c518;
    color: #f5c518 !important;
}

.ac-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ac-status {
    text-align: center;
    min-height: 1.4rem;
    margin: 0 auto 0.65rem;
    color: #fde68a;
    font-weight: 700;
}

.ac-play {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
    gap: 0.9rem;
    align-items: start;
}

.ac-board-wrap {
    background: #f8f4ea;
    border: 4px solid #07141d;
    border-radius: 16px;
    padding: 0.45rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.ac-board svg {
    display: block;
    width: 100%;
    height: auto;
}

.ac-label-given {
    fill: #c9a227;
    stroke: #7a5b10;
    stroke-width: 1;
}

.ac-label-missing {
    fill: #c90c0f;
    stroke: #7f1d1d;
    stroke-width: 1;
    cursor: pointer;
}

.ac-label-missing.is-focus {
    stroke: #f4c430;
    stroke-width: 2.5;
}

.ac-label-wrong {
    fill: #7f1d1d;
}

.ac-label-text {
    font-family: "Rockwell", "Roboto Slab", serif;
    font-size: 13px;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.ac-label-given-text {
    fill: #1a1208;
}

.ac-label-missing-text {
    fill: #fff;
}

.ac-inputs {
    background: rgba(7, 20, 29, 0.72);
    border: 2px solid #1c4558;
    border-radius: 14px;
    padding: 0.8rem 0.85rem;
}

.ac-inputs h2 {
    margin: 0 0 0.35rem;
    color: #fde68a;
    font-size: 1.05rem;
}

.ac-reasons {
    margin: 0 0 0.7rem;
    color: #c5d4de;
    font-size: 0.86rem;
}

.ac-field {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
}

.ac-field label {
    min-width: 1.6rem;
    font-weight: 800;
    color: #fde68a;
}

.ac-field input {
    width: 5.2rem;
    min-height: 42px;
    border: 2px solid #c90c0f;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    font-size: 1.15rem;
    font-weight: 800;
    text-align: center;
}

.ac-field input.is-wrong {
    border-color: #7f1d1d;
    background: #fee2e2;
}

.ac-field input.is-ok {
    border-color: #15803d;
    background: #dcfce7;
}

.ac-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    margin-top: 0.7rem;
}

.ac-pad button {
    min-height: 44px;
    border-radius: 8px;
    border: 2px solid #c90c0f;
    background: #fff !important;
    color: #c90c0f !important;
    font-weight: 800;
    cursor: pointer;
}

.ac-pad button:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

.ac-hint {
    text-align: center;
    max-width: 40rem;
    margin: 0.75rem auto 0;
    color: #c5d4de;
    font-size: 0.92rem;
}

.ac-settings-panel__label {
    font-weight: 700;
    margin: 0.4rem 0 0.45rem;
}

.ac-settings-panel__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.ac-settings-panel__note {
    color: #64748b;
    font-size: 0.92rem;
}

.difficulty-pill {
    padding: 0.45rem 0.75rem;
    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;
}

.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-card .stat-value {
    font-size: 1.6rem;
    color: #c90c0f;
    font-weight: 700;
}

.stat-card .stat-label {
    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;
    color: #1a1a1a;
}

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

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

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

.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;
}

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

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

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

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

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

@media (max-width: 800px) {
    .ac-play {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body.ac-page.with-game-header .ac-shell {
        padding-top: 0.75rem;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-bottom: 1.25rem;
    }

    .ac-hud {
        max-width: 100%;
        gap: 0.4rem;
        padding: 0.4rem 0.45rem;
    }

    .ac-lcd {
        min-width: 0;
        flex: 1 1 0;
        font-size: 1rem;
    }
}
