/* ============================================
   Yacht Dice - 주사위 대결
   2 Player VS 컬렉션
   ============================================ */

/* CSS Variables */
:root {
    --bg-dark: #1a3a52;
    --bg-medium: #2d5a7b;
    --bg-light: #3d7a9b;
    --cup-brown: #8b4513;
    --cup-dark: #5d3a1a;
    --dice-white: #ffffff;
    --dice-dot: #333333;
    --gold: #ffd700;
    --gold-dark: #b8860b;
    --green-select: #4caf50;
    --green-dark: #388e3c;
    --red-warning: #f44336;
    --cyan: #00bcd4;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --bonus-color: #ff9800;
    --p1-color: #4fc3f7;
    --p2-color: #ff8a65;

    /* Responsive layout scale */
    --dice-ui-scale: 1;
    --dice-section-gap-extra: 0px;
    --dice-cup-shift-y: 0px;
    --cup-width: calc(clamp(104px, 28vw, 188px) * var(--dice-ui-scale));
    --cup-height: calc(var(--cup-width) * 0.9);
    --cup-inner-padding: clamp(7px, 1.7vw, 11px);
    --cup-inner-bottom: clamp(12px, 2.8vw, 18px);
    --mini-dice-size: calc(var(--cup-width) * 0.212);
    --mini-dot-size: calc(var(--mini-dice-size) * 0.2);
    --dice-size: calc(clamp(44px, 11.8vw, 78px) * var(--dice-ui-scale));
    --dice-slot-size: calc(var(--dice-size) + (clamp(2px, 0.8vw, 5px) * var(--dice-ui-scale)));
    --dice-gap: calc(clamp(3px, 1.1vw, 8px) * var(--dice-ui-scale));
    --cup-info-width: calc(clamp(78px, 22vw, 136px) * var(--dice-ui-scale));
    --cup-info-font-size: calc(0.9rem * var(--dice-ui-scale));
    --cup-shake-duration: 180ms;
    --cup-shake-rotate: 3.4deg;
    --cup-shake-translate: 2px;
    --cup-shake-lift: 0px;

    --score-header-font: 15px;
    --score-header-player-font: 13px;
    --score-row-font: 15px;
    --score-value-font: 16px;
    --score-icon-font: 17px;
    --score-total-label-font: 13px;
    --score-total-font: 16px;
    --score-total-vs-font: 11px;
    --score-confirm-font: 15px;
    --score-col-name-fr: 5fr;
    --score-col-player-fr: 2.35fr;
    --score-col-mid-gap-fr: 0.85fr;
    --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;
    --scoreboard-max-height: 470px;
}

/* Reset */
* {
    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;
    background-color: var(--bg-medium);
    background-image: linear-gradient(180deg,
            var(--bg-dark) 0%,
            var(--bg-medium) 50%,
            var(--bg-dark) 100%);
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    margin: 0;
    overflow: hidden;
    touch-action: none;
    font-family: var(--game-font-family);
    background-color: var(--bg-medium);
    background-image: linear-gradient(180deg,
            var(--bg-dark) 0%,
            var(--bg-medium) 50%,
            var(--bg-dark) 100%);
    color: var(--text-primary);
    overscroll-behavior: none;
    -webkit-touch-callout: none;
}

/* ============================================
   메인 컨테이너
   ============================================ */
.game-container {
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.game-container.entry-layout-pending .dice-section,
.game-container.entry-layout-pending .scoreboard-section,
.game-container.entry-layout-pending .header-section,
.game-container.entry-layout-pending .turn-announcement {
    visibility: hidden;
    pointer-events: none;
}

.game-container.entry-layout-pending> :not(.entry-start-overlay) {
    visibility: hidden;
    pointer-events: none;
}

/* ============================================
   상단: 턴 정보
   ============================================ */
/* Entry Start Overlay */
.entry-start-overlay {
    position: absolute;
    inset: 0;
    z-index: 1200;
    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(26, 58, 82, 0.2) 0%, rgba(0, 0, 0, 0.8) 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(111, 204, 255, 0.96) 0%, rgba(41, 133, 194, 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(79, 195, 247, 0.48), 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.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(79, 195, 247, 0.34), 0 8px 20px rgba(0, 0, 0, 0.45);
    }

    50% {
        box-shadow: 0 0 30px rgba(111, 204, 255, 0.74), 0 10px 22px rgba(0, 0, 0, 0.56);
    }

    100% {
        box-shadow: 0 0 18px rgba(79, 195, 247, 0.34), 0 8px 20px rgba(0, 0, 0, 0.45);
    }
}

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

    100% {
        left: 132%;
    }
}

