/* ============================================
   Air Hockey - 에어하키 게임 스타일
   테마: 네온 옐로 사이버
   ============================================ */

:root {
    /* 메인 컬러 */
    --neon-green: #ffef66;
    --neon-green-dim: #c6a51e;
    --neon-green-glow: rgba(255, 239, 102, 0.42);
    --board-accent: #ffef66;
    --board-accent-dim: #c6a51e;
    --board-accent-glow: rgba(255, 239, 102, 0.42);
    --countdown-text-color: #ffef66;
    --countdown-text-glow: var(--board-accent-glow);
    --dark-bg: #171304;
    --dark-bg-medium: #241c08;
    --field-bg: #120d03;
    --field-line: rgba(255, 239, 102, 0.24);

    /* 플레이어 컬러 */
    --p1-color: #6ec8ff;
    --p1-glow: rgba(110, 200, 255, 0.5);
    --p2-color: #ff6b6b;
    --p2-glow: rgba(255, 107, 107, 0.5);

    /* UI */
    --text-primary: #ffffff;
    --text-dim: #e4ddb0;
    --overlay-bg: rgba(0, 0, 0, 0.85);
    --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: var(--dark-bg);
}

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: var(--dark-bg);
    color: var(--text-primary);
}

/* ============================================
   게임 컨테이너
   ============================================ */
.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-action-stack {
    visibility: hidden;
    pointer-events: none;
}

.game-container.prestart-ui-disabled .gamepad-section .gamepad-controls,
.game-container.prestart-ui-disabled .center-score,
.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-info {
    position: relative;
    z-index: 87;
}

.game-container.prestart-ui-disabled .gamepad-info .gp-emoji,
.game-container.prestart-ui-disabled .gamepad-info .gp-name {
    position: relative;
    z-index: 88;
}

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

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

.game-container.countdown-controls-disabled .dash-btn {
    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,
.game-container.p2-ai-opponent .p2-gamepad .dash-btn {
    transform: rotate(180deg);
    transition: none;
}

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

/* ============================================
   게임패드 섹션 (P1, P2 공통)
   ============================================ */
.gamepad-section {
    flex: 0 0 clamp(74px, 13dvh, 118px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    touch-action: none;
    position: relative;
    z-index: 10;
    overflow: visible;
}

.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(110, 200, 255, 0.12) 0%, transparent 100%);
}

/* 게임패드 정보 */
.gamepad-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: clamp(0.76rem, 2.4vw, 0.96rem);
    white-space: nowrap;
    pointer-events: none;
    max-width: 70vw;
    padding: 0 8px;
}

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

.gp-name {
    flex: 1;
    min-width: 0;
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: 1.12em;
    opacity: 0.7;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45vw;
}

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

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

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

/* 게임패드 컨트롤 */
.gamepad-controls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    --control-zone-width: 50%;
    --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: min(var(--control-btn-size-raw), var(--joystick-base-size));
    --dash-btn-size: min(
        calc(var(--control-btn-size) * 1.5),
        calc(var(--control-zone-width) - var(--control-zone-start-padding) - var(--control-zone-end-padding))
    );
    --control-btn-bottom: clamp(2px, 0.9dvh, 10px);
    --control-overlay-depth: clamp(34px, 6.8dvh, 92px);
}

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

/* ============================================
   조이스틱
   ============================================ */
.joystick-area {
    display: none;
}

.joystick-base {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 239, 102, 0.32);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6),
        0 0 10px rgba(255, 239, 102, 0.16);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joystick-knob {
    width: 40%;
    height: 40%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255, 239, 102, 0.94), rgba(198, 165, 30, 0.82));
    box-shadow: 0 0 15px rgba(255, 239, 102, 0.5),
        0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: absolute;
    will-change: transform;
    pointer-events: none;
}

.p2-gamepad .joystick-base {
    border-color: rgba(255, 239, 102, 0.32);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6),
        0 0 10px rgba(255, 239, 102, 0.16);
}

