/* ===== Loading Overlay ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #1a1310;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loading-spinner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.loading-logo {
  width: 64px;
  height: 64px;
  animation: loadingBounce 1s ease-in-out infinite;
}
.loading-ring {
  position: absolute;
  top: -10px;
  width: 84px;
  height: 84px;
  border: 3px solid rgba(232, 168, 73, 0.15);
  border-top-color: #e8a849;
  border-radius: 50%;
  animation: loadingSpin 0.9s linear infinite;
}
.loading-text {
  color: rgba(255, 213, 79, 0.7);
  font-size: 0.85rem;
  letter-spacing: 3px;
  font-weight: 600;
}
@keyframes loadingSpin {
  to { transform: rotate(360deg); }
}
@keyframes loadingBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== CSS Variables (Dark Theme - Default) ===== */
:root {
  --bg-primary: #1a1310;
  --bg-secondary: #231c16;
  --bg-card: #2a221a;
  --bg-card-hover: #342a20;
  --bg-sidebar: #15110d;
  --text-primary: #f0e6d6;
  --text-secondary: #a89880;
  --text-muted: #786858;
  --border-color: #3d3228;
  --accent: #e8a849;
  --accent-glow: rgba(232, 168, 73, 0.3);
  --fire: #ff6b35;
  --fire-bg: rgba(255, 107, 53, 0.15);
  --water: #5bc4d4;
  --water-bg: rgba(91, 196, 212, 0.15);
  --grass: #66bb6a;
  --grass-bg: rgba(102, 187, 106, 0.15);
  --iron: #a89e94;
  --iron-bg: rgba(168, 158, 148, 0.15);
  --gold: #ffd54f;
  --sidebar-width: 260px;
  --header-height: 60px;
  --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
  --overlay-bg: rgba(10,5,0,0.6);
  --code-bg: rgba(0,0,0,0.3);
  --golden-border: #c8973e;
  --golden-glow: rgba(255, 213, 79, 0.15);
  --warm-highlight: rgba(232, 168, 73, 0.08);
}

/* ===== Light Theme ===== */
[data-theme="light"] {
  --bg-primary: #f5f0e8;
  --bg-secondary: #faf6ef;
  --bg-card: #fefcf7;
  --bg-card-hover: #f5efe4;
  --bg-sidebar: #faf5ec;
  --text-primary: #2c2418;
  --text-secondary: #6b5d4e;
  --text-muted: #9a8b7a;
  --border-color: #d6cbb8;
  --accent: #b8842e;
  --accent-glow: rgba(184, 132, 46, 0.2);
  --fire: #e05528;
  --fire-bg: rgba(224, 85, 40, 0.1);
  --water: #2a8fb5;
  --water-bg: rgba(42, 143, 181, 0.1);
  --grass: #43a047;
  --grass-bg: rgba(67, 160, 71, 0.1);
  --iron: #7a7068;
  --iron-bg: rgba(122, 112, 104, 0.1);
  --gold: #d4900a;
  --shadow-card: 0 2px 8px rgba(80,50,10,0.1);
  --overlay-bg: rgba(0,0,0,0.3);
  --code-bg: rgba(0,0,0,0.05);
  --golden-border: #c8973e;
  --golden-glow: rgba(200, 151, 62, 0.1);
  --warm-highlight: rgba(184, 132, 46, 0.06);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  font-family: 'Segoe UI', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: linear-gradient(135deg, var(--bg-sidebar), var(--bg-secondary));
  border-bottom: 2px solid var(--golden-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), #ffab40);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: 12px;
}

.header-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-left: 16px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

.lang-switcher {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.lang-btn {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1310;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-sidebar);
  border-right: 2px solid var(--golden-border);
  overflow-y: auto;
  z-index: 900;
  padding: 16px 0;
  transition: transform 0.3s ease;
}

.nav-section {
  padding: 8px 16px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  gap: 10px;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(232, 168, 73, 0.05);
  border-left-color: var(--accent);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(232, 168, 73, 0.1);
  border-left-color: var(--accent);
}