.header-section {
    flex: 0 0 auto;
    padding: 8px 16px;
    padding-top: calc(8px + env(safe-area-inset-top));
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
}

/* 룰 버튼 */
.rules-btn {
    position: absolute;
    left: 12px;
    z-index: 1210;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rules-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.round-info {
    position: absolute;
    left: 16px;
}

.round-badge {
    position: absolute;
    right: 64px;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.current-turn-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.turn-emoji {
    font-size: 1.5rem;
    animation: turnEmojiBounce 1s ease-in-out infinite;
}

@keyframes turnEmojiBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.turn-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.turn-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 홈 버튼 */
.home-btn-container {
    position: absolute;
    right: 12px;
    z-index: 1210;
    width: 44px;
    height: 44px;
    cursor: pointer;
}

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

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

.home-btn-fill {
    fill: none;
    stroke: var(--p1-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
}

.home-btn-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
}

/* ============================================
   중앙: 주사위 영역
   ============================================ */
.dice-section {
    flex: 3.5 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: calc(8px * var(--dice-ui-scale)) 6px calc(10px * var(--dice-ui-scale));
    gap: calc((8px * var(--dice-ui-scale)) + var(--dice-section-gap-extra));
    min-height: 0;
    position: relative;
}

.dice-cup-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cup-width) minmax(0, 1fr);
    align-items: center;
    column-gap: calc(clamp(8px, 2.4vw, 16px) * var(--dice-ui-scale));
    width: 100%;
    height: var(--cup-height);
    min-height: var(--cup-height);
    margin-inline: auto;
    padding-inline: clamp(2px, 1vw, 8px);
    position: relative;
    transform: translateY(var(--dice-cup-shift-y));
}

/* 통 컨테이너 (버튼 겹침용) */
.dice-cup-container {
    grid-column: 2;
    position: relative;
    width: var(--cup-width);
    height: var(--cup-height);
    justify-self: center;
}

/* 굴리기 버튼 (통 위에 투명하게 겹침) */
.roll-btn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    border-radius: 12px 12px 24px 24px;
    cursor: pointer;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.roll-btn:active:not(:disabled) {
    background: transparent;
}

.roll-btn:disabled {
    cursor: not-allowed;
}

.cup-right-info {
    grid-column: 3;
    justify-self: start;
    align-self: center;
    position: static;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(clamp(2px, 1vw, 5px) * var(--dice-ui-scale));
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: var(--cup-info-width);
}

.rolls-display,
.combo-hint {
    border-radius: 20px;
    font-weight: 700;
    white-space: nowrap;
    align-self: flex-start;
}

.rolls-display {
    padding: clamp(4px, 1vh, 7px) clamp(8px, 2.4vw, 12px);
    font-size: var(--cup-info-font-size);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: calc(var(--cup-info-font-size) + (2 * clamp(4px, 1vh, 7px)) + 2px);
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--gold);
    color: var(--gold);
    margin-top: clamp(6px, 1.4vh, 12px);
}

