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

@font-face {
    font-family: 'Paperozi';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

body {
    font-family: 'Paperozi', sans-serif;
    color: #2A1E1E;
    overflow: hidden;
    font-weight: 700;
    background-color: #000;
}

/* 영어 폰트 설정 */
html[lang="en"] body {
    font-family: 'Handserif', serif;
}

/* 영어 제목 폰트 (game_title) */
html[lang="en"] [data-i18n="game_title"],
html[lang="en"] .menu-container h1 {
    font-family: 'JustMandrawn', cursive;
    font-weight: 500;
}

/* --- Background Layers --- */
#background-layer-1, #background-layer-3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    pointer-events: none;
    display: none; /* 초기에는 숨김 */
}

#background-layer-1 {
    background-image: url('/bg1_morning.png');
    z-index: -2;
}

#background-layer-3 {
    background-image: url('/bg2_morning.png');
    z-index: 1;
}

/* Afternoon backgrounds */
#background-layer-1.afternoon {
    background-image: url('/bg1_afternoon.png');
}

#background-layer-3.afternoon {
    background-image: url('/bg2_afternoon.png');
}

/* --- 화면 회전 안내 --- */
#rotate-device-overlay {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: #2A1E1E; color: #F5F2E7;
    z-index: 9999;
    flex-direction: column; justify-content: center; align-items: center;
    text-align: center; font-size: 1.4rem;
}
#rotate-device-overlay span { font-size: 3rem; margin-top: 20px; animation: spin 2s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (orientation: portrait) {
    #rotate-device-overlay { display: flex; }
    .fullscreen-overlay, .game-container { display: none !important; }
}

/* --- 메뉴 및 범용 스타일 --- */
.fullscreen-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #D2B48C, #8B7355);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 100;
    color: #F5F2E7; text-align: center; padding: 20px;
}

#splashScreen .logo-title { font-family: 'Orbitron', sans-serif; font-size: clamp(2.5rem, 10vw, 5rem); color: #fff; text-shadow: 0 0 15px rgba(255, 255, 255, 0.8); animation: fadeIn 1s forwards; }
@keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } }

/* Preload Screen */
#preloadScreen {
    z-index: 9999 !important;
}
.preload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
}
.preload-container .logo-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.5rem, 10vw, 5rem);
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    margin: 0;
}
.preload-progress {
    width: 400px;
    max-width: 90vw;
}
.preload-bar-bg {
    width: 100%;
    height: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}
.preload-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #D2B48C, #8B7355);
    transition: width 0.3s ease;
    border-radius: 15px;
}
.preload-text {
    text-align: center;
    color: #fff;
    font-size: 1.2rem;
    margin-top: 15px;
    font-family: 'Orbitron', sans-serif;
}
.menu-container {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    min-width: 320px;
    max-width: 500px;
    width: 90%;
}
.menu-container h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #fff;
}
.menu-container h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
}
#playerNameInput {
    padding: 12px;
    font-size: 1.1rem;
    width: 100%;
    max-width: 250px;
    margin-bottom: 20px;
    border: 2px solid #fff;
    background-color: rgba(255,255,255,0.9);
    border-radius: 5px;
    color: #333;
    font-family: 'Paperozi', sans-serif;
}
.menu-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-family: 'Paperozi', sans-serif;
    background-color: rgba(255,255,255,0.9);
    color: #3A6B35;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
}
.menu-btn:hover { background-color: #fff; color: #8B7355; }
.menu-btn:disabled { background-color: #4C4C4C; color: #888; cursor: not-allowed; }
.save-slot-btn { text-align: left; padding-left: 25px; }
.save-slot-btn small { display: block; font-size: 0.9rem; color: #555; margin-top: 5px; }

.menu-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
}
.menu-buttons .menu-btn {
    margin: 0;
}
.menu-buttons .menu-btn:last-child:nth-child(odd) {
    grid-column: span 2;
}

/* 설정 화면 볼륨 컨트롤 */
.settings-content {
    width: 100%;
    margin: 20px 0;
}
.volume-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}
.volume-control label {
    font-size: 1.1rem;
    min-width: 100px;
}
.volume-control input[type="range"] {
    flex: 1;
}
.volume-control span {
    font-size: 1.1rem;
    min-width: 50px;
    text-align: right;
}

.language-control {
    margin-top: 20px;
}
.language-control label {
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-align: center;
}
.language-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.language-buttons button {
    padding: 10px 20px;
    font-size: 1rem;
    font-family: 'Paperozi', sans-serif;
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
}
.language-buttons button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}
.language-buttons button.active {
    background-color: #fff;
    color: #8B7355;
}

/* --- 게임 공통 컴포넌트 --- */
.character-image{
    font-size: 280px;
    margin-top: 80px;
    margin-bottom: 15px;
    transition: transform 0.4s ease, opacity 0.4s ease;
    transform: scale(1);
    opacity: 1;
}

#characterImage {
    max-width: 100%;
    max-height: 900px;
    width: auto;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#characterImage:hover {
    transform: scale(1.05);
}

