:root {
    --amber: #6ec8ff;
    --amber-dim: #3f99cf;
    --amber-glow: rgba(110, 200, 255, 0.42);
    --blue: #ff6b6b;
    --blue-glow: rgba(255, 107, 107, 0.42);
    --countdown-text-color: #c6a075;
    --countdown-text-glow: rgba(168, 134, 91, 0.45);
    --bg-dark: #17110c;
    --bg-mid: #241a12;
    --field-bg: #1f160f;
    --line: rgba(198, 160, 117, 0.2);
    --text: #fff;
    --text-dim: #9e8262;
    --app-height: 100dvh;
    --app-safe-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--browser-safe-bottom-offset, 0px));
    --game-font-family: 'Lilita One', 'Jua', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
    background-color: #3b2a1d;
    background-image: radial-gradient(circle at 50% 50%, #3b2a1d 0%, var(--bg-dark) 70%);
}

body {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    margin: 0;
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
    font-family: var(--game-font-family);
    background-color: #3b2a1d;
    background-image: radial-gradient(circle at 50% 50%, #3b2a1d 0%, var(--bg-dark) 70%);
    color: var(--text);
}

.game-container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-top: env(safe-area-inset-top);
    padding-bottom: var(--app-safe-bottom);
}

.game-container.entry-layout-pending .gamepad-section,
.game-container.entry-layout-pending .side-score-panel,
.game-container.entry-layout-pending .side-action-stack {
    visibility: hidden;
    pointer-events: none;
}

.game-container.prestart-ui-disabled .gamepad-section .gamepad-controls,
.game-container.prestart-ui-disabled .side-score-panel {
    opacity: 0.34;
    filter: grayscale(0.85) saturate(0.45);
}

.game-container.prestart-ui-disabled::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 84;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, rgba(26, 58, 82, 0.2) 0%, rgba(0, 0, 0, 0.8) 72%);
}

.game-container.prestart-ui-disabled .gamepad-section {
    z-index: 86;
    pointer-events: none;
}

.game-container.prestart-ui-disabled .gamepad-section .gamepad-controls,
.game-container.prestart-ui-disabled .gamepad-section .gamepad-controls * {
    pointer-events: none;
}

.game-container.prestart-ui-disabled .gamepad-info {
    z-index: 87;
}

.game-container.prestart-ui-disabled .side-action-stack {
    z-index: 86;
}

.game-container.countdown-controls-disabled .shoot-btn-wrapper,
.game-container.countdown-controls-disabled .dash-btn-wrapper {
    opacity: 0.38;
    filter: grayscale(0.9) saturate(0.4);
    pointer-events: none;
}

.game-container.p2-controls-disabled .p2-gamepad .gamepad-controls {
    opacity: 0.38;
    filter: grayscale(0.9) saturate(0.4);
    pointer-events: none;
}

.game-container.p2-ai-opponent .side-score-p2 .side-score-value {
    transform: none;
}

.game-container.p2-ai-opponent .p2-gamepad {
    pointer-events: none;
}

.game-container.p2-ai-opponent .p2-gamepad .gamepad-controls {
    visibility: hidden;
    pointer-events: none;
}

.game-container.p2-ai-opponent .p2-gamepad .gamepad-info {
    transform: translateX(-50%) rotate(180deg);
    transition: none;
}

.game-container.p2-ai-opponent .p2-gamepad .shoot-btn,
.game-container.p2-ai-opponent .p2-gamepad .dash-btn {
    transform: rotate(180deg);
    transition: none;
}

.game-container.p2-ai-opponent .rules-content-p2 {
    transform: none;
}

.gamepad-section {
    flex: 0 0 clamp(92px, 15.5dvh, 142px);
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0 8px;
    position: relative;
    z-index: 10;
}

.p2-gamepad {
    transform: rotate(180deg);
    background: linear-gradient(0deg, rgba(255, 107, 107, 0.12) 0%, transparent 100%);
}

.p1-gamepad {
    background: linear-gradient(0deg, rgba(198, 160, 117, 0.12) 0%, transparent 100%);
}

