/* dungeon.css - 《算能地牢：秘境大冒险》复古奇幻地牢视觉系统与响应式交互 */

:root {
  --dungeon-bg: #0c0a09;
  --stone-card: rgba(28, 25, 23, 0.9);
  --gold: #eab308;
  --amber: #f59e0b;
  --torch: #ea580c;
  --mana: #8b5cf6;
  --hp-red: #ef4444;
  --text-main: #f5f5f4;
  --text-muted: #a8a29e;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--dungeon-bg);
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(234, 88, 12, 0.1) 0%, transparent 50%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 28px 28px, 28px 28px;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
}

/* 顶部双向传送门推荐栏 */
.portal-cross-bar {
  background: linear-gradient(90deg, #1e1b4b, #31104b);
  border-bottom: 1px solid rgba(139, 92, 246, 0.4);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.portal-link {
  color: #c084fc;
  text-decoration: none;
  font-weight: bold;
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  padding: 3px 10px;
  border-radius: 20px;
  transition: all 0.2s ease;
}
.portal-link:hover {
  background: rgba(139, 92, 246, 0.4);
  color: #fff;
}

/* 勇者状态仪表板 HUD */
.dungeon-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 10, 9, 0.95);
  border-bottom: 1px solid rgba(234, 179, 8, 0.25);
  backdrop-filter: blur(10px);
  padding: 10px 18px;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-avatar {
  font-size: 32px;
}

.hero-stats-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 160px;
}

.stat-bar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.bar-bg {
  flex: 1;
  height: 6px;
  background: #292524;
  border-radius: 3px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transition: width 0.3s ease;
}

.mp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6);
  transition: width 0.3s ease;
}

.dungeon-currencies {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  font-weight: bold;
}

.cur-gold {
  color: var(--gold);
}

.cur-floor {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 12px;
}

.dungeon-header-actions {
  display: flex;
  gap: 8px;
}

.btn-dungeon-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
}
.btn-dungeon-action:hover {
  border-color: var(--gold);
}

/* 导航选项卡条 */
.dungeon-nav-bar {
  background: #1c1917;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
}

.d-nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.d-nav-btn:hover {
  color: var(--text-main);
}
.d-nav-btn.active {
  color: var(--gold);
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

/* 主内容布局 */
.dungeon-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* 视图 1：地牢迷宫地图 */
.floor-banner {
  text-align: center;
  margin-bottom: 20px;
}

.floor-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 4px;
}

.floor-unit {
  font-size: 13px;
  color: var(--text-muted);
}

.dungeon-map-board {
  background: var(--stone-card);
  border: 2px solid #44403c;
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 480px;
  margin: 0 auto 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.dungeon-map-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.dungeon-map-row:last-child {
  margin-bottom: 0;
}

.dungeon-room-cell {
  flex: 1;
  aspect-ratio: 1;
  background: #292524;
  border: 2px solid #57534e;
  border-radius: var(--radius-md);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: all 0.2s ease;
  padding: 4px;
}

.dungeon-room-cell.is-fog {
  background: #1c1917;
  border-color: #292524;
  opacity: 0.5;
}

.dungeon-room-cell.is-player {
  border-color: var(--gold) !important;
  background: rgba(234, 179, 8, 0.2) !important;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.4);
}

.dungeon-room-cell.can-move {
  cursor: pointer;
  border-color: #38bdf8 !important;
  animation: pulse-move 1.5s infinite;
}

@keyframes pulse-move {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.dungeon-room-cell.is-visited {
  opacity: 0.7;
}

.cell-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.cell-tag {
  font-size: 10px;
  color: var(--text-muted);
}

.map-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* 视图 2：回合制算能法术决斗 */
.combat-card {
  background: var(--stone-card);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 680px;
  margin: 0 auto;
}

.enemy-versus-header {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.4);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.enemy-avatar {
  font-size: 42px;
}

.enemy-meta {
  flex: 1;
}

.enemy-name {
  font-size: 17px;
  font-weight: bold;
  margin-bottom: 6px;
}

.enemy-hp-bar {
  height: 8px;
  background: #292524;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.enemy-hp-fill {
  height: 100%;
  width: 100%;
  background: #ef4444;
  transition: width 0.3s ease;
}

.enemy-hp-text {
  font-size: 11px;
  color: var(--text-muted);
}

.combat-question-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.combat-q-prompt {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}

.combat-formula-tag {
  font-family: monospace;
  font-size: 15px;
  color: var(--gold);
  background: rgba(234, 179, 8, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
}

.combat-spells-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.combat-spell-btn {
  background: #292524;
  border: 1px solid #44403c;
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}
.combat-spell-btn:hover:not(:disabled) {
  background: #44403c;
  border-color: var(--gold);
  transform: translateX(4px);
}

.spell-tag {
  font-size: 11px;
  background: rgba(139, 92, 246, 0.25);
  color: #c084fc;
  padding: 2px 6px;
  border-radius: 4px;
}

.combat-battle-log {
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.6;
}
.combat-battle-log.success {
  border-left: 3px solid #10b981;
}
.combat-battle-log.warning {
  border-left: 3px solid #ef4444;
}

/* 视图 3：宝箱房 */
.chest-card {
  background: var(--stone-card);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.chest-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.chest-title {
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 10px;
}

.chest-options-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}

.chest-pick-btn {
  background: #292524;
  border: 1px solid #57534e;
  color: #fff;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  cursor: pointer;
  text-align: left;
}
.chest-pick-btn:hover {
  border-color: var(--gold);
  background: #44403c;
}

/* 视图 4：遗物与背包 */
.relics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.relic-card {
  background: var(--stone-card);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.empty-relics, .empty-codex {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* 视图 5：错题法典 */
.codex-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.codex-item {
  background: var(--stone-card);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
}

.codex-q {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.codex-ans {
  font-size: 13.5px;
  margin-bottom: 4px;
}
.codex-ans.wrong { color: #f87171; }
.codex-ans.right { color: #4ade80; }

.codex-expl {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 8px 0;
}

.btn-clear-codex {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
}
