/**
 * 《世界历史长河：十文明探索》V0.2.0
 * 样章一《尼尼微：失落的泥板》桌面与移动端响应式样式
 */

.btn-launch-nineveh {
  width: 100%;
  padding: 13px 18px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #b58328 0%, #e0af45 100%);
  border: 1px solid #ffd666;
  border-radius: var(--radius-sm);
  color: #131821;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.35);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.btn-launch-nineveh:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.nineveh-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0d121a;
  display: flex;
  flex-direction: column;
}

.nineveh-game-overlay[hidden] {
  display: none;
}

.nineveh-game-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  color: #f4ebd9;
}

.ng-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(18, 24, 34, 0.96);
  border-bottom: 1px solid var(--border-antique);
  flex-shrink: 0;
}

.ng-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ng-chapter-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #ffd666;
  background: rgba(212, 175, 55, 0.16);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.ng-chapter-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: #fff6e3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ng-hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ng-shard-pill {
  font-size: 12px;
  font-weight: 700;
  color: #ffd666;
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 5px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.ng-btn-ghost {
  padding: 6px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-antique);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.ng-btn-return {
  padding: 6px 12px;
  background: linear-gradient(135deg, #2b5687 0%, #1f73b7 100%);
  border: 1px solid #4a9be3;
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ng-clue-bar {
  padding: 6px 16px;
  background: rgba(14, 19, 27, 0.92);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  font-size: 11.5px;
  color: #ffe394;
  text-align: center;
  flex-shrink: 0;
}

.ng-canvas-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d121a;
  overflow: hidden;
  padding: 8px;
}

#ng-world-canvas {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 960 / 640;
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  background: #1f2633;
  touch-action: none;
}

.ng-prompt-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(16, 22, 32, 0.94);
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 12.5px;
  color: #fff4db;
  z-index: 10;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.ng-prompt-banner[hidden] {
  display: none;
}

.ng-btn-interact-inline {
  padding: 4px 10px;
  background: var(--color-gold);
  color: #131821;
  border: none;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.ng-touch-controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  z-index: 12;
}

.ng-joystick-base {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(20, 28, 40, 0.65);
  border: 2px solid rgba(212, 175, 55, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}

.ng-joystick-knob {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 214, 102, 0.85);
  border: 2px solid #131821;
  pointer-events: none;
}

.ng-touch-interact-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #b58328 0%, #e0af45 100%);
  border: 2px solid #ffd666;
  color: #131821;
  font-size: 13px;
  font-weight: 800;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.ng-touch-interact-btn:disabled {
  background: rgba(32, 42, 56, 0.72);
  border-color: rgba(255, 255, 255, 0.2);
  color: #7d8da3;
  cursor: default;
}

.ng-hud-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 16px;
  font-size: 11px;
  color: #93a4bc;
  background: rgba(14, 18, 26, 0.95);
  border-top: 1px solid var(--border-antique);
  flex-shrink: 0;
}

.ng-fiction-tag {
  color: #bc8cff;
  white-space: nowrap;
}

/* 游戏内二级弹窗 */
.ng-submodal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(8, 12, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.ng-submodal-backdrop[hidden] {
  display: none;
}

.ng-submodal-card {
  width: min(620px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: #161d28;
  border: 1px solid var(--border-antique);
  border-top: 3px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

.mg-wrap, .ng-dialog-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mg-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: #fff4db;
}

.mg-disclosure {
  font-size: 11px;
  color: #9bb0c9;
  margin-top: 4px;
  line-height: 1.45;
}

.mg-btn-exit {
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-antique);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.mg-status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  background: rgba(12, 16, 24, 0.7);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: #ffd666;
}

.mg-clues-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}

.clue-pill {
  background: rgba(212, 175, 55, 0.14);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 2px 8px;
  border-radius: 4px;
  color: #ffe8a3;
}

