/* 컨테이너 */
.main-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main-content {
    background-color: var(--secondary-color);
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
    border: 1px solid var(--border-color);
    min-height: 400px;
    align-self: start;
    overflow: auto;
    width: 100%;
}

.sub-content {
    display: flex;
    background-color: rgba(28, 71, 244, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(28, 71, 244, 0.3);
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(28, 71, 244, 0.3);
    width: 100%;
    align-items: center;
    height: 60px;
    justify-content: center;
    cursor: pointer;
    color: #1c47f4;
}

.sub-content {
    transition: background-color 1s ease, border-color 1s ease, box-shadow 1s ease, color 1s ease;
}

.content-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

.content-layout > * {
    min-width: 0; /* 기본적으로 그리드 셀 내 아이템이 줄어들게 강제 */
}

/* --- 게임 컨테이너 및 아이템 스타일 --- */
.games-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px; /* 최소 높이 설정 (로딩 시에도 공간 확보) */
}

.balance-game-item {
    background-color: #FFFFFF;
    border-radius: 20px; /* 더 둥근 모서리 */
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* 더 깊고 부드러운 그림자 */
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    animation: fadeInScale 0.6s ease-out forwards; /* 나타날 때 애니메이션 */
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.balance-game-item h2 {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 25px;
    line-height: 1.4;
    font-weight: 600;
}

/* 프로그레스 바 */
.progress-bar-container {
    height: 15px; /* 높이 약간 증가 */
    background-color: #E6EBF0; /* 더 밝은 배경색 */
    border-radius: 6px;
    margin: 0 0 10px 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar-fill {
    height: 100%;
    background-image: linear-gradient(to right, #6DD5ED, #4A90E2); /* 하늘색-파랑 그라데이션 */
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8em;
    color: #6C7A89;
    font-weight: 500;
    white-space: nowrap; /* 텍스트 줄바꿈 방지 */
}

/* 옵션 버튼 영역 */
.options-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* 버튼 사이 간격 */
    flex-wrap: wrap; /* 작은 화면에서 줄바꿈 */
}

.options-wrapper form {
    display: contents; /* 폼 자체는 레이아웃에 영향 미치지 않도록 */
}

.option-btn {
    flex: 1; /* 공간 균등 분배 */
    background-image: linear-gradient(135deg, #4A90E2 0%, #6DD5ED 100%); /* 파랑-하늘 그라데이션 */
    color: white;
    border: none;
    border-radius: 15px; /* 버튼 모서리 둥글게 */
    padding: 20px 25px;
    font-size: 1.5em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.4); /* 버튼 그림자 */
    white-space: normal; /* 긴 텍스트 줄바꿈 허용 */
    line-height: 1.4;
    min-height: 200px;
}

.option-btn:hover {
    transform: translateY(-5px); /* 호버 시 위로 살짝 */
    box-shadow: 0 12px 25px rgba(74, 144, 226, 0.5); /* 그림자 진해짐 */
    background-image: linear-gradient(135deg, #6DD5ED 0%, #4A90E2 100%); /* 그라데이션 방향 변경 */
}

.option-btn2 {
    background-image: linear-gradient(135deg, #FF7B8A, #FF5F6D);
    box-shadow: 0 8px 20px rgba(226, 74, 74, 0.4); /* 버튼 그림자 */
}

.option-btn2:hover {
    transform: translateY(-5px); /* 호버 시 위로 살짝 */
    box-shadow: 0 12px 25px rgba(226, 74, 74, 0.5); /* 그림자 진해짐 */
    background-image: linear-gradient(135deg, #FF7B8A, #FF5F6D);
}

.option-btn:disabled {
    background-image: linear-gradient(135deg, #a4b0be 0%, #b2bec3 100%); /* 비활성화 시 회색 */
    cursor: not-allowed;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: none; /* 비활성화 시 애니메이션 제거 */
}

.selected:disabled {
    background-image: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
    color: rgb(0, 0, 0);
    font-weight: bold;
    transform: scale(1.1);
}

.vs-text {
    font-size: 1.8em;
    font-weight: 700;
    color: #A0B2C6; /* VS 텍스트 색상 */
    margin: 0 10px; /* 버튼과의 간격 */
    display: inline-block; /* flex-wrap에 반응하도록 */
}

/* --- 결과 표시 (Result Display) 스타일 --- */
.result-display {
    margin-top: 35px; /* 위쪽 여백 증가 */
    padding: 25px;
    background-color: #FAFBFC; /* 아주 밝은 회색 배경 */
    border-radius: 15px; /* 더 둥근 모서리 */
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05), 0 5px 15px rgba(0,0,0,0.05); /* 입체적인 그림자 */
    text-align: center;
    opacity: 0; /* 초기에는 숨김 */
    transform: translateY(20px); /* 아래에서 위로 나타나는 효과 */
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/* 결과 표시가 활성화될 때 (JavaScript로 추가될 때) */
.balance-game-item .result-display:not(:empty) {
    opacity: 1;
    transform: translateY(0);
}

.result-message {
    font-size: 1.15em;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.result-message p:first-child {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.25em;
}

.result-message p:last-child {
    font-size: 0.95em;
    color: #6c7a89;
}

.result-bars-container {
    display: flex;
    width: 95%; /* 부모에 비해 너비 조절 */
    margin: 0 auto 20px auto;
    height: 40px; /* 막대 높이 증가 */
    border-radius: 10px; /* 더 둥근 모서리 */
    overflow: hidden;
    background-color: #E0E6EB; 
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15); /* 더 강한 내부 그림자 */
}

.result-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600; /* 폰트 굵기 증가 */
    font-size: 1em; /* 텍스트 크기 증가 */
    transition: width 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* 부드러운 이징 효과 */
    min-width: 0%; 
    position: relative;
    white-space: nowrap; /* 텍스트 줄바꿈 방지 */
}

.result-bar span {
    position: absolute;
    color: white;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.6); /* 텍스트 그림자 강화 */
    padding: 0 8px; /* 텍스트 주변 패딩 */
}

/* A 선택지 막대 스타일 */
.result-bar-a {
    background-image: linear-gradient(135deg, #4A90E2 0%, #6DD5ED 100%); /* 부드러운 초록 그라데이션 */
}

/* B 선택지 막대 스타일 */
.result-bar-b {
    background-image: linear-gradient(to right, #FF7B8A, #FF5F6D); /* 부드러운 핑크-레드 그라데이션 */
}

.result-labels {
    display: flex;
    justify-content: space-between;
    width: 95%;
    margin: 10px auto 0 auto;
    font-size: 0.95em;
    font-weight: 500;
    color: #6C7A89;
}

.label-a {
    color: #4A90E2;
    text-align: left;
    flex: 1;
    padding-right: 10px;
}

.label-b {
    color: #FF5F6D; /* B 막대 색상과 통일 */
    text-align: right;
    flex: 1;
    padding-left: 10px;
}

/* 다음 게임 버튼 스타일 */
.next-game-btn {
    background-image: linear-gradient(135deg, #4A90E2 0%, #6DD5ED 100%); /* 선택 버튼과 유사한 그라데이션 */
    margin-top: 30px; /* 결과 바와 간격 추가 */
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.4);
    font-size: 1.15em;
    padding: 15px 30px;
    border-radius: 15px; /* 버튼 모서리 둥글게 */
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.next-game-btn:hover {
    background-image: linear-gradient(135deg, #6DD5ED 0%, #4A90E2 100%);
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(74, 144, 226, 0.5);
}

.last-game-btn {
    height: 120px;
    font-size: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 로딩/완료 메시지 스타일 */
.loading-message, .no-more-games-message {
    padding: 40px;
    font-size: 1.3em;
    color: #555;
    text-align: center;
    background-color: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.6s ease-out forwards;
}

.no-more-games-message h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 700;
}
.no-more-games-message p {
    font-size: 1.1em;
    color: #6c7a89;
    margin-bottom: 30px;
}

.timer-display-container {
    margin-bottom: 10px;
    font-weight: 700;
}



@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 반응형 디자인을 위한 미디어 쿼리 */
@media (max-width: 768px) {
    .content-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    header h1 {
        font-size: 2em;
    }
    .balance-game-item {
        padding: 20px;
    }
    .balance-game-item h2 {
        font-size: 1.5em;
    }
    .option-btn {
        min-width: 100%; /* 모바일에서 버튼들이 세로로 쌓이도록 */
        padding: 15px 20px;
        min-height: 30px;
        font-size: 1.1em;
    }
    .options-wrapper {
        flex-direction: column; /* 모바일에서 버튼을 세로로 정렬 */
        gap: 10px;
    }
    .vs-text {
        margin: 0; /* 세로 정렬 시 VS 텍스트 위아래 간격 */
    }
    .result-display {
        padding: 20px;
    }
    .result-bars-container {
        width: 100%;
    }
    .result-labels {
        width: 100%;
    }

    .result-message {
        font-size: 1.15em;
        color: #333;
        margin-bottom: 15px;
        line-height: 1.5;
    }

    .next-game-btn {
        margin-top: 20px; /* 결과 바와 간격 추가 */
    }
}