.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-icon-img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; }

/* ===== Main Content ===== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 32px;
  min-height: calc(100vh - var(--header-height));
}

/* ===== Sections ===== */
.section {
  margin-bottom: 48px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--golden-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title .icon { font-size: 1.5rem; }

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.95rem;
  line-height: 1.8;
}

.sub-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--accent);
}

/* ===== Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* ===== Mercenary Cards ===== */
.merc-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.merc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  transition: all 0.3s;
  display: flex;
  gap: 16px;
  align-items: center;
}

.merc-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.merc-card[data-attr="Lava"] { border-left: 3px solid var(--fire); }
.merc-card[data-attr="Frost"] { border-left: 3px solid var(--water); }
.merc-card[data-attr="Forest"] { border-left: 3px solid var(--grass); }
.merc-card[data-attr="Iron"] { border-left: 3px solid var(--iron); }

.merc-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,235,200,0.05);
  flex-shrink: 0;
}

.merc-info { flex: 1; min-width: 0; }

.merc-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.merc-name-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.merc-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-fire { background: var(--fire-bg); color: var(--fire); }
.tag-water { background: var(--water-bg); color: var(--water); }
.tag-grass { background: var(--grass-bg); color: var(--grass); }
.tag-iron { background: var(--iron-bg); color: var(--iron); }

.tag-tank { background: rgba(255,215,0,0.15); color: #ffd54f; }
.tag-close { background: rgba(255,82,82,0.15); color: #ff5252; }
.tag-ranged { background: rgba(129,212,250,0.15); color: #f0c060; }
.tag-support { background: rgba(129,199,132,0.15); color: #81c784; }

/* ===== Stone/Mineral Cards ===== */
.stone-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stone-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  transition: all 0.3s;
}

.stone-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.stone-card.common { border-top: 3px solid #78909c; }
.stone-card.special { border-top: 3px solid #ab47bc; }
.stone-card.treasure { border-top: 3px solid var(--gold); }

.stone-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}

.stone-name { font-weight: 600; font-size: 0.95rem; }
.stone-name-zh { color: var(--text-secondary); font-size: 0.8rem; }
.stone-unlock { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }

/* ===== Filter Buttons ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1310;
}

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(200, 151, 62, 0.3);
  margin-bottom: 24px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;

}

.data-table thead {
  background: var(--bg-card);
  position: sticky;
  top: 0;
}

.data-table th {
  padding: 12px 14px;
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 2px solid var(--golden-border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(61, 50, 40, 0.5);
  color: var(--text-primary);
  /*text-align: center;*/
}

.data-table tbody tr:hover {
  background: rgba(232, 168, 73, 0.04);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255,235,200,0.02);
}

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .gold-val { color: var(--gold); }
.data-table .elem-val { color: #ab47bc; }

/* Material icons in tables */
.material-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 4px;
  object-fit: contain;
}

/* ===== Collapsible ===== */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 4px;
  user-select: none;
}

.collapsible-header:hover {
  background: var(--bg-card-hover);
}

.collapsible-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapsible-arrow {
  transition: transform 0.3s;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.collapsible-header.open .collapsible-arrow {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.collapsible-content.open {
  max-height: 10000px;
}

.collapsible-inner {
  padding: 16px 0;
}

/* ===== Element Cycle Image ===== */
.element-cycle {
  text-align: center;
  margin: 20px 0;
}

.element-cycle img {
  max-width: 400px;
  width: 100%;
}

/* ===== Info Boxes ===== */
.info-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.info-box.tip {
  border-left: 3px solid var(--accent);
}

.info-box.warning {
  border-left: 3px solid var(--gold);
}

.info-box-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--accent);
}

.info-box.warning .info-box-title {
  color: var(--gold);
}

/* ===== Reward Tables ===== */
.reward-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.reward-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
}