.gamepad-info {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: clamp(0.64rem, 2.1vw, 0.8rem);
    white-space: nowrap;
    pointer-events: none;
    max-width: calc(100% - 148px);
    padding: 0 4px;
    z-index: 2;
}

.gp-emoji {
    font-size: 1.1em;
}

.gp-name {
    flex: 0 1 auto;
    min-width: 0;
    font-family: var(--game-font-family);
    font-weight: 700;
    opacity: 0.8;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(40vw, 180px);
    text-align: center;
}

.gp-score {
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: 1.22em;
    min-width: 16px;
    text-align: center;
}

.p1-gamepad .gp-score {
    color: var(--amber);
    text-shadow: 0 0 12px var(--amber-glow);
}

.p2-gamepad .gp-score {
    color: var(--blue);
    text-shadow: 0 0 12px var(--blue-glow);
}

.gamepad-controls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    --control-zone-width: 60%;
    --control-zone-start-padding: 0px;
    --control-zone-end-padding: 0px;
    --control-btn-gap: 0px;
    --control-btn-size-raw: calc(
        (var(--control-zone-width) - var(--control-zone-start-padding) - var(--control-zone-end-padding) - var(--control-btn-gap)) * 0.5
    );
    --joystick-base-size: clamp(126px, 22.5dvh, 228px);
    --control-btn-size: var(--control-btn-size-raw);
    --control-btn-bottom: clamp(2px, 0.9dvh, 10px);
    --control-overlay-depth: clamp(34px, 6.8dvh, 92px);
    z-index: 15;
}

.p1-gamepad .gamepad-controls {
    --control-zone-start-padding: env(safe-area-inset-left, 0px);
}

/* P2 패드는 180도 회전되므로 로컬 시작점이 실제 화면 오른쪽에 대응한다. */
.p2-gamepad .gamepad-controls {
    --control-zone-start-padding: env(safe-area-inset-right, 0px);
}