.combo-hint {
    opacity: 0;
    visibility: hidden;
    display: inline-flex;
    padding: clamp(4px, 1vh, 7px) clamp(8px, 2.4vw, 12px);
    font-size: var(--cup-info-font-size);
    min-height: calc(var(--cup-info-font-size) + (2 * clamp(4px, 1vh, 7px)) + 2px);
    align-items: center;
    justify-content: flex-start;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    background: linear-gradient(180deg, #d4a017 0%, #b8860b 100%);
    border: 1px solid var(--gold);
    color: #2f2200;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s, visibility 0.2s;
}

.combo-hint.show {
    opacity: 1;
    visibility: visible;
    animation: comboHintPop 0.3s ease-out;
}

.combo-hint:active {
    transform: scale(0.97);
}

@keyframes comboHintPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    70% {
        transform: scale(1.1);
    }

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

.dice-cup {
    width: var(--cup-width);
    height: var(--cup-height);
    background: linear-gradient(180deg, var(--cup-brown) 0%, var(--cup-dark) 100%);
    border-radius: 12px 12px 24px 24px;
    position: relative;
    cursor: pointer;
    box-shadow:
        inset 0 5px 15px rgba(255, 255, 255, 0.2),
        inset 0 -5px 15px rgba(0, 0, 0, 0.3),
        0 5px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
}

.dice-cup:active {
    transform: scale(0.98);
}

.dice-cup.shaking {
    animation: cupShake var(--cup-shake-duration) cubic-bezier(0.22, 1, 0.36, 1) infinite;
    will-change: transform;
}

@keyframes cupShake {

    0%,
    100% {
        transform: rotate(0deg) translate3d(0, 0, 0);
    }

    25% {
        transform: rotate(calc(var(--cup-shake-rotate) * -0.74)) translate3d(calc(var(--cup-shake-translate) * -0.82), calc(var(--cup-shake-lift) * -1), 0);
    }

    50% {
        transform: rotate(calc(var(--cup-shake-rotate) * 0.24)) translate3d(calc(var(--cup-shake-translate) * 0.18), calc(var(--cup-shake-lift) * 0.35), 0);
    }

    75% {
        transform: rotate(var(--cup-shake-rotate)) translate3d(var(--cup-shake-translate), calc(var(--cup-shake-lift) * -0.76), 0);
    }
}

.dice-cup.shake-ready {
    animation: cupShakeReady 0.3s ease-in-out;
}

@keyframes cupShakeReady {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.dice-cup.rolling {
    animation: cupRoll 0.5s ease-out;
}

@keyframes cupRoll {
    0% {
        transform: rotate(0deg) translateY(0);
    }

    50% {
        transform: rotate(180deg) translateY(-20px);
    }

    100% {
        transform: rotate(180deg) translateY(0);
    }
}

.dice-cup.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    /* 터치/클릭 차단 */
}

.cup-inner {
    position: absolute;
    top: var(--cup-inner-padding);
    left: var(--cup-inner-padding);
    right: var(--cup-inner-padding);
    bottom: var(--cup-inner-bottom);
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px 8px 16px 16px;
    overflow: hidden;
}

#kept-dice-in-cup {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    align-items: center;
    justify-items: center;
    gap: clamp(1px, 0.6vw, 3px);
    padding: clamp(2px, 1vw, 5px);
}

/* 통 안의 주사위 */
.dice-in-cup {
    width: var(--mini-dice-size);
    height: var(--mini-dice-size);
    background: var(--dice-white);
    border-radius: 3px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: clamp(1px, 0.5vw, 2px);
    gap: 0px;

    /* 3D Extrusion (Front face remains perfectly square) */
    transform: translate(-3px, -3px) scale(0.95);
    box-shadow:
        1px 1px 0 #eeeeee,
        2px 2px 0 #dddddd,
        3px 3px 0 #cccccc,
        4px 4px 0 #bbbbbb,
        5px 5px 0 #aaaaaa,
        6px 6px 5px rgba(0, 0, 0, 0.5);
    margin: 2px;
}

