#game-root .sd-wrap {
    max-width: min(92vw, 640px);
    margin: 0 auto;
    padding: 0 4px 20px;
    font-family: Inter, Arial, sans-serif;
    color: var(--cg-ink);
}

#game-root .sd-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

#game-root .sd-stats {
    display: flex;
    align-items: stretch;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

#game-root .sd-stat {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--cg-panel);
    border: 1px solid var(--cg-line);
    border-radius: 10px;
    padding: 6px 8px;
    text-align: center;
    box-shadow: 0 8px 18px rgba(33, 43, 40, 0.07);
}

#game-root .sd-stat span {
    display: block;
    color: var(--cg-muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#game-root .sd-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#game-root .sd-lives {
    color: #d1462f;
    letter-spacing: 1px;
}

#game-root .sd-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

#game-root .sd-btn {
    appearance: none;
    min-height: 44px;
    border: 1px solid var(--cg-line);
    background: var(--cg-panel);
    color: var(--cg-ink);
    border-radius: 10px;
    padding: 0 14px;
    font-family: inherit;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(33, 43, 40, 0.07);
    transition: transform 120ms ease, border-color 120ms ease;
}

#game-root .sd-btn:hover {
    transform: translateY(-1px);
    border-color: var(--cg-teal);
}

#game-root .sd-btn:focus-visible,
#game-root .sd-seg-btn:focus-visible,
#game-root .sd-stage canvas:focus-visible {
    outline: 3px solid rgba(18, 122, 137, 0.42);
    outline-offset: 3px;
}

#game-root .sd-icon {
    min-width: 44px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    font-size: 1.1rem;
}

#game-root .sd-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#game-root .sd-btn-primary {
    background: var(--cg-teal);
    border-color: var(--cg-teal);
    color: #fff;
}

#game-root .sd-stage {
    position: relative;
    width: min(100%, calc(min(80vh, 760px) * 0.8));
    margin: 0 auto;
    aspect-ratio: 4 / 5;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #22305a;
    background: #04070f;
    box-shadow: 0 18px 44px rgba(10, 16, 38, 0.34), inset 0 0 0 1px rgba(120, 160, 255, 0.07);
}

#game-root .sd-stage canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

#game-root .sd-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(circle at 50% 40%, rgba(12, 22, 52, 0.72), rgba(3, 6, 16, 0.92));
    backdrop-filter: blur(2px);
}

#game-root .sd-overlay[hidden] {
    display: none;
}

#game-root .sd-panel {
    width: min(100%, 340px);
    background: linear-gradient(180deg, #131e42, #0c142e);
    border: 1px solid #2f4177;
    border-radius: 14px;
    padding: 20px 18px;
    text-align: center;
    color: #e8eefc;
    box-shadow: 0 24px 60px rgba(2, 6, 20, 0.6);
}

#game-root .sd-panel h2 {
    margin: 0 0 8px;
    font-size: 1.4rem;
    line-height: 1.15;
    color: #fff;
}

#game-root .sd-panel p {
    margin: 0 0 14px;
    color: #a9b8dd;
    font-size: 0.9rem;
    line-height: 1.45;
}

#game-root .sd-ovstats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 0 0 14px;
}

#game-root .sd-ovstats[hidden] {
    display: none;
}

#game-root .sd-ovstat {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(140, 170, 240, 0.2);
    border-radius: 9px;
    padding: 6px 4px;
}

#game-root .sd-ovstat span {
    display: block;
    color: #91a3cd;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#game-root .sd-ovstat strong {
    display: block;
    margin-top: 1px;
    font-size: 15px;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

#game-root .sd-ov-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

#game-root .sd-btn-ghost {
    background: rgba(255, 255, 255, 0.07);
    border-color: #33477f;
    color: #dce6ff;
    box-shadow: none;
}

#game-root .sd-controls {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin: 14px 0 6px;
}

#game-root .sd-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#game-root .sd-glabel {
    color: var(--cg-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

#game-root .sd-seg {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--cg-panel);
    border: 1px solid var(--cg-line);
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(33, 43, 40, 0.07);
}

#game-root .sd-seg-btn {
    appearance: none;
    min-height: 44px;
    min-width: 44px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--cg-muted);
    font-family: inherit;
    font-weight: 800;
    font-size: 0.86rem;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

#game-root .sd-seg-btn:hover {
    color: var(--cg-ink);
    background: rgba(18, 122, 137, 0.08);
}

#game-root .sd-seg-btn[aria-pressed="true"] {
    background: var(--cg-teal);
    border-color: var(--cg-teal);
    color: #fff;
}

#game-root .sd-hint {
    margin: 8px 0 6px;
    color: var(--cg-muted);
    font-size: 0.82rem;
    text-align: center;
}

#game-root .sd-mini {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--cg-muted);
    font-size: 0.8rem;
}

#game-root .sd-mini strong {
    color: var(--cg-ink);
}

#game-root .sd-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(8, 14, 30, 0.46);
}

#game-root .sd-modal[hidden] {
    display: none;
}

#game-root .sd-modal-card {
    position: relative;
    width: min(100%, 440px);
    max-height: 84vh;
    overflow-y: auto;
    padding: 22px;
    border: 1px solid var(--cg-line);
    border-radius: 14px;
    background: var(--cg-panel);
    color: var(--cg-ink);
    box-shadow: 0 24px 70px rgba(10, 16, 38, 0.3);
}

#game-root .sd-modal-card h2 {
    margin: 0 52px 10px 0;
    font-size: 1.35rem;
    line-height: 1.15;
}

#game-root .sd-modal-card p {
    margin: 10px 0 0;
    color: var(--cg-muted);
    line-height: 1.5;
    font-size: 0.92rem;
}

#game-root .sd-close {
    position: absolute;
    top: 12px;
    right: 12px;
    min-width: 44px;
    padding: 0;
    font-size: 22px;
    line-height: 1;
}

@media (max-width: 560px) {
    #game-root .sd-wrap {
        max-width: 100%;
        padding: 0 2px 16px;
    }

    #game-root .sd-stat-best {
        display: none;
    }

    #game-root .sd-stat {
        padding: 5px 4px;
    }

    #game-root .sd-stat strong {
        font-size: 16px;
    }

    #game-root .sd-stage {
        width: 100%;
    }

    #game-root .sd-controls {
        gap: 10px;
    }

    #game-root .sd-seg-btn {
        padding: 0 12px;
        font-size: 0.82rem;
    }
}
