:root {
    --bg-main: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --accent: #6366f1;
    --text-light: #f8fafc;
    --field-green: #2ecc71;
    --field-dirt: #e67e22;
}

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

body {
    font-family: 'Noto Sans KR', 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
}

.main-wrapper {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
}

/* Stadium Section (Left) */
.stadium-section {
    flex: 3; /* 75% */
    display: flex;
    flex-direction: column;
}

.stadium-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Scoreboard */
.live-scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.5);
    padding: 10px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.live-tag {
    background: #e74c3c;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 900;
    margin-bottom: 5px;
    width: fit-content;
}

.score-num {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    margin-left: 10px;
}

.count-board {
    display: flex;
    gap: 15px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

.count-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #334155;
    margin-left: 3px;
}

.dots span.active-ball { background: #3498db; box-shadow: 0 0 8px #3498db; }
.dots span.active-strike { background: #f1c40f; box-shadow: 0 0 8px #f1c40f; }
.dots span.active-out { background: #e74c3c; box-shadow: 0 0 8px #e74c3c; }

.bases-view {
    position: relative;
    width: 60px;
    height: 60px;
    transform: rotate(45deg);
    margin-top: 10px;
}

.base {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #334155;
}

#base-1 { top: 0; right: 0; }
#base-2 { top: 0; left: 0; }
#base-3 { bottom: 0; left: 0; }
.base.occupied { background: #ff7675; box-shadow: 0 0 10px #ff7675; }

/* Baseball Field (Google Doodle Style with Canvas) */
.baseball-field {
    flex: 1;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); /* 밤하늘 야구 경기장 테마 */
    border-radius: 24px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}

#baseball-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
}

.result-overlay {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 20;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-overlay.show {
    transform: translate(-50%, -50%) scale(1.5);
}

.result-overlay h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 4.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 25px rgba(0,0,0,0.8);
    background: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 타이밍 가이드 피드백 텍스트 */
.timing-indicator {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    color: #00ffcc;
    border: 2px solid #00ffcc;
    padding: 8px 24px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    pointer-events: none;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s;
    opacity: 0;
}

.timing-indicator.show {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

.timing-indicator.perfect { color: #f1c40f; border-color: #f1c40f; box-shadow: 0 0 20px rgba(241, 196, 15, 0.6); }
.timing-indicator.good { color: #2ecc71; border-color: #2ecc71; box-shadow: 0 0 20px rgba(46, 204, 113, 0.6); }
.timing-indicator.early { color: #e67e22; border-color: #e67e22; box-shadow: 0 0 20px rgba(230, 126, 34, 0.6); }
.timing-indicator.late { color: #e67e22; border-color: #e67e22; box-shadow: 0 0 20px rgba(230, 126, 34, 0.6); }
.timing-indicator.miss { color: #e74c3c; border-color: #e74c3c; box-shadow: 0 0 20px rgba(231, 76, 60, 0.6); }

/* Controls (인터랙티브 리빌딩) */
.stadium-controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: center;
}

.batter-info-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 18px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.batter-name-tag {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.batter-info-card h3 {
    font-size: 1.6rem;
    color: #ff7675;
    font-weight: 900;
}

.batter-info-card p {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 2px;
}

.action-buttons-interactive {
    flex: 1;
    display: flex;
    gap: 15px;
}

.action-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    border-radius: 16px;
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    cursor: pointer;
    color: white;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 0.2s;
}

.action-btn:hover::after {
    opacity: 1;
}

.action-btn:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 투구 요청 버튼 */
.pitch-trigger {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pitch-trigger:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* 스윙 버튼 */
.swing-trigger {
    background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.3rem;
}

.swing-trigger:hover {
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

.key-hint {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-left: 5px;
    font-weight: normal;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 6px;
}

.panic-system {
    width: 180px;
}

.panic-bar {
    height: 12px;
    background: #334155;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panic-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff7675, #d63031);
    box-shadow: 0 0 10px rgba(214, 48, 49, 0.8);
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Chat Section (Right) */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.chat-header {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.viewer-count { font-size: 0.7rem; color: #94a3b8; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 10px;
}

.chat-bubble {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: chatIn 0.3s ease-out;
}

.chat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    background: white;
    border: 2px solid var(--glass-border);
}

.chat-body {
    background: rgba(255,255,255,0.05);
    padding: 10px 15px;
    border-radius: 0 15px 15px 15px;
}

.chat-user { font-weight: bold; font-size: 0.75rem; margin-bottom: 4px; display: block; }
.chat-text { font-size: 1rem; line-height: 1.4; }

.chat-user.seoan { color: #3498db; }
.chat-user.muji { color: #f1c40f; }
.chat-user.poo { color: #e67e22; }
.chat-user.dodeok { color: #e74c3c; }
.chat-user.chun { color: #9b59b6; }

@keyframes chatIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.seoan-card-btn {
    width: 100%;
    margin-top: 15px;
    padding: 15px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
}

/* Animations */
.wells-windup { transform: translateY(-20px) rotate(-10deg); }
.batter-swing { transform: rotate(-30deg) translateX(10px); }
.shake { animation: shake 0.5s linear; }

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    100% { transform: translate(1px, 1px) rotate(0deg); }
}