.mini-dice-dot {
    width: var(--mini-dot-size);
    height: var(--mini-dot-size);
    background: var(--dice-dot);
    border-radius: 50%;
    justify-self: center;
    align-self: center;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* 킵된 주사위 (통 안) - legacy */
.kept-dice-mini {
    width: 16px;
    height: 16px;
    background: var(--dice-white);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: var(--dice-dot);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ============================================
   주사위 결과 영역
   ============================================ */
.dice-result-area {
    display: flex;
    justify-content: center;
    gap: var(--dice-gap);
    width: 100%;
}

.dice-slot {
    width: var(--dice-slot-size);
    height: var(--dice-slot-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dice {
    width: var(--dice-size);
    height: var(--dice-size);
    background: var(--dice-white);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    box-shadow:
        0 3px 0 #ccc,
        0 5px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    transform-style: preserve-3d;
}

.dice:active {
    transform: scale(0.95);
}

.dice[data-kept="true"] {
    box-shadow:
        0 0 0 3px var(--gold),
        0 3px 0 var(--gold-dark),
        0 5px 15px rgba(255, 215, 0, 0.5);
    transform: translateY(-5px);
}

.dice.combo-highlight {
    animation: diceGlow 0.8s ease-in-out infinite alternate;
}

@keyframes diceGlow {
    0% {
        box-shadow:
            0 0 5px var(--gold),
            0 0 10px var(--gold),
            0 3px 0 #ccc;
    }

    100% {
        box-shadow:
            0 0 15px var(--gold),
            0 0 25px var(--gold),
            0 0 35px rgba(255, 215, 0, 0.5),
            0 3px 0 #ccc;
    }
}

.dice[data-kept="true"]::after {
    content: '🔒';
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: 0.9rem;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

.dice.rolling {
    animation: diceRoll 0.6s ease-out;
}

@keyframes diceRoll {
    0% {
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: rotateX(360deg) rotateY(180deg) rotateZ(90deg) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: rotateX(720deg) rotateY(360deg) rotateZ(180deg) scale(1);
        opacity: 1;
    }
}

.dice.landing {
    animation: diceLand 0.2s ease-out;
}

@keyframes diceLand {
    0% {
        transform: translateY(-10px);
    }

    50% {
        transform: translateY(2px);
    }

    100% {
        transform: translateY(0);
    }
}

.dice.hidden {
    opacity: 0;
    transform: scale(0) translateY(-50px);
    pointer-events: none;
}

/* 주사위 나오는 애니메이션 */
/* 주사위 통으로 들어가는 애니메이션 */
.dice.going-in {
    animation: diceGoingIn 0.35s ease-in forwards;
    pointer-events: none;
}

@keyframes diceGoingIn {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    40% {
        opacity: 1;
        transform: scale(0.9) translateY(-20px);
    }

    100% {
        opacity: 0;
        transform: scale(0.3) translateY(-120px);
    }
}

/* 주사위 나오는 애니메이션 (바운스 포함) */
.dice.coming-out {
    animation: diceComingOut 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes diceComingOut {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-120px);
    }

    50% {
        opacity: 1;
        transform: scale(1.08) translateY(4px);
    }

    70% {
        transform: scale(0.98) translateY(-2px);
    }

    85% {
        transform: scale(1.02) translateY(1px);
    }

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

/* 주사위 눈금 */
.dice-face {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: calc(clamp(2px, 0.8vw, 4px) * var(--dice-ui-scale));
    gap: 1px;
}

.dice-dot {
    width: calc(clamp(8px, 2.3vw, 12px) * var(--dice-ui-scale));
    height: calc(clamp(8px, 2.3vw, 12px) * var(--dice-ui-scale));
    background: var(--dice-dot);
    border-radius: 50%;
    justify-self: center;
    align-self: center;
}

/* ============================================
   게임 메시지
   ============================================ */
.game-message {
    font-size: calc(clamp(0.8rem, 2.2vw, 0.95rem) * var(--dice-ui-scale));
    line-height: 1.2;
    color: var(--text-secondary);
    text-align: center;
    padding: calc(2px * var(--dice-ui-scale)) 12px;
    height: calc((2 * 1.2em) + (4px * var(--dice-ui-scale)));
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* 확정 버튼 행 */
.confirm-row {
    display: flex !important;
    align-items: stretch;
    justify-content: center;
    background: transparent;
    border-radius: 6px;
    padding: 0;
    min-height: 0;
}

.confirm-mini-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--game-font-family);
    font-size: var(--score-confirm-font);
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(180deg, var(--green-select) 0%, var(--green-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
    white-space: nowrap;
}

.confirm-mini-btn:active {
    transform: scale(0.97);
    background: var(--green-dark);
}

/* 턴 알림 */
.turn-announcement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(var(--turn-announcement-rotation, 0deg)) scale(0.9);
    min-width: clamp(190px, 52vw, 330px);
    max-width: min(88vw, 420px);
    padding: 16px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 14px;
    border: 1px solid rgba(242, 221, 189, 0.92);
    background: linear-gradient(180deg, rgba(247, 233, 207, 0.95) 0%, rgba(174, 141, 95, 0.96) 100%);
    box-shadow: 0 10px 24px rgba(19, 14, 9, 0.36);
    opacity: 0;
    pointer-events: none;
    z-index: 255;
}

.turn-announcement.p2-perspective {
    --turn-announcement-rotation: 180deg;
}

.turn-announcement.show {
    animation: chess-turn-announce 1.45s ease-out forwards;
}

@keyframes chess-turn-announce {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(var(--turn-announcement-rotation, 0deg)) scale(0.82);
    }

    16% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(var(--turn-announcement-rotation, 0deg)) scale(1.03);
    }

    68% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(var(--turn-announcement-rotation, 0deg)) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(var(--turn-announcement-rotation, 0deg)) scale(0.95);
    }
}

.turn-announcement-emoji {
    font-size: 2rem;
    line-height: 1;
}

.turn-announcement-text {
    font-family: var(--game-font-family);
    font-size: clamp(0.95rem, 3.6vw, 1.08rem);
    font-weight: 700;
    color: #2f2112;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.42);
}

/* 확정 오버레이 */
.confirm-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95) 0%, rgba(56, 142, 60, 0.95) 100%);
    padding: 16px 30px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease-out;
}

.confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.confirm-category {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.confirm-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.confirm-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.confirm-btn,
.cancel-btn {
    padding: 10px 24px;
    font-family: var(--game-font-family);
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.confirm-btn {
    background: white;
    color: var(--green-dark);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.confirm-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.cancel-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.85rem;
    padding: 6px 16px;
}

.cancel-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.game-message.highlight {
    color: var(--gold);
    font-weight: 700;
    animation: messageHighlight 0.5s ease-out;
}

@keyframes messageHighlight {
    0% {
        transform: scale(1.1);
    }

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

/* ============================================
   하단: 점수판
   ============================================ */
.scoreboard-section {
    flex: 6.5 0 0;
    max-height: var(--scoreboard-max-height);
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    min-height: 0;
    position: relative;
    padding-bottom: max(4px, var(--app-safe-bottom));
}

.scoreboard-header {
    display: none;
}

.header-left {
    display: flex;
    align-items: center;
    padding-left: 4px;
}

.header-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.header-player.active {
    background: rgba(255, 215, 0, 0.2);
    border-radius: 6px;
    padding: 2px;
    margin: -2px;
}

.header-emoji {
    font-size: 1rem;
}

.header-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#header-p1 .header-name {
    color: var(--p1-color);
}

#header-p2 .header-name {
    color: var(--p2-color);
}

.scoreboard-body {
    flex: 1 1 0;
    overflow: hidden;
    padding: clamp(3px, 0.9vw, 5px);
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.9vw, 5px);
    min-height: 0;
    height: 100%;
}

/* 2열 레이아웃 */
.score-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(3px, 0.9vw, 5px);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.score-column {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: clamp(3px, 0.8vw, 5px);
    overflow: hidden;
    min-height: 0;
}

/* 점수 행들을 담는 컨테이너 - 모든 행 균등 분배 */
.score-column>.score-row-compact {
    flex: 1;
}

