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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

/* 피버 모드 배경 */
body.fever-mode {
    animation: feverBg 0.5s ease infinite alternate;
}

@keyframes feverBg {
    from { background: linear-gradient(135deg, #2a1a1e 0%, #3e1616 50%, #601010 100%); }
    to { background: linear-gradient(135deg, #3a2a1e 0%, #4e2616 50%, #702010 100%); }
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
}

/* 광고 배너 */
.ad-banner {
    background: linear-gradient(90deg, #2a2a4a, #3a3a5a);
    border: 2px dashed #555;
    border-radius: 8px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 14px;
    margin: 10px 0;
}

/* 메인 레이아웃 */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 15px;
    margin: 15px 0;
}

/* 패널 공통 */
.upgrades-panel,
.automation-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 75vh;
    overflow-y: auto;
}

.upgrades-panel h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #ffd700;
}

/* 업그레이드 아이템 */
.upgrade-item {
    background: linear-gradient(145deg, #2a2a4a, #1a1a3a);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.upgrade-item:hover {
    transform: translateY(-2px);
    border-color: #ffd700;
}

.upgrade-item.affordable {
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.upgrade-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.upgrade-count {
    background: #ffd700;
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.upgrade-effect {
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 3px;
}

.upgrade-cost {
    font-size: 0.8rem;
    color: #4CAF50;
    font-weight: bold;
}

/* 중앙 패널 */
.center-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* 스탯 바 */
.stats-bar {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 25px;
    border-radius: 15px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat.main-stat {
    padding: 0 20px;
    border-left: 1px solid #444;
    border-right: 1px solid #444;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 3px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffd700;
}

.stat-value.gem-color {
    color: #00bcd4;
}

.stat-value.auto-value {
    color: #4CAF50;
}

.stat-value.active-production {
    animation: pulse-green 1s ease infinite;
}

@keyframes pulse-green {
    0%, 100% { color: #4CAF50; }
    50% { color: #8BC34A; text-shadow: 0 0 10px #4CAF50; }
}

/* 피버 게이지 */
.fever-section {
    width: 100%;
    text-align: center;
}

.fever-bar {
    background: #1a1a3a;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}

.fever-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ff8e53, #ffd93d);
    width: 0%;
    transition: width 0.2s ease;
    border-radius: 10px;
}

.fever-fill.fever-active {
    animation: feverPulse 0.3s ease infinite alternate;
}

@keyframes feverPulse {
    from { filter: brightness(1); }
    to { filter: brightness(1.5); }
}

.fever-text {
    font-size: 0.85rem;
    color: #ff8e53;
    font-weight: bold;
}

/* 공장 클릭 영역 */
.factory-display {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 220px;
}

.click-button {
    width: 180px;
    height: 180px;
    background: linear-gradient(145deg, #3a3a6a, #2a2a5a);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 4px solid #ffd700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    user-select: none;
}

.click-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
}

.click-button:active,
.click-button.clicked {
    transform: scale(0.95);
}

.factory-icon {
    font-size: 3.5rem;
    margin-bottom: 5px;
}

.click-text {
    font-size: 1rem;
    color: #ffd700;
    font-weight: bold;
}

/* 진행도 */
.progress-section {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 15px;
    border-radius: 12px;
    text-align: center;
}

.progress-section h3 {
    margin-bottom: 8px;
    color: #ffd700;
    font-size: 0.9rem;
}

#milestone-name {
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #aaa;
}

.progress-bar {
    background: #1a1a3a;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A, #CDDC39);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 8px;
}

#milestone-text {
    font-size: 0.75rem;
    color: #888;
}

/* 프레스티지 */
.prestige-section {
    width: 100%;
    background: linear-gradient(145deg, #4a2a6a, #3a1a5a);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid #9c27b0;
}

.prestige-section.hidden { display: none; }

.prestige-section h3 {
    color: #e1bee7;
    margin-bottom: 8px;
    font-size: 1rem;
}

.prestige-section p {
    margin-bottom: 10px;
    color: #ce93d8;
    font-size: 0.85rem;
}

.prestige-points {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.2rem;
}

.prestige-btn {
    background: linear-gradient(145deg, #9c27b0, #7b1fa2);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.prestige-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.5);
}

/* 탭 시스템 */
.panel-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
}

.panel-tabs.second-row {
    margin-top: 0;
}

.tab-btn {
    flex: 1;
    padding: 8px 5px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.tab-btn.active {
    background: #ffd700;
    color: #000;
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.2);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-description {
    text-align: center;
    color: #888;
    font-size: 0.8rem;
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* 자동화 요약 */
.auto-summary {
    background: linear-gradient(145deg, #1a3a1a, #0a2a0a);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    text-align: center;
}

.auto-summary-title {
    font-size: 0.85rem;
    color: #8BC34A;
    margin-bottom: 5px;
}

.auto-summary-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.auto-summary-sub {
    font-size: 0.75rem;
    color: #888;
    margin-top: 5px;
}

/* 자동화 아이템 */
.automation-item {
    background: linear-gradient(145deg, #2a4a2a, #1a3a1a);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.automation-item:hover {
    border-color: #4CAF50;
}

.automation-item.affordable {
    border-color: #8BC34A;
    box-shadow: 0 0 10px rgba(139, 195, 74, 0.3);
}

.automation-item.active {
    background: linear-gradient(145deg, #3a5a3a, #2a4a2a);
}

.current-production {
    font-size: 0.75rem;
    color: #8BC34A;
    font-weight: bold;
    margin: 3px 0;
}

.automation-flavor {
    font-size: 0.7rem;
    color: #666;
    font-style: italic;
    margin-top: 3px;
}

/* 연구 아이템 */
.research-item {
    background: linear-gradient(145deg, #2a3a4a, #1a2a3a);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.research-item:hover {
    border-color: #2196F3;
}

.research-item.affordable {
    border-color: #64B5F6;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
}

.research-item.maxed {
    opacity: 0.6;
    cursor: default;
}

.maxed-text {
    color: #ffd700;
    font-weight: bold;
    font-size: 0.85rem;
}

/* 기술 아이템 */
.tech-item {
    background: linear-gradient(145deg, #4a2a4a, #3a1a3a);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.tech-item:hover {
    border-color: #9c27b0;
}

.tech-item.affordable {
    border-color: #BA68C8;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.3);
}

.tech-item.purchased {
    border-color: #4CAF50;
    opacity: 0.7;
}

.tech-points {
    text-align: center;
    padding: 10px;
    background: rgba(156, 39, 176, 0.2);
    border-radius: 10px;
    margin-bottom: 12px;
    font-weight: bold;
    color: #e1bee7;
}

/* 퀘스트 */
.quest-item {
    background: linear-gradient(145deg, #3a3a2a, #2a2a1a);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border: 2px solid #ffd700;
}

.quest-item.completed {
    border-color: #4CAF50;
    background: linear-gradient(145deg, #2a4a2a, #1a3a1a);
}

.quest-name {
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.quest-progress-bar {
    background: #1a1a3a;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffb700);
    transition: width 0.3s ease;
}

.quest-progress-text {
    font-size: 0.75rem;
    color: #888;
}

.quest-reward {
    font-size: 0.8rem;
    color: #ffd700;
    margin-top: 5px;
}

.claim-btn {
    margin-top: 8px;
    padding: 6px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.claim-btn:hover {
    background: #8BC34A;
    transform: scale(1.05);
}

.quest-locked {
    text-align: center;
    padding: 30px;
    color: #888;
}

/* 업적 */
.achievement-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
}

.achievement-item.unlocked {
    background: linear-gradient(145deg, #3a3a1a, #2a2a0a);
    border: 1px solid #ffd700;
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-name {
    font-size: 0.85rem;
}

.achievement-reward {
    font-size: 0.8rem;
    color: #00bcd4;
}

/* 통계 */
.stats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 0.85rem;
}

/* 업적 팝업 */
.achievement-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, #ffd700, #ffb700);
    color: #000;
    padding: 12px 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideDown 0.5s ease;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.5);
}

.achievement-popup.hidden { display: none; }

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.achievement-icon { font-size: 1.8rem; }
.achievement-title { font-weight: bold; font-size: 0.8rem; }

/* 플로팅 숫자 */
#floating-numbers {
    position: fixed;
    pointer-events: none;
    z-index: 100;
}

.floating-number {
    position: absolute;
    font-weight: bold;
    color: #ffd700;
    font-size: 1.3rem;
    animation: floatUp 1s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.floating-number.critical {
    color: #ff4444;
    font-size: 1.8rem;
    animation: floatUpCrit 1s ease-out forwards;
}

.floating-number.gem {
    color: #00bcd4;
    font-size: 1.5rem;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-80px) scale(1.2); }
}

@keyframes floatUpCrit {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    50% { transform: translateY(-40px) scale(1.5); }
    100% { opacity: 0; transform: translateY(-100px) scale(1); }
}

/* 골든 파츠 */
.golden-parts {
    position: absolute;
    font-size: 2.5rem;
    cursor: pointer;
    animation: goldenFloat 1s ease-in-out infinite, goldenGlow 0.5s ease infinite alternate;
    z-index: 50;
}

@keyframes goldenFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes goldenGlow {
    from { filter: drop-shadow(0 0 5px #ffd700); }
    to { filter: drop-shadow(0 0 20px #ffd700); }
}

/* 파티클 */
.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffd700;
    border-radius: 50%;
    pointer-events: none;
    animation: particle 0.8s ease-out forwards;
}

.critical-particle {
    background: #ff4444;
    width: 12px;
    height: 12px;
}

@keyframes particle {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0) translate(var(--tx), var(--ty)); }
}

/* 콤보 표시 */
.combo-display {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, #ff6b6b, #ee5a5a);
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85rem;
    animation: comboBounce 0.3s ease;
    white-space: nowrap;
}

@keyframes comboBounce {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.2); }
}

/* 레벨업 효과 */
.level-up-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: levelUp 1.5s ease-out forwards;
    z-index: 1000;
    pointer-events: none;
}

@keyframes levelUp {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(2); }
}

/* 저장 컨트롤 */
.save-controls {
    position: fixed;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
}

.save-controls button {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

#save-btn { background: #4CAF50; color: white; }
#load-btn { background: #2196F3; color: white; }
#reset-btn { background: #f44336; color: white; }

.save-controls button:hover { transform: scale(1.05); }

/* 스크롤바 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: rgba(255, 215, 0, 0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 215, 0, 0.7); }

/* 보석 상점 */
.shop-header-info {
    text-align: center;
    padding: 12px;
    background: linear-gradient(145deg, #1a3a4a, #0a2a3a);
    border: 2px solid #00bcd4;
    border-radius: 12px;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.gem-display {
    color: #00bcd4;
    font-weight: bold;
    font-size: 1.3rem;
}

.shop-section {
    margin-bottom: 15px;
}

.shop-section h4 {
    color: #ffd700;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
    font-size: 0.9rem;
}

.shop-item {
    background: linear-gradient(145deg, #2a3a4a, #1a2a3a);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.shop-item:hover {
    border-color: #00bcd4;
    transform: translateY(-2px);
}

.shop-item.affordable {
    border-color: #00bcd4;
    box-shadow: 0 0 10px rgba(0, 188, 212, 0.3);
}

.shop-item.maxed {
    opacity: 0.5;
    cursor: default;
    border-color: #4CAF50;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.shop-name {
    font-weight: bold;
    font-size: 0.85rem;
}

.shop-count {
    background: #00bcd4;
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

.shop-desc {
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 5px;
}

.shop-cost {
    font-size: 0.8rem;
    color: #00bcd4;
    font-weight: bold;
}

/* 골든 아워 효과 */
body.golden-hour {
    animation: goldenHourBg 1s ease infinite alternate;
}

@keyframes goldenHourBg {
    from {
        background: linear-gradient(135deg, #2a2a1e 0%, #3e3616 50%, #605010 100%);
    }
    to {
        background: linear-gradient(135deg, #3a3a2e 0%, #4e4626 50%, #706020 100%);
    }
}

body.golden-hour .click-button {
    border-color: #ffd700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
}

/* 메가 피버 효과 */
body.mega-fever {
    animation: megaFeverBg 0.3s ease infinite alternate;
}

@keyframes megaFeverBg {
    from {
        background: linear-gradient(135deg, #4a1a1e 0%, #6e1616 50%, #901010 100%);
    }
    to {
        background: linear-gradient(135deg, #5a2a2e 0%, #7e2626 50%, #a02020 100%);
    }
}

body.mega-fever .click-button {
    animation: megaPulse 0.2s ease infinite alternate;
}

@keyframes megaPulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

/* 버프 인디케이터 */
.buff-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 10px;
    z-index: 500;
}

.buff-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.buff-timer {
    color: #ffd700;
}

/* 탭 세 번째 줄 */
.panel-tabs.third-row {
    margin-top: 0;
}

/* 섹션 타이틀 */
.section-title {
    color: #ffd700;
    font-size: 0.9rem;
    margin: 15px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
}

/* 제품 시스템 */
.product-bonus-summary {
    background: linear-gradient(145deg, #2a4a3a, #1a3a2a);
    border: 2px solid #4CAF50;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
    text-align: center;
}

.product-bonus-summary span {
    color: #8BC34A;
    font-weight: bold;
}

.product-item {
    background: linear-gradient(145deg, #3a3a2a, #2a2a1a);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.product-item:hover {
    border-color: #ff9800;
    transform: translateY(-2px);
}

.product-item.affordable {
    border-color: #ff9800;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.3);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.product-name {
    font-weight: bold;
    font-size: 0.85rem;
}

.product-count {
    background: #ff9800;
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

.product-desc {
    font-size: 0.75rem;
    color: #aaa;
    margin-bottom: 3px;
}

.product-bonus {
    font-size: 0.75rem;
    color: #8BC34A;
    margin-bottom: 3px;
}

.product-cost {
    font-size: 0.8rem;
    color: #ff9800;
    font-weight: bold;
}

/* 시설 시스템 */
.facility-item {
    background: linear-gradient(145deg, #2a2a4a, #1a1a3a);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.facility-item:hover {
    border-color: #9c27b0;
    transform: translateY(-2px);
}

.facility-item.affordable {
    border-color: #BA68C8;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.3);
}

.facility-item.maxed {
    opacity: 0.6;
    cursor: default;
    border-color: #4CAF50;
}

.facility-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.facility-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.facility-level {
    background: #9c27b0;
    color: #fff;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.facility-effect {
    font-size: 0.75rem;
    color: #ce93d8;
    margin-bottom: 5px;
}

.facility-cost {
    font-size: 0.8rem;
    color: #BA68C8;
    font-weight: bold;
}

/* 도박 시스템 */
.gambling-item {
    background: linear-gradient(145deg, #4a3a2a, #3a2a1a);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.gambling-item:hover {
    border-color: #ff5722;
    transform: translateY(-2px);
}

.gambling-item.available {
    border-color: #ff5722;
    box-shadow: 0 0 15px rgba(255, 87, 34, 0.4);
}

.gambling-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.gambling-name {
    font-weight: bold;
    font-size: 0.95rem;
}

.gambling-odds {
    background: linear-gradient(145deg, #ff5722, #e64a19);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.gambling-desc {
    font-size: 0.8rem;
    color: #ffab91;
    margin-bottom: 5px;
}

.gambling-bet {
    font-size: 0.75rem;
    color: #888;
}

.gamble-btn {
    margin-top: 8px;
    padding: 8px 20px;
    background: linear-gradient(145deg, #ff5722, #e64a19);
    border: none;
    color: #fff;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.gamble-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 15px rgba(255, 87, 34, 0.4);
}

.gambling-locked {
    margin-top: 8px;
    color: #666;
    font-size: 0.75rem;
    font-style: italic;
}

.gambling-stats {
    background: rgba(255, 87, 34, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    text-align: center;
}

.gambling-stats p {
    font-size: 0.8rem;
    color: #ffab91;
    margin-bottom: 5px;
}

.gambling-stats p:last-child {
    margin-bottom: 0;
}

.gambling-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gambling-stat:last-child {
    border-bottom: none;
}

.gambling-stat .win {
    color: #4CAF50;
    font-weight: bold;
}

.gambling-stat .lose {
    color: #f44336;
    font-weight: bold;
}

/* 도박 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, #2a2a4a, #1a1a3a);
    border-radius: 20px;
    padding: 25px;
    min-width: 350px;
    max-width: 90%;
    border: 3px solid #ff5722;
    box-shadow: 0 0 50px rgba(255, 87, 34, 0.5);
}

.modal-content h3 {
    text-align: center;
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.gamble-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.gamble-info p {
    margin-bottom: 8px;
    color: #aaa;
}

.gamble-info p:last-child {
    margin-bottom: 0;
}

.bet-controls {
    margin-bottom: 20px;
}

.bet-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}

.bet-buttons button {
    padding: 8px 15px;
    background: linear-gradient(145deg, #3a3a6a, #2a2a5a);
    border: 2px solid #555;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.bet-buttons button:hover {
    border-color: #ff5722;
    background: linear-gradient(145deg, #4a4a7a, #3a3a6a);
}

#bet-amount {
    width: 100%;
    height: 12px;
    margin-bottom: 15px;
    cursor: pointer;
    accent-color: #ff5722;
}

.bet-display {
    text-align: center;
    font-size: 1.3rem;
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 8px;
}

.potential-win {
    text-align: center;
    font-size: 1.1rem;
    color: #4CAF50;
    font-weight: bold;
}

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

.gamble-confirm {
    padding: 12px 30px;
    background: linear-gradient(145deg, #ff5722, #e64a19);
    border: none;
    color: #fff;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.gamble-confirm:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 87, 34, 0.5);
}

.gamble-cancel {
    padding: 12px 30px;
    background: linear-gradient(145deg, #555, #444);
    border: none;
    color: #fff;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.gamble-cancel:hover {
    background: linear-gradient(145deg, #666, #555);
}

/* 도박 결과 팝업 */
.gambling-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px 50px;
    border-radius: 20px;
    font-size: 1.8rem;
    font-weight: bold;
    z-index: 3000;
    animation: resultPop 0.5s ease;
    text-align: center;
}

.gambling-result.win {
    background: linear-gradient(145deg, #2a5a2a, #1a4a1a);
    border: 3px solid #4CAF50;
    color: #8BC34A;
    box-shadow: 0 0 50px rgba(76, 175, 80, 0.6);
}

.gambling-result.lose {
    background: linear-gradient(145deg, #5a2a2a, #4a1a1a);
    border: 3px solid #f44336;
    color: #ff6b6b;
    box-shadow: 0 0 50px rgba(244, 67, 54, 0.6);
}

@keyframes resultPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ===== 보스 시스템 ===== */
.boss-locked {
    text-align: center;
    padding: 30px 15px;
    color: #888;
}

.boss-locked p {
    margin-bottom: 10px;
}

.boss-stats {
    background: rgba(156, 39, 176, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
}

.boss-stat {
    font-size: 0.9rem;
    color: #ce93d8;
}

.boss-stat .win {
    color: #4CAF50;
    font-weight: bold;
}

.boss-item {
    background: linear-gradient(145deg, #3a2a4a, #2a1a3a);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border: 2px solid #9c27b0;
    transition: all 0.2s ease;
}

.boss-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.3);
}

.boss-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.boss-emoji {
    font-size: 2rem;
}

.boss-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #e1bee7;
}

.boss-info {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.boss-hp {
    color: #ff6b6b;
}

.boss-time {
    color: #64B5F6;
}

.boss-rewards {
    font-size: 0.85rem;
    color: #ffd700;
    margin-bottom: 12px;
}

.boss-challenge-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(145deg, #9c27b0, #7b1fa2);
    border: none;
    color: white;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.boss-challenge-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.5);
}

/* 보스 전투 UI */
.boss-battle {
    text-align: center;
}

.boss-battle-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.boss-battle-emoji {
    font-size: 3rem;
    animation: bossShake 0.5s ease infinite;
}

@keyframes bossShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.boss-battle-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: #e1bee7;
}

.boss-hp-bar {
    background: #1a1a3a;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
    border: 2px solid #9c27b0;
}

.boss-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #f44336, #ff6b6b, #ff8a80);
    transition: width 0.2s ease;
    border-radius: 13px;
}

.boss-hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.boss-timer {
    font-size: 1.2rem;
    font-weight: bold;
    color: #64B5F6;
    margin-bottom: 10px;
}

.boss-timer.danger {
    color: #f44336;
    animation: timerPulse 0.5s ease infinite;
}

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

.boss-damage-info {
    font-size: 0.9rem;
    color: #ffab91;
    margin-bottom: 5px;
}

.boss-battle-rewards {
    font-size: 0.85rem;
    color: #ffd700;
    margin-bottom: 15px;
}

.boss-click-area {
    background: linear-gradient(145deg, #2a1a3a, #1a0a2a);
    border: 3px solid #9c27b0;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
}

.boss-click-area:hover {
    background: linear-gradient(145deg, #3a2a4a, #2a1a3a);
}

.boss-click-area:active {
    transform: scale(0.98);
}

.boss-target {
    font-size: 4rem;
    display: block;
    animation: bossFloat 1s ease-in-out infinite;
}

@keyframes bossFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.boss-hint {
    display: block;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #888;
}

.boss-flee-btn {
    padding: 8px 20px;
    background: linear-gradient(145deg, #555, #444);
    border: none;
    color: #aaa;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.boss-flee-btn:hover {
    background: linear-gradient(145deg, #666, #555);
    color: #fff;
}

/* 보스 데미지 표시 */
.boss-damage {
    position: absolute;
    font-weight: bold;
    color: #ff6b6b;
    font-size: 1.2rem;
    animation: bossDamageFloat 0.8s ease-out forwards;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.boss-damage.critical {
    color: #ffd700;
    font-size: 1.8rem;
}

@keyframes bossDamageFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-50px) scale(1.3); }
}

/* 유지비 표시 */
.maintenance-warning {
    background: linear-gradient(145deg, #4a2a1a, #3a1a0a);
    border: 2px solid #ff5722;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 12px;
    text-align: center;
    font-size: 0.85rem;
}

.maintenance-warning span {
    color: #ff5722;
    font-weight: bold;
}

/* 반응형 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    .upgrades-panel, .automation-panel {
        max-height: none;
    }
    .modal-content {
        min-width: 300px;
    }
}
