/* ===== 정글 부족들 — 스타일 ===== */

:root {
  --bg-dark: #1a1a2e;
  --bg-panel: #16213e;
  --bg-card: #0f3460;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0b0;
  --accent: #e94560;
  --accent-green: #4ecca3;
  --accent-gold: #f5c518;
  --border-color: #2a2a4a;
}

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

body {
  font-family: 'Noto Sans KR', 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* ===== 메인 레이아웃 ===== */
.game-layout {
  display: grid;
  grid-template-areas:
    "header header header"
    "left   center right"
    "bottom bottom bottom";
  grid-template-rows: 50px 1fr 120px;
  grid-template-columns: 240px 1fr 240px;
  height: 100vh;
  gap: 2px;
}

/* ===== 헤더 ===== */
.header {
  grid-area: header;
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 2px solid var(--border-color);
}

.header h1 {
  font-size: 1.1em;
  color: var(--accent-gold);
}

#round-info {
  font-size: 1em;
  font-weight: bold;
}

.phase-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: bold;
  background: var(--bg-card);
}

.phase-season { background: #2d4a22; }
.phase-negotiation { background: #4a3b22; }
.phase-command { background: #22344a; }
.phase-resolution { background: #4a2222; }
.phase-maintenance { background: #3a2244; }

#player-info {
  font-weight: bold;
  font-size: 1em;
}

/* ===== 좌측 패널 ===== */
.left-panel {
  grid-area: left;
  background: var(--bg-panel);
  padding: 12px;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

.left-panel h3 {
  font-size: 0.9em;
  color: var(--accent-gold);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

/* ===== 중앙 캔버스 ===== */
.center-area {
  grid-area: center;
  background: #0d1117;
  position: relative;
}

#game-canvas {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* ===== 우측 패널 ===== */
.right-panel {
  grid-area: right;
  background: var(--bg-panel);
  padding: 12px;
  overflow-y: auto;
  border-left: 1px solid var(--border-color);
}

.right-panel h3 {
  font-size: 0.9em;
  color: var(--accent-gold);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

/* ===== 하단 바 ===== */
.bottom-bar {
  grid-area: bottom;
  background: var(--bg-panel);
  padding: 8px 16px;
  display: flex;
  gap: 12px;
  border-top: 2px solid var(--border-color);
  overflow-y: auto;
}

/* ===== 자원 ===== */
.resource-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.resource-item {
  background: var(--bg-card);
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8em;
}

.resource-icon { font-size: 1.1em; }
.resource-value {
  margin-left: auto;
  font-weight: bold;
  color: var(--accent-gold);
}

/* ===== 상태 ===== */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-item {
  font-size: 0.8em;
  padding: 3px 6px;
  background: var(--bg-card);
  border-radius: 4px;
}

/* ===== 건물 ===== */
.building-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.building-item {
  font-size: 0.75em;
  padding: 3px 6px;
  background: var(--bg-card);
  border-radius: 4px;
}

/* ===== 점수판 ===== */
.score-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  background: var(--bg-card);
  border-radius: 4px;
  font-size: 0.8em;
}

.score-value {
  font-weight: bold;
  color: var(--accent-gold);
}

/* ===== 목표 ===== */
.objective-item {
  font-size: 0.75em;
  padding: 5px 8px;
  background: var(--bg-card);
  border-radius: 4px;
  margin-bottom: 4px;
}

/* ===== 로그 ===== */
.log-list {
  flex: 1;
  font-size: 0.75em;
}

.log-entry {
  padding: 2px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--text-secondary);
}

.empty-text {
  color: var(--text-secondary);
  font-size: 0.75em;
  font-style: italic;
}

/* ===== 타일 정보 ===== */
#tile-info {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(15, 52, 96, 0.95);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.8em;
  min-width: 180px;
  display: none;
  z-index: 10;
}

#tile-info h3 {
  color: var(--accent-gold);
  margin-bottom: 6px;
}

#tile-info div {
  margin-bottom: 3px;
}

/* ===== 모달 오버레이 ===== */
#modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#modal-overlay.active { display: flex; }

.modal-dialog {
  background: var(--bg-panel);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 24px 32px;
  max-width: 500px;
  min-width: 320px;
  text-align: center;
}

.modal-dialog h2 {
  margin-bottom: 12px;
  color: var(--accent-gold);
}

.modal-dialog p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-line;
}

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

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* ===== 이벤트 카드 ===== */
.event-card .event-icon {
  font-size: 3em;
  margin-bottom: 8px;
}

.event-flavor {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9em;
}

.event-effect {
  color: var(--accent);
  font-weight: bold;
}

/* ===== 전투 결과 ===== */
.combat-sides {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
}

.combat-side {
  padding: 12px;
  background: var(--bg-card);
  border-radius: 8px;
  min-width: 120px;
}

.combat-vs {
  font-size: 1.5em;
  font-weight: bold;
  color: var(--accent);
}

.combat-winner {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--accent-gold);
  margin: 12px 0;
}

/* ===== 핫시트 오버레이 ===== */
#hotseat-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 20, 0.97);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#hotseat-overlay.active { display: flex; }

.hotseat-screen {
  text-align: center;
}

.hotseat-warning {
  font-size: 1em;
  color: var(--accent);
  margin-bottom: 24px;
  animation: pulse 2s infinite;
}

.hotseat-player {
  font-size: 2.5em;
  font-weight: bold;
  margin-bottom: 12px;
}

.hotseat-message {
  font-size: 1.2em;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hotseat-message.small {
  font-size: 0.9em;
}

.hotseat-phase-name {
  font-size: 2em;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

/* ===== 게임 오버 ===== */
.gameover h1 {
  font-size: 2.5em;
  color: var(--accent-gold);
  margin-bottom: 20px;
}

.gameover-winner {
  font-size: 1.8em;
  font-weight: bold;
  margin-bottom: 24px;
}

.gameover-scores {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.gameover-player {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 1em;
  min-width: 280px;
}

.gameover-player.first {
  border: 2px solid var(--accent-gold);
}

/* ===== 버튼 ===== */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: bold;
  transition: all 0.2s;
}

.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-option {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  text-align: left;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-option small {
  color: var(--text-secondary);
  font-weight: normal;
  font-size: 0.8em;
}

.btn-option:hover {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.15);
}

.btn-large {
  padding: 14px 32px;
  font-size: 1.1em;
}

/* ===== 애니메이션 ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 스크롤바 ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