.column-header {
    display: grid;
    grid-template-columns: var(--score-col-name-fr) var(--score-col-player-fr) var(--score-col-mid-gap-fr) var(--score-col-player-fr);
    font-size: var(--score-header-font);
    font-weight: 700;
    padding: clamp(4px, 0.9vh, 6px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: clamp(1px, 0.3vh, 3px);
    gap: clamp(1px, 0.45vw, 3px);
    flex-shrink: 0;
}

.column-header .col-title {
    color: var(--gold);
}

.column-header .col-p1,
.column-header .col-p2 {
    text-align: center;
    font-size: var(--score-header-player-font);
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
    word-break: keep-all;
    line-height: 1;
    display: block;
}

.column-header .col-p1 {
    color: var(--p1-color);
}

.column-header .col-p2 {
    color: var(--p2-color);
}

.score-row-compact {
    display: grid;
    grid-template-columns: var(--score-col-name-fr) var(--score-col-player-fr) var(--score-col-mid-gap-fr) var(--score-col-player-fr);
    align-items: center;
    padding: clamp(2px, 0.55vh, 5px) clamp(4px, 1.1vw, 7px);
    border-radius: 6px;
    font-size: var(--score-row-font);
    gap: clamp(1px, 0.45vw, 3px);
}

.score-mid-gap {
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.score-row-compact.selectable {
    cursor: pointer;
    touch-action: manipulation;
    background: rgba(76, 175, 80, 0.15);
}

.score-row-compact.selectable:active {
    background: rgba(76, 175, 80, 0.3);
}

.score-row-compact.selected {
    background: rgba(76, 175, 80, 0.4);
    box-shadow: 0 0 0 1px var(--green-select);
}

.score-row-compact.bonus-row {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    grid-template-columns: var(--score-col-name-fr) var(--score-col-player-fr) var(--score-col-mid-gap-fr) var(--score-col-player-fr);
}

.score-row-compact.bonus-row .cat-name {
    font-size: calc(var(--score-row-font) * 0.88);
}

.score-row-compact.bonus-row .score-val {
    font-size: calc(var(--score-value-font) * 0.84);
    text-overflow: clip;
    min-width: 0;
    justify-self: stretch;
}

.score-row-compact.bonus-row .score-val.bonus-progress {
    font-size: calc(var(--score-value-font) * 0.72);
    letter-spacing: -0.03em;
}

.cat-name {
    font-size: var(--score-row-font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: clamp(2px, 0.7vw, 4px);
    min-width: 0;
}

.cat-icon {
    font-size: var(--score-icon-font);
    line-height: 1;
}

.cat-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.die-face-icon {
    display: block;
    flex-shrink: 0;
    width: calc(var(--score-icon-font) * 1.18);
    height: calc(var(--score-icon-font) * 1.18);
    transform: translateY(-0.02em);
}

.die-face-body {
    fill: var(--dice-white);
    stroke: rgba(0, 0, 0, 0.12);
    stroke-width: 3;
}

.die-face-pip {
    fill: var(--dice-dot);
}

.score-val {
    text-align: center;
    font-weight: 700;
    font-size: var(--score-value-font);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

.score-val.used {
    color: var(--text-secondary);
}

.score-val.preview {
    color: var(--green-select);
    background: none;
}

.score-val.earned {
    color: var(--bonus-color);
}

.score-val.last-confirmed {
    color: #ffe082 !important;
    background: rgba(255, 215, 0, 0.15);
}

.score-val.last-confirmed {
    display: grid;
    place-items: center;
    width: 1.70em;
    height: 1.70em;
    margin-inline: auto;
    border-radius: 0;
    overflow: hidden;
    text-overflow: clip;
}

/* 총점 행 */
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: clamp(4px, 0.8vh, 7px) clamp(7px, 1.8vw, 11px);
    flex-shrink: 0;
}

.total-label {
    font-size: var(--score-total-label-font);
    font-weight: 700;
    color: var(--gold);
}

.total-scores {
    display: flex;
    align-items: center;
    gap: clamp(5px, 1.6vw, 8px);
    font-size: var(--score-total-font);
    font-weight: 700;
}

.total-p1 {
    color: var(--p1-color);
    text-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
}

.total-p2 {
    color: var(--p2-color);
    text-shadow: 0 0 8px rgba(255, 138, 101, 0.5);
}

.total-vs {
    font-size: var(--score-total-vs-font);
    color: var(--text-muted);
}

/* 점수 행 */
.score-row {
    display: grid;
    grid-template-columns: 1fr 55px 55px;
    padding: 3px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    align-items: center;
    transition: background 0.2s;
    min-height: 0;
}

.score-row.section-header {
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.6rem;
    color: var(--text-muted);
    padding: 2px 8px;
}

.score-row.bonus-row {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
    margin: 2px 4px;
    border-radius: 4px;
    padding: 2px 8px;
}

.score-row.total-row {
    background: rgba(255, 215, 0, 0.15);
    border-top: 2px solid var(--gold);
    margin-top: auto;
    padding: 6px 8px;
}

.score-row.total-row .category-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
}

.score-cell.total-score {
    font-size: 0.9rem;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.score-row.selectable {
    cursor: pointer;
}

.score-row.selectable:active {
    background: rgba(76, 175, 80, 0.3);
}

.category-cell {
    display: flex;
    align-items: center;
    gap: 4px;
}

.category-icon {
    font-size: 0.8rem;
}

.category-name {
    font-size: 0.7rem;
}

.score-cell {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px;
    border-radius: 3px;
}

.score-cell.used {
    color: var(--text-secondary);
}

.score-cell.preview {
    color: var(--gold);
    background: rgba(255, 215, 0, 0.15);
    animation: previewPulse 1s ease-in-out infinite;
}

.score-cell.selectable {
    background: rgba(76, 175, 80, 0.3);
    color: var(--green-select);
    cursor: pointer;
    border: 1px solid var(--green-select);
}

.score-cell.selectable:active {
    transform: scale(0.95);
}

.score-cell.empty {
    color: var(--text-muted);
}

@keyframes previewPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}


/* ============================================
   콤보 팝업
   ============================================ */
.combo-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border-radius: 20px;
    width: min(92vw, 620px);
    max-width: 92vw;
    min-width: 0;
    padding: clamp(22px, 4.8vw, 30px) clamp(20px, 7.8vw, 50px);
    text-align: center;
    z-index: 200;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
}

.combo-popup.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.combo-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    animation: comboIconBounce 0.5s ease-out;
}

