* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #0f2236 0%, #17324c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

#game-shell {
    position: relative;
    width: min(100vw, calc(100vh * 640 / 760));
    aspect-ratio: 640 / 760;
}

#gameCanvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    /* Crisp pixel rendering */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    z-index: 1;
}

#threejs-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    display: block;
}

#threejs-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

#replay-toggle-panel {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    background: transparent;
    border: 0;
    box-shadow: none;
    pointer-events: auto;
    --replay-scale: 1;
}

.replay-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.replay-toggle-eyebrow {
    color: #88aacc;
    font: 700 calc(9px * var(--replay-scale))/1 monospace;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.replay-toggle-title {
    color: #f0f4f8;
    font: 700 calc(11px * var(--replay-scale))/1.15 monospace;
}

.replay-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    width: calc(44px * var(--replay-scale));
    height: calc(24px * var(--replay-scale));
    align-items: center;
    justify-content: center;
}

.replay-switch input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.replay-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #9db5c7;
    transition: background-color 140ms ease;
}

.replay-switch-thumb {
    position: absolute;
    top: calc(3px * var(--replay-scale));
    left: calc(3px * var(--replay-scale));
    width: calc(18px * var(--replay-scale));
    height: calc(18px * var(--replay-scale));
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(17, 34, 51, 0.22);
    transition: transform 180ms ease, background-color 140ms ease;
}

.replay-switch input:focus-visible + .replay-switch-track {
    outline: 2px solid rgba(30, 93, 137, 0.45);
    outline-offset: 2px;
}

.replay-switch input:checked + .replay-switch-track {
    background: #1f5d89;
}

.replay-switch input:checked + .replay-switch-track + .replay-switch-thumb {
    transform: translateX(calc(20px * var(--replay-scale)));
    background: #edf7ff;
}