.reward-rank {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.reward-rank.gold { color: var(--gold); }
.reward-rank.silver { color: #c0b8a8; }
.reward-rank.bronze { color: #d4a574; }

.reward-detail {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* ===== Skill Description ===== */
.skill-list {
  list-style: none;
  padding: 0;
}

.skill-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(61, 50, 40, 0.3);
  display: flex;
  gap: 10px;
}

.skill-list li:last-child { border-bottom: none; }

.skill-label {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  min-width: 100px;
}

/* ===== New Mine Cards ===== */
.newmine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.newmine-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.newmine-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.newmine-info {
  flex: 1;
  min-width: 0;
}

.newmine-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--gold);
  margin-bottom: 6px;
}

.newmine-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ===== Pagination for large tables ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #1a1310; border-color: var(--accent); }

/* ===== Show More Button ===== */
.show-more-btn {
  display: block;
  margin: 12px auto;
  padding: 8px 24px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s;
}

.show-more-btn:hover {
  background: rgba(232, 168, 73, 0.1);
  border-color: var(--accent);
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1310;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: all 0.3s;
  z-index: 999;
}

.back-to-top.visible { display: flex; }
.back-to-top:hover { transform: translateY(-2px); }

/* ===== Donate Section ===== */
.donate-section {
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid var(--border-color);
  background: linear-gradient(180deg, transparent, rgba(232, 168, 73, 0.03));
}

.donate-section h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.donate-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.donate-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
}

.kofi-btn {
  background: #ff5e5b;
  color: #fff;
}
.kofi-btn:hover {
  background: #e8524f;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 94, 91, 0.4);
}

.crypto-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.crypto-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.crypto-tip {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, margin 0.4s ease;
  margin-top: 0;
}
.crypto-tip.show {
  max-height: 200px;
  margin-top: 20px;
}

.crypto-card {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 24px;
  text-align: center;
  position: relative;
}

.crypto-label {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
}

.crypto-address {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  max-width: 420px;
}

.copy-btn {
  padding: 6px 16px;
  background: var(--accent);
  color: #1a1310;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover {
  background: #f0c060;
  transform: scale(1.05);
}

.copy-toast {
  display: none;
  margin-left: 10px;
  font-size: 0.8rem;
  color: var(--grass);
  font-weight: 600;
}
.copy-toast.show {
  display: inline;
  animation: toastFade 2s ease forwards;
}

@keyframes toastFade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== Footer ===== */
/* Contact section */
.contact-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.contact-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 12px;
}

.contact-links {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
}

.contact-email {
  color: var(--text-secondary);
  background: var(--bg-card);
}

.contact-email:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232, 168, 73, 0.06);
}

.contact-telegram {
  color: #fff;
  background: #2AABEE;
  border-color: #2AABEE;
}

.contact-telegram:hover {
  background: #1a9ad6;
  border-color: #1a9ad6;
  box-shadow: 0 0 10px rgba(42, 171, 238, 0.4);
}

.footer {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
}
.visitor-counter {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.75;
}
.visitor-icon { font-size: 1rem; }
.visitor-count {
  font-weight: 700;
  color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .hamburger { display: block; }

  .header-subtitle { display: none; }

  .lang-switcher {
    margin-left: 8px;
  }

  .lang-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .theme-toggle {
    padding: 4px 8px;
    font-size: 1rem;
  }

  .merc-card-grid {
    grid-template-columns: 1fr;
  }

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

  .stone-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

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

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

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 850;
}

@media (max-width: 900px) {
  .sidebar-overlay.open { display: block; }
}

/* ===== Utility ===== */
.text-gold { color: var(--gold); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-fire { color: var(--fire); }
.text-water { color: var(--water); }
.text-grass { color: var(--grass); }
.text-iron { color: var(--iron); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ===== Tab Style for Equipment ===== */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

/* ===== Mercenary Detail Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 8px solid rgba(64, 52, 45, 1);
  border-radius: 5px;
  box-shadow: 0 0 30px rgba(0,0,0,0.5), 0 0 15px var(--golden-glow);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: #d32f2f;
  border: black 1px solid;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 10;
  width: 32px; height: 32px;
  border-radius: 15%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #b71c1c;
  color: #fff;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 24px 16px;
  /*border-bottom: 1px solid var(--golden-border);*/
  border-bottom: 1px solid rgba(64, 52, 45, 1);
}

.modal-merc-img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,235,200,0.05);
  flex-shrink: 0;
}

