/* Dark Gothic Fantasy Theme */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Crimson+Text:wght@400;600;700&family=JetBrains+Mono:wght@400;700&display=swap');
@import './hp-base.css';
@import './layout-base.css';

:root {
  /* Palette - Dark Fantasy */
  --bg: #050505;
  --bg-texture: radial-gradient(circle at 50% 0%, #1a1a1a, #050505 80%);
  
  /* Surfaces */
  --panel: #111111;
  --panel-border: #333333;
  
  --card: #161616;
  --card-hover: #1f1f1f;
  --card-border: #444444;
  
  /* Text */
  --text: #dcdcdc;        /* Parchment White */
  --muted: #888888;       /* Iron Grey */
  --text-highlight: #f0e6d2; 
  
  /* Accents */
  --gold: #c5a059;        /* Antique Gold */
  --gold-dim: #8a6e36;
  
  --red: #8a1c1c;         /* Blood Red */
  --red-bright: #b92b2b;
  
  --blue: #4a6fa5;        /* Steel Blue */
  --green: #4a8a5a;       /* Moss Green */
  
  /* Functional Mappings */
  --accent: var(--gold);
  --danger: var(--red-bright);
  --ok: var(--green);
  
  /* Dimensions */
  --radius: 2px;          /* Sharp corners */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Crimson Text', serif;
  font-size: 17px; /* Slightly larger for serif readability */
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-texture);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}

/* --- Layout --- */
.wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.layout-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* --- Header --- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--panel-border);
  margin-bottom: 8px;
}

h1 {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 1px;
}

/* --- Buttons --- */
.btn {
  background: #1a1a1a;
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  text-transform: uppercase;
  white-space: nowrap;
}

.btn .btn-line {
  display: block;
  line-height: 1.2;
}

.btn .btn-line + .btn-line {
  margin-top: 2px;
}

.btn:hover {
  background: #252525;
  border-color: var(--muted);
  color: var(--text-highlight);
}

.btn.active {
  background: #2a2a2a;
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 8px rgba(197, 160, 89, 0.15);
}

#btnAI, #btnAIHost {
  border-color: #3a3a5a;
  color: #a0a0d0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
#btnAI::before, #btnAIHost::before {
  content: '';
  position: absolute;
  inset: -100%;
  background: conic-gradient(
    transparent 0deg,
    rgba(0, 255, 200, 0.8) 50deg,
    rgba(120, 80, 255, 0.7) 100deg,
    transparent 150deg,
    transparent 180deg,
    rgba(255, 100, 200, 0.8) 230deg,
    rgba(80, 200, 255, 0.7) 280deg,
    transparent 330deg
  );
  animation: ai-marquee 3s linear infinite;
  z-index: -2;
}
#btnAI::after, #btnAIHost::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: #1a1a1a;
  border-radius: calc(var(--radius) - 1px);
  z-index: -1;
}
@keyframes ai-marquee {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
#btnAI:hover, #btnAIHost:hover {
  border-color: transparent;
  color: #d0d0ff;
}
#btnAI:hover::after, #btnAIHost:hover::after {
  background: #1a1a2a;
}

/* --- Panels --- */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  padding: 20px;
  position: relative;
}

/* Decorative corners for panels */
.panel::after {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border: 1px solid transparent;
  pointer-events: none;
  /* Subtle inner border effect */
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* --- Stat Bar --- */
.statbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  background: #0f0f0f;
  border: 1px solid var(--panel-border);
  padding: 16px 24px;
}

/* Layout Logic */
.statbar .stat-floor { flex: 0 0 140px; }
.statbar .stat-class { flex: 0 0 160px; }
.statbar .stat-hp { flex: 1 1 360px; min-width: 200px; }
.statbar .stat-attr { flex: 0 0 calc((100% - 72px) / 4); min-width: 0; }
.statbar .stat-class { display: flex; align-items: center; gap: 8px; }
.statbar .stat-class .class-info { display: flex; align-items: center; }

.statbar strong {
  font-family: 'Cinzel', serif; /* Using Serif for stats too for style */
  font-weight: 700;
  font-size: 18px;
}

#floorTxt { color: var(--gold); }
#goldTxt { color: var(--gold); }
#atkTxt { color: #d46a6a; }
#blkTxt { color: #8daacc; }

.tag {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 8px;
}

/* HP Bar - Gothic Style */
.hp {
  height: 16px;
  background: #080000;
  border: 1px solid #441111;
  box-shadow: inset 0 0 8px #000;
}

.hp > .fill {
  background: linear-gradient(90deg, #500000, #8a1c1c);
}

.hp > .fill.ghost {
  background: linear-gradient(90deg, rgba(80, 0, 0, 0.45), rgba(138, 28, 28, 0.45));
}

.hp > .txt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #ffcccc;
  text-shadow: 0 1px 2px #000;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 2px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
  position: relative;
  min-height: 180px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.card:not(.cooldown):not(.unaffordable):not(.old-card):hover {
  transform: translateY(-2px);
  background: var(--card-hover);
  border-color: var(--gold-dim);
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

.card h3 {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--text-highlight);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #333;
}

/* Class Selection Card */
.class-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.class-card .class-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-highlight);
}

.class-card .muted {
  font-size: 13px;
  line-height: 1.5;
}

.class-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 12px;
}

.class-attrs span {
  padding: 2px 6px;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  background: var(--card-hover);
  color: var(--text);
  white-space: nowrap;
}