.character-dialogue{background:rgba(245, 235, 220, 0.45);backdrop-filter:blur(2px);color:#2A1E1E;padding:1.8vh 1.8vw;border-radius:5px;width:100%;font-size:clamp(14px, 2.2vh, 16px);position:relative;border:1px solid rgba(255,255,255,0.4);z-index:10;}
.character-name{color:#005a9c;font-weight:700;font-size:clamp(13px, 2vh, 15px);margin-bottom:5px;}
.bribe-offer{margin-top:10px;padding:10px;background:rgba(225,177,44,.2);border:1px solid #E1B12C;border-radius:3px;font-size:clamp(13px, 2vh, 15px);position:relative;z-index:100;}
.bribe-buttons{margin-top:8px;display:flex;gap:5px;justify-content:center;position:relative;z-index:100;}
.bribe-buttons button { padding: 6px 10px; font-size: 12px; border: none; border-radius: 3px; cursor: pointer; color: #F5F2E7; font-family: 'Paperozi', sans-serif; position:relative;z-index:100; }
#acceptBribeBtn { background:#8B1E1E; }
#rejectBribeBtn { background:#3A6B35; }

.dialogue-box{display:flex;align-items:flex-start;gap:10px;width:100%;}
.dialogue-speaker{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:130px;
    background: white;
    border-radius: 5%;}
.speaker-icon{font-size:clamp(30px, 5vh, 40px);color:white;text-shadow:0 0 5px black;}
.speaker-name{font-size:clamp(9px, 1vh, 10px);color:#000000;font-weight:700;text-align:center;}
.dialogue-content{flex:1;background:rgba(245, 235, 220, 0.45);backdrop-filter:blur(2px);padding:1.8vh 1.8vw;border-radius:5px;border:1px solid rgba(255,255,255,0.4);}
.dialogue-text{color:#ffffff;font-size:clamp(14px, 2.2vh, 16px);font-style:italic;margin:0;}
.character-dialogue .dialogue-text,
.dialogue-content .dialogue-text {
    color: #2A1E1E;
}
.reincarnation-btn, .imprisonment-btn{width:100%;height:100%;font-size:clamp(16px, 2.8vh, 20px);font-weight:700;border:none;border-radius:5px;cursor:pointer;transition:all .3s ease;font-family: 'Paperozi', sans-serif;}
.reincarnation-btn{background:#3A6B35;color:#F5F2E7;}.reincarnation-btn:hover:not(:disabled){background:#5A8B56;}.reincarnation-btn:disabled{background:#4C4C4C;cursor:not-allowed;}
.imprisonment-btn{background:#8B1E1E;color:#F5F2E7;}.imprisonment-btn:hover{background:#A03030;}

/* 지원자 사진 컨테이너 */
.info-photo-container {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#applicantPhoto {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: block;
    margin: 0 auto;
}

.info-section{background:rgba(245, 235, 220, 0.5);margin-bottom:1.5vh;padding:1.2vh 1.2vw;border-radius:3px;border-left:4px solid;}
.section-title{font-size:clamp(19.5px, 3vh, 22.5px);color:#333;margin-bottom:8px;font-weight:700;}
.section-content{font-size:clamp(21px, 3.3vh, 24px);color:#000;}

/* 한글판 지원자 정보 패널 폰트 크기 70% */
html[lang="ko"] #applicantInfoPanel .section-title {
    font-size: clamp(13.65px, 2.1vh, 15.75px);
}
html[lang="ko"] #applicantInfoPanel .section-content {
    font-size: clamp(14.7px, 2.31vh, 16.8px);
}

.death-cause{border-left-color:#8B1E1E;}
.special-marking {
    width: 20px; height: 20px; margin-left: 8px;
    vertical-align: middle;
}
.personality{border-left-color:#3A6B35;}
.desires{border-left-color:#9370db;}
.recommendation{border-left-color:#00a86b;}
.hint-label{font-style:italic;}
.desires .hint-label{color:#9370db;}
.recommendation .hint-label{color:#00a86b;}
.wishes{border-left-color:#E1B12C;}
.skills{border-left-color:#20242C;}
.message{position:fixed;top:20px;left:50%;transform:translateX(-50%);padding:12px 24px;border-radius:3px;font-weight:700;opacity:0;transition:all .3s ease;z-index:3000;box-shadow:0 2px 5px rgba(0,0,0,.2);font-size:1.1rem;}.message.show{opacity:1;transform:translateX(-50%) translateY(10px);}.message.success{background:#3A6B35;color:#F5F2E7;}.message.error{background:#8B1E1E;color:#F5F2E7;}.message.info{background:#20242C;color:#F5F2E7;}.message.warning{background:#E1B12C;color:#2A1E1E;}
.result-overlay,.day-transition{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.8);display:none;align-items:center;justify-content:center;z-index:2500;flex-direction:column;}
.result-popup{background:#fff;color:#2A1E1E;padding:30px;border-radius:5px;max-width:400px;text-align:center;box-shadow:0 10px 30px rgba(0,0,0,.5);border:2px solid #20242C;font-size:1.1rem;}

/* ------------------------------------------------------------------ */
/* --- 최종 가로 모드 레이아웃 --- */
/* ------------------------------------------------------------------ */
.game-container {
    display: grid;
    grid-template-areas:
        "header header header"
        "icon-left monitor icon-right"
        "icon-left monitor icon-right";
    grid-template-columns: 100px 1fr 100px;
    grid-template-rows: auto 1fr auto;
    height: 100%;
    width: 100%;
    gap: 8px;
    padding: 8px;
    position: relative;
}

.header, .monitor-panel, .monitor-panel .dialogue-box {
    position: relative;
    z-index: 2;
}

.character-dialogue {
    position: relative;
    z-index: 10;
}

.header {
    grid-area: header;
    background: rgba(210, 180, 140, 0.75);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 1vh 1vw;
    display: flex;
    flex-direction: column;
    gap: 1vh;
    border-radius: 8px;
}

.header-row-1 {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.header-row-2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1vw;
    padding: 0.5vh 1vw;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.header-stat .stat-label { font-size: clamp(11px, 1.8vh, 14px); color: #113a5d; }
.header-stat .stat-value { font-size: clamp(16px, 2.8vh, 20px); font-weight: bold; color: #002b4d; }
.header-menu { display: flex; gap: 8px; align-items: center; }
.header-btn {
    font-size: clamp(18px, 3.5vh, 24px);
    background: none;
    border: none;
    cursor: pointer;
    color: #002b4d;
    padding: 0;
    transition: transform 0.2s, opacity 0.2s;
}
.header-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}
.header-btn:active {
    transform: scale(0.95);
}
.header-btn-icon {
    width: clamp(32px, 5vh, 48px);
    height: clamp(32px, 5vh, 48px);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}
.header-btn-icon:hover {
    background: rgba(255, 255, 255, 0.5);
}
.btn-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* ========== 아날로그 게이지 (Eclipse 모드 전용) ========== */
.balance-gauge-container {
    flex-shrink: 0;
    width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.analog-gauge {
    position: relative;
    width: 150px;
    height: 75px;
}

.gauge-arc {
    position: relative;
    width: 150px;
    height: 75px;
    border-radius: 75px 75px 0 0;
    background: linear-gradient(to right,
        #7bed9f 0%,
        #7bed9f 30%,
        #ddd 50%,
        #ff6b6b 70%,
        #ff6b6b 100%
    );
    overflow: hidden;
}

.gauge-arc::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 60px;
    background: #F5F2E7;
    border-radius: 60px 60px 0 0;
}

.gauge-center {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #002b4d;
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.gauge-pointer {
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 3px;
    height: 60px;
    background: #002b4d;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    transition: transform 0.6s ease-out;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.gauge-pointer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid #002b4d;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    width: 150px;
    font-size: clamp(10px, 1.5vh, 12px);
    font-weight: 700;
}

.gauge-label-left {
    color: #7bed9f;
}

.gauge-label-right {
    color: #ff6b6b;
}

.world-population-bar {
    display: flex;
    justify-content: space-evenly;
    gap: 1vw;
    flex: 1;
}

/* 세계 인구 현황 아이템 */
.world-population-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    max-width: 150px;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.world-name {
    font-size: clamp(15px, 2.25vh, 18px);
    color: #113a5d;
    font-weight: 700;
    text-align: center;
}

.world-pop {
    font-size: clamp(14px, 2vh, 16px);
    font-weight: 900;
    color: #002b4d;
    font-family: 'Orbitron', sans-serif;
}

/* 인구 진행 바 */
.population-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.population-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.5s ease;
    width: 62.5%; /* 초기값: 125K / 200K = 62.5% */
}

/* 경고 상태 (인구 10만 이하) */
.world-population-item.warning .world-pop {
    color: #ff9800;
}

.world-population-item.warning .population-fill {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}

/* 위험 상태 (재해 진행 중) */
.world-population-item.has-anomaly {
    animation: blinkAnomaly 1.5s ease-in-out infinite;
    background: rgba(255, 51, 51, 0.1);
}

.world-population-item.has-anomaly .population-fill {
    background: linear-gradient(90deg, #f44336, #e57373);
}

/* 멸망 상태 */
.world-population-item.destroyed {
    opacity: 0.3;
}

.world-population-item.destroyed .world-pop::after {
    content: ' ☠️';
    font-size: 0.8em;
}

/* --- 아이콘 메뉴 --- */
.icon-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    align-items: center;
    padding: 10px 5px;
    z-index: 10;
}

.icon-menu:first-of-type {
    grid-area: icon-left;
}

.icon-menu:last-of-type {
    grid-area: icon-right;
}

.icon-menu-btn {
    width: 80px;
    height: 90px;
    font-size: 1.8rem;
    background: rgba(210, 180, 140, 0.75);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    font-family: 'Paperozi', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    position: relative;
}

.icon-menu-btn .icon {
    font-size: 2rem;
    display: block;
}

.icon-menu-btn .label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #002b4d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    display: block;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.icon-menu-btn:hover {
    background: rgba(210, 180, 140, 0.95);
    transform: scale(1.08);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.icon-menu-btn:hover .label {
    color: #001a33;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8);
}

.icon-menu-btn:active {
    transform: scale(0.95);
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #ff3b3b;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.monitor-panel {
    grid-area: monitor;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1vh 0;
    min-height: 0;
    z-index: 10;
}

/* --- 사이드 패널 Wrapper (버튼 overflow 처리) --- */
.side-panel-wrapper {
    position: absolute;
    top: 70px;
    width: 35%;
    max-width: 500px;
    height: calc(100% - 80px);
    z-index: 1000;
    overflow: visible; /* 버튼이 튀어나올 수 있도록 */
}

.side-panel-wrapper.left-panel-wrapper {
    left: 10px;
}

.side-panel-wrapper.right-panel-wrapper {
    right: 10px;
}

/* --- 사이드 패널 (지원자 정보, 공문) --- */
.side-panel {
    position: relative;
    width: 100%;
    height: 100%;
    background: rgba(245, 235, 220, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(210, 180, 140, 0.8);
    border-radius: 10px;
    padding: 20px;
    padding-top: 50px; /* 닫기 버튼 공간 확보 */
    overflow: visible; /* overflow를 없애고 panel-content에서 처리 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

/* panel-content가 스크롤 처리 */
.panel-content {
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100% - 50px); /* padding-top만큼 빼기 */
    padding-right: 5px;
}

/* --- 인게임 설정 패널 (중앙) --- */
.settings-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    width: 90%;
    max-width: 450px;
    max-height: 80%;
    background: rgba(245, 235, 220, 0.98);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(210, 180, 140, 0.9);
    border-radius: 15px;
    padding: 30px;
    padding-top: 60px;
    z-index: 2000;
    overflow-y: auto;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.settings-panel[style*="display: block"] {
    opacity: 1;
}

.settings-panel .close-panel-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    background: #8B1E1E;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transform: none;
}

.settings-panel .close-panel-btn:hover {
    background: #a52a2a;
    transform: scale(1.1);
}

.settings-panel h2 {
    text-align: center;
    color: #8B4513;
    font-size: 2rem;
    margin-bottom: 25px;
    margin-top: 0;
}

/* fadeInScale 애니메이션 제거 - 인게임 설정창 위치 이슈 방지 */

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.close-panel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 50px;
    background: #8B1E1E;
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Paperozi', sans-serif;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Info 패널 (왼쪽) - 오른쪽 끝에서 반쯤 튀어나옴 */
.left-close-btn {
    right: -20px;
    border-radius: 0 8px 8px 0;
}

.left-close-btn:hover {
    background: #A03030;
    right: -25px;
}

/* Dispatch 패널 (오른쪽) - 왼쪽 끝에서 반쯤 튀어나옴 */
.right-close-btn {
    left: -20px;
    border-radius: 8px 0 0 8px;
}

.right-close-btn:hover {
    background: #A03030;
    left: -25px;
}

/* --- 팝업 오버레이 (메뉴얼, 수감) --- */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

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

.popup-content {
    background: rgba(245, 235, 220, 0.95);
    padding: 30px;
    border-radius: 10px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.close-popup-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: #8B1E1E;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Paperozi', sans-serif;
}

.close-popup-btn:hover {
    background: #A03030;
    transform: rotate(90deg);
}

.manual-popup {
    min-width: 600px;
}

/* --- 상점 전체 화면 --- */
.shop-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #D2B48C, #8B7355);
    z-index: 1500;
    padding: 30px;
    overflow-y: auto;
}

.close-shop-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 12px 24px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    font-family: 'Paperozi', sans-serif;
    font-weight: 700;
}

.close-shop-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* --- 공문 스타일 --- */
.document-container {
    background: white;
    padding: 30px 40px;
    border: 2px solid #333;
    border-radius: 5px;
    font-family: 'Paperozi', sans-serif;
    color: #2A1E1E;
    line-height: 1.8;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100% - 50px);
    padding-right: 5px;
}

.document-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.document-header h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.document-number {
    font-size: 0.8rem;
    color: #666;
}

.document-body {
    font-size: 0.95rem;
}

.document-greeting {
    margin-bottom: 15px;
}

.document-intro {
    margin-bottom: 20px;
}

.document-subject {
    margin-bottom: 25px;
    line-height: 2;
}

.document-details {
    background: rgba(210, 180, 140, 0.1);
    padding: 20px;
    border-radius: 5px;
    margin: 25px 0;
    text-align: center;
}

.detail-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.detail-row label {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.doc-select {
    width: 100%;
    max-width: 400px;
    padding: 10px 15px;
    font-size: 1.1rem;
    border: 2px solid #D2B48C;
    border-radius: 5px;
    font-family: 'Paperozi', sans-serif;
    background: white;
    cursor: pointer;
}

.document-closing {
    margin-top: 25px;
    margin-bottom: 30px;
}

.document-signature {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.signature-line {
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.stamp-area {
    width: 150px;
    height: 150px;
    border: 2px dashed #999;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.stamp-area:hover {
    border-color: #333;
    background: rgba(210, 180, 140, 0.1);
}

.stamp-placeholder {
    color: #999;
    font-size: 0.9rem;
    text-align: center;
    user-select: none;
}

.stamp-seal {
    width: 120px;
    height: 120px;
    border: 4px solid #8B1E1E;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(139,30,30,0.9) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: stampAppear 0.5s ease-out;
    box-shadow: 0 4px 10px rgba(139, 30, 30, 0.5);
}

.stamp-text {
    font-size: 2rem;
    font-weight: 900;
    color: #8B1E1E;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    font-family: 'Paperozi', sans-serif;
}

.stamp-date {
    font-size: 0.8rem;
    color: #8B1E1E;
    margin-top: 5px;
    font-weight: 700;
}

@keyframes stampAppear {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* --- 확인 팝업 --- */
.confirm-popup {
    max-width: 500px;
    text-align: center;
    padding: 40px;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-family: 'Paperozi', sans-serif;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.confirm-yes {
    background: #8B1E1E;
    color: white;
}

.confirm-yes:hover {
    background: #A03030;
    transform: scale(1.05);
}

.confirm-no {
    background: #3A6B35;
    color: white;
}

.confirm-no:hover {
    background: #5A8B56;
    transform: scale(1.05);
}

.confirm-btn:active {
    transform: scale(0.95);
}

/* --- 수감 삽화 --- */
.imprison-illustration {
    text-align: center;
    animation: fadeInScale 0.5s ease-out;
}

.imprison-illustration img {
    max-width: 80%;
    max-height: 80vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* --- 지원자 이미지 오버레이 --- */
.character-image-popup {
    text-align: center;
    animation: fadeInScale 0.5s ease-out;
    cursor: pointer;
}

.character-image-popup img {
    max-width: 85%;
    max-height: 85vh;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
    transition: transform 0.3s ease;
}

.character-image-popup img:hover {
    transform: scale(1.02);
}

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

.panel-tabs { display: flex; margin-bottom: 1vh; flex-shrink: 0; }
.tab-btn { 
    flex: 1; 
    padding: 14px 10px; /* 상하 여백 증가 */
    font-size: 18px; /* 폰트 크기 증가 */
    border: 1px solid rgba(0,0,0,0.2); background: rgba(0,0,0,0.1); color: #eee; cursor: pointer; font-family: 'Paperozi', sans-serif; 
}
.tab-btn.active { background: rgba(245, 235, 220, 0.8); color: #002b4d; font-weight: bold; border-bottom-color: transparent; }
.panel-content { flex: 1; overflow-y: auto; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.manual-title { font-size: clamp(14px, 2.4vh, 17px); margin-bottom: 1vh; color: #002b4d; }
.manual-item { background: rgba(245, 235, 220, 0.5); padding: 1.2vh; margin-bottom: 0.5vh; border-left: 3px solid #005a9c; font-size: clamp(12px, 2vh, 14px); }
.shop-header { text-align: center; margin-bottom: 1vh; }
.shop-header h2 { font-size: clamp(24px, 4.2vh, 27px); }
.shop-header p { font-size: clamp(19.5px, 3.3vh, 22.5px); }
.shop-content { display: flex; flex-direction: column; gap: 0.8vh; }
.shop-item { display: flex; align-items: center; background: rgba(245, 235, 220, 0.7); padding: 1vh; border-radius: 3px; }
.shop-item-info { flex: 1; }
.shop-item-name { font-size: clamp(21px, 3.3vh, 24px); font-weight: bold; }
.shop-item-desc { font-size: clamp(19.5px, 3vh, 22.5px); color: #333; margin-top: 4px; }
.shop-item-price { font-size: clamp(18px, 3vh, 21px); margin: 0 0.8vw; }
.buy-btn { font-size: clamp(18px, 3vh, 21px); padding: 1vh; background: #3A6B35; color: #F5F2E7; border: none; cursor: pointer; font-family: 'Paperozi', sans-serif; border-radius: 3px; }
.buy-btn:disabled { background: #4C4C4C; }

.monitor-panel { grid-area: monitor; display: flex; flex-direction: column; justify-content: space-between; padding: 1vh 0; min-height: 0; }
.monitor-panel .dialogue-box { margin-top: 1vh; }

.character-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: -1;
}

.terminal-section { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.terminal-title { font-size: clamp(14px, 2.4vh, 17px); text-align: center; margin-bottom: 0.5vh; padding-bottom: 0.5vh; border-bottom: 1px solid rgba(0,0,0,0.2); flex-shrink: 0; color: #2A1E1E; font-weight: 700; }
.terminal-list { flex: 1; overflow-y: auto; background: rgba(245, 235, 220, 0.6); border-radius: 3px; }
.terminal-list .placeholder { padding: 1.5vh; font-size: clamp(13px, 2.2vh, 15px); color: #555; text-align: center; }
.terminal-item { padding: 1vh 1vw; font-size: clamp(14px, 2.4vh, 16px); cursor: pointer; border-bottom: 1px solid rgba(210, 180, 140, 0.5); position: relative; }
.terminal-item:hover { background: rgba(245, 235, 220, 0.8); }
.terminal-item.selected { background: #E1B12C !important; color: #2A1E1E; font-weight: bold; }

/* --- Karma Bar Styles --- */
.world-item {
    padding-bottom: 14px;
}
.anomaly-warning {
    color: #ff3333;
    font-size: 0.75em;
    font-weight: bold;
    margin-top: 2px;
    text-shadow: 0 0 3px rgba(255,51,51,0.5);
    animation: pulse-warning 1.5s ease-in-out infinite;
}
@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.footer-actions { grid-area: footer; display: grid; grid-template-columns: 1fr 1fr; gap: 1vw; }

/* Day Transition Text Visibility Fix */
.day-transition {
    color: #F5F2E7;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.7);
}

.day-transition h2 {
    font-size: clamp(3.5rem, 15vw, 6rem);
    font-weight: 900;
    font-family: 'Orbitron', sans-serif;
    margin: 0;
    color: #F5F2E7;
}

#transitionDayNumber {
    font-size: clamp(3.5rem, 15vw, 6rem);
    font-weight: 900;
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 1rem;
}

#transitionDayInfo {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
}

/* --- Cutscene Styles --- */
#cutsceneOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: flex-end;
    padding: 20px;
    background-size: cover;
    background-position: center;
    color: #fff;
    font-family: 'Paperozi', sans-serif;
}

.cutscene-box {
    width: 100%;
    max-width: 900px;
    min-height: 200px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #fff;
    border-radius: 10px;
    padding: 15px;
    padding-top: 40px; /* speaker-info 공간 확보 */
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.speaker-info {
    position: absolute; /* 대화창 위로 올라오도록 */
    top: -35px; /* 대화창 경계선 위로 살짝 올림 */
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    padding: 5px 15px;
    border-radius: 5px;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    gap: 12px;
}

.speaker-icon {
    font-size: 1.8rem;
}

.speaker-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ffffff;
}

.cutscene-box .dialogue-text {
    font-size: 1.5rem;
    line-height: 1.6;
    flex-grow: 1; /* 남은 공간을 모두 차지 */
}

.next-indicator {
    text-align: right;
    font-size: 1.4rem;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.player-options {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.player-option-btn {
    width: 80%;
    padding: 15px;
    font-size: 1.3rem;
    font-family: 'Paperozi', sans-serif;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.player-option-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.speaker-portrait{
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid #fff;
}
.is-cutscene #characterDialogue, /* 컷신 중 지원자 대화창만 숨김 */
.is-daytransition #characterDialogue, /* 날짜 변경 중 지원자 대화창 숨김 */
.is-daytransition #characterImage { /* 날짜 변경 중 지원자 이미지 숨김 */
  visibility: hidden;
}

/* Game Over Screen */
.game-over-content {
    text-align: center;
}

/* Feedback Sections */
.feedback-section {
    margin-top: 15px;
    padding: 12px;
    border-radius: 5px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.feedback-muyoung {
    background: rgba(78, 205, 196, 0.1);
    border-left: 4px solid #4ECDC4;
    color: #4ECDC4;
}

.feedback-eclipse {
    background: rgba(255, 107, 157, 0.1);
    border-left: 4px solid #FF6B9D;
    color: #FF6B9D;
}

.feedback-section strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
}

/* Eclipse Mode Button */
.eclipse-mode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: 2px solid #9F7AEA !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s ease !important;
}

.eclipse-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
}

/* --- Achievements Screen --- */
.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 5px;
    margin-bottom: 20px;
}

.achievement-item {
    background: #333;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #6a5acd, #483d8b);
    opacity: 1;
    border-color: #9370db;
}

.achievement-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.achievement-details {
    flex-grow: 1;
}

.achievement-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
}

.achievement-item.locked .achievement-title {
    color: #888;
}

.achievement-desc {
    font-size: 0.9rem;
    color: #ccc;
    margin-top: 5px;
}

.achievement-item.locked .achievement-desc {
    color: #666;
}

#achievement-unlocked-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #2A1E1E;
    padding: 15px 30px;
    border-radius: 50px;
    z-index: 9999;
    font-size: 1.2rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: none;
    animation: toast-in-out 4s forwards;
}

@keyframes toast-in-out {
    0% { transform: translate(-50%, 100px); opacity: 0; }
    20% { transform: translate(-50%, 0); opacity: 1; }
    80% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, 100px); opacity: 0; }
}

/* ========== Phase 1: 시각적 피드백 강화 애니메이션 ========== */

/* 캐릭터 페이드아웃 (배정 승인 시) */
@keyframes fadeOutUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.8);
    }
}

.character-fadeout {
    animation: fadeOutUp 0.8s ease-out forwards;
}

/* 캐릭터 등장 애니메이션 */
@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-appear {
    animation: slideInFromTop 0.5s ease-out;
}

/* 인구 변화 숫자 팝업 */
@keyframes popupNumber {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) scale(1);
    }
}

.popup-number {
    position: fixed;
    font-size: 4rem;
    font-weight: 900;
    font-family: 'Orbitron', sans-serif;
    z-index: 3500;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    animation: popupNumber 1.5s ease-out forwards;
}

.popup-number.positive {
    color: #00ff00;
}

.popup-number.negative {
    color: #ff3333;
}

/* 화면 플래시 효과 */
@keyframes flashSuccess {
    0% {
        background-color: rgba(255, 215, 0, 0);
    }
    50% {
        background-color: rgba(255, 215, 0, 0.3);
    }
    100% {
        background-color: rgba(255, 215, 0, 0);
    }
}

@keyframes flashFail {
    0% {
        background-color: rgba(255, 51, 51, 0);
    }
    50% {
        background-color: rgba(255, 51, 51, 0.4);
    }
    100% {
        background-color: rgba(255, 51, 51, 0);
    }
}

.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    pointer-events: none;
}

.screen-flash.success {
    animation: flashSuccess 0.3s ease-out;
}

.screen-flash.fail {
    animation: flashFail 0.5s ease-out;
}

/* 화면 흔들림 (재해 발생 시) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.screen-shake {
    animation: shake 0.5s ease-in-out;
}

/* 세계 아이콘 깜박임 (재해 진행 중) */
@keyframes blinkAnomaly {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 rgba(255, 51, 51, 0);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 20px rgba(255, 51, 51, 0.8);
    }
}

.world-item.has-anomaly {
    animation: blinkAnomaly 1.5s ease-in-out infinite;
}

/* 결과 박스 개선 (아래에서 슬라이드 인) */
@keyframes slideInFromBottom {
    0% {
        opacity: 0;
        transform: translateY(100px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 개선된 결과 오버레이 */
.enhanced-result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.enhanced-result-box {
    background: linear-gradient(135deg, rgba(245, 235, 220, 0.95), rgba(200, 220, 240, 0.95));
    padding: 40px;
    border-radius: 15px;
    max-width: 700px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    border: 3px solid rgba(210, 180, 140, 0.8);
    animation: slideInFromBottom 0.4s ease-out;
}

.enhanced-result-header {
    position: relative;
    text-align: center;
    margin-bottom: 30px;
}

.enhanced-result-name {
    font-size: 2.5rem;
    font-weight: 900;
    color: #002b4d;
    margin-bottom: 10px;
    font-family: 'Orbitron', sans-serif;
}

.result-close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    background: #ff3333;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
}

.result-close-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.enhanced-result-image {
    max-width: 200px;
    max-height: 200px;
    margin: 0 auto 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.enhanced-result-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    font-family: 'Orbitron', sans-serif;
}

.stat-value.positive {
    color: #00ff00;
}

.stat-value.negative {
    color: #ff3333;
}

.enhanced-result-text {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #2A1E1E;
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
}

/* Typewriter 효과용 커서 */
.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background-color: #2A1E1E;
    margin-left: 3px;
    animation: blink 0.7s infinite;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== Resolution Settings ==================== */

/* Resolution Bar (Body 최상단에 고정) */
.resolution-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 35px;
    background: rgba(0, 0, 0, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 15px;
    backdrop-filter: blur(5px);
}

.resolution-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resolution-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resolution-dropdown {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.85rem;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.resolution-dropdown:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #E1B12C;
}

.resolution-dropdown:focus {
    border-color: #E1B12C;
    box-shadow: 0 0 5px rgba(225, 177, 44, 0.5);
}

.resolution-dropdown option {
    background: #2A1E1E;
    color: #fff;
}

/* Resolution control in settings */
.resolution-control {
    margin-top: 30px;
    padding: 20px 0;
}

.resolution-control label {
    display: block;
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #2A1E1E;
    font-weight: 700;
}

.resolution-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.resolution-btn {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #8B7355;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #2A1E1E;
    transition: all 0.3s ease;
    font-family: 'Orbitron', sans-serif;
    min-width: 140px;
}

.resolution-btn small {
    display: block;
    font-size: 0.75rem;
    margin-top: 5px;
    opacity: 0.7;
    pointer-events: none; /* 클릭 이벤트가 부모 버튼으로 전달되도록 */
}

.resolution-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #E1B12C;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.resolution-btn.active {
    background: #E1B12C;
    border-color: #D2B48C;
    color: #fff;
    box-shadow: 0 4px 12px rgba(225, 177, 44, 0.5);
}

/* ==================== Container Queries ==================== */

/* Container Query 설정 (이미 responsive.js에서 적용) */
.total-container {
    container-type: size;
    container-name: game-container;
}

/* 1024×768 (Classic 4:3) - 기본값 */
@container game-container (width: 1024px) {
    .header {
        font-size: 0.9rem;
    }

    .menu-btn {
        font-size: 1.2rem;
        padding: 12px 30px;
    }

    .side-panel {
        width: 300px;
    }

    /* 컷신 스타일 */
    .cutscene-box {
        max-width: 700px;
        min-height: 180px;
    }

    .cutscene-box .dialogue-text {
        font-size: 1.3rem;
    }

    .speaker-name {
        font-size: 1.2rem;
    }

    /* 캐릭터 이미지 */
    #characterImage {
        max-height: 350px;
    }

    .character-image {
        margin-top: 70px;
    }
}

/* 1280×720 (HD 16:9) */
@container game-container (width: 1280px) {
    .header {
        font-size: 1rem;
        padding: 15px 25px;
    }

    .menu-btn {
        font-size: 1.3rem;
        padding: 14px 35px;
    }

    .menu-container {
        max-width: 550px;
        padding: 35px;
    }

    .menu-container h1 {
        font-size: 2.8rem;
    }

    .menu-container h2 {
        font-size: 1.8rem;
    }

    #playerNameInput {
        padding: 14px;
        font-size: 1.2rem;
        max-width: 280px;
    }

    .menu-buttons {
        gap: 18px;
    }

    .side-panel {
        width: 350px;
    }

    .dialogue-box {
        font-size: 1.1rem;
        padding: 20px 25px;
    }

    /* 16:9에서 좌우 공간 활용 */
    .icon-menu-left {
        left: 15px;
    }

    .icon-menu-right {
        right: 15px;
    }

    /* 컷신 스타일 */
    .cutscene-box {
        max-width: 800px;
        min-height: 200px;
    }

    .cutscene-box .dialogue-text {
        font-size: 1.4rem;
    }

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

    .speaker-icon {
        font-size: 1.9rem;
    }

    /* 캐릭터 이미지 */
    #characterImage {
        max-height: 420px;
    }

    .character-image {
        margin-top: 60px;
        font-size: 320px;
    }
}

/* 1920×1080 (Full HD 16:9) */
@container game-container (width: 1920px) {
    .header {
        font-size: 1.2rem;
        padding: 20px 40px;
    }

    .header-row-1 {
        gap: 40px;
    }

    .menu-btn {
        font-size: 1.6rem;
        padding: 18px 45px;
    }

    .menu-container {
        max-width: 700px;
        padding: 50px;
    }

    .menu-container h1 {
        font-size: 4rem;
        margin-bottom: 40px;
    }

    .menu-container h2 {
        font-size: 2.2rem;
        margin-bottom: 30px;
    }

    #playerNameInput {
        padding: 16px;
        font-size: 1.4rem;
        max-width: 350px;
    }

    .menu-buttons {
        gap: 20px;
    }

    .side-panel {
        width: 450px;
        font-size: 1.2rem;
    }

    /* 캐릭터 이미지 */
    #characterImage {
        height: 800px;
        width: auto;
    }

    .character-image {
        margin-top: 80px;
        font-size: 650px;
        width: 900px;
        height: 900px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .dialogue-box {
        font-size: 1.3rem;
        padding: 25px 35px;
    }

    .monitor-panel {
        padding: 30px;
        gap: 25px;
    }

    /* 아이콘 메뉴 확대 */
    .icon-menu-btn {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
    }

    .icon-menu-btn .label {
        font-size: 0.9rem;
    }

    /* 16:9 와이드 레이아웃 - 더 넓은 간격 */
    .icon-menu-left {
        left: 20px;
    }

    .icon-menu-right {
        right: 20px;
    }

    /* 상점 그리드 확대 */
    .shop-content {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }

    /* 세계 인구 바 확대 */
    .world-population-bar {
        gap: 25px;
        padding: 20px 30px;
    }

    /* 컷신 스타일 */
    .cutscene-box {
        max-width: 1100px;
        min-height: 250px;
        padding: 25px;
        padding-top: 50px;
    }

    .cutscene-box .dialogue-text {
        font-size: 1.7rem;
        line-height: 1.8;
    }

    .speaker-name {
        font-size: 1.6rem;
    }

    .speaker-icon {
        font-size: 2.2rem;
    }

    .speaker-portrait {
        width: 64px;
        height: 64px;
    }

    .player-option-btn {
        font-size: 1.5rem;
        padding: 18px;
    }
}

/* ==================== Fallback for non-Container Query browsers ==================== */

/* JS에서 설정한 CSS 변수 사용 */
@supports not (container-type: size) {
    .total-container[data-resolution="hd"] .header {
        font-size: calc(0.9rem * var(--scale-factor, 1));
    }

    .total-container[data-resolution="hd"] .menu-btn {
        font-size: calc(1.2rem * var(--scale-factor, 1));
    }

    .total-container[data-resolution="fhd"] .header {
        font-size: calc(0.9rem * var(--scale-factor, 1));
    }

    .total-container[data-resolution="fhd"] .menu-btn {
        font-size: calc(1.2rem * var(--scale-factor, 1));
    }
}