@keyframes comboIconBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

.combo-name {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--bg-dark);
    margin-bottom: 5px;
    white-space: nowrap;
    max-width: 100%;
}

.combo-score {
    font-size: 1.4rem;
    line-height: 1.2;
    color: var(--bg-dark);
    white-space: nowrap;
    max-width: 100%;
}

/* ============================================
   게임 오버 오버레이
   ============================================ */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    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;
}

.game-over-content .winner-emoji {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: winnerEmojiBounce 1s ease-out infinite;
}

@keyframes winnerEmojiBounce {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

.game-over-content h1 {
    font-size: 2.5rem;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    margin-bottom: 20px;
}

.game-over-content #winner-score {
    display: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

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

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

#restart-btn,
#hub-btn {
    display: block;
    width: 100%;
    max-width: 250px;
    margin: 10px auto;
    padding: 14px 25px;
    font-family: var(--game-font-family);
    font-size: 1.1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
}

#restart-btn {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    box-shadow: 0 4px 0 #8b6914;
}

#hub-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

#game-over .game-over-board-view-btn {
    display: block;
    width: 100%;
    max-width: 250px;
    margin: 6px auto 10px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    font-family: var(--game-font-family);
    font-size: 0.93rem;
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
}

#game-over .game-over-board-view-btn:active {
    transform: scale(0.98);
}

#game-over .game-over-return-btn {
    display: none;
    position: fixed;
    left: 50%;
    bottom: max(16px, var(--app-safe-bottom));
    transform: translateX(-50%);
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-family: var(--game-font-family);
    font-size: 0.95rem;
    color: #111;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

#game-over .game-over-return-btn:active {
    transform: translateX(-50%) scale(0.98);
}

#game-over.board-view {
    background: transparent;
    pointer-events: none;
}

#game-over.board-view .game-over-content {
    display: none;
}

#game-over.board-view .game-over-return-btn {
    display: block;
    pointer-events: auto;
}

#home-btn-container.board-view-disabled,
#surrender-btn-container.board-view-disabled {
    opacity: 0.45;
    filter: saturate(0.75);
    pointer-events: none;
}

/* ============================================
   플래시 효과
   ============================================ */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 400;
}

.flash-overlay.flash {
    animation: flashEffect 0.3s ease-out;
}

@keyframes flashEffect {
    0% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
    }
}