.card p {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
}

.card .foot {
  margin-top: auto;
  padding-top: 12px;
  font-size: 14px;
}

.card.card-selected {
  border: 1px solid var(--gold);
  box-shadow: 0 0 15px rgba(197, 160, 89, 0.2);
  background: #222;
}

/* Card Type Accents */
.card.type-fight h3 { color: #ff8888; }
.card.type-elite h3, .card.type-boss h3 { color: #ff4444; text-shadow: 0 0 5px rgba(255,0,0,0.3); }
.card.type-shop h3 { color: var(--gold); }
.card.type-event h3 { color: #aaaaff; }

.card.unaffordable { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; }
.card.cooldown { opacity: 0.6; cursor: not-allowed; background: repeating-linear-gradient(45deg, #111, #111 10px, #161616 10px, #161616 20px); }

.card.card-fade-out {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
}

/* --- Log --- */
#logBox {
  width: 400px;
  flex: 0 0 400px;
  height: calc(100vh - 48px);
  position: sticky;
  top: 24px;
  background: #0a0a0a;
  border: 1px solid var(--panel-border);
  overflow-y: auto;
  overflow-x: hidden;
}

.log { padding: 20px; font-size: 15px; }

.log .log-floor {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: var(--text-highlight);
  border-bottom: 1px solid var(--gold-dim);
  padding-bottom: 6px;
  margin: 24px 0 12px;
  text-align: center;
}

.log p { margin: 8px 0; color: #bbbbbb; }
.log .log-critical { color: var(--gold); font-weight: bold; }
.log .log-new { border-left: 2px solid var(--gold-dim); padding-left: 10px; background: rgba(197, 160, 89, 0.05); }

.log .ai-out {
  background: #141418;
  border: 1px solid #2a2a3a;
  padding: 16px;
  border-radius: 2px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #ccc;
}

.log .ai-out pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* --- Footer --- */
.footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.relic {
  background: #111;
  border: 1px solid #333;
  padding: 4px 8px;
  border-radius: 2px;
  color: var(--gold);
  font-size: 16px;
}
.relic.exhausted {
  opacity: 0.6;
  filter: grayscale(0.9);
}

/* Misc */
.hr { height: 1px; background: #333; margin: 12px 0; border: none; }
.pill {
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid #444;
  background: #111;
  color: #aaa;
  border-radius: 2px;
}
.pill.bad { border-color: #600; color: #f88; background: #200; }

/* Enemy Image */
.enemy-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border: 1px solid #444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}
.enemy-media img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  background: #080808;
  border: 1px solid var(--gold-dim);
  color: var(--text);
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  pointer-events: none;
  display: none;
  font-family: 'Crimson Text', serif;
  font-size: 15px;
}

/* Settings Panel */
.settings-panel {
  margin-top: 16px;
  background: #111;
}
.settings select, .settings input {
  background: #000;
  border: 1px solid #444;
  color: var(--text);
  padding: 6px;
  font-family: 'Cinzel', serif;
}

/* Animations */
.grid.battle-active {
  animation: shake 0.4s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* 响应式怪物属性布局 */
.enemy-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.attr-item {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text);
  flex-shrink: 0;
}

/* 小屏幕适配 */
@media (max-width: 600px) {
  .enemy-attrs {
    gap: 4px 8px;
  }
  .attr-item {
    font-size: 11px;
    padding: 1px 4px;
  }
}

/* Relic Book Override for Gothic Theme */
.relic-book-modal {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 0 40px #000;
}

.relic-book-header {
  background: #080808;
  border-bottom: 1px solid #333;
}

.relic-book-title {
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  font-family: 'Cinzel', serif;
}

.relic-list-container {
  background: #050505;
}

.relic-details-panel {
  background: #0c0c0c;
  border-left: 1px solid #333;
}

.relic-group-title {
  color: var(--gold-dim);
  border-bottom: 1px solid #333;
  font-family: 'Cinzel', serif;
}

.relic-name {
  color: #aaa;
}

.relic-item:hover .relic-name, .relic-item.selected .relic-name {
  color: var(--text-highlight);
}

.relic-item:hover, .relic-item.selected {
  background: rgba(255, 255, 255, 0.05);
}

/* Dark Icon Backgrounds */
.relic-icon {
  background: #1a1a1a;
  border: 1px solid #333;
}

.relic-item:hover .relic-icon, .relic-item.selected .relic-icon {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(197, 160, 89, 0.2);
  background: #222;
}

/* Specific Category Colors - Darker Muted */
.relic-item.type-offense .relic-icon { background: #2a1a1a; border-color: #522; }
.relic-item.type-defense .relic-icon { background: #1a222a; border-color: #235; }
.relic-item.type-survival .relic-icon { background: #1a2a1a; border-color: #252; }
.relic-item.type-economy .relic-icon { background: #2a251a; border-color: #542; }
.relic-item.type-utility .relic-icon { background: #221a2a; border-color: #425; }
.relic-item.type-combat .relic-icon { background: #2a1e1a; border-color: #532; }

/* Details Panel */
.relic-detail-icon {
  background: #161616;
  border: 1px solid var(--gold-dim);
}

.relic-detail-title {
  color: var(--gold);
  font-family: 'Cinzel', serif;
}

.relic-detail-type {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #888;
}

.relic-detail-desc {
  color: #ccc;
}
