﻿:root {
    --bg-dark: #090d16;
    --card-bg: rgba(18, 24, 38, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --player-color: #38bdf8;
    --ai-color: #f43f5e;
    --gold: #fbbf24;
    --success: #10b981;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 20px;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.25;
    animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 450px;
    height: 450px;
    background: #6366f1;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #ec4899;
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: #06b6d4;
    top: 40%;
    left: 45%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 60px) scale(1.15); }
}

/* Container */
.game-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
.game-header {
    text-align: center;
}

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 10px;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary);
}

.game-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Card Common */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* Scoreboard */
.scoreboard {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 20px 24px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.player-score .score-label { color: var(--player-color); }
.ai-score .score-label { color: var(--ai-color); }

.score-val {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
}

.player-score .score-val { color: #e0f2fe; text-shadow: 0 0 15px rgba(56, 189, 248, 0.5); }
.ai-score .score-val { color: #ffe4e6; text-shadow: 0 0 15px rgba(244, 63, 94, 0.5); }

.score-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.streak-badge {
    background: rgba(251, 191, 36, 0.15);
    color: var(--gold);
    border: 1px solid rgba(251, 191, 36, 0.3);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
}

.vs-text {
    font-weight: 900;
    font-size: 1.2rem;
    color: #64748b;
}

.draw-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Battle Arena */
.battle-arena {
    display: grid;
    grid-template-columns: 1fr 140px 1fr;
    padding: 36px 20px;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.fighter-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.slot-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
}

.hand-display {
    width: 110px;
    height: 110px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3.6rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.player-slot .hand-display.active {
    border-color: var(--player-color);
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.4);
    transform: scale(1.08);
}

.ai-slot .hand-display.active {
    border-color: var(--ai-color);
    box-shadow: 0 0 25px rgba(244, 63, 94, 0.4);
    transform: scale(1.08);
}

.hand-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #cbd5e1;
}

.arena-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.result-badge {
    font-size: 1rem;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.result-badge.win {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    animation: popBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-badge.lose {
    background: rgba(244, 63, 94, 0.2);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.5);
}

.result-badge.draw {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.5);
}

/* Shake Animation */
.shaking-player {
    animation: shakePlayer 0.5s infinite;
}

.shaking-ai {
    animation: shakeAi 0.5s infinite;
}

@keyframes shakePlayer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-20deg) scale(1.1); }
}

@keyframes shakeAi {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(20deg) scale(1.1); }
}

@keyframes popBounce {
    0% { transform: scale(0.5); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Controls */
.controls-container {
    text-align: center;
}

.controls-container h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 14px;
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.choice-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 12px;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(12px);
}

.choice-btn:hover:not(:disabled) {
    transform: translateY(-6px) scale(1.03);
    border-color: var(--primary);
    box-shadow: 0 10px 25px var(--primary-glow);
    background: rgba(99, 102, 241, 0.15);
}

.choice-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-icon {
    font-size: 2.8rem;
    transition: transform 0.2s;
}

.choice-btn:hover:not(:disabled) .choice-icon {
    transform: scale(1.15);
}

.choice-name {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Footer Buttons */
.game-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sound {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.btn-sound:hover {
    background: rgba(99, 102, 241, 0.3);
}

/* Victory Modal */
.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.victory-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border: 2px solid var(--gold);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 50px rgba(251, 191, 36, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 400px;
    width: 90%;
}

.victory-modal.show .modal-content {
    transform: scale(1);
}

.trophy-icon {
    font-size: 4.5rem;
    margin-bottom: 12px;
    animation: float 2s infinite ease-in-out;
}

.modal-content h2 {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 8px;
    font-weight: 900;
}

.modal-content p {
    color: #e0e7ff;
    margin-bottom: 24px;
    font-size: 1.05rem;
}

.btn-primary {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0f172a;
    font-weight: 800;
    font-size: 1rem;
    padding: 12px 28px;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(245, 158, 11, 0.6);
}

/* Screen Shake for Big Win */
.shake-screen {
    animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screenShake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

@media (max-width: 600px) {
    .battle-arena {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .arena-center {
        order: -1;
    }
    .hand-display {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
}
