/* --- Custom Stylish Winrate Bar --- */
.winrate-bar-container {
    margin-bottom: 10px;
    margin-top: 10px;
}
.winrate-bar {
    display: flex;
    height: 44px;
    border-radius: 22px;
    overflow: hidden;
    border: 2px solid #e0e7ff;
    background: linear-gradient(90deg, #e0e7ff 0%, #f3f4f6 100%);
    box-shadow: 0 4px 16px rgba(102,126,234,0.08);
    position: relative;
    font-size: 1.15em;
}
.winrate-bar > div {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1em;
    letter-spacing: 0.5px;
    transition: width 0.6s cubic-bezier(.4,2,.6,1);
    text-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.winrate-bar > div:first-child {
    background: linear-gradient(90deg, #667eea 60%, #8fa6f7 100%);
    color: #fff;
    border-right: 1.5px solid #e0e7ff;
}
.winrate-bar > div:last-child {
    background: linear-gradient(90deg, #a084ca 0%, #764ba2 100%);
    color: #fff;
}
.winrate-bar-labels {
    display: flex;
    justify-content: space-between;
    margin: 0 8px 18px 8px;
    font-size: 1.08em;
    color: #495057;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* --- Result Card Glow/Gradient --- */
.prediction-result {
    background: linear-gradient(135deg, #fff 80%, #e0e7ff 100%);
    border-radius: 24px;
    padding: 44px 28px 36px 28px;
    text-align: center;
    box-shadow: 0 12px 36px rgba(102, 126, 234, 0.13), 0 2px 8px rgba(118, 75, 162, 0.07);
    animation: fadeInUp 0.6s cubic-bezier(.4,2,.6,1);
    border: 1.5px solid #e0e7ff;
}
.prediction-result h3 {
    font-size: 2.1rem;
    margin-bottom: 32px;
    color: #333;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 8px rgba(102,126,234,0.08);
}

/* --- Button Glow/Depth --- */
.predict-button {
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.18), 0 2px 8px rgba(118, 75, 162, 0.09);
    border: none;
    font-size: 1.22rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: box-shadow 0.3s, transform 0.2s;
}
.predict-button:hover:not(:disabled) {
    box-shadow: 0 16px 36px rgba(102, 126, 234, 0.22), 0 4px 16px rgba(118, 75, 162, 0.13);
    transform: translateY(-2px) scale(1.03);
}
.predict-button:active:not(:disabled) {
    transform: scale(0.98);
}

/* --- Section Card Soft Shadow --- */
.team-selection, .team-card {
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.08), 0 1.5px 6px rgba(118, 75, 162, 0.05);
    border: 1.5px solid #e0e7ff;
}
.team-card {
    border-radius: 20px;
    background: linear-gradient(120deg, #fff 85%, #f3f4f6 100%);
}

/* --- Subtle Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(30px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }
}

/* Modal specific animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 104px 24px; /* 8px 그리드: 24px, 104px (100px + 4px) */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px 0;
}

/* Progress Indicator */
.progress-container {
    margin: 0 auto 40px auto; /* 8px 그리드: 40px */
    max-width: 600px;
    padding: 0 24px; /* 8px 그리드: 24px */
}

.progress-steps {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.step.active .step-circle {
    background: white;
    border-color: white;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.step.completed .step-circle {
    background: rgba(34, 197, 94, 0.9);
    border-color: #22c55e;
}

.step-number {
    font-weight: 700;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.step.active .step-number {
    color: #667eea;
}

.step.completed .step-number {
    color: white;
}

.step-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    white-space: nowrap;
}

.step.active .step-label {
    color: white;
    font-weight: 600;
}

.step-line {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 16px;
    position: relative;
    overflow: hidden;
}

.step-line.completed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    animation: progressFill 0.5s ease-out;
}

@keyframes progressFill {
    from {
        width: 0%;
    }
    to {
        width: 100%;
    }
}

.app-title {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.app-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
}

/* Main Content */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 32px; /* 8px 그리드: 32px */
}

/* Team Selection Section */
.team-selection {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.team-selection::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.team-selection h2 {
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

.selector-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px; /* 8px 그리드: 32px */
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px; /* 8px 그리드: 8px */
    min-width: 200px;
}

.input-label {
    font-weight: 500;
    color: #555;
    font-size: 1rem;
}

.team-select {
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    font-weight: 500;
}

.team-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.team-select:hover {
    border-color: #667eea;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #fefefe 0%, #f8f9fa 100%);
}

.team-select:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.vs-divider {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 20px;
}

/* Teams Display Section */
.teams-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px; /* 8px 그리드: 32px */
}

.team-card {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: height 0.3s ease;
}

.team-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 64px rgba(102, 126, 234, 0.2), 0 8px 24px rgba(0, 0, 0, 0.1);
}

.team-card:hover::before {
    height: 6px;
    animation: glow 0.3s ease-out;
}

.team-card:active {
    transform: translateY(-4px) scale(1.01);
    transition: all 0.1s ease;
}

@keyframes glow {
    0% { box-shadow: none; }
    50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.5); }
    100% { box-shadow: none; }
}

#home-team-card::before {
    background: linear-gradient(90deg, #667eea 0%, #4f46e5 100%);
}

#away-team-card::before {
    background: linear-gradient(90deg, #764ba2 0%, #667eea 100%);
}

.team-card .card-content {
    position: relative;
    z-index: 1;
}

.team-header {
    display: flex;
    align-items: center;
    gap: 16px; /* 8px 그리드: 16px */
    margin-bottom: 24px; /* 8px 그리드: 24px */
    padding-bottom: 16px; /* 8px 그리드: 16px */
    border-bottom: 1px solid #f0f0f0;
}

.team-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    background: #f8f9fa;
    padding: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.team-logo:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.team-name {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    cursor: pointer;
}

.team-name:hover {
    color: #667eea;
    transform: translateX(4px);
}

.pitcher-section {
    display: flex;
    flex-direction: column;
    gap: 16px; /* 8px 그리드: 16px */
}

.pitcher-label {
    font-weight: 500;
    color: #555;
    font-size: 1rem;
}

.pitcher-select {
    padding: 16px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    background: linear-gradient(135deg, white 0%, #f8f9fa 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    font-weight: 500;
    width: 100%;
}

.pitcher-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.pitcher-select:hover {
    border-color: #667eea;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #fefefe 0%, #f8f9fa 100%);
}

.pitcher-select:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

.pitcher-info {
    padding: 24px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    min-height: 160px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 24px;
    border: 1px solid rgba(233, 236, 239, 0.5);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.pitcher-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.pitcher-info:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.pitcher-face {
    width: 100px;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    flex-shrink: 0;
}

.pitcher-face:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.pitcher-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    text-align: left;
}

.pitcher-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin: 0;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.pitcher-era {
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 10px 16px;
    border-radius: 12px;
    display: inline-block;
    align-self: flex-start;
}

.pitcher-position {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

/* Prediction Section */
.prediction-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 16px 24px; /* 8px 그리드: 16px, 24px */
    border-top: 1px solid #e1e5e9;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.predict-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 16px 32px; /* 8px 그리드: 16px, 32px */
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* 8px 그리드: 8px */
}

.predict-button:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 32px rgba(102, 126, 234, 0.4), 0 8px 16px rgba(118, 75, 162, 0.2);
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
}

.predict-button:active:not(:disabled) {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
    transition: all 0.1s ease;
}

.predict-button:disabled {
    background: linear-gradient(45deg, #9ca3af, #6b7280);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 버튼 ripple 효과 */
.predict-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.predict-button:active::after {
    width: 100%;
    height: 100%;
}

.button-text {
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-left: 2px solid rgba(255, 255, 255, 0.4);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s ease-in-out infinite;
    position: relative;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-top: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: spin 1.2s ease-in-out infinite reverse;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Result Section */
.result-section {
    display: flex;
    justify-content: center;
}

.result-container {
    width: 100%;
    max-width: 600px;
}

.prediction-result {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.prediction-result h3 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #333;
    font-weight: 700;
}

.prediction-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 20px;
}

.team-prediction {
    padding: 20px;
    border-radius: 15px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.team-prediction:first-child {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(102, 126, 234, 0.05));
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.team-prediction:last-child {
    background: linear-gradient(135deg, rgba(118, 75, 162, 0.1), rgba(118, 75, 162, 0.05));
    border: 2px solid rgba(118, 75, 162, 0.2);
}

.team-prediction strong {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
}

.win-rate {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 10px;
}

.vs-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading State */
.loading-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-title {
        font-size: 2rem;
    }

    .app-subtitle {
        font-size: 1rem;
    }

    /* Progress indicator mobile */
    .progress-container {
        margin-bottom: 32px;
        padding: 0 16px;
    }

    .step-label {
        font-size: 0.7rem;
    }

    .step-circle {
        width: 32px;
        height: 32px;
    }

    .step-number {
        font-size: 0.8rem;
    }

    .step-line {
        margin: 0 8px;
    }

    .teams-display {
        grid-template-columns: 1fr;
        gap: 24px; /* 8px 그리드: 24px */
    }

    .selector-group {
        flex-direction: column;
        gap: 24px; /* 8px 그리드: 24px */
    }

    .vs-divider {
        padding: 8px; /* 8px 그리드: 8px */
    }

    .team-card {
        padding: 24px; /* 8px 그리드: 24px */
    }

    .prediction-grid {
        grid-template-columns: 1fr;
        gap: 24px; /* 8px 그리드: 24px */
    }

    .vs-text {
        order: -1;
        margin-bottom: 24px; /* 8px 그리드: 24px */
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px; /* 8px 그리드: 16px */
    }

    .app-main {
        gap: 24px; /* 8px 그리드: 24px */
    }

    .team-selection,
    .team-card,
    .prediction-result {
        padding: 24px; /* 8px 그리드: 24px */
    }

    .predict-button {
        padding: 16px 24px; /* 8px 그리드: 16px, 24px */
        font-size: 1.1rem;
    }

    /* 모바일에서 투수 정보 세로 배치 */
    .pitcher-info {
        flex-direction: column;
        text-align: center;
        gap: 16px;
        min-height: auto;
        padding: 20px;
    }

    .pitcher-face {
        width: 80px;
        height: 100px;
    }

    .pitcher-details {
        text-align: center;
        gap: 8px;
    }

    .pitcher-name {
        font-size: 1.3rem;
    }

    .pitcher-era {
        align-self: center;
        font-size: 1.1rem;
    }
}