.p2-gamepad .joystick-knob {
    background: radial-gradient(circle at 35% 35%, rgba(255, 239, 102, 0.94), rgba(198, 165, 30, 0.82));
    box-shadow: 0 0 15px rgba(255, 239, 102, 0.5),
        0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ============================================
   대시 버튼
   ============================================ */
.dash-btn-wrapper {
    --dash-border-width: 5px;
    --dash-radius: 40px;
    --dash-track-color: var(--dash-border, rgba(186, 190, 198, 0.78));
    --dash-meter-color: var(--dash-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));
    top: auto;
    transform: none;
    width: var(--dash-btn-size);
    height: auto;
    aspect-ratio: 1 / 1;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p1-gamepad .dash-btn-wrapper {
    --dash-accent: #8ea4b6;
    --dash-bg: rgba(32, 44, 54, 0.88);
    --dash-border: rgba(142, 164, 182, 0.78);
}

.p2-gamepad .dash-btn-wrapper {
    --dash-accent: #b49a9a;
    --dash-bg: rgba(70, 46, 46, 0.88);
    --dash-border: rgba(180, 154, 154, 0.78);
}

.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(--dash-radius-px, var(--dash-radius));
    box-sizing: border-box;
    border: var(--dash-border-width) solid transparent;
    background: var(--dash-bg, rgba(28, 32, 40, 0.88));
    color: var(--dash-accent, var(--p1-color));
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: clamp(1.28rem, calc(var(--dash-btn-size) * 0.134), 1.78rem);
    letter-spacing: clamp(1px, calc(var(--dash-btn-size) * 0.012), 1.8px);
    text-shadow: none;
    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:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

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

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

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

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

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

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

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

/* 사용자 기준 왼쪽: P1은 screen-left, P2는 180도 회전으로 screen-right */
.p2-gamepad .dash-btn-wrapper {
    left: var(--control-zone-start-padding);
    right: auto;
    bottom: 0;
}

.p1-gamepad .dash-btn-wrapper {
    bottom: 0;
}

/* ============================================
   에어하키 필드
   ============================================ */
.field-section {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: var(--dark-bg);
    overflow: hidden;
    position: relative;
}

.field-inner {
    position: relative;
    height: 100%;
    background: var(--field-bg);
    border: 2px solid rgba(194, 188, 160, 0.84);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 239, 102, 0.16),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
    /* width set by JS based on screen aspect ratio */
}

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

/* 골대 마커 */
.goal-marker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 4px;
    z-index: 5;
    border-radius: 2px;
}

.goal-top {
    top: 0;
    background: var(--p2-color);
    box-shadow: 0 0 12px var(--p2-glow), 0 2px 8px var(--p2-glow);
}

.goal-bottom {
    bottom: 0;
    background: var(--p1-color);
    box-shadow: 0 0 12px var(--p1-glow), 0 -2px 8px var(--p1-glow);
}

/* 중앙 점수 */
.center-score {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--game-font-family);
    font-weight: 700;
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    opacity: 0.15;
    pointer-events: none;
    z-index: 2;
    align-items: center;
    gap: 8px;
}

.cs-p1 {
    color: var(--p1-color);
}

.cs-p2 {
    color: var(--p2-color);
}

.cs-divider {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8em;
}

/* 필드 오버레이 */
.field-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

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

.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(61, 53, 16, 0.22) 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(255, 239, 102, 0.96) 0%, rgba(198, 165, 30, 0.96) 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 24px rgba(255, 239, 102, 0.42), 0 8px 20px rgba(0, 0, 0, 0.5);
    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.5) 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(255, 239, 102, 0.28), 0 8px 20px rgba(0, 0, 0, 0.45);
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 239, 102, 0.62), 0 10px 22px rgba(0, 0, 0, 0.55);
    }

    100% {
        box-shadow: 0 0 18px rgba(255, 239, 102, 0.28), 0 8px 20px rgba(0, 0, 0, 0.45);
    }
}

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

    100% {
        left: 132%;
    }
}

/* ============================================
   홈 버튼 (2초 홀드)
   ============================================ */
.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(22, 19, 7, 0.82);
    border: 2px solid rgba(255, 255, 255, 0.24);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.08), 0 0 12px rgba(0, 0, 0, 0.45);
}

.side-score-value {
    line-height: 1;
}

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

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

