/* =========================================================
   역천록 (逆天錄) - 선협 다크모드 스타일시트
   ========================================================= */

:root {
  --bg-main: #0d0f12;
  --bg-card: #16191f;
  --bg-card-hover: #1e222a;
  --border-gold: #cfa45a;
  --border-dark: #2a2e39;
  --text-main: #e6e8ec;
  --text-muted: #8b92a0;
  --accent-gold: #e5b967;
  --accent-jade: #3ebd83;
  --accent-crimson: #e05252;
  --accent-cyan: #4fc3f7;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
}

.hidden { display: none !important; }

/* ==========================================
   캐릭터 생성 화면 스타일
   ========================================== */
.create-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 32px;
  max-width: 760px;
  margin: 40px auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.create-header h1 {
  color: var(--accent-gold);
  font-size: 1.8rem;
  letter-spacing: 1px;
}

.create-header .sub {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 8px;
}

.create-header .desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: bold;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-text {
  font-size: 0.8rem;
  color: var(--accent-gold);
  font-weight: bold;
}

.input-text {
  background: #090a0d;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-text:focus {
  border-color: var(--border-gold);
}

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.card-option {
  background: #0d0f14;
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s;
}

.card-option:hover {
  background: #171b22;
  border-color: #4b5563;
}

.card-option.active {
  background: rgba(207, 164, 90, 0.12);
  border-color: var(--border-gold);
  box-shadow: 0 0 10px rgba(207, 164, 90, 0.25);
}

.card-option strong { font-size: 0.95rem; }
.card-option small { font-size: 0.75rem; color: var(--text-muted); }

.gold { color: var(--accent-gold); }
.blue { color: var(--accent-cyan); }
.orange { color: #fb923c; }
.purple { color: #c084fc; }

.submit-btn {
  background: linear-gradient(180deg, #cfa45a, #96702e);
  color: #1a1204;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
}

.submit-btn:hover {
  background: linear-gradient(180deg, #dfb76e, #ab8237);
  box-shadow: 0 0 16px rgba(207, 164, 90, 0.4);
}

/* ==========================================
   메인 게임 화면 스타일
   ========================================== */
.status-header {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-bottom: 2px solid var(--border-gold);
  border-radius: 8px;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.game-title {
  font-size: 1.6rem;
  color: var(--accent-gold);
  letter-spacing: 2px;
}

.game-title .sub-title {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 6px;
}

.character-name {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.character-name span { color: var(--text-main); font-weight: bold; }
.tag { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; background: #262c38; color: #cbd5e1; }
.root-tag { background: #451a03; color: #fb923c; border: 1px solid #9a3412; }

.vital-stats {
  display: flex;
  gap: 16px;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}

.stat-badge .label { font-size: 0.75rem; color: var(--text-muted); }
.stat-badge .value { font-size: 1.05rem; font-weight: bold; margin-top: 2px; }

.realm-badge .value { color: var(--accent-gold); }
.lifespan-badge .value { color: var(--accent-jade); }
.spirit-stone-badge .value { color: var(--accent-cyan); }

/* 메인 그리드 레이아웃 */
.main-container {
  display: grid;
  grid-template-columns: 180px 1fr 320px;
  gap: 20px;
}

.nav-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-btn {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 14px;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.tab-btn:hover { background: var(--bg-card-hover); color: var(--text-main); }
.tab-btn.active {
  background: var(--bg-card-hover);
  color: var(--accent-gold);
  border-color: var(--border-gold);
  font-weight: bold;
  box-shadow: inset 3px 0 0 var(--border-gold);
}

.tab-content {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 24px;
  min-height: 500px;
}

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

.panel h2 { color: var(--accent-gold); font-size: 1.3rem; margin-bottom: 8px; }
.panel .description { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }

.progress-section {
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: 6px;
  border: 1px solid var(--border-dark);
  margin-bottom: 24px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress-bar-bg {
  background: #08090b;
  border-radius: 10px;
  height: 16px;
  overflow: hidden;
  border: 1px solid #222630;
}

.progress-bar-fill {
  background: linear-gradient(90deg, #1b694b, #3ebd83);
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.action-buttons { display: flex; gap: 12px; }

button.primary-btn {
  background: linear-gradient(180deg, #2a5a40, #1b422e);
  color: #d1fae5;
  border: 1px solid #34d399;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

button.primary-btn:hover {
  background: linear-gradient(180deg, #326d4d, #215339);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

button.breakthrough-btn {
  background: linear-gradient(180deg, #6b4e23, #4d3615);
  color: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

button.breakthrough-btn:disabled {
  background: #1e222a;
  color: #4b5563;
  border-color: #374151;
  cursor: not-allowed;
  box-shadow: none;
}

button.breakthrough-btn:not(:disabled):hover {
  background: linear-gradient(180deg, #85612c, #5e431a);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.log-container {
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-dark);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.log-head h3 { font-size: 1rem; color: var(--accent-gold); }
.remake-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
}
.remake-link:hover { color: var(--accent-gold); }

.log-box {
  flex: 1;
  overflow-y: auto;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}

.log-entry {
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--border-dark);
}

.log-entry.system { border-left-color: var(--accent-cyan); color: #bae6fd; }
.log-entry.breakthrough { border-left-color: var(--accent-gold); color: #fde68a; }
.log-entry.tribulation { border-left-color: var(--accent-crimson); color: #fca5a5; }

.coming-soon {
  color: var(--text-muted);
  font-style: italic;
  padding: 40px;
  text-align: center;
  border: 1px dashed var(--border-dark);
  border-radius: 6px;
}

/* =========================================================
   모바일 & 태블릿 반응형 미디어 쿼리 (Responsive Mobile Layout)
   ========================================================= */

/* 1. 태블릿 및 소형 화면 (900px 이하) */
@media (max-width: 900px) {
  body {
    padding: 12px;
  }

  .status-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }

  .vital-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-badge {
    min-width: unset;
    padding: 8px 4px;
    text-align: center;
  }

  /* 3단 그리드 ➔ 1단 세로 스택 전환 */
  .main-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* 탭 네비게이션: 세로 목록 ➔ 상단 가로 슬라이드 탭 */
  .nav-tabs {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }

  .tab-btn {
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 10px 8px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .tab-btn.active {
    box-shadow: inset 0 -3px 0 var(--border-gold);
  }

  .log-container {
    margin-top: 10px;
  }

  .log-box {
    max-height: 220px;
  }
}

/* 2. 스마트폰 전용 화면 (600px 이하) */
@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .create-card {
    padding: 16px;
    margin: 10px auto;
    border-radius: 8px;
    gap: 16px;
  }

  .create-header h1 {
    font-size: 1.4rem;
  }

  .game-title {
    font-size: 1.3rem;
  }

  /* 생성 화면 카드 반응형 정돈 */
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .card-option {
    padding: 10px;
  }

  .card-option strong {
    font-size: 0.95rem;
  }

  .card-option small {
    font-size: 0.75rem;
  }

  /* 터치 친화적 액션 버튼 */
  .submit-btn,
  button.meditate-btn,
  button.breakthrough-btn {
    min-height: 48px;
    font-size: 1rem;
    padding: 12px;
  }

  .character-name {
    flex-wrap: wrap;
    font-size: 0.85rem;
  }

  .stat-badge .value {
    font-size: 0.95rem;
  }

  .tab-content {
    padding: 16px;
  }
}
