/* メインスタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #2c3e50;
    color: #ecf0f1;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s;
}

.screen.hidden {
    display: none;
    opacity: 0;
}

/* タイトル画面 */
#title-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#language-selector {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#title-screen h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 3rem;
    opacity: 0.9;
}

/* ボタン */
.btn-primary, .btn-secondary, .btn-action, .btn-end {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-action {
    background-color: #27ae60;
    color: white;
    margin: 0.5rem;
}

.btn-action:hover {
    background-color: #229954;
}

.btn-action:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-end {
    background-color: #e74c3c;
}

.btn-end:hover {
    background-color: #c0392b;
}

/* メインゲーム画面 */
#main-screen {
    padding: 1rem;
    background-color: transparent;
}

#header {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    background-color: rgba(44, 62, 80, 0.9);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none; /* ヘッダーを透過してクリック可能に */
}

#header > * {
    pointer-events: auto; /* ヘッダー内の要素はクリック可能に */
}

#phase-title {
    font-size: 1.5rem;
}

#turn-info {
    font-size: 1.2rem;
    color: #3498db;
}

/* Canvas背景 */
#background-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* 左側統合パネル */
#left-panel {
    position: absolute;
    top: 6rem;
    left: 1rem;
    width: 350px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none; /* パネルを透過してクリック可能に */
}

#left-panel > * {
    pointer-events: auto; /* パネル内の要素はクリック可能に */
}

/* リソース表示 */
#resources-panel {
    background-color: rgba(44, 62, 80, 0.9);
    padding: 1rem;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    pointer-events: auto; /* パネル内はクリック可能に */
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h3 {
    margin: 0;
    color: #3498db;
}

#resources-list {
    font-size: 0.9rem;
    line-height: 1.8;
}

.resource-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

#tech-level {
    font-size: 0.95rem;
    white-space: nowrap;
}

#tech-value {
    color: #f39c12;
    font-size: 1.1rem;
}

/* SDGsゲージ */
#sdg-gauges {
    background-color: rgba(44, 62, 80, 0.9);
    padding: 1rem;
    border-radius: 8px;
    pointer-events: auto; /* パネル内はクリック可能に */
}

#sdg-gauges h3 {
    margin-bottom: 0.5rem;
    color: #3498db;
}

#population-display {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 4px;
    text-align: center;
}

#population-value {
    font-weight: bold;
    color: #3498db;
    font-size: 1.2rem;
}

.gauge-container {
    margin-bottom: 0.8rem;
}

.gauge-label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.gauge-bar {
    width: 100%;
    height: 25px;
    background-color: rgba(127, 140, 141, 0.3);
    border-radius: 12px;
    overflow: visible;
    position: relative;
}

.gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
    transition: width 0.5s ease;
    border-radius: 12px;
}

.gauge-value {
    position: absolute;
    top: 0;
    right: 0.3rem;
    font-size: 0.85rem;
    color: #2ecc71;
    font-weight: bold;
    line-height: 25px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* 収集メッセージ */
#collection-message {
    position: absolute;
    top: 5.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    text-shadow:
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000,
        2px 2px 0 #000,
        0 0 10px rgba(0,0,0,0.5);
    z-index: 15;
    opacity: 0;
    animation: fadeInScale 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(2);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

/* 商人キャラクター */
#merchant-character {
    position: absolute;
    cursor: pointer;
    z-index: 20;
    opacity: 0;
    transition: opacity 1s ease-in, transform 0.3s ease;
    font-size: 12rem;
    text-align: center;
}

#merchant-character:hover {
    transform: scale(1.1);
}

#merchant-label {
    position: absolute;
    top: -2rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* アクションボタン */
#action-buttons {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 10;
    pointer-events: none; /* ボタンコンテナを透過してクリック可能に */
}

#action-buttons > * {
    pointer-events: auto; /* ボタン自体はクリック可能に */
}

/* ボタンバッジ（新機能通知） */
.btn-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background-color: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: pulse 1.5s infinite;
}

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

/* 幕間演出 */
#interlude-screen {
    background-color: #000;
    animation: fadeIn 1s;
}

#interlude-text {
    font-size: 2rem;
    text-align: center;
    padding: 2rem;
    animation: fadeIn 2s;
}

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

/* エンディング画面 */
#ending-screen {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

#ending-screen h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
}

#final-score {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}