.shoot-btn-wrapper {
    --action-border-width: 5px;
    --action-radius: 34px;
    --action-track-color: var(--action-border, rgba(186, 190, 198, 0.78));
    --action-meter-color: var(--action-border, rgba(186, 190, 198, 0.78));
    position: absolute;
    left: var(--control-zone-start-padding);
    bottom: calc(var(--control-btn-bottom) + var(--control-overlay-depth));
    width: var(--control-btn-size);
    height: auto;
    aspect-ratio: 1 / 1;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.dash-btn-wrapper {
    --action-border-width: 5px;
    --action-radius: 34px;
    --action-track-color: var(--action-border, rgba(186, 190, 198, 0.78));
    --action-meter-color: var(--action-border, rgba(186, 190, 198, 0.78));
    position: absolute;
    left: calc(var(--control-zone-start-padding) + var(--control-btn-size) + var(--control-btn-gap));
    bottom: calc(var(--control-btn-bottom) + var(--control-overlay-depth));
    width: var(--control-btn-size);
    height: auto;
    aspect-ratio: 1 / 1;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.p1-gamepad .shoot-btn-wrapper {
    --action-accent: #879aad;
    --action-bg: rgba(28, 39, 49, 0.88);
    --action-border: rgba(135, 154, 173, 0.74);
    bottom: 0;
}

.p1-gamepad .dash-btn-wrapper {
    --action-accent: #d6ceaa;
    --action-bg: rgba(79, 74, 58, 0.84);
    --action-border: rgba(214, 206, 170, 0.78);
    bottom: 0;
}

.shoot-btn,
.dash-btn {
    position: relative;
    z-index: 1;
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: var(--action-radius-px, var(--action-radius));
    box-sizing: border-box;
    border: var(--action-border-width) solid transparent;
    background: var(--action-bg, rgba(32, 44, 54, 0.88));
    color: var(--action-accent, #8ea4b6);
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: clamp(1.2rem, calc(var(--control-btn-size) * 0.126), 1.64rem);
    letter-spacing: clamp(1px, calc(var(--control-btn-size) * 0.012), 1.8px);
    cursor: pointer;
    touch-action: none;
    transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
    padding: 0;
}

.dash-btn {
    font-size: clamp(1.28rem, calc(var(--control-btn-size) * 0.134), 1.78rem);
}

.shoot-btn:active:not(.on-cooldown),
.dash-btn:active:not(.on-cooldown) {
    transform: translateY(2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.shoot-btn.on-cooldown,
.dash-btn.on-cooldown,
.shoot-btn:disabled,
.dash-btn:disabled {
    background: rgba(36, 39, 45, 0.68);
    color: rgba(168, 174, 181, 0.56);
    box-shadow: none;
}

.shoot-btn:disabled + .action-border-progress,
.dash-btn:disabled + .action-border-progress {
    --action-track-color: rgba(118, 123, 132, 0.4);
    --action-meter-color: var(--action-border, rgba(186, 190, 198, 0.78));
}

.shoot-btn.on-cooldown + .action-border-progress,
.dash-btn.on-cooldown + .action-border-progress {
    --action-track-color: transparent;
}

.action-border-progress {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
    pointer-events: none;
    transform: rotate(0deg);
}

.action-border-progress-track,
.action-border-progress-meter {
    fill: none;
    stroke-width: var(--action-border-width);
    vector-effect: non-scaling-stroke;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.action-border-progress-track {
    stroke: var(--action-track-color, rgba(118, 123, 132, 0.4));
}

.action-border-progress-meter {
    stroke: var(--action-meter-color, var(--action-border, rgba(186, 190, 198, 0.78)));
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

.p2-gamepad .shoot-btn-wrapper {
    --action-accent: #ac8e8e;
    --action-bg: rgba(64, 41, 41, 0.88);
    --action-border: rgba(172, 142, 142, 0.74);
    bottom: 0;
}

.p2-gamepad .dash-btn-wrapper {
    --action-accent: #d6ceaa;
    --action-bg: rgba(79, 74, 58, 0.84);
    --action-border: rgba(214, 206, 170, 0.78);
    bottom: 0;
}

.p2-gamepad .action-border-progress {
    transform: rotate(180deg);
}

.p2-gamepad .shoot-btn:active:not(.on-cooldown),
.p2-gamepad .dash-btn:active:not(.on-cooldown) {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.p2-gamepad .shoot-btn.on-cooldown,
.p2-gamepad .dash-btn.on-cooldown,
.p2-gamepad .shoot-btn:disabled,
.p2-gamepad .dash-btn:disabled {
    background: rgba(36, 39, 45, 0.74);
    color: rgba(168, 174, 181, 0.56);
    box-shadow: none;
}

.joystick-area {
    position: absolute;
    left: 0;
    right: auto;
    bottom: 0;
    width: 100%;
    height: calc((var(--app-height, 100dvh) - env(safe-area-inset-top, 0px) - var(--app-safe-bottom)) * 0.5);
    pointer-events: auto;
    touch-action: none;
    z-index: 1;
}

.p2-gamepad .joystick-area {
    left: 0;
    right: auto;
    bottom: 0;
}

.p1-gamepad .joystick-area {
    left: 0;
    right: auto;
    bottom: 0;
    width: 100%;
}

.joystick-base {
    width: var(--joystick-base-size);
    height: var(--joystick-base-size);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(110, 200, 255, 0.36);
    background: rgba(24, 18, 13, 0.44);
    box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.42), 0 0 10px rgba(110, 200, 255, 0.16);
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
}

.joystick-area.is-active .joystick-base {
    opacity: 1;
}

.joystick-area.is-idle-visible .joystick-base {
    opacity: 0.52;
}

.p2-gamepad .joystick-base {
    border-color: rgba(255, 107, 107, 0.36);
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.55), 0 0 10px rgba(255, 107, 107, 0.16);
}

.joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40%;
    height: 40%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle at 35% 35%, rgba(196, 233, 255, 0.95), rgba(78, 158, 209, 0.85));
    box-shadow: 0 0 14px rgba(110, 200, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    pointer-events: none;
}

.p2-gamepad .joystick-knob {
    background: radial-gradient(circle at 35% 35%, rgba(255, 209, 209, 0.95), rgba(200, 80, 80, 0.85));
    box-shadow: 0 0 14px rgba(255, 107, 107, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.field-section {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--bg-dark);
    overflow: hidden;
    position: relative;
}

.field-inner {
    position: relative;
    height: 100%;
    border: 2px solid rgba(168, 134, 91, 0.55);
    border-radius: 12px;
    overflow: hidden;
    background: var(--field-bg);
    box-shadow: 0 0 20px rgba(168, 134, 91, 0.12), inset 0 0 30px rgba(0, 0, 0, 0.35);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#game-canvas.field-rotated-180 {
    transform: rotate(180deg);
    transform-origin: center center;
}

.map-badge {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: var(--game-font-family);
    font-size: clamp(0.62rem, 1.8vw, 0.74rem);
    letter-spacing: 0.7px;
    color: #f2debf;
    background: rgba(24, 17, 12, 0.8);
    border: 1px solid rgba(168, 134, 91, 0.28);
    pointer-events: none;
}

.field-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.field-overlay.show {
    opacity: 1;
}

.field-overlay-text {
    --overlay-text-rotation: 0deg;
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: clamp(3rem, 12vw, 5rem);
    color: var(--countdown-text-color);
    text-shadow: 0 0 30px var(--countdown-text-glow),
        0 0 60px var(--countdown-text-glow);
    animation: pulseText 0.6s ease-in-out infinite alternate;
}

.field-overlay-text.overlay-text-p2-view {
    --overlay-text-rotation: 180deg;
}

.field-overlay-text.score-announcement-text {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
}

.entry-start-overlay {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    background: radial-gradient(circle at 50% 50%, rgba(35, 24, 14, 0.2) 0%, rgba(0, 0, 0, 0.78) 72%);
}

.entry-start-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.entry-start-btn {
    position: absolute;
    left: 50%;
    top: calc(50% + ((env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 0.5) - (var(--global-ad-banner-reserved, 0px) * 0.5));
    transform: translate(-50%, -50%);
    overflow: hidden;
    min-width: clamp(180px, 46vw, 300px);
    min-height: clamp(66px, 11dvh, 88px);
    padding: 0 24px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(180deg, rgba(248, 205, 137, 0.98) 0%, rgba(217, 145, 70, 0.98) 100%);
    color: #111315;
    font-family: var(--game-font-family);
    font-size: clamp(1.34rem, 5.3vw, 1.92rem);
    letter-spacing: 0.5px;
    box-shadow: 0 0 28px rgba(248, 188, 94, 0.58), 0 8px 20px rgba(0, 0, 0, 0.48);
    cursor: pointer;
    animation: entry-start-pulse 1.5s ease-in-out infinite;
}

.entry-start-btn > span {
    position: relative;
    z-index: 2;
}

.entry-start-btn::after {
    content: '';
    position: absolute;
    top: -45%;
    left: -68%;
    width: 46%;
    height: 190%;
    transform: skewX(-18deg);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.52) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    z-index: 1;
    pointer-events: none;
    animation: entry-start-sweep 2.4s linear infinite;
}

.entry-start-btn:active {
    transform: translate(-50%, -50%) scale(0.98);
}

@keyframes entry-start-pulse {
    0% {
        box-shadow: 0 0 18px rgba(248, 188, 94, 0.4), 0 8px 20px rgba(0, 0, 0, 0.45);
    }

    50% {
        box-shadow: 0 0 34px rgba(252, 205, 124, 0.82), 0 10px 22px rgba(0, 0, 0, 0.55);
    }

    100% {
        box-shadow: 0 0 18px rgba(248, 188, 94, 0.4), 0 8px 20px rgba(0, 0, 0, 0.45);
    }
}

@keyframes entry-start-sweep {
    0% {
        left: -70%;
    }

    100% {
        left: 132%;
    }
}

.side-score-panel {
    position: absolute;
    top: 50%;
    left: max(0px, env(safe-area-inset-left));
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.side-score-box {
    width: clamp(40px, 8.4vw, 52px);
    aspect-ratio: 1 / 1;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: clamp(1rem, 3.2vw, 1.3rem);
    background: rgba(24, 17, 12, 0.82);
    border: 2px solid rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.06), 0 0 12px rgba(0, 0, 0, 0.45);
}

.side-score-p2 {
    color: var(--blue);
    border-color: rgba(255, 107, 107, 0.55);
    text-shadow: 0 0 10px var(--blue-glow);
}

.side-score-p2 .side-score-value {
    transform: rotate(180deg);
}

.side-score-p1 {
    color: var(--amber);
    border-color: rgba(110, 200, 255, 0.55);
    text-shadow: 0 0 10px var(--amber-glow);
}

.side-action-stack {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.home-btn-container {
    position: relative;
    width: 44px;
    height: 44px;
    cursor: pointer;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-btn-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.home-btn-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.16);
    stroke-width: 3;
}

.home-btn-fill {
    fill: none;
    stroke: #9a6a3a;
    stroke-width: 3;
    stroke-dasharray: 125.66;
    stroke-dashoffset: 125.66;
    stroke-linecap: round;
}

.home-btn-icon {
    font-size: 1.2rem;
    z-index: 1;
}

.rules-btn-container {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(168, 134, 91, 0.45);
    background: rgba(24, 17, 12, 0.9);
    color: var(--amber);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 8px rgba(168, 134, 91, 0.16), 0 0 10px rgba(0, 0, 0, 0.45);
}

.map-editor-btn-container {
    border-color: rgba(255, 107, 107, 0.5);
    color: var(--blue);
    box-shadow: inset 0 0 8px rgba(255, 107, 107, 0.16), 0 0 10px rgba(0, 0, 0, 0.45);
}

.rules-btn-container:active {
    transform: scale(0.95);
}

.rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 16px;
}

.rules-overlay.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.rules-book-split {
    width: min(94vw, 440px);
    max-height: min(92dvh, 760px);
    display: grid;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.rules-overlay:not(.dual-layout) .rules-book-split {
    grid-template-rows: minmax(0, 1fr);
}

.rules-overlay:not(.dual-layout) .rules-content-p2 {
    display: none;
}

.rules-content {
    width: 100%;
    max-height: none;
    background: linear-gradient(180deg, #2a1b0f 0%, #120c07 100%);
    border: 1px solid rgba(168, 134, 91, 0.35);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(168, 134, 91, 0.08);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
}

.rules-overlay.dual-layout .rules-content-p2 {
    transform: rotate(180deg);
}

.rules-content h2 {
    margin-bottom: 10px;
    text-align: center;
    font-size: clamp(1.02rem, 3.6vw, 1.16rem);
    color: #f8cd89;
}

.rules-content ul {
    list-style: none;
    display: grid;
    gap: 8px;
    color: #ffe3bb;
    font-size: clamp(0.85rem, 3vw, 0.92rem);
    line-height: 1.45;
    overflow: auto;
    padding-right: 4px;
    margin: 0;
    flex: 1;
}

.rules-content li {
    border-left: 2px solid rgba(168, 134, 91, 0.38);
    padding-left: 9px;
}

.rules-content li b {
    color: #ffd08f;
}

.close-rules-btn {
    width: 100%;
    margin-top: 12px;
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: var(--game-font-family);
    font-size: 0.98rem;
    background: linear-gradient(180deg, #f8cd89 0%, #d99146 100%);
    color: #1a120b;
    cursor: pointer;
}

.close-rules-btn:active {
    transform: scale(0.98);
}

.rules-map-footer {
    margin-top: 5px;
    color: rgba(255, 208, 143, 0.46);
    font-family: var(--game-font-family);
    font-size: 0.62rem;
    line-height: 1.1;
    text-align: right;
    padding: 1px 2px 0;
    opacity: 0.58;
}

.rules-map-name {
    color: rgba(201, 255, 231, 0.52);
    font-family: var(--game-font-family);
    font-size: 0.62rem;
    font-weight: 400;
    letter-spacing: 0.1px;
}

.map-select-overlay {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.map-select-overlay.show {
    display: flex;
}

.map-select-content {
    width: min(92vw, 390px);
    border-radius: 14px;
    border: 1px solid rgba(168, 134, 91, 0.35);
    background: linear-gradient(180deg, #2a1b0f 0%, #120c07 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(168, 134, 91, 0.08);
    padding: 18px 16px 16px;
}

.map-select-content h2 {
    margin-bottom: 6px;
    color: var(--amber);
    text-align: center;
    font-size: 1.22rem;
}

.map-select-content p {
    color: #ffe3bb;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 10px;
}

.map-select-content label {
    display: block;
    color: #ffd08f;
    font-size: 0.86rem;
    margin-bottom: 6px;
}

.map-select-content select {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(168, 134, 91, 0.35);
    background: rgba(24, 17, 12, 0.9);
    color: #ffe5c2;
    padding: 10px;
    font-family: var(--game-font-family);
    font-size: 0.9rem;
}

.map-select-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 8px;
}

.map-select-side-btn {
    border-radius: 10px;
    border: 1px solid rgba(168, 134, 91, 0.35);
    background: rgba(255, 255, 255, 0.08);
    color: #ffe5c2;
    padding: 9px 10px;
    font-family: var(--game-font-family);
    font-size: 0.92rem;
    cursor: pointer;
}

.map-select-start-btn {
    width: 100%;
    margin-top: 12px;
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    font-family: var(--game-font-family);
    font-size: 1rem;
    background: linear-gradient(180deg, var(--amber) 0%, var(--amber-dim) 100%);
    color: #1a120b;
    cursor: pointer;
    box-shadow: 0 0 14px var(--amber-glow);
}

.map-select-side-btn:active,
.map-select-start-btn:active {
    transform: scale(0.98);
}

.game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s;
}

.game-over-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.game-over-content {
    text-align: center;
    padding: 30px;
}

.winner-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: bounce-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.winner-text {
    font-family: var(--game-font-family);
    font-size: clamp(1.5rem, 6vw, 2.1rem);
    font-weight: 700;
    color: var(--amber);
    text-shadow: 0 0 20px var(--amber-glow);
    margin-bottom: 20px;
}

.shared-game-over #winner-text {
    font-size: clamp(1.05rem, 4vw, 1.45rem) !important;
}

.winner-score {
    display: none;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    color: var(--text-dim);
    margin-bottom: 0;
}

.final-scores {
    font-family: var(--game-font-family);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 25px;
}

.final-score-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.final-score-row:first-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.final-score-row:first-child span:last-child {
    color: var(--amber);
}

.final-score-row:last-child span:last-child {
    color: var(--blue);
}

.go-btn {
    display: block;
    width: 200px;
    margin: 8px auto;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-family: var(--game-font-family);
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.go-btn:active {
    transform: scale(0.95) translateY(2px);
}

.restart-btn {
    background: linear-gradient(180deg, var(--amber), var(--amber-dim));
    color: #1a120b;
    box-shadow: 0 0 15px var(--amber-glow), 0 4px 0 #5f452d;
}

.hub-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.flash-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
}

.flash-overlay.flash-hit {
    animation: flash-hit 0.35s ease-out;
}

@keyframes pulseText {
    from {
        transform: rotate(var(--overlay-text-rotation)) scale(1);
        opacity: 0.9;
    }

    to {
        transform: rotate(var(--overlay-text-rotation)) scale(1.05);
        opacity: 1;
    }
}

@keyframes pulse-text {
    from {
        transform: rotate(var(--overlay-text-rotation)) scale(1);
        opacity: 0.9;
    }

    to {
        transform: rotate(var(--overlay-text-rotation)) scale(1.05);
        opacity: 1;
    }
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes flash-hit {
    0% {
        opacity: 0.82;
        background: rgba(168, 134, 91, 0.9);
    }

    100% {
        opacity: 0;
        background: transparent;
    }
}

@media (max-height: 600px) {
    .gamepad-section {
        flex-basis: clamp(76px, 12.4dvh, 104px);
    }

    .gamepad-controls {
        --control-overlay-depth: clamp(20px, 4.5dvh, 56px);
        --joystick-base-size: clamp(104px, 18.5dvh, 168px);
    }

    .shoot-btn,
    .dash-btn {
        font-size: clamp(1rem, 2.5dvh, 1.24rem);
        letter-spacing: 0.5px;
    }

    .dash-btn {
        font-size: clamp(1.06rem, 2.7dvh, 1.34rem);
    }
}