/* 1. 王宫寻物画板 */
.palace-scene-board {
  position: relative;
  width: 100%;
  height: 250px;
  background: radial-gradient(circle at 50% 45%, #34291d 0%, #1c1712 100%);
  border: 1px solid #6e5838;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.palace-item-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: rgba(20, 26, 36, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 8px;
  color: #f4ebd9;
  cursor: pointer;
  font-size: 11px;
}

.palace-item-spot.is-found {
  border-color: #56d364;
  background: rgba(46, 160, 67, 0.25);
  opacity: 0.65;
}

.spot-icon {
  font-size: 18px;
}

.spot-name {
  white-space: nowrap;
  font-size: 10px;
}

/* 2. 图书馆填字 */
.library-prompts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-prompt-card {
  padding: 10px 12px;
  background: rgba(12, 16, 24, 0.75);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  line-height: 1.5;
}

.library-prompt-card.is-active {
  border-color: #ffd666;
  background: rgba(212, 175, 55, 0.08);
}

.prompt-blank {
  display: inline-block;
  min-width: 68px;
  padding: 0 6px;
  border-bottom: 2px solid #ffd666;
  color: #ffd666;
  font-weight: 700;
  text-align: center;
}

.library-wordbank {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wordbank-label {
  font-size: 11.5px;
  color: #b5c4d8;
}

.wordbank-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wordbank-chip {
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-antique);
  color: #fff4db;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}

/* 3. 军营战术棋 */
.tactics-grid {
  display: grid;
  gap: 6px;
  max-width: 340px;
  width: 100%;
  margin: 0 auto;
}

.tactics-cell {
  aspect-ratio: 1;
  background: #232c3b;
  border: 1px solid #3c4b64;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  position: relative;
}

.tactics-cell.is-blocked {
  background: #141922;
  cursor: not-allowed;
}

.tactics-cell.is-goal {
  background: rgba(212, 175, 55, 0.16);
  border-color: #ffd666;
}

.tactics-cell.is-selected {
  border: 2px solid #ffd666;
}

.tactics-cell.can-move {
  background: rgba(88, 166, 255, 0.22);
  border-color: #58a6cf;
}

.tactics-cell.can-attack {
  background: rgba(248, 81, 73, 0.26);
  border-color: #ff7b72;
}

.unit-hp {
  font-size: 10px;
  color: #ffd666;
  display: block;
}

/* 4. 最终谜题与任务列表 */
.final-slots-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.final-slot-card {
  text-align: left;
  padding: 10px 12px;
  background: rgba(12, 16, 24, 0.8);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-sm);
  color: #f4ebd9;
  cursor: pointer;
}

.final-slot-card.is-active {
  border-color: #ffd666;
}

.slot-year {
  font-weight: 700;
  color: #ffd666;
  font-size: 12.5px;
}

.slot-desc {
  font-size: 11.5px;
  color: #b4c3d6;
  margin: 2px 0;
}

.slot-value {
  font-size: 12px;
  color: #56d364;
  font-weight: 600;
}

.mg-feedback {
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(14, 18, 25, 0.75);
  border-radius: var(--radius-sm);
  color: #d7e1ef;
  line-height: 1.5;
}

.mg-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.mg-btn-primary {
  padding: 8px 16px;
  background: linear-gradient(135deg, #b58328 0%, #e0af45 100%);
  border: 1px solid #ffd666;
  color: #131821;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
}

.mg-btn-secondary {
  padding: 8px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-antique);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
}

.ng-quest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ng-quest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(12, 16, 24, 0.7);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.ng-quest-area {
  font-size: 10.5px;
  color: #93a4bc;
}

.ng-quest-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.ng-quest-row.state-completed .ng-quest-badge {
  background: rgba(46, 160, 67, 0.22);
  color: #56d364;
}

.ng-npc-speech {
  background: rgba(12, 16, 24, 0.72);
  border-left: 3px solid var(--color-gold);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
}

.npc-speaker {
  font-size: 11.5px;
  font-weight: 700;
  color: #ffd666;
  margin-bottom: 4px;
}

.ng-repeat-note {
  font-size: 11.5px;
  color: #56d364;
}

.ng-dialog-text {
  font-size: 13px;
  line-height: 1.6;
  color: #d7e1ef;
}

.epilogue-facts-list {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: #d7e1ef;
  list-style: none;
}

@media screen and (max-width: 640px) {
  .ng-hud-top {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ng-chapter-badge {
    display: none;
  }

  .ng-chapter-title {
    font-size: 14px;
  }

  .ng-hud-stats {
    gap: 5px;
  }

  .ng-shard-pill, .ng-btn-ghost, .ng-btn-return {
    font-size: 11px;
    padding: 5px 8px;
  }

  .ng-hud-footer {
    font-size: 10px;
    padding: 5px 10px;
  }

  .ng-fiction-tag {
    display: none;
  }

  .ng-joystick-base {
    width: 104px;
    height: 104px;
  }

  .ng-joystick-knob {
    width: 42px;
    height: 42px;
  }

  .ng-touch-interact-btn {
    width: 72px;
    height: 72px;
    font-size: 13px;
  }

  .ng-clue-bar {
    font-size: 10.5px;
    padding: 5px 10px;
  }
}

/* V0.2.2 三种支线小游戏样式 */
.market-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.market-stall-cell {
  min-height: 74px;
  background: #232c3b;
  border: 1px solid #3c4b64;
  border-radius: 8px;
  color: #f4ebd9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  cursor: pointer;
}

.market-stall-cell.is-active {
  background: rgba(212, 175, 55, 0.14);
  border-color: #ffd666;
}

.market-stall-cell.is-empty {
  opacity: 0.4;
  cursor: default;
}

.stall-icon {
  font-size: 20px;
}

.stall-name {
  font-size: 11px;
  white-space: nowrap;
}

.card-duel-arena {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duel-fighter {
  padding: 10px 12px;
  background: rgba(12, 16, 24, 0.8);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.duel-fighter.enemy-side {
  border-left: 3px solid #cf222e;
}

.duel-fighter.player-side {
  border-left: 3px solid #2ea043;
}

.enemy-intent {
  font-size: 11.5px;
  color: #ffa198;
}

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

.duel-card-btn {
  text-align: left;
  padding: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-sm);
  color: #fff4db;
  cursor: pointer;
}

.duel-card-btn:hover {
  border-color: #ffd666;
}

.duel-card-title {
  font-weight: 700;
  font-size: 13px;
  color: #ffd666;
  margin-bottom: 3px;
}

.duel-card-desc {
  font-size: 11px;
  color: #b4c3d6;
  line-height: 1.4;
}

/* V0.3.0 文明档案馆样式 */
.archive-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-tab-btn {
  padding: 5px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-full);
  color: #b4c3d6;
  font-size: 11.5px;
  cursor: pointer;
}

.archive-tab-btn.is-active {
  background: rgba(212, 175, 55, 0.2);
  border-color: #ffd666;
  color: #ffd666;
  font-weight: 700;
}

.archive-entries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}

.archive-entry-card {
  padding: 10px 12px;
  background: rgba(12, 16, 24, 0.78);
  border: 1px solid var(--border-antique);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.archive-entry-card.is-locked {
  opacity: 0.65;
}

.archive-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: #fff4db;
}

.archive-fact-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(88, 166, 255, 0.16);
  color: #79c0ff;
  white-space: nowrap;
}

.archive-entry-body {
  color: #d0dceb;
  line-height: 1.5;
  margin-bottom: 4px;
}

.archive-entry-source {
  font-size: 10.5px;
  color: #8ea3bc;
}

.ng-history-link-bar {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(185, 154, 96, 0.08);
  border: 1px solid rgba(216, 188, 133, 0.28);
}

.ng-history-link-bar.is-compact {
  margin-top: 6px;
  padding: 6px 8px;
}

.ng-history-note {
  font-size: 11px;
  color: #d8bc85;
  margin-bottom: 6px;
}

.ng-history-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ng-history-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  min-height: 36px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(216, 188, 133, 0.42);
  color: #f3d79e;
  font-size: 12px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ng-history-link-btn:hover {
  background: rgba(216, 188, 133, 0.16);
  border-color: #f3d79e;
}

.ng-history-rel-pill {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(216, 188, 133, 0.2);
  color: #fde68a;
  white-space: nowrap;
}

.is-highlighted {
  outline: 2px solid #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