.flash-overlay.yacht-flash {
    background: linear-gradient(135deg, var(--gold) 0%, #ff6b6b 50%, var(--gold) 100%);
    animation: yachtFlash 1s ease-out;
}

@keyframes yachtFlash {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 0.9;
    }

    40% {
        opacity: 0.3;
    }

    60% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.2;
    }

    100% {
        opacity: 0;
    }
}

/* ============================================
   반응형
   ============================================ */
@media (max-height: 600px) {
    :root {
        --cup-width: calc(clamp(82px, 24vw, 116px) * var(--dice-ui-scale));
        --dice-size: calc(clamp(34px, 10.5vw, 48px) * var(--dice-ui-scale));
    }

    .dice-section {
        padding: calc(6px * var(--dice-ui-scale));
        gap: calc((6px * var(--dice-ui-scale)) + var(--dice-section-gap-extra));
    }
}

@media (max-width: 360px) {
    :root {
        --cup-width: calc(clamp(84px, 27vw, 112px) * var(--dice-ui-scale));
        --dice-size: calc(clamp(36px, 11vw, 46px) * var(--dice-ui-scale));
    }

    .turn-name {
        font-size: 1rem;
    }

    .score-column {
        padding: 3px;
    }

    .score-row-compact {
        padding: 2px 4px;
    }

}

/* ============================================
   룰 오버레이
   ============================================ */
.rules-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

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

.rules-content {
    background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-dark) 100%);
    border-radius: 16px;
    padding: 18px 18px 16px;
    max-width: 360px;
    width: min(92vw, 360px);
    max-height: min(82vh, 760px);
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rules-content h2 {
    text-align: center;
    font-size: clamp(1.02rem, 3.8vw, 1.18rem);
    color: var(--gold);
    margin-bottom: 12px;
}

.rules-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rules-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 12px 12px 10px;
}

.rules-section h3 {
    font-size: 0.92rem;
    color: var(--cyan);
    margin-bottom: 8px;
}

.rules-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rules-section li {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.42;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rules-section li:last-child {
    border-bottom: none;
}

.rules-section li b {
    color: var(--text-primary);
}

.rules-tip {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.84rem;
    color: var(--gold);
    line-height: 1.4;
    text-align: left;
    margin-top: 12px;
}

.close-rules-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 10px 12px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
    border: none;
    border-radius: 10px;
    font-family: var(--game-font-family);
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 0 #8b6914;
}

.close-rules-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #8b6914;
}

/* ============================================
   항복 버튼
   ============================================ */
.surrender-btn-container {
    position: absolute;
    left: 62px;
    width: 44px;
    height: 44px;
    cursor: pointer;
}

.surrender-btn-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

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

.surrender-btn-fill {
    fill: none;
    stroke: var(--p1-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 126;
    stroke-dashoffset: 126;
}

.surrender-btn-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    line-height: 1;
}

/* 항복 확인 모달 */
.surrender-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.surrender-overlay.show {
    opacity: 1;
    visibility: visible;
}

.surrender-content {
    background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-dark) 100%);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    border: 2px solid var(--red-warning);
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.surrender-overlay.show .surrender-content {
    transform: scale(1);
}

.surrender-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.surrender-content h2 {
    font-family: var(--game-font-family);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.surrender-warning {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.surrender-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.surrender-cancel-btn,
.surrender-confirm-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-family: var(--game-font-family);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.surrender-cancel-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.surrender-cancel-btn:active {
    background: rgba(255, 255, 255, 0.3);
}

.surrender-confirm-btn {
    background: linear-gradient(180deg, var(--red-warning) 0%, #c62828 100%);
    color: white;
    box-shadow: 0 3px 0 #8b1a1a;
}

.surrender-confirm-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #8b1a1a;
}

/* ============================================
   점수 카운트업 애니메이션
   ============================================ */
.score-countup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--game-font-family);
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8),
        0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 150;
    pointer-events: none;
    opacity: 0;
}

.score-countup.show {
    animation: scoreCountUp 0.8s ease-out forwards;
}

@keyframes scoreCountUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    60% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.8);
    }
}

/* ============================================
   Yacht 색종이 파티클
   ============================================ */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 350;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

.confetti.show {
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}
