@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root {
    --maple-gold: #FFD700;
    --maple-blue: #B4C5E4;
    --maple-dark: #3C3744;
    --card-red: #E63946;
    --card-blue: #4895EF;
    --card-green: #2DC653;
    --card-yellow: #F4D03F;
}

.game-page-container {
    padding: 20px 0 80px;
    max-width: 1100px;
    margin: 0 auto;
}

/* 게임 윈도우 */
.game-card-window {
    background: white;
    border-radius: 25px;
    border: 1px solid #eee;
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
    padding: 30px;
    min-height: 650px;
    position: relative;
    display: none;
    flex-direction: column;
    align-items: center;
}

.game-card-window.active {
    display: flex;
}

/* --- Setup --- */
.setup-container { text-align: center; margin: auto; }
.setup-card-box { background: #f8f9fa; border-radius: 20px; padding: 35px; margin-bottom: 25px; border: 1px solid #f0f0f0; }
.count-selector { display: flex; gap: 12px; justify-content: center; margin-bottom: 25px; }
.count-btn { width: 65px; height: 65px; border-radius: 14px; border: 2px solid #eee; background: white; cursor: pointer; font-size: 16px; font-weight: 700; transition: all 0.2s; }
.count-btn.active { border-color: var(--maple-blue); background: #f0f4ff; color: var(--maple-dark); box-shadow: 0 4px 12px rgba(180, 197, 228, 0.3); }

/* --- 게임 액션 버튼 --- */
.game-action-btn {
    padding: 12px 40px;
    background: var(--maple-dark);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(60, 55, 68, 0.2);
}
.game-action-btn:hover:not(:disabled) { background: #2a2630; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.game-action-btn:disabled { background: #ccc; cursor: not-allowed; opacity: 0.7; }

.game-start-button { width: 100%; padding: 18px; background: var(--maple-dark); color: white; border: none; border-radius: 14px; font-size: 18px; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.game-start-button:hover { background: #2a2630; transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }

/* --- Game Layout --- */
#game-layout-wrapper { width: 100%; display: flex; flex-direction: column; gap: 15px; }

/* 중앙 3컬럼 레이아웃 */
.game-middle-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin: 10px 0;
}

.side-ai-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 140px;
    flex: 1;
}

#ai-left { align-items: flex-end; }
#ai-right { align-items: flex-start; }

.opponent-player {
    background: #fcfcfc;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 10px;
    width: 100%;
    max-width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.3s;
    position: relative;
}

.opponent-player.active-player { border-color: var(--maple-blue); background: #f7faff; box-shadow: 0 0 20px rgba(180, 197, 228, 0.25); }
.opponent-name { font-size: 13px; font-weight: 700; color: #555; margin-bottom: 5px; }
.opponent-cards { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; margin: 5px 0; max-width: 120px; }
.card-back-mini { width: 15px; height: 22px; background: var(--maple-dark); border-radius: 2px; border: 1px solid rgba(255,255,255,0.2); overflow: hidden; display: flex; align-items: center; justify-content: center; }

#game-center { 
    flex: 2; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    gap: 10px; 
}

#game-status-bar { display: flex; align-items: center; gap: 15px; background: #3C3744; padding: 10px 25px; border-radius: 50px; font-size: 14px; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

/* 중앙 공격 안내문 스타일 */
.central-attack-notice {
    color: #ff4d4d;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
    animation: attackPulse 1s infinite;
    text-shadow: 0 0 10px rgba(255, 77, 77, 0.3);
    height: 20px;
}

/* 보드 매트 */
.board-mat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: #fbfbfb;
    padding: 30px 40px;
    border-radius: 30px;
    border: 1px solid #f0f0f0;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);
    position: relative;
}

.pile-box { display: flex; flex-direction: column; align-items: center; gap: 15px; position: relative; }
.pile-label { font-size: 11px; font-weight: 900; color: #ddd; letter-spacing: 2px; position: absolute; top: -25px; }
.pile-divider { width: 1px; height: 80px; background: linear-gradient(to bottom, transparent, #eee, transparent); margin: 0 10px; }

.count-badge { background: #fff; padding: 5px 15px; border-radius: 50px; font-size: 12px; font-weight: 700; color: #3C3744; border: 1px solid #eee; box-shadow: 0 2px 5px rgba(0,0,0,0.05); white-space: nowrap; }
.count-badge #deck-count { color: #FF6B6B; }
.count-badge.empty { color: #B4C5E4; }

#current-color-indicator { font-size: 14px; color: #888; display: flex; align-items: center; gap: 10px; }
#current-color-display { padding: 4px 15px; border-radius: 12px; color: white; font-weight: 700; font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }

#player-area-box { border-top: 2px solid #f8f9fa; padding-top: 20px; width: 100%; }
#player-info-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; font-size: 14px; font-weight: 700; }
.card-effect-guide { color: #B4C5E4; font-size: 13px; font-weight: 700; min-height: 20px; transition: all 0.2s; }
.hand-container { display: flex; gap: 10px; justify-content: center; min-height: 140px; overflow-x: auto; padding: 10px 0; scrollbar-width: thin; }

/* --- Cards --- */
.game-card {
    width: 80px;
    height: 116px;
    border-radius: 12px;
    background: white;
    border: 3px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.1));
}
.card-back { background: var(--maple-dark); border-color: #444; }
.card-back-design { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 10px; }
.card-back-logo { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }

.card-red { background: var(--card-red); }
.card-blue { background: var(--card-blue); }
.card-green { background: var(--card-green); }
.card-yellow { background: var(--card-yellow); }
.card-wild { background: linear-gradient(135deg, #6D28D9, #EF4444, #6D28D9); background-size: 200%; animation: shimmer 4s infinite; }
.card-shield { background: #1A3A4A; border-color: #7FDBFF !important; }

@keyframes shimmer { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.card-value { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 30px; font-weight: 900; color: white; text-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.card-corner { position: absolute; color: white; font-size: 11px; font-weight: 900; }
.card-corner.tl { top: 6px; left: 8px; }
.card-corner.br { bottom: 6px; right: 8px; transform: rotate(180deg); }
.card-oval { position: absolute; width: 80%; height: 75%; background: rgba(255,255,255,0.12); border-radius: 50%; top: 12.5%; left: 10%; transform: rotate(-25deg); }

.hand-card.playable:hover { transform: translateY(-25px) scale(1.08); z-index: 50; box-shadow: 0 15px 35px rgba(0,0,0,0.2); border-color: var(--maple-blue); }
.hand-card.not-playable { opacity: 0.45; cursor: not-allowed; filter: grayscale(30%); }

/* --- Modals --- */
.game-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000; /* 더 높은 우선순위 */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.45); /* 투명도를 더 낮춰서 배경이 더 잘 보이게 함 */
    border-radius: 25px; /* game-card-window와 동일하게 */
}

.modal-window {
    background: white;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    border: 1px solid #eee;
    text-align: center;
    width: 90%;
    max-width: 380px;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 드로우 확인 모달 전용 스타일 확장 */
#draw-confirm-modal .modal-window {
    max-width: 850px;
    width: 95%;
}

#draw-confirm-cards {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 12px;
    margin: 25px 0;
    padding: 15px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #B4C5E4 #f8f9fa;
    -webkit-overflow-scrolling: touch;
}

#draw-confirm-cards::-webkit-scrollbar {
    height: 6px;
}

#draw-confirm-cards::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 10px;
}

#draw-confirm-cards::-webkit-scrollbar-thumb {
    background: #B4C5E4;
    border-radius: 10px;
}

#draw-confirm-cards .game-card {
    width: 75px; /* 크기를 살짝 조정 */
    height: 109px;
    flex-shrink: 0; /* 크기 축소 방지 */
    cursor: default;
}

#draw-confirm-cards .game-card:hover {
    transform: none;
}

.color-selection-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
.color-choice { height: 60px; border-radius: 12px; border: none; color: white; font-weight: 700; font-size: 15px; cursor: pointer; transition: transform 0.2s; }
.color-choice:hover { transform: scale(1.05); }

/* 색상 선택 버튼별 배경색 */
.red-choice { background: var(--card-red); }
.blue-choice { background: var(--card-blue); }
.green-choice { background: var(--card-green); }
.yellow-choice { background: var(--card-yellow); color: var(--maple-dark); }

/* --- Toast --- */
.game-toast { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--maple-dark); color: white; padding: 14px 35px; border-radius: 50px; z-index: 600; font-weight: 700; font-size: 18px; box-shadow: 0 5px 25px rgba(0,0,0,0.2); }

/* --- Attack Banner --- */
.attack-banner { position: absolute; top: 20px; background: linear-gradient(135deg, #ff4d4d, #c0392b); color: white; padding: 12px 25px; border-radius: 15px; display: flex; align-items: center; gap: 15px; z-index: 450; box-shadow: 0 8px 25px rgba(255,77,77,0.4); border: 1px solid rgba(255,255,255,0.2); }
.attack-number { font-size: 36px; font-weight: 900; color: #FFD700; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.gameover-stats-box { background: #f8f9fa; padding: 20px; border-radius: 15px; margin: 20px 0; font-size: 14px; line-height: 2; border: 1px solid #eee; }

.game-tooltip { display: none; }
.hidden { display: none !important; }

@keyframes modalPop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes attackPulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }

/* --- Mode Tabs --- */
.mode-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 25px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-tab-btn.active {
    background: white;
    color: #3C3744;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 800px) {
    .game-middle-layout { flex-direction: column; gap: 10px; }
    .side-ai-area { flex-direction: row; min-width: auto; justify-content: center; }
    #ai-left, #ai-right { align-items: center; }
    .opponent-player { max-width: 140px; padding: 10px; }
}

@media (max-width: 600px) {
    .game-card { width: 65px; height: 95px; }
    .card-value { font-size: 24px; }
    .game-card-window { padding: 20px; }
    .game-action-btn { padding: 10px 30px; font-size: 13px; }
    .board-mat { padding: 20px; gap: 10px; }
    .pile-divider { margin: 0 10px; }
}
