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

body.si-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #f4f7fb;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 14% 10%, rgba(31, 157, 74, 0.18), transparent 42%),
        radial-gradient(circle at 88% 8%, rgba(201, 12, 15, 0.2), transparent 46%),
        linear-gradient(180deg, #121212 0%, #1c1c1c 48%, #0a0a0a 100%);
}

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

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

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

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

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

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

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

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

.si-lcd span {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #4cc9f0;
}

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

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

.si-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(244, 196, 48, 0.28);
    background: rgba(10, 10, 10, 0.7);
    color: #f4f7fb;
    font-weight: 700;
    cursor: pointer;
}

.si-tool-btn:hover {
    border-color: #f5c518;
    color: #f5c518;
}

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

.si-pad-wrap {
    display: flex;
    justify-content: center;
    padding: 0.25rem;
}

.si-pad {
    --si-size: min(72vw, 380px);
    position: relative;
    width: var(--si-size);
    height: var(--si-size);
    border-radius: 50%;
    background: #111;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 10px #1a1a1a;
}

.si-slice {
    position: absolute;
    width: 46%;
    height: 46%;
    border: 0;
    padding: 0;
    cursor: pointer;
    opacity: 0.55;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.08s ease, filter 0.08s ease, transform 0.08s ease;
}

.si-slice:disabled {
    cursor: default;
}

.si-slice:disabled.is-lit {
    opacity: 1;
}

.si-slice.is-lit {
    opacity: 1;
    filter: brightness(1.35);
    transform: scale(1.02);
}

.si-slice.is-wrong {
    animation: si-shake 0.28s ease;
}

.si-green {
    top: 4%;
    left: 4%;
    border-radius: 100% 8% 8% 8%;
    background: #1f9d4a;
}

.si-red {
    top: 4%;
    right: 4%;
    border-radius: 8% 100% 8% 8%;
    background: #c90c0f;
}

.si-yellow {
    bottom: 4%;
    left: 4%;
    border-radius: 8% 8% 8% 100%;
    background: #f4c430;
}

.si-blue {
    bottom: 4%;
    right: 4%;
    border-radius: 8% 8% 100% 8%;
    background: #1e4d9c;
}

.si-centre {
    position: absolute;
    inset: 34%;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #3a3a3a, #161616);
    border: 3px solid #f4c430;
    color: #f4c430;
    font-weight: 800;
    font-size: clamp(0.7rem, 3.2vw, 1.05rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

@keyframes si-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.si-hint {
    text-align: center;
    color: #d4d4d4;
    font-size: 0.92rem;
    margin: 0.85rem 0 0;
}

.si-settings-panel__title {
    margin: 0 0 0.75rem;
    color: #c90c0f;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.92rem;
}

.si-settings-panel__label {
    margin: 0 0 0.45rem;
    color: #1a120c;
    font-weight: 600;
}

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

#settingsModal .difficulty-pill {
    border: 1px solid #fed7aa;
    border-radius: 999px;
    padding: 0.5rem 0.85rem;
    background: #fff7ed;
    color: #1a120c !important;
    font-weight: 600;
    cursor: pointer;
}

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

#settingsModal .si-settings-panel__note {
    margin: 0.75rem 0 0;
    color: #7f1d1d;
    font-size: 0.9rem;
}

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

.si-help-pads {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.si-help-pad {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.55rem;
}

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

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

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

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

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

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

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

    .si-hud {
        max-width: 100%;
    }

    .si-lcd {
        min-width: 0;
        flex: 1 1 0;
    }

    .si-pad {
        --si-size: min(86vw, 360px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .si-slice {
        transition: none;
    }
}