.side-score-p1 {
    color: var(--p1-color);
    border-color: rgba(110, 200, 255, 0.55);
    text-shadow: 0 0 10px var(--p1-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.15);
    stroke-width: 3;
}

.home-btn-fill {
    fill: none;
    stroke: var(--neon-green);
    stroke-width: 3;
    stroke-dasharray: 125.66;
    stroke-dashoffset: 125.66;
    stroke-linecap: round;
}

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

.rules-btn-container {
    position: relative;
    width: 44px;
    height: 44px;
    border: 2px solid rgba(255, 239, 102, 0.45);
    border-radius: 50%;
    background: rgba(24, 20, 7, 0.88);
    color: var(--neon-green);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 8px rgba(255, 239, 102, 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, var(--dark-bg-medium) 0%, var(--dark-bg) 100%);
    border: 1px solid rgba(255, 239, 102, 0.38);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 0 20px rgba(255, 239, 102, 0.1);
    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: var(--neon-green);
}

.rules-content ul {
    list-style: none;
    display: grid;
    gap: 8px;
    color: #efe8bf;
    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(255, 239, 102, 0.42);
    padding-left: 9px;
}

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

.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, var(--neon-green) 0%, var(--neon-green-dim) 100%);
    color: var(--dark-bg);
    cursor: pointer;
}

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

/* ============================================
   게임 오버
   ============================================ */
.game-over-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.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: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.winner-text {
    font-family: var(--game-font-family);
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 700;
    color: var(--neon-green);
    text-shadow: 0 0 20px var(--neon-green-glow);
    margin-bottom: 20px;
}

.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(--p1-color);
}

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

.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(--neon-green), var(--neon-green-dim));
    color: var(--dark-bg);
    box-shadow: 0 0 15px var(--neon-green-glow), 0 4px 0 #7a6614;
}

.hub-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    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-goal {
    animation: flashGoal 0.4s 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 bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    60% {
        transform: scale(1.15);
    }

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

@keyframes flashGoal {
    0% {
        opacity: 0.8;
        background: var(--neon-green);
    }

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

@keyframes dashPulse {
    0% {
        box-shadow: 0 0 5px var(--neon-green-glow);
    }

    50% {
        box-shadow: 0 0 30px var(--neon-green-glow), 0 0 60px var(--neon-green-glow);
    }

    100% {
        box-shadow: 0 0 5px var(--neon-green-glow);
    }
}

/* ============================================
   네온 효과 제거 오버라이드
   ============================================ */
:root {
    --neon-green-glow: rgba(255, 239, 102, 0);
    --board-accent-glow: rgba(255, 239, 102, 0);
    --countdown-text-glow: rgba(255, 239, 102, 0);
    --p1-glow: rgba(110, 200, 255, 0);
    --p2-glow: rgba(255, 107, 107, 0);
}

.p1-gamepad .gp-score,
.p2-gamepad .gp-score,
.side-score-p1,
.side-score-p2,
.field-overlay-text,
.winner-text {
    text-shadow: none;
}

.joystick-base,
.p2-gamepad .joystick-base {
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6),
        0 8px 16px rgba(0, 0, 0, 0.24);
}

.joystick-knob,
.p2-gamepad .joystick-knob {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.field-inner {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.goal-top,
.goal-bottom {
    box-shadow: none;
}

.entry-start-btn {
    box-shadow: 0 0 24px rgba(255, 239, 102, 0.42), 0 8px 20px rgba(0, 0, 0, 0.5);
    animation: entry-start-pulse 1.5s ease-in-out infinite;
}

.rules-btn-container {
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.45);
}

.rules-content {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.restart-btn {
    box-shadow: 0 4px 0 #7a6614;
}

/* ============================================
   반응형
   ============================================ */
@media (max-height: 600px) {
    .gamepad-section {
        flex-basis: clamp(64px, 10.5dvh, 88px);
    }

    .gamepad-controls {
        --joystick-base-size: clamp(104px, 18.5dvh, 168px);
    }

    .dash-btn {
        font-size: clamp(1rem, calc(var(--dash-btn-size) * 0.104), 1.28rem);
        letter-spacing: clamp(0.8px, calc(var(--dash-btn-size) * 0.01), 1.4px);
    }
}
