.ah-page {
    margin: 0;
    background: #0e1a24;
    color: #f4efe4;
    font-family: "Segoe UI", system-ui, sans-serif;
}

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

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

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

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

.ah-locks {
    display: flex;
    gap: 0.45rem;
    margin: 0.2rem 0 0.85rem;
}

.ah-lock {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #c6a15b;
    background: #12202c;
    color: #c6a15b;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.ah-lock.is-open {
    background: #c6a15b;
    color: #1a1208;
}

.ah-lock.is-current {
    box-shadow: 0 0 0 3px #c90c0f;
    color: #f4efe4;
}

.ah-tool-btn {
    background: #1e3344;
    color: #f4efe4;
    border: 2px solid #c6a15b;
    border-radius: 10px;
    min-height: 44px;
    padding: 0.4rem 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.ah-tool-btn:hover {
    background: #c6a15b;
    color: #1a1208;
}

.ah-card {
    background: #f4efe4;
    color: #1a1208;
    border-radius: 16px;
    padding: 1.1rem 1.15rem 1.2rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.ah-strand {
    margin: 0;
    color: #8a5a12;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ah-topic {
    margin: 0.15rem 0 0.55rem;
    color: #c90c0f;
    font-size: 1.05rem;
}

.ah-prompt {
    margin: 0 0 0.8rem;
    font-size: 1.2rem;
    line-height: 1.4;
}

.ah-figure {
    margin: 0 0 0.8rem;
}

.ah-figure svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    display: block;
}

.ah-status {
    min-height: 1.4rem;
    margin: 0 0 0.7rem;
    color: #5c3b12;
    font-weight: 600;
}

.ah-form {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: end;
}

.ah-answer-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ah-input {
    width: 7.5rem;
    font-size: 1.6rem;
    letter-spacing: 0.18em;
    text-align: center;
    padding: 0.45rem 0.4rem;
    border-radius: 10px;
    border: 2px solid #1a1208;
    background: #fff;
    color: #1a1208;
}

.ah-hint {
    margin: 0.85rem 0 0;
    color: #d7c7a1;
}

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

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

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

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

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

@media (max-width: 640px) {
    body.ah-page.with-game-header .ah-shell {
        padding-top: 4.6rem;
    }
}
