/* village/assets/style.css — 로컬의 반격 마을 홈 뷰 */
/* 외부 폰트·프레임워크 없음. 시스템 한글 폰트 사용. */

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

:root {
  --bg:          #0f1117;
  --surface:     #1c1f28;
  --surface-2:   #252830;
  --border:      #2a2d38;
  --text:        #e8e8e8;
  --text-muted:  #888;
  --text-faint:  #555;

  /* 4대 주권 컬러 */
  --food:        #4caf50;
  --energy:      #ff9800;
  --currency:    #ffd600;
  --data:        #2196f3;

  /* 로컬페이 등급 */
  --grade-s:     #e74c3c;
  --grade-a:     #e67e22;
  --grade-b:     #27ae60;
  --grade-c:     #3498db;

  /* 미션 상태 */
  --status-open:      #27ae60;
  --status-draft:     #f39c12;
  --status-submitted: #3498db;

  /* 법인 상태 */
  --org-active:   #27ae60;
  --org-planning: #f39c12;
  --org-paused:   #95a5a6;

  --radius:      8px;
  --radius-sm:   4px;
}

body {
  font-family: 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 0;
  min-height: 100vh;
}

/* ── 레이아웃 ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.site-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.site-header .version {
  font-size: 0.72rem;
  color: var(--text-faint);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ── 섹션 ── */
.section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── 자급률 게이지 ── */
.gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gauge-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
}

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

.gauge-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.gauge-pct {
  font-size: 1.4rem;
  font-weight: 700;
}

.gauge-bar-wrap {
  background: var(--border);
  border-radius: var(--radius-sm);
  height: 8px;
  overflow: hidden;
}

.gauge-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.6s ease;
}

.gauge-dummy-note {
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-top: 6px;
}

/* 주권별 컬러 */
.gauge-card[data-axis="식량"]  .gauge-bar-fill { background: var(--food); }
.gauge-card[data-axis="식량"]  .gauge-pct      { color: var(--food); }
.gauge-card[data-axis="에너지"] .gauge-bar-fill { background: var(--energy); }
.gauge-card[data-axis="에너지"] .gauge-pct      { color: var(--energy); }
.gauge-card[data-axis="화폐"]  .gauge-bar-fill { background: var(--currency); }
.gauge-card[data-axis="화폐"]  .gauge-pct      { color: var(--currency); }
.gauge-card[data-axis="데이터"] .gauge-bar-fill { background: var(--data); }
.gauge-card[data-axis="데이터"] .gauge-pct      { color: var(--data); }

/* ── 미션 카드 ── */
.mission-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mission-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.mission-status-col {
  padding-top: 3px;
}

.mission-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.mission-org {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mission-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.deadline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── 코어법인 그리드 ── */
.org-svg-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.org-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.org-card-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.org-name {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.3;
}

.org-role {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.org-leader {
  font-size: 0.7rem;
  color: var(--text-faint);
}

.scope-badge {
  font-size: 0.65rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: auto;
}

/* ── 상태 dot ── */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── 등급 배지 ── */
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

.badge-s { background: var(--grade-s); }
.badge-a { background: var(--grade-a); }
.badge-b { background: var(--grade-b); }
.badge-c { background: var(--grade-c); }

/* ── 로컬페이 리더보드 ── */
.leaderboard {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

.lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.lb-row:last-child {
  border-bottom: none;
}

.lb-rank {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.lb-rank.top3 {
  color: var(--grade-a);
}

.lb-actor {
  font-size: 0.85rem;
  font-weight: 500;
}

.lb-grade {
  /* grade 배지 인라인 */
}

.lb-amount {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

.lb-amount .unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── 참여하기 섹션 ── */
.join-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  border: 1px solid var(--border);
}

.join-box h2 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.join-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.7;
}

.join-btn {
  display: inline-block;
  background: var(--data);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 28px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}

.join-btn:hover,
.join-btn:focus {
  opacity: 0.85;
  outline: 2px solid var(--data);
  outline-offset: 2px;
}

.agent-tip {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-faint);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: inline-block;
}

/* ── 빈 상태 ── */
.empty {
  color: var(--text-faint);
  font-size: 0.82rem;
  padding: 12px 0;
}

/* ── 푸터 ── */
.site-footer {
  margin-top: 16px;
  font-size: 0.68rem;
  color: var(--text-faint);
  text-align: right;
}

/* ── 반응형 ── */
@media (max-width: 600px) {
  .gauge-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mission-card {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .mission-meta {
    grid-column: 2;
    grid-row: 2;
    flex-direction: row;
    align-items: center;
  }

  .org-grid {
    grid-template-columns: 1fr 1fr;
  }

  .lb-row {
    grid-template-columns: 28px 1fr auto;
  }

  .lb-grade { display: none; }

  main {
    padding: 16px 12px 48px;
  }
}