.modal-merc-info { flex: 1; }

.modal-merc-name {
  font-size: 1.4rem;
  font-weight: 700;
}

.modal-merc-name-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.modal-merc-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.modal-base-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.modal-stat-box {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
}

.modal-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.modal-body { padding: 20px 24px 24px; }

.modal-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
}

.modal-section-title:first-child { margin-top: 0; }

.modal-skill-row {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(61,50,40,0.3);
}

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

.modal-skill-label {
  font-weight: 600;
  color: var(--accent);
  min-width: 90px;
  flex-shrink: 0;
}

.modal-skill-desc { color: var(--text-secondary); }

.modal-estimated-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.7rem;
  background: rgba(255,215,79,0.15);
  color: var(--gold);
  margin-left: 8px;
}

/* Stat calculator inside modal */
.stat-calc {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  flex-wrap: wrap;
}

.stat-calc label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-calc select, .stat-calc input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: inherit;
  width: 80px;
}

.stat-calc select:focus, .stat-calc input:focus {
  outline: none;
  border-color: var(--accent);
}

.stat-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stat-result-box {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-result-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-result-value {
  font-size: 1.15rem;
  font-weight: 700;
}

.stat-result-value.hp { color: #66bb6a; }
.stat-result-value.atk { color: #ff7043; }
.stat-result-value.def { color: var(--accent); }

/* Quick ref table in modal */
.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 8px;
}

.modal-table th {
  padding: 6px 8px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
}

.modal-table td {
  padding: 5px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(61,50,40,0.3);
  font-variant-numeric: tabular-nums;
}

.modal-table tr:hover { background: rgba(232,168,73,0.04); }

.merc-card { cursor: pointer; }

/* ===== Light Theme Overrides ===== */
[data-theme="light"] .header {
  box-shadow: 0 1px 4px rgba(80,50,10,0.1);
}

[data-theme="light"] .sidebar {
  box-shadow: 1px 0 4px rgba(80,50,10,0.05);
}

[data-theme="light"] .merc-card:hover,
[data-theme="light"] .card:hover {
  box-shadow: 0 4px 16px rgba(80,50,10,0.1);
}

[data-theme="light"] .filter-btn.active,
[data-theme="light"] .lang-btn.active {
  color: #2c2418;
}

[data-theme="light"] .back-to-top {
  color: #2c2418;
  box-shadow: 0 4px 12px rgba(80,50,10,0.15);
}

[data-theme="light"] .copy-btn {
  color: #2c2418;
}

[data-theme="light"] .data-table tbody tr:nth-child(even) {
  background: rgba(0,0,0,0.02);
}

[data-theme="light"] .data-table tbody tr:hover {
  background: rgba(184, 132, 46, 0.05);
}

[data-theme="light"] .crypto-address {
  background: var(--code-bg);
}

[data-theme="light"] .modal {
  border-color: #c8b8a0;
}

[data-theme="light"] .modal-overlay {
  background: var(--overlay-bg);
}

[data-theme="light"] .header-title {
  background: linear-gradient(135deg, #c47d0a, #d4900a);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="light"] .tag-tank { background: rgba(230,138,0,0.12); color: #b87800; }
[data-theme="light"] .tag-close { background: rgba(211,47,47,0.1); color: #c62828; }
[data-theme="light"] .tag-ranged { background: rgba(42,143,181,0.1); color: #1a7a9e; }
[data-theme="light"] .tag-support { background: rgba(67,160,71,0.1); color: #2e7d32; }

/* ===== Theme Toggle ===== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 5px 10px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Changelog Section ===== */
/* ===== Timeline (Milestones) ===== */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--accent));
  border-radius: 3px;
}
.timeline-item {
  position: relative;
  padding: 12px 0 12px 20px;
}
.timeline-dot {
  position: absolute;
  left: -24px;
  top: 16px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--gold);
}
.timeline-date {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.92rem;
  margin-bottom: 2px;
}
.timeline-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.changelog-list {
  list-style: none;
  padding: 0;
}

.changelog-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(61, 50, 40, 0.3);
}

.changelog-item:last-child { border-bottom: none; }

.changelog-date {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  min-width: 110px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.changelog-content {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.changelog-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 6px;
  vertical-align: middle;
}

.changelog-tag.new { background: rgba(102,187,106,0.15); color: var(--grass); }
.changelog-tag.fix { background: rgba(232,168,73,0.15); color: var(--accent); }
.changelog-tag.launch { background: rgba(255,213,79,0.15); color: var(--gold); }

/* ===== Game-like Decorative Enhancements ===== */

/* Golden accent line under section titles */
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  margin-top: 8px;
}

/* Subtle inner glow on cards */
.merc-card, .newmine-card, .reward-item {
  box-shadow: inset 0 1px 0 rgba(255, 213, 79, 0.05);
}

/* Stone card rarity glow on hover */
.stone-card.treasure:hover {
  box-shadow: 0 4px 16px rgba(255, 213, 79, 0.15);
}
.stone-card.special:hover {
  box-shadow: 0 4px 16px rgba(171, 71, 188, 0.15);
}

/* Warm-toned scrollbar */
::-webkit-scrollbar-thumb { background: rgba(200, 151, 62, 0.4); }
::-webkit-scrollbar-thumb:hover { background: rgba(200, 151, 62, 0.6); }

/* Card hover golden outline hint */
.card:hover, .merc-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(200, 151, 62, 0.2);
}

/* Light theme tones down decorative effects */
[data-theme="light"] .merc-card, [data-theme="light"] .newmine-card, [data-theme="light"] .reward-item {
  box-shadow: inset 0 1px 0 rgba(200, 151, 62, 0.05);
}

[data-theme="light"] .card:hover, [data-theme="light"] .merc-card:hover {
  box-shadow: 0 4px 16px rgba(80,50,10,0.1), 0 0 0 1px rgba(200, 151, 62, 0.15);
}

[data-theme="light"] .stone-card.treasure:hover {
  box-shadow: 0 4px 16px rgba(212, 144, 10, 0.15);
}

/* Theme transition */
body, .header, .sidebar, .main-content, .modal, .card, .merc-card, .stone-card,
.info-box, .data-table, .collapsible-header, .donate-section, .footer,
.tab-btn, .filter-btn, .back-to-top, .newmine-card, .reward-item,
.stat-result-box, .modal-stat-box, .crypto-card,
.compare-merc-slot, .compare-controls, .compare-skills-panel, .compare-picker-card {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ===== Mercenary Comparator Modal ===== */
.modal-compare {
  max-width: 1000px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}

.compare-main-view {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}

.compare-picker-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.compare-title {
  padding: 18px 28px 14px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  border-bottom: 1px solid rgba(64, 52, 45, 1);
  padding-right: 56px;
  flex-shrink: 0;
}

.compare-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 18px 20px 0;
}

.compare-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compare-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

/* Merc slot (clickable area) */
.compare-merc-slot {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  min-height: 150px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.compare-merc-slot:hover {
  border-color: var(--accent);
  background: rgba(232, 168, 73, 0.06);
}

.compare-slot-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.compare-slot-plus {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--accent);
  opacity: 0.7;
}

.compare-slot-selected {
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  width: 100%;
  pointer-events: none;
}

.compare-slot-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.compare-slot-name {
  font-weight: 700;
  font-size: 1rem;
}

.compare-slot-tags {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Tier / level controls */
.compare-controls {
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
}

.compare-controls label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.compare-controls input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 64px;
}

.compare-controls input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Skills panel */
.compare-skills-panel {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.83rem;
  border: 1px solid var(--border-color);
  min-height: 44px;
}

.compare-skill-row {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.compare-skill-label {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  font-size: 0.76rem;
  min-width: 68px;
  padding-top: 1px;
}

.compare-skill-desc {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

.compare-skills-placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 4px 0;
}

/* Stat comparison bars */
.compare-stats-section {
  padding: 14px 20px 22px;
}

.compare-stats-divider {
  height: 1px;
  background: rgba(64, 52, 45, 1);
  margin-bottom: 16px;
}

.compare-stats-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 14px;
}

.compare-stat-row {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.compare-stat-val {
  font-weight: 700;
  font-size: 1rem;
}

.compare-stat-left-val {
  text-align: right;
}

.compare-stat-right-val {
  text-align: left;
}

.compare-stat-winner {
  color: var(--gold);
}

.compare-stat-loser {
  color: var(--text-muted);
  font-weight: 500;
}

.compare-stat-bar-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-stat-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compare-stat-bar-wrap {
  display: flex;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.compare-bar-seg {
  height: 100%;
  min-width: 0;
  transition: flex 0.35s ease;
}

/* Picker view */
.compare-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(64, 52, 45, 1);
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--gold);
}

.compare-picker-close-btn {
  background: #d32f2f;
  border: 1px solid black;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 15%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.2s;
}

.compare-picker-close-btn:hover {
  background: #b71c1c;
}

.compare-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.compare-picker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.compare-picker-card:hover {
  border-color: var(--accent);
  background: rgba(232, 168, 73, 0.08);
}

.compare-picker-card img {
  width: 66px;
  height: 66px;
  object-fit: contain;
}

.compare-picker-card-name {
  font-size: 0.76rem;
  font-weight: 600;
  margin-top: 5px;
  line-height: 1.2;
}

.compare-picker-card-tags {
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 3px;
}

/* Comparator CTA on main page */
.merc-compare-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.merc-compare-desc {
  margin: 0;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
}

.compare-open-btn {
  background: var(--accent);
  color: #1a1310;
  border: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.compare-open-btn:hover {
  background: var(--gold);
  box-shadow: 0 0 14px var(--golden-glow);
}

/* Comparator modal — Mobile: keep two columns, scale down */
@media (max-width: 640px) {
  .compare-layout {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 10px 0;
  }

  .compare-panel {
    gap: 7px;
  }

  .compare-merc-slot {
    min-height: 100px;
    padding: 8px 6px;
  }

  .compare-slot-img {
    width: 52px;
    height: 52px;
  }

  .compare-slot-name {
    font-size: 0.76rem;
  }

  .compare-slot-plus {
    font-size: 1.8rem;
  }

  .compare-slot-placeholder {
    font-size: 0.76rem;
  }

  .compare-controls {
    padding: 6px 8px;
    gap: 5px;
  }

  .compare-controls label {
    font-size: 0.72rem;
  }

  .compare-controls input {
    width: 46px;
    font-size: 0.78rem;
    padding: 4px 6px;
  }

  .compare-skills-panel {
    padding: 6px 8px;
    font-size: 0.74rem;
    min-height: 32px;
  }

  .compare-skill-row {
    flex-direction: column;
    gap: 2px;
    padding: 5px 0;
  }

  .compare-skill-label {
    min-width: unset;
    font-size: 0.68rem;
    text-align: left;
  }

  .compare-skill-desc {
    font-size: 0.7rem;
    text-align: right;
  }

  .compare-stats-section {
    padding: 10px 10px 14px;
  }

  .compare-stat-row {
    grid-template-columns: 58px 1fr 58px;
    gap: 6px;
    margin-bottom: 10px;
  }

  .compare-stat-val {
    font-size: 0.82rem;
  }

  .compare-stat-bar-wrap {
    height: 14px;
  }

  .compare-title {
    padding: 14px 16px 10px;
    padding-right: 46px;
    font-size: 1rem;
  }
}
