* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  color: #3a3a3a;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 15px;
  line-height: 1.7;
  padding: 20px;
  transition: background 0.8s, color 0.8s;
}
.theme-primitive { background: #f7f3ee; }
.theme-ancient { background: #f0eadd; }
.theme-classical { background: #eae5dd; }
.theme-medieval { background: #ede4d6; }
.theme-industrial { background: #e5e3e0; }
.theme-modern { background: #e0e5ed; }
.theme-digital { background: #dce0ed; }
.theme-future { background: #1a1a2e; color: #c0c0d0; }
.theme-cosmic { background: #0d0d1a; color: #a0a0c0; }
.theme-future #lang-toggle, .theme-cosmic #lang-toggle { border-color: #333; color: #888; }
.theme-future #lang-toggle:hover, .theme-cosmic #lang-toggle:hover { color: #ddd; background: #222; }
.theme-future #era, .theme-cosmic #era { background: rgba(255,255,255,0.04); border-color: #333; }

.theme-future #story .story-detail, .theme-cosmic #story .story-detail { color: #b0b0c0; }
.theme-future .story-timeline, .theme-cosmic .story-timeline { border-color: #222; }
.theme-future .story-past-era, .theme-cosmic .story-past-era { color: #666; }
.theme-future #log, .theme-cosmic #log { border-color: #222; }
.theme-future .action-btn, .theme-cosmic .action-btn { background: rgba(255,255,255,0.06); border-color: #333; color: #c0c0d0; }
.theme-future .action-btn:hover:not(:disabled), .theme-cosmic .action-btn:hover:not(:disabled) { background: rgba(255,255,255,0.1); border-color: #555; }
.theme-future .action-btn:disabled, .theme-cosmic .action-btn:disabled { color: #444; border-color: #222; }
.theme-future #header, .theme-cosmic #header { border-color: #222; }
#game {
  max-width: 680px;
  margin: 0 auto;
}
#header {
  border-bottom: 1px solid #ddd8d0;
  padding-bottom: 12px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
#lang-toggle {
  cursor: pointer;
  color: #888;
  font-size: 13px;
  user-select: none;
  padding: 2px 8px;
  border: 1px solid #ddd8d0;
  border-radius: 3px;
}
#lang-toggle:hover { color: #3a3a3a; background: #f0ece6; }
.auto-toggle {
  cursor: pointer;
  color: #888;
  font-size: 13px;
  user-select: none;
  padding: 2px 8px;
  border: 1px solid #ddd8d0;
  border-radius: 3px;
  background: none;
  font-family: inherit;
  margin-right: 10px;
  vertical-align: middle;
}
.auto-toggle:hover { color: #3a3a3a; background: #f0ece6; }
.auto-toggle.active { color: #27ae60; border-color: #27ae60; background: #eafaf1; }
.theme-future .auto-toggle, .theme-cosmic .auto-toggle { border-color: #333; color: #888; }
.theme-future .auto-toggle:hover, .theme-cosmic .auto-toggle:hover { color: #ddd; background: #222; }
.theme-future .auto-toggle.active, .theme-cosmic .auto-toggle.active { color: #27ae60; border-color: #27ae60; background: rgba(39,174,96,0.1); }
.auto-indicator {
  width: 100%;
  text-align: center;
  padding: 16px 0;
  color: #27ae60;
  font-size: 14px;
}
#resources {
  text-align: right;
  font-size: 14px;
  line-height: 1.9;
}
.resource { display: inline-block; margin-left: 14px; }
.resource span { color: #b8860b; font-weight: bold; }
.res-pps {
  font-size: 11px;
  color: #27ae60;
  margin-left: 3px;
  font-weight: normal;
  opacity: 0.9;
}
.theme-future .res-pps, .theme-cosmic .res-pps {
  color: #4ade80;
}

#era {
  background: #faf8f5;
  border: 1px solid #e8e4df;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.era-header { margin-bottom: 4px; }
.era-line1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.era-emoji { font-size: 20px; margin-right: 6px; }
.era-name { font-size: 16px; font-weight: bold; color: #b8860b; }
.era-era { font-size: 12px; color: #999; margin-left: 8px; }
.era-year { font-size: 12px; color: #aaa; margin-left: 4px; }
.era-pop-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: #786b59;
  background: rgba(184, 134, 11, 0.08);
  border: 1px solid rgba(184, 134, 11, 0.2);
  border-radius: 12px;
  padding: 2px 9px;
  margin: 4px 0 6px 0;
  cursor: help;
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}
.era-pop-badge:hover {
  background: rgba(184, 134, 11, 0.15);
  border-color: rgba(184, 134, 11, 0.35);
  color: #5c4e38;
}

.era-bar, .era-progress { height: 3px; background: #e8e4df; border-radius: 2px; margin-top: 4px; overflow: hidden; }
.era-bar-fill, .era-progress-fill { height: 100%; background: #b8860b; border-radius: 2px; transition: width 0.3s; }

#story {
  margin-bottom: 14px;
  min-height: 60px;
  font-size: 14px;
  line-height: 1.8;
}
#story p { margin-bottom: 8px; font-size: 14px; line-height: 1.8; }
.story-current { margin-bottom: 12px; }
.story-era-name { font-size: 15px; color: #b8860b; display: block; margin-bottom: 6px; }
.story-detail { color: #555; font-size: 14px; line-height: 1.8; }
.story-timeline { border-top: 1px solid #e0dcd6; padding-top: 8px; }
.story-timeline-label { font-size: 12px; color: #bbb; display: block; margin-bottom: 4px; }
.story-past-era { display: inline-block; font-size: 12px; color: #999; margin-right: 10px; }
.highlight { color: #b8860b; }
.danger { color: #c0392b; }
.success { color: #27ae60; }
.muted { color: #999; }

#buildings-info {
  margin: 6px 0;
  font-size: 0;
  line-height: 1.8;
}
.building-tag {
  display: inline;
  font-size: 13px;
  padding: 0 3px;
  color: #888;
}
.building-tag.clickable { color: #3a3a3a; cursor: pointer; }
.building-tag.clickable:hover { color: #b8860b; }

#actions {
  margin: 12px 0 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.buy-multiplier-dock {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.mult-btn {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid #d4cfc9;
  color: #666;
  font-size: 11px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.mult-btn:hover {
  background: #fff;
  border-color: #b8860b;
  color: #333;
}
.mult-btn.active {
  background: #b8860b;
  border-color: #996e00;
  color: #fff;
  box-shadow: 0 0 6px rgba(184, 134, 11, 0.4);
}
.theme-future .mult-btn, .theme-cosmic .mult-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: #444;
  color: #aaa;
}
.theme-future .mult-btn.active, .theme-cosmic .mult-btn.active {
  background: #3498db;
  border-color: #2980b9;
  color: #fff;
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.5);
}
.action-btn {
  position: relative;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  border: 1px solid #d4cfc9;
  color: #3a3a3a;
  padding: 7px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border-radius: 3px;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
@media (hover: hover) {
  .action-btn:hover:not(:disabled) {
    background: #f0ece6;
    border-color: #bbb;
  }
}
.action-btn:disabled {
  color: #ccc;
  cursor: not-allowed;
  border-color: #e8e4df;
}
.action-btn.cooldown { color: #bbb; }
.action-btn .btn-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: #e8e0d6;
  pointer-events: none;
  z-index: 0;
  transition: none;
}
.action-btn .btn-label { position: relative; z-index: 1; }
.action-btn[data-cost]:hover::after {
  content: attr(data-cost);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* Great Wonders & Historical Monuments */
#wonders-container {
  margin: 14px 0 10px;
}
.wonders-header {
  font-size: 12px;
  font-weight: bold;
  color: #b8860b;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wonders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.wonder-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e0d8c8;
  border-radius: 6px;
  padding: 10px 12px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.wonder-card.active {
  border-color: #d4af37;
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(253,248,235,0.9));
}
.wonder-card.completed {
  border-color: #b8860b;
  background: linear-gradient(135deg, rgba(254,250,238,0.95), rgba(255,243,212,0.9));
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.15);
}
.wonder-card-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.wonder-emoji {
  font-size: 22px;
  line-height: 1;
}
.wonder-title-box {
  flex: 1;
}
.wonder-title {
  font-size: 13px;
  font-weight: bold;
  color: #2c3e50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.wonder-stage-tag {
  font-size: 11px;
  color: #d35400;
  font-weight: normal;
}
.wonder-badge-complete {
  font-size: 11px;
  color: #b8860b;
  font-weight: bold;
  background: rgba(218, 165, 32, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
}
.wonder-desc {
  font-size: 11px;
  color: #777;
  margin-top: 2px;
  line-height: 1.3;
}
.wonder-progress-bar {
  height: 4px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0 6px;
}
.wonder-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f39c12, #e67e22);
  transition: width 0.3s ease;
}
.wonder-stage-desc {
  font-size: 11px;
  color: #555;
  margin-bottom: 4px;
}
.wonder-bonus-preview {
  font-size: 11px;
  color: #b8860b;
  font-weight: 500;
  margin-bottom: 8px;
}
.wonder-bonus-pill {
  font-size: 11px;
  color: #8e6500;
  font-weight: bold;
  margin-top: 6px;
  background: rgba(184, 134, 11, 0.08);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid #b8860b;
}
.wonder-action-row {
  display: flex;
  justify-content: flex-end;
}
.wonder-build-btn {
  background: #b8860b;
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.wonder-build-btn.disabled {
  background: #ddd;
  color: #999;
  cursor: not-allowed;
}
.wonder-build-btn.affordable:hover {
  background: #996e00;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(184, 134, 11, 0.3);
}

.theme-future .wonder-card, .theme-cosmic .wonder-card {
  background: rgba(20, 25, 35, 0.85);
  border-color: #334;
}
.theme-future .wonder-title, .theme-cosmic .wonder-title {
  color: #ecf0f1;
}
.theme-future .wonder-card.active, .theme-cosmic .wonder-card.active {
  border-color: #3498db;
  background: linear-gradient(135deg, rgba(25, 35, 50, 0.95), rgba(20, 45, 65, 0.9));
}
.theme-future .wonder-card.completed, .theme-cosmic .wonder-card.completed {
  border-color: #9b59b6;
  background: linear-gradient(135deg, rgba(35, 25, 55, 0.95), rgba(45, 30, 70, 0.9));
}

.branch-header {
  width: 100%;
  margin-bottom: 8px;
  font-size: 14px;
}
.branch-header p {
  color: #888;
  font-size: 13px;
  margin-top: 2px;
}
.branch-card {
  background: #fff;
  border: 1px solid #d4cfc9;
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  width: calc(50% - 4px);
  min-width: 200px;
  flex: 1 1 auto;
}
.branch-card:hover {
  background: #f0ece6;
  border-color: #bbb;
}
.branch-card:active {
  background: #e5ded5;
}
.branch-choice-title {
  font-size: 15px;
  font-weight: bold;
  color: #3a3a3a;
  margin-bottom: 3px;
}
.branch-choice-bonus {
  font-size: 12px;
  color: #b8860b;
  margin-bottom: 4px;
}
.branch-choice-desc {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  line-height: 1.5;
}
.branch-choice-preview {
  font-size: 12px;
  color: #999;
}
.branch-badge {
  display: inline-block;
  font-size: 11px;
  background: #b8860b;
  color: #fff;
  padding: 0 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.6;
}

#log {
  border-top: 1px solid #ddd8d0;
  margin-top: 14px;
  padding-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 13px;
  color: #888;
}
#log p { margin-bottom: 2px; }

.era-overlay {
  display: none !important;
}
.era-overlay-particles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}
.era-overlay-deco {
  position: absolute;
  pointer-events: none;
}
.era-overlay-content {
  text-align: center;
  z-index: 2;
  animation: contentAppear 0.6s ease-out;
}
@keyframes contentAppear {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.era-overlay-emoji {
  font-size: 80px;
  line-height: 1;
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
}
.era-overlay-name {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 8px;
  letter-spacing: 2px;
}
.era-overlay-era {
  font-size: 16px;
  letter-spacing: 1px;
}

/* ── EMBER: fire, pottery, gunpowder, thermodynamics, atomic ── */
.at-ember .era-overlay { background: #1a0800; }
.at-ember .era-overlay-name { color: #ff6b35; text-shadow: 0 0 20px rgba(255,107,53,0.4); }
.at-ember .era-overlay-era { color: #aa6644; }
.at-ember .era-p {
  position: absolute;
  border-radius: 50%;
  animation: emberRise linear infinite;
}
@keyframes emberRise {
  0% { transform: translateY(0) scale(1); opacity: 0.9; }
  50% { opacity: 1; }
  100% { transform: translateY(-100vh) scale(0.2); opacity: 0; }
}
.at-ember .era-deco-glow {
  position: absolute;
  bottom: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  height: 40%;
  background: radial-gradient(ellipse at center bottom, rgba(255,80,20,0.15) 0%, transparent 70%);
  animation: glowPulse 2s ease-in-out infinite alternate;
}
@keyframes glowPulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ── ROCK: stone_tools, roads, concrete ── */
.at-rock .era-overlay { background: #12100e; }
.at-rock .era-overlay-name { color: #a09080; text-shadow: 0 0 15px rgba(160,144,128,0.3); }
.at-rock .era-overlay-era { color: #706050; }
.at-rock .era-p {
  position: absolute;
  animation: rockFloat 4s ease-in-out infinite;
}
@keyframes rockFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.5; }
  25% { transform: translateY(-20px) rotate(5deg); opacity: 0.7; }
  50% { transform: translateY(-10px) rotate(-3deg); opacity: 0.6; }
  75% { transform: translateY(-25px) rotate(8deg); opacity: 0.8; }
}
.at-rock .era-deco-crack {
  position: absolute;
  background: rgba(160,144,128,0.1);
  animation: crackGrow 3s ease-out forwards;
}
@keyframes crackGrow {
  from { transform: scaleX(0); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

/* ── WAVE: canoe, fishing, navigation, steamship ── */
.at-wave .era-overlay { background: #060d18; }
.at-wave .era-overlay-name { color: #4fc3f7; text-shadow: 0 0 20px rgba(79,195,247,0.3); }
.at-wave .era-overlay-era { color: #4477aa; }
.at-wave .era-p {
  position: absolute;
  border-radius: 50%;
  background: rgba(79,195,247,0.4);
  animation: waveFloat 3s ease-in-out infinite;
}
@keyframes waveFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
  50% { transform: translateY(-30px) scale(1.3); opacity: 0.7; }
}
.at-wave .era-deco-ripple {
  position: absolute;
  border: 1px solid rgba(79,195,247,0.2);
  border-radius: 50%;
  animation: rippleExpand 2.5s ease-out infinite;
}
@keyframes rippleExpand {
  from { transform: scale(0.3); opacity: 0.8; }
  to { transform: scale(2.5); opacity: 0; }
}

/* ── VINE: agriculture, gathering, wolf_taming, fishing ── */
.at-vine .era-overlay { background: #0a1208; }
.at-vine .era-overlay-name { color: #66bb6a; text-shadow: 0 0 20px rgba(102,187,106,0.3); }
.at-vine .era-overlay-era { color: #4a8a4e; }
.at-vine .era-p {
  position: absolute;
  animation: vineGrow 3.5s ease-out infinite;
}
@keyframes vineGrow {
  0% { transform: translateY(40px) scale(0.5) rotate(-10deg); opacity: 0; }
  30% { opacity: 0.8; }
  100% { transform: translateY(-60px) scale(1) rotate(10deg); opacity: 0; }
}
.at-vine .era-deco-leaf {
  position: absolute;
  font-size: 20px;
  animation: leafSway 4s ease-in-out infinite;
}
@keyframes leafSway {
  0%, 100% { transform: rotate(-15deg) translateY(0); }
  50% { transform: rotate(15deg) translateY(-15px); }
}

/* ── SPARK: smelting, bronze_age, iron_tools, electricity ── */
.at-spark .era-overlay { background: #120a02; }
.at-spark .era-overlay-name { color: #ffa726; text-shadow: 0 0 20px rgba(255,167,38,0.4); }
.at-spark .era-overlay-era { color: #aa7733; }
.at-spark .era-p {
  position: absolute;
  border-radius: 50%;
  animation: sparkFly 1.5s ease-out infinite;
}
@keyframes sparkFly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
.at-spark .era-deco-anvil {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 40px;
  opacity: 0.15;
  animation: anvilGlow 1.5s ease-in-out infinite alternate;
}
@keyframes anvilGlow {
  from { filter: brightness(0.8); }
  to { filter: brightness(1.5); }
}

/* ── INK: language, writing, papermaking, printing, telegraph, internet ── */
.at-ink .era-overlay { background: #0a0a12; }
.at-ink .era-overlay-name { color: #ce93d8; text-shadow: 0 0 20px rgba(206,147,216,0.3); }
.at-ink .era-overlay-era { color: #8866aa; }
.at-ink .era-p {
  position: absolute;
  border-radius: 50%;
  animation: inkDrop 2s ease-in infinite;
}
@keyframes inkDrop {
  0% { transform: scale(0); opacity: 0; }
  30% { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}
.at-ink .era-deco-char {
  position: absolute;
  font-size: 24px;
  opacity: 0.12;
  animation: charFloat 5s ease-in-out infinite;
}
@keyframes charFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.08; }
  50% { transform: translateY(-20px) rotate(5deg); opacity: 0.15; }
}

/* ── ARCH: city_states, philosophy, renaissance ── */
.at-arch .era-overlay { background: #100e14; }
.at-arch .era-overlay-name { color: #b0bec5; text-shadow: 0 0 20px rgba(176,190,197,0.3); }
.at-arch .era-overlay-era { color: #778899; }
.at-arch .era-p {
  position: absolute;
  animation: columnRise 3s ease-out infinite;
}
@keyframes columnRise {
  0% { transform: translateY(60px) scaleY(0.5); opacity: 0; }
  50% { opacity: 0.6; }
  100% { transform: translateY(-20px) scaleY(1); opacity: 0; }
}
.at-arch .era-deco-arch {
  position: absolute;
  border: 2px solid rgba(176,190,197,0.1);
  border-radius: 50% 50% 0 0;
  animation: archGlow 3s ease-in-out infinite alternate;
}
@keyframes archGlow {
  from { border-color: rgba(176,190,197,0.05); }
  to { border-color: rgba(176,190,197,0.15); }
}

/* ── PAGE: compass, navigation, telescope, printing, discovery ── */
.at-page .era-overlay { background: #0e0c08; }
.at-page .era-overlay-name { color: #d4a574; text-shadow: 0 0 20px rgba(212,165,116,0.3); }
.at-page .era-overlay-era { color: #997755; }
.at-page .era-p {
  position: absolute;
  background: rgba(212,165,116,0.15);
  border: 1px solid rgba(212,165,116,0.1);
  animation: pageFloat 4s ease-in-out infinite;
}
@keyframes pageFloat {
  0% { transform: translateY(0) rotateY(0deg) rotateX(10deg); opacity: 0.3; }
  50% { transform: translateY(-30px) rotateY(180deg) rotateX(-10deg); opacity: 0.6; }
  100% { transform: translateY(0) rotateY(360deg) rotateX(10deg); opacity: 0.3; }
}

/* ── GEAR: steam, automobile, factory, railroad ── */
.at-gear .era-overlay { background: #0c0a08; }
.at-gear .era-overlay-name { color: #78909c; text-shadow: 0 0 20px rgba(120,144,156,0.3); }
.at-gear .era-overlay-era { color: #556677; }
.at-gear .era-p {
  position: absolute;
  animation: gearSpin 4s linear infinite;
}
@keyframes gearSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.at-gear .era-deco-smoke {
  position: absolute;
  border-radius: 50%;
  background: rgba(200,200,200,0.06);
  animation: smokeRise 4s ease-out infinite;
}
@keyframes smokeRise {
  0% { transform: translateY(0) scale(0.5); opacity: 0.4; }
  100% { transform: translateY(-200px) scale(3); opacity: 0; }
}

/* ── CIRCUIT: computer, dna, nanotech, bci, quantum ── */
.at-circuit .era-overlay { background: #060a14; }
.at-circuit .era-overlay-name { color: #4dd0e1; text-shadow: 0 0 20px rgba(77,208,225,0.4); }
.at-circuit .era-overlay-era { color: #3399aa; }
.at-circuit .era-p {
  position: absolute;
  border-radius: 50%;
  animation: circuitPulse 2s ease-in-out infinite;
}
@keyframes circuitPulse {
  0%, 100% { transform: scale(1); opacity: 0.3; box-shadow: 0 0 5px currentColor; }
  50% { transform: scale(1.5); opacity: 0.8; box-shadow: 0 0 15px currentColor; }
}
.at-circuit .era-deco-line {
  position: absolute;
  height: 1px;
  animation: lineScan 2s linear infinite;
}
@keyframes lineScan {
  from { transform: translateX(-100%); opacity: 0; }
  50% { opacity: 0.5; }
  to { transform: translateX(200%); opacity: 0; }
}

/* ── STAR: spaceflight, interstellar, matrioshka, kardashev ── */
.at-star .era-overlay { background: #020208; }
.at-star .era-overlay-name { color: #e8eaf6; text-shadow: 0 0 25px rgba(232,234,246,0.4); }
.at-star .era-overlay-era { color: #7788bb; }
.at-star .era-p {
  position: absolute;
  border-radius: 50%;
  animation: starTwinkle 3s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 1; }
}
.at-star .era-deco-nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  animation: nebulaDrift 8s ease-in-out infinite alternate;
}
@keyframes nebulaDrift {
  from { transform: translate(0,0) scale(1); }
  to { transform: translate(30px,-20px) scale(1.2); }
}

/* ── VOID: dimension, multiverse, transcendence, stargate ── */
.at-void .era-overlay { background: #020008; }
.at-void .era-overlay-name { color: #b388ff; text-shadow: 0 0 30px rgba(179,136,255,0.5); }
.at-void .era-overlay-era { color: #7744cc; }
.at-void .era-p {
  position: absolute;
  border-radius: 50%;
  animation: voidSwirl 5s linear infinite;
}
@keyframes voidSwirl {
  0% { transform: rotate(0deg) translateX(80px) scale(0.5); opacity: 0.3; }
  50% { opacity: 0.8; }
  100% { transform: rotate(360deg) translateX(80px) scale(0.5); opacity: 0.3; }
}
.at-void .era-deco-ring {
  position: absolute;
  border: 1px solid rgba(179,136,255,0.15);
  border-radius: 50%;
  animation: ringExpand 3s ease-out infinite;
}
@keyframes ringExpand {
  from { transform: scale(0.2); opacity: 0.6; }
  to { transform: scale(3); opacity: 0; }
}
.at-void .era-overlay-emoji { animation: voidPulse 2s ease-in-out infinite alternate; }
@keyframes voidPulse {
  from { transform: scale(1) rotate(0deg); filter: hue-rotate(0deg) drop-shadow(0 0 20px rgba(179,136,255,0.4)); }
  to { transform: scale(1.15) rotate(5deg); filter: hue-rotate(30deg) drop-shadow(0 0 40px rgba(179,136,255,0.8)); }
}

/* ══════════════════════════════════════════════════════════════
   ERA SCENES - Unique natural element animations per era
   Each era has 3+ unique visual scenes
   ══════════════════════════════════════════════════════════════ */

/* ── PRIMITIVE ERA SCENES ── */
/* Scene 1: Campfire flames (keep for primitive) */
.fire-scene-campfire {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 100px;
  background: radial-gradient(ellipse at center bottom, rgba(255,100,0,0.4) 0%, rgba(255,60,0,0.2) 40%, transparent 70%);
  animation: campfireFlicker 0.8s ease-in-out infinite alternate;
}
.fire-scene-campfire::before,
.fire-scene-campfire::after {
  content: '';
  position: absolute;
  bottom: 0;
  border-radius: 50% 50% 20% 20%;
  background: linear-gradient(0deg, rgba(255,150,0,0.9), rgba(255,80,0,0.6), rgba(255,40,0,0.1));
}
.fire-scene-campfire::before {
  left: 30%;
  width: 40%;
  height: 70%;
  animation: flameLeft 0.6s ease-in-out infinite alternate;
}
.fire-scene-campfire::after {
  left: 45%;
  width: 30%;
  height: 85%;
  animation: flameRight 0.5s ease-in-out infinite alternate;
}
@keyframes campfireFlicker {
  0% { filter: brightness(0.9) blur(1px); }
  100% { filter: brightness(1.1) blur(0.5px); }
}
@keyframes flameLeft {
  0% { transform: scaleY(0.8) skewX(-5deg); opacity: 0.8; }
  100% { transform: scaleY(1.1) skewX(5deg); opacity: 1; }
}
@keyframes flameRight {
  0% { transform: scaleY(1) skewX(3deg); opacity: 0.9; }
  100% { transform: scaleY(0.85) skewX(-3deg); opacity: 0.7; }
}

/* Scene 2: Floating leaves */
.era-scene-leaves {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.era-leaf {
  position: absolute;
  font-size: 24px;
  animation: leafFloat 4s ease-in-out infinite;
}
@keyframes leafFloat {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(100vh) translateX(var(--drift)) rotate(360deg); opacity: 0; }
}

/* Scene 3: Fireflies */
.era-scene-fireflies {
  position: absolute;
  inset: 0;
}
.era-firefly {
  position: absolute;
  width: 6px;
  height: 6px;
  background: radial-gradient(circle, #ffff00, #ffcc00);
  border-radius: 50%;
  box-shadow: 0 0 10px #ffff00, 0 0 20px #ffcc00;
  animation: fireflyFloat 3s ease-in-out infinite;
}
@keyframes fireflyFloat {
  0%, 100% { transform: translate(0, 0); opacity: 0.3; }
  25% { transform: translate(var(--dx), var(--dy)); opacity: 1; }
  50% { transform: translate(calc(var(--dx) * -1), var(--dy)); opacity: 0.5; }
  75% { transform: translate(var(--dx), calc(var(--dy) * -1)); opacity: 1; }
}

/* ── ANCIENT ERA SCENES ── */
/* Scene 1: Growing wheat */
.era-scene-wheat {
  position: absolute;
  bottom: 10%;
  left: 0;
  right: 0;
  height: 60%;
}
.era-wheat-stalk {
  position: absolute;
  bottom: 0;
  width: 3px;
  background: linear-gradient(0deg, #8B7355, #D4A574);
  border-radius: 2px;
  animation: wheatSway 2s ease-in-out infinite;
  transform-origin: bottom center;
}
.era-wheat-stalk::before {
  content: '🌾';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
}
@keyframes wheatSway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* Scene 2: Pottery wheel */
.era-scene-pottery {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 100px;
}
.era-scene-pottery::before {
  content: '🏺';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 60px;
  animation: potterySpin 4s linear infinite;
}
.era-scene-pottery::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 10px;
  background: #8B4513;
  border-radius: 50%;
  animation: potteryPulse 1s ease-in-out infinite;
}
@keyframes potterySpin {
  0% { transform: translate(-50%, -50%) rotateY(0deg); }
  100% { transform: translate(-50%, -50%) rotateY(360deg); }
}
@keyframes potteryPulse {
  0%, 100% { transform: translateX(-50%) scaleX(1); }
  50% { transform: translateX(-50%) scaleX(1.1); }
}

/* Scene 3: Ritual circle */
.era-scene-ritual {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  border: 3px solid rgba(255,215,0,0.5);
  border-radius: 50%;
  animation: ritualGlow 2s ease-in-out infinite;
}
.era-scene-ritual::before {
  content: '🔮';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
  animation: ritualPulse 1.5s ease-in-out infinite;
}
@keyframes ritualGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(255,215,0,0.3); }
  50% { box-shadow: 0 0 40px rgba(255,215,0,0.6); }
}
@keyframes ritualPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}

/* ── CLASSICAL ERA SCENES ── */
/* Scene 1: Metallic shimmer */
.era-scene-shimmer {
  position: absolute;
  inset: 0;
}
.era-shimmer-spark {
  position: absolute;
  background: linear-gradient(135deg, #c0c0c0, #ffd700);
  border-radius: 50%;
  animation: shimmerPulse 1.5s ease-in-out infinite;
}
@keyframes shimmerPulse {
  0%, 100% { transform: scale(0.5); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Scene 2: Olive branches */
.era-scene-olive {
  position: absolute;
  inset: 0;
}
.era-olive-branch {
  position: absolute;
  font-size: 28px;
  animation: oliveSway 3s ease-in-out infinite;
}
@keyframes oliveSway {
  0%, 100% { transform: rotate(-10deg) translateY(0); }
  50% { transform: rotate(10deg) translateY(-10px); }
}

/* Scene 3: Scroll unfurling */
.era-scene-scroll {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 80px;
}
.era-scene-scroll::before {
  content: '📜';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 50px;
  animation: scrollUnfurl 2s ease-in-out infinite;
}
@keyframes scrollUnfurl {
  0%, 100% { transform: translate(-50%, -50%) scaleX(1); }
  50% { transform: translate(-50%, -50%) scaleX(1.2); }
}

/* ── MEDIEVAL ERA SCENES ── */
/* Scene 1: Castle towers */
.era-scene-castle {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 150px;
}
.era-scene-castle::before {
  content: '🏰';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 80px;
  animation: castleRise 3s ease-out forwards;
}
@keyframes castleRise {
  0% { transform: translateX(-50%) translateY(50px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Scene 2: Waving banners */
.era-scene-banners {
  position: absolute;
  top: 15%;
  left: 0;
  right: 0;
  height: 40%;
}
.era-banner {
  position: absolute;
  top: 0;
  width: 20px;
  height: 60px;
  animation: bannerWave 1.5s ease-in-out infinite;
  transform-origin: top center;
}
.era-banner::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: #8B4513;
}
@keyframes bannerWave {
  0%, 100% { transform: skewX(-5deg); }
  50% { transform: skewX(5deg); }
}

/* Scene 3: Sword glints */
.era-scene-swords {
  position: absolute;
  inset: 0;
}
.era-sword-glint {
  position: absolute;
  width: 30px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: swordGlint 1s ease-in-out infinite;
}
@keyframes swordGlint {
  0%, 100% { opacity: 0; transform: scaleX(0.5); }
  50% { opacity: 1; transform: scaleX(1.2); }
}
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation: ritualPulse 2s ease-in-out infinite;
}
.fire-scene-ritual::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 2px solid rgba(255,150,0,0.2);
  border-radius: 50%;
  animation: ritualRing 3s linear infinite;
}
@keyframes ritualPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); filter: drop-shadow(0 0 10px rgba(255,100,0,0.5)); }
  50% { transform: translate(-50%, -50%) scale(1.1); filter: drop-shadow(0 0 20px rgba(255,100,0,0.8)); }
}
/* ── INDUSTRIAL ERA SCENES ── */
/* Scene 1: Ship sails */
.era-scene-ship {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 120px;
}
.era-scene-ship::before {
  content: '⛵';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 70px;
  animation: shipSail 3s ease-in-out infinite;
}
@keyframes shipSail {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  50% { transform: translateX(-50%) translateY(-10px) rotate(2deg); }
}

/* Scene 2: Compass rose */
.era-scene-compass {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 100px;
}
.era-scene-compass::before {
  content: '🧭';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 50px;
  animation: compassSpin 6s linear infinite;
}
@keyframes compassSpin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Scene 3: Treasure coins */
.era-scene-coins {
  position: absolute;
  inset: 0;
}
.era-coin {
  position: absolute;
  top: -20px;
  font-size: 20px;
}
.era-coin::before {
  content: '🪙';
  animation: coinFall 2s ease-in infinite;
}
@keyframes coinFall {
  0% { transform: translateY(0) rotateY(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotateY(720deg); opacity: 0; }
}

/* ── MODERN ERA SCENES ── */
/* Scene 1: Steam clouds */
.era-scene-steam {
  position: absolute;
  inset: 0;
}
.era-steam-cloud {
  position: absolute;
  bottom: 20%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.8), transparent);
  border-radius: 50%;
  animation: steamRise 4s ease-out infinite;
}
@keyframes steamRise {
  0% { transform: translateY(0) scale(0.5); opacity: 0.8; }
  100% { transform: translateY(-200px) scale(2); opacity: 0; }
}

/* Scene 2: Spinning gears */
.era-scene-gears {
  position: absolute;
  inset: 0;
}
.era-gear {
  position: absolute;
  font-size: 30px;
  animation: gearSpin 3s linear infinite;
}
@keyframes gearSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Scene 3: Electric sparks */
.era-scene-sparks {
  position: absolute;
  inset: 0;
}
.era-electric-bolt {
  position: absolute;
  width: 30px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ffff00, transparent);
  animation: electricFlash 0.3s ease-in-out infinite;
}
@keyframes electricFlash {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ── DIGITAL ERA SCENES ── */
/* Scene 1: Matrix rain */
.era-scene-matrix {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.era-matrix-col {
  position: absolute;
  top: -100%;
  display: flex;
  flex-direction: column;
  font-family: monospace;
  font-size: 14px;
  color: #00ff00;
  text-shadow: 0 0 5px #00ff00;
  animation: matrixFall 3s linear infinite;
}
.era-matrix-col span {
  line-height: 1.2;
}
@keyframes matrixFall {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* Scene 2: Pixel grid */
.era-scene-grid {
  position: absolute;
  inset: 0;
}
.era-pixel {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0.6;
  animation: pixelPulse 1.5s ease-in-out infinite;
}
@keyframes pixelPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* Scene 3: Data streams */
.era-scene-data {
  position: absolute;
  inset: 0;
}
.era-data-stream {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, transparent, #00ffff, transparent);
  animation: dataFlow 2s linear infinite;
}
@keyframes dataFlow {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* ── FUTURE ERA SCENES ── */
/* Scene 1: Star field */
.era-scene-stars {
  position: absolute;
  inset: 0;
}
.era-star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: starTwinkle 2s ease-in-out infinite;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Scene 2: Plasma orbs */
.era-scene-plasma {
  position: absolute;
  inset: 0;
}
.era-plasma-orb {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  filter: blur(10px);
  animation: plasmaPulse 2s ease-in-out infinite;
}
@keyframes plasmaPulse {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.9; }
}

/* Scene 3: Holographic grid */
.era-scene-holo {
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(90deg, rgba(0,255,255,0.1) 1px, transparent 1px),
    linear-gradient(rgba(0,255,255,0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: holoScroll 4s linear infinite;
}
@keyframes holoScroll {
  0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
  100% { transform: perspective(500px) rotateX(60deg) translateY(30px); }
}

/* ── COSMIC ERA SCENES ── */
/* Scene 1: Spiral galaxy */
.era-scene-galaxy {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(255,255,255,0.3), rgba(100,100,255,0.2), transparent);
  border-radius: 50%;
  animation: galaxySpin 10s linear infinite;
}
@keyframes galaxySpin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Scene 2: Black hole */
.era-scene-blackhole {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, #000, transparent);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(100,0,150,0.8), inset 0 0 20px rgba(100,0,150,0.5);
  animation: blackholePulse 2s ease-in-out infinite;
}
@keyframes blackholePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Scene 3: Quantum particles */
.era-scene-quantum {
  position: absolute;
  inset: 0;
}
.era-quantum-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: quantumFloat 3s ease-in-out infinite;
}
@keyframes quantumFloat {
  0%, 100% { transform: translate(0, 0); opacity: 0.5; }
  25% { transform: translate(20px, -20px); opacity: 1; }
  50% { transform: translate(-10px, 20px); opacity: 0.3; }
  75% { transform: translate(-20px, -10px); opacity: 0.8; }
}

/* ══════════════════════════════════════════════════════════════
   ERA UNIQUE SCENES - Each era has its own unique animation
   ══════════════════════════════════════════════════════════════ */

/* ── PRIMITIVE ERA ── */
.era-campfire { position: absolute; bottom: 15%; left: 50%; transform: translateX(-50%); width: 120px; height: 100px; background: radial-gradient(ellipse at center bottom, rgba(255,100,0,0.4) 0%, rgba(255,60,0,0.2) 40%, transparent 70%); animation: campfireFlicker 0.8s ease-in-out infinite alternate; }
.era-campfire::before, .era-campfire::after { content: ''; position: absolute; bottom: 0; border-radius: 50% 50% 20% 20%; background: linear-gradient(0deg, rgba(255,150,0,0.9), rgba(255,80,0,0.6), rgba(255,40,0,0.1)); }
.era-campfire::before { left: 30%; width: 40%; height: 70%; animation: flameLeft 0.6s ease-in-out infinite alternate; }
.era-campfire::after { left: 45%; width: 30%; height: 85%; animation: flameRight 0.5s ease-in-out infinite alternate; }
@keyframes campfireFlicker { 0% { filter: brightness(0.9) blur(1px); } 100% { filter: brightness(1.1) blur(0.5px); } }
@keyframes flameLeft { 0% { transform: scaleY(0.8) skewX(-5deg); opacity: 0.8; } 100% { transform: scaleY(1.1) skewX(5deg); opacity: 1; } }
@keyframes flameRight { 0% { transform: scaleY(1) skewX(3deg); opacity: 0.9; } 100% { transform: scaleY(0.85) skewX(-3deg); opacity: 0.7; } }

.era-stone, .era-stone-piece { position: absolute; }
.era-stone-piece { font-size: 24px; animation: stoneFloat 3s ease-in-out infinite; }
@keyframes stoneFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(10deg); } }

.era-speech, .era-speech-char { position: absolute; }
.era-speech-char { font-size: 18px; color: #8B4513; animation: speechFloat 2s ease-in-out infinite; }
@keyframes speechFloat { 0%, 100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(-15px); opacity: 1; } }

.era-paint, .era-paint-mark { position: absolute; }
.era-paint-mark { animation: paintSplat 1.5s ease-out infinite; }
@keyframes paintSplat { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); opacity: 0.8; } }

.era-arrow, .era-arrow-shot { position: absolute; }
.era-arrow-shot { width: 30px; height: 3px; background: linear-gradient(90deg, #8B4513, #D2691E); animation: arrowFly 1.5s ease-out infinite; }
@keyframes arrowFly { 0% { transform: translateX(-100px) rotate(var(--rot)); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateX(100px) rotate(var(--rot)); opacity: 0; } }

.era-paddle { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); font-size: 60px; animation: paddleRow 2s ease-in-out infinite; }
.era-paddle::before { content: '🛶'; }
@keyframes paddleRow { 0%, 100% { transform: translateX(-50%) rotate(-10deg); } 50% { transform: translateX(-50%) rotate(10deg); } }

.era-wolf, .era-wolf-item { position: absolute; }
.era-wolf-item { font-size: 24px; animation: wolfMove 2s ease-in-out infinite; }
@keyframes wolfMove { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(20px); } }

/* ── ANCIENT ERA ── */
.era-fish, .era-fish-item { position: absolute; }
.era-fish-item { font-size: 24px; animation: fishSwim 2s ease-in-out infinite; }
@keyframes fishSwim { 0%, 100% { transform: translateX(0) scaleX(1); } 50% { transform: translateX(30px) scaleX(-1); } }

.era-basket, .era-basket-item { position: absolute; }
.era-basket-item { font-size: 24px; animation: basketGather 2s ease-in-out infinite; }
@keyframes basketGather { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

.era-wheat { position: absolute; bottom: 10%; left: 0; right: 0; height: 60%; }
.era-wheat-stalk { position: absolute; bottom: 0; width: 3px; height: 50px; background: linear-gradient(0deg, #8B7355, #D4A574); border-radius: 2px; animation: wheatSway 2s ease-in-out infinite; transform-origin: bottom center; }
.era-wheat-stalk::before { content: '🌾'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 20px; }
@keyframes wheatSway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

.era-clay { position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); font-size: 60px; }
.era-clay::before { content: '🏺'; animation: claySpin 4s linear infinite; }
@keyframes claySpin { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(360deg); } }

.era-thread, .era-thread-item { position: absolute; }
.era-thread-item { font-size: 24px; animation: threadWeave 2s ease-in-out infinite; }
@keyframes threadWeave { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(15px); } }

/* ── BRONZE/IRON ERA ── */
.era-furnace { position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); font-size: 60px; }
.era-furnace::before { content: '⚒️'; animation: furnaceGlow 1.5s ease-in-out infinite; }
@keyframes furnaceGlow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }

.era-alloy, .era-alloy-item { position: absolute; }
.era-alloy-item { font-size: 24px; animation: alloyShine 2s ease-in-out infinite; }
@keyframes alloyShine { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.5) saturate(1.2); } }

.era-anvil, .era-anvil-item { position: absolute; }
.era-anvil-item { font-size: 24px; animation: anvilStrike 1s ease-out infinite; }
@keyframes anvilStrike { 0%, 80%, 100% { transform: translateY(0); } 90% { transform: translateY(-10px); } }

/* ── CLASSICAL ERA ── */
.era-column { position: absolute; bottom: 10%; left: 0; right: 0; height: 80%; }
.era-column-pillar { position: absolute; bottom: 0; width: 20px; height: 100px; background: linear-gradient(180deg, #D4A574, #8B7355); animation: columnRise 2s ease-out forwards; }
@keyframes columnRise { 0% { transform: translateY(50px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

.era-pavement, .era-pavement-stone { position: absolute; }
.era-pavement-stone { width: 30px; height: 30px; background: #8B7355; animation: pavementAppear 0.5s ease-out forwards; opacity: 0; }
@keyframes pavementAppear { 0% { opacity: 0; transform: scale(0.5); } 100% { opacity: 0.7; transform: scale(1); } }

.era-scroll { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); font-size: 50px; }
.era-scroll::before { content: '📜'; animation: scrollUnfurl 2s ease-in-out infinite; }
@keyframes scrollUnfurl { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(1.2); } }

.era-coin, .era-coin-item { position: absolute; }
.era-coin-item { font-size: 24px; animation: coinFall 2s ease-in infinite; }
@keyframes coinFall { 0% { transform: translateY(-20px) rotateY(0); opacity: 1; } 100% { transform: translateY(100vh) rotateY(720deg); opacity: 0; } }

.era-cement, .era-cement-item { position: absolute; }
.era-cement-item { font-size: 24px; animation: cementBuild 2s ease-out infinite; }
@keyframes cementBuild { 0% { transform: translateY(20px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }

/* ── MEDIEVAL ERA ── */
.era-paper { position: absolute; inset: 0; }
.era-paper-sheet { position: absolute; width: 20px; height: 25px; background: #F5F5DC; border: 1px solid #D4A574; animation: paperFloat 3s ease-in-out infinite; }
@keyframes paperFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(10deg); } }

.era-explosion, .era-explosion-item { position: absolute; }
.era-explosion-item { font-size: 30px; animation: explosionBurst 1.5s ease-out infinite; }
@keyframes explosionBurst { 0% { transform: scale(0); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.8; } 100% { transform: scale(2); opacity: 0; } }

.era-press, .era-press-item { position: absolute; }
.era-press-item { font-size: 24px; animation: pressPrint 2s ease-in-out infinite; }
@keyframes pressPrint { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.era-needle { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); font-size: 50px; }
.era-needle::before { content: '🧭'; animation: needleSpin 3s linear infinite; }
@keyframes needleSpin { 0% { transform: translateX(-50%) rotate(0deg); } 100% { transform: translateX(-50%) rotate(360deg); } }

.era-star-nav { position: absolute; inset: 0; }
.era-star-dot { position: absolute; background: #fff; border-radius: 50%; animation: starTwinkle 2s ease-in-out infinite; }
@keyframes starTwinkle { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ── RENAISSANCE/SCIENCE ── */
.era-art, .era-art-item { position: absolute; }
.era-art-item { font-size: 24px; animation: artFloat 2s ease-in-out infinite; }
@keyframes artFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-15px) rotate(5deg); } }

.era-lens { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); font-size: 50px; }
.era-lens::before { content: '🔭'; animation: lensFocus 2s ease-in-out infinite; }
@keyframes lensFocus { 0%, 100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.1); } }

.era-apple, .era-apple-item { position: absolute; }
.era-apple-item { font-size: 24px; animation: appleDrop 2s ease-in infinite; }
@keyframes appleDrop { 0% { transform: translateY(-30px); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(30px); opacity: 0; } }

.era-beaker, .era-beaker-item { position: absolute; }
.era-beaker-item { font-size: 24px; animation: beakerBubble 1.5s ease-in-out infinite; }
@keyframes beakerBubble { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.era-heat, .era-heat-item { position: absolute; }
.era-heat-item { font-size: 24px; animation: heatRise 2s ease-out infinite; }
@keyframes heatRise { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-50px); opacity: 0; } }

/* ── INDUSTRIAL ERA ── */
.era-boiler, .era-boiler-item { position: absolute; }
.era-boiler-item { font-size: 24px; animation: boilerSteam 2s ease-out infinite; }
@keyframes boilerSteam { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }

.era-lightning, .era-lightning-item { position: absolute; }
.era-lightning-item { font-size: 24px; animation: lightningFlash 0.5s ease-in-out infinite; }
@keyframes lightningFlash { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.era-signal, .era-signal-item { position: absolute; }
.era-signal-item { font-size: 24px; animation: signalPulse 1.5s ease-in-out infinite; }
@keyframes signalPulse { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.2); opacity: 1; } }

.era-propeller, .era-propeller-item { position: absolute; }
.era-propeller-item { font-size: 24px; animation: propellerMove 2s ease-in-out infinite; }
@keyframes propellerMove { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(20px); } }

/* ── MODERN ERA ── */
.era-wheel, .era-wheel-item { position: absolute; }
.era-wheel-item { font-size: 24px; animation: wheelRoll 2s linear infinite; }
@keyframes wheelRoll { 0% { transform: translateX(-20px) rotate(0deg); } 100% { transform: translateX(20px) rotate(360deg); } }

.era-wave, .era-wave-item { position: absolute; }
.era-wave-item { font-size: 24px; animation: waveBroadcast 1.5s ease-in-out infinite; }
@keyframes waveBroadcast { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.3); opacity: 1; } }

.era-wing, .era-wing-item { position: absolute; }
.era-wing-item { font-size: 24px; animation: wingFly 2s ease-in-out infinite; }
@keyframes wingFly { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(5deg); } }

.era-radiation, .era-radiation-item { position: absolute; }
.era-radiation-item { font-size: 24px; animation: radiationPulse 2s ease-in-out infinite; }
@keyframes radiationPulse { 0%, 100% { transform: scale(1); filter: hue-rotate(0deg); } 50% { transform: scale(1.2); filter: hue-rotate(30deg); } }

/* ── DIGITAL ERA ── */
.era-helix, .era-helix-item { position: absolute; }
.era-helix-item { font-size: 24px; animation: helixSpin 3s linear infinite; }
@keyframes helixSpin { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(360deg); } }

.era-orbit, .era-orbit-item { position: absolute; }
.era-orbit-item { font-size: 24px; animation: orbitCircle 4s linear infinite; }
@keyframes orbitCircle { 0% { transform: rotate(0deg) translateX(30px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(30px) rotate(-360deg); } }

.era-rocket, .era-rocket-item { position: absolute; }
.era-rocket-item { font-size: 24px; animation: rocketLaunch 2s ease-out infinite; }
@keyframes rocketLaunch { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-100px); opacity: 0; } }

.era-module, .era-module-item { position: absolute; }
.era-module-item { font-size: 24px; animation: moduleFloat 3s ease-in-out infinite; }
@keyframes moduleFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-15px) rotate(5deg); } }

.era-network, .era-network-item { position: absolute; }
.era-network-item { font-size: 24px; animation: networkConnect 1.5s ease-in-out infinite; }
@keyframes networkConnect { 0%, 100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.2); opacity: 1; } }

.era-atom, .era-atom-item { position: absolute; }
.era-atom-item { font-size: 24px; animation: atomOrbit 3s linear infinite; }
@keyframes atomOrbit { 0% { transform: rotate(0deg) translateX(20px) rotate(0deg); } 100% { transform: rotate(360deg) translateX(20px) rotate(-360deg); } }

/* ── FUTURE ERA ── */
.era-nebula { position: absolute; inset: 0; }
.era-nebula-particle { position: absolute; width: 8px; height: 8px; border-radius: 50%; animation: nebulaDrift 4s ease-in-out infinite; }
@keyframes nebulaDrift { 0%, 100% { transform: translate(0, 0); opacity: 0.5; } 50% { transform: translate(20px, -20px); opacity: 1; } }

.era-dyson, .era-dyson-item { position: absolute; }
.era-dyson-item { font-size: 24px; animation: dysonPulse 2s ease-in-out infinite; }
@keyframes dysonPulse { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.1); filter: brightness(1.3); } }

.era-galaxy { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 200px; height: 200px; background: radial-gradient(ellipse, rgba(255,255,255,0.3), rgba(100,100,255,0.2), transparent); border-radius: 50%; animation: galaxySpin 10s linear infinite; }
@keyframes galaxySpin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* ── COSMIC ERA ── */
.era-portal { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100px; height: 100px; border: 3px solid rgba(100,200,255,0.5); border-radius: 50%; animation: portalSpin 3s linear infinite; }
@keyframes portalSpin { 0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); } 50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.2); } 100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); } }

.era-shard, .era-shard-item { position: absolute; }
.era-shard-item { font-size: 24px; animation: shardFloat 2s ease-in-out infinite; }
@keyframes shardFloat { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(15deg); } }

.era-glow, .era-glow-item { position: absolute; }
.era-glow-item { font-size: 24px; animation: glowPulse 2s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { filter: brightness(1) drop-shadow(0 0 5px rgba(255,255,255,0.5)); } 50% { filter: brightness(1.5) drop-shadow(0 0 20px rgba(255,255,255,0.8)); } }

.era-vortex { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 120px; height: 120px; border: 4px solid transparent; border-top-color: rgba(100,200,255,0.8); border-bottom-color: rgba(200,100,255,0.8); border-radius: 50%; animation: vortexSpin 2s linear infinite; }
@keyframes vortexSpin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* ── FIRE SCENE CONTAINER ── */
.fire-scenes-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   HIDDEN CLICKABLE RESOURCES
   ══════════════════════════════════════════════════════════════ */
.era-hidden-resource {
  position: absolute;
  font-size: 16px;
  cursor: pointer;
  z-index: 100;
  animation: resourceSparkle 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(255,255,100,0.8));
  transition: transform 0.2s, filter 0.2s;
  pointer-events: auto;
}
.era-hidden-resource:hover {
  transform: scale(1.5);
  filter: drop-shadow(0 0 15px rgba(255,255,100,1));
}
@keyframes resourceSparkle {
  0%, 100% { opacity: 0.4; transform: scale(0.8) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.1) rotate(15deg); }
}
.era-resource-popup {
  position: absolute;
  font-size: 24px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 15px rgba(255,215,0,1);
  pointer-events: none;
  z-index: 200;
  animation: resourcePopup 1s ease-out forwards;
}
@keyframes resourcePopup {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-50px); opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════
   MODAL DIALOGS (Offline Report, Events, Codex, etc.)
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: modalFadeIn 0.25s ease-out;
}
.modal-overlay.modal-closing {
  animation: modalFadeOut 0.25s ease-in forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes modalFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.96); }
}

.modal-card {
  background: #ffffff;
  color: #333333;
  border-radius: 8px;
  border: 1px solid #d4cfc9;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  max-width: 440px;
  width: 100%;
  padding: 24px;
  text-align: left;
}

.theme-primitive .modal-card { background: #faf6f0; border-color: #d8d0c5; }
.theme-ancient .modal-card { background: #f3ede2; border-color: #d6ccbe; }
.theme-classical .modal-card { background: #ede7de; border-color: #d0c6b8; }
.theme-medieval .modal-card { background: #efe7db; border-color: #d2c6b4; }
.theme-industrial .modal-card { background: #eae8e5; border-color: #cac6c0; }
.theme-modern .modal-card { background: #e6ebf2; border-color: #c4cede; }
.theme-digital .modal-card { background: #e0e5f2; border-color: #bcc6de; }
.theme-future .modal-card { background: #1f1f38; color: #d0d0e8; border-color: #3a3a60; }
.theme-cosmic .modal-card { background: #121226; color: #b0b0e0; border-color: #2e2e58; }

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.modal-icon {
  font-size: 24px;
}
.modal-title {
  font-size: 17px;
  font-weight: bold;
  color: #b8860b;
  margin: 0;
}
.theme-future .modal-title, .theme-cosmic .modal-title {
  color: #f1c40f;
}

.modal-desc {
  font-size: 13px;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.6;
}
.theme-future .modal-desc, .theme-cosmic .modal-desc {
  color: #9999b8;
}

.modal-stats {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}
.theme-future .modal-stats, .theme-cosmic .modal-stats {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.modal-stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.modal-stat-row:last-child {
  margin-bottom: 0;
}
.modal-stat-row .stat-label {
  color: #777;
}
.modal-stat-row .stat-val {
  font-weight: bold;
  color: #333;
}
.theme-future .modal-stat-row .stat-label, .theme-cosmic .modal-stat-row .stat-label { color: #8888aa; }
.theme-future .modal-stat-row .stat-val, .theme-cosmic .modal-stat-row .stat-val { color: #e0e0ff; }

.offline-gains-box {
  background: rgba(39, 174, 96, 0.08);
  border: 1px solid rgba(39, 174, 96, 0.25);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 20px;
}
.theme-future .offline-gains-box, .theme-cosmic .offline-gains-box {
  background: rgba(39, 174, 96, 0.12);
  border-color: rgba(39, 174, 96, 0.35);
}

.gains-heading {
  font-size: 12px;
  font-weight: bold;
  color: #27ae60;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gains-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gain-item {
  display: flex;
  align-items: center;
  font-size: 14px;
}
.gain-emoji {
  font-size: 16px;
  margin-right: 8px;
}
.gain-name {
  flex: 1;
  color: #444;
}
.theme-future .gain-name, .theme-cosmic .gain-name { color: #c0c0d8; }
.gain-amount {
  color: #27ae60;
  font-size: 15px;
}
.theme-future .gain-amount, .theme-cosmic .gain-amount { color: #4ade80; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
}
.modal-btn {
  background: #b8860b;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
}
.modal-btn:hover {
  background: #996e00;
  transform: translateY(-1px);
}
.modal-btn:active {
  transform: translateY(0);
}
.theme-future .modal-btn, .theme-cosmic .modal-btn {
  background: #3b82f6;
}
.theme-future .modal-btn:hover, .theme-cosmic .modal-btn:hover {
  background: #2563eb;
}

/* ══════════════════════════════════════════════════════════════
   ACTIVE BUFFS & HISTORICAL EVENTS
   ══════════════════════════════════════════════════════════════ */
.buffs-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
}
.buff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(243, 156, 18, 0.15);
  border: 1px solid rgba(243, 156, 18, 0.4);
  color: #b8860b;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  animation: pulseGlow 2s infinite alternate;
}
.theme-future .buff-pill, .theme-cosmic .buff-pill {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}
.buff-pill strong {
  font-size: 10px;
  opacity: 0.85;
}

@keyframes pulseGlow {
  from { box-shadow: 0 0 2px rgba(243, 156, 18, 0.2); }
  to { box-shadow: 0 0 8px rgba(243, 156, 18, 0.5); }
}

.event-modal-card {
  max-width: 480px;
}
.event-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #b8860b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.theme-future .event-badge, .theme-cosmic .event-badge {
  color: #f1c40f;
}
.event-desc {
  margin-bottom: 20px;
  line-height: 1.6;
}
.event-choices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-choice-wrapper {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.event-choice-btn {
  background: #f8f6f2;
  border: 1px solid #d4cfc9;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  line-height: 1.4;
}
.event-choice-btn:hover:not(:disabled) {
  background: #ffffff;
  border-color: #b8860b;
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.15);
  transform: translateY(-1px);
}
.event-choice-btn:active:not(:disabled) {
  transform: translateY(0);
}
.event-choice-btn.disabled, .event-choice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #eae6e0;
  border-color: #d8d4ce;
  color: #888888;
}

.theme-future .event-choice-btn, .theme-cosmic .event-choice-btn {
  background: #18182c;
  border-color: #353555;
  color: #e0e0f0;
}
.theme-future .event-choice-btn:hover:not(:disabled), .theme-cosmic .event-choice-btn:hover:not(:disabled) {
  background: #22223e;
  border-color: #3b82f6;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}
.theme-future .event-choice-btn.disabled, .theme-future .event-choice-btn:disabled,
.theme-cosmic .event-choice-btn.disabled, .theme-cosmic .event-choice-btn:disabled {
  background: #151525;
  border-color: #252538;
  color: #606078;
}

.choice-req-warning {
  font-size: 11px;
  color: #e74c3c;
  padding-left: 4px;
}

/* ── HEADER NAVIGATION & BADGES ── */
#header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-header-btn {
  background: rgba(0,0,0,0.03);
  border: 1px solid #ddd8d0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  color: #555;
  transition: all 0.2s ease;
  user-select: none;
}
.nav-header-btn:hover {
  background: #f0ece6;
  color: #111;
  border-color: #c4beaf;
}
.nav-badge {
  background: #e67e22;
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: bold;
  line-height: 1;
}
.theme-future .nav-header-btn, .theme-cosmic .nav-header-btn {
  background: #18182c;
  border-color: #333355;
  color: #a0a0c0;
}
.theme-future .nav-header-btn:hover, .theme-cosmic .nav-header-btn:hover {
  background: #252545;
  color: #fff;
  border-color: #555588;
}

/* ── ACHIEVEMENT TOAST BANNER ── */
.achievement-toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 90%;
  max-width: 480px;
}
.achievement-toast {
  pointer-events: auto;
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(254, 243, 199, 0.98));
  border: 1.5px solid #f59e0b;
  box-shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.35), 0 8px 10px -6px rgba(217, 119, 6, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  transition: transform 0.2s, opacity 0.25s;
  backdrop-filter: blur(8px);
  color: #451a03;
}
.achievement-toast:hover {
  transform: scale(1.02);
}
.achievement-toast.ach-toast-out {
  animation: toastSlideOut 0.3s ease-in forwards;
}
@keyframes toastSlideIn {
  0% { opacity: 0; transform: translateY(-30px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastSlideOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.95); }
}
.ach-toast-icon-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.ach-toast-sparkle {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 12px;
  animation: spinSparkle 2s linear infinite;
}
@keyframes spinSparkle {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}
.ach-toast-content {
  flex: 1;
  min-width: 0;
}
.ach-toast-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.ach-toast-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: #d97706;
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
}
.ach-toast-title {
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
}
.ach-toast-name {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 2px;
}
.ach-toast-desc {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ach-toast-bonus {
  flex-shrink: 0;
}
.ach-toast-bonus-badge {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── ACHIEVEMENTS VIEW & MODAL ── */
.ach-modal-card, .codex-modal-card {
  max-width: 740px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.modal-header-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #666;
}
.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.modal-close-btn:hover {
  color: #222;
  background: rgba(0,0,0,0.06);
}
.modal-body-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}
.ach-summary-banner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.ach-summary-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ach-stat-box {
  display: flex;
  flex-direction: column;
}
.ach-stat-num {
  font-size: 22px;
  font-weight: bold;
  color: #b45309;
}
.bonus-highlight .ach-stat-num {
  color: #059669;
}
.ach-stat-lbl {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}
.ach-progress-bar-bg {
  height: 8px;
  background: rgba(0,0,0,0.08);
  border-radius: 4px;
  overflow: hidden;
}
.ach-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #10b981);
  border-radius: 4px;
  transition: width 0.4s ease;
}
.ach-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.ach-filter-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s;
}
.ach-filter-btn:hover {
  background: #f9fafb;
}
.ach-filter-btn.active {
  background: #d97706;
  color: #fff;
  border-color: #d97706;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.2);
}
.ach-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.ach-item-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: all 0.2s;
}
.ach-item-card.unlocked {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #fffbeb, #fff);
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.15);
}
.ach-item-card.locked {
  opacity: 0.65;
  background: #f9fafb;
  border-color: #e5e7eb;
}
.ach-card-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.04);
}
.ach-item-card.unlocked .ach-card-icon-wrap {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
}
.ach-card-info {
  flex: 1;
  min-width: 0;
}
.ach-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
}
.ach-card-name {
  font-weight: 600;
  font-size: 14px;
  color: #1f2937;
}
.ach-card-status.done {
  font-size: 11px;
  color: #059669;
  font-weight: 600;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
}
.ach-card-status.locked {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}
.ach-card-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

/* ── CODEX VIEW & LAYOUT ── */
.codex-overview-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.codex-stat-item {
  display: flex;
  flex-direction: column;
}
.codex-stat-val {
  font-weight: bold;
  font-size: 16px;
  color: #2563eb;
}
.codex-stat-label {
  font-size: 12px;
  color: #6b7280;
}
.codex-tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.codex-tab-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  color: #4b5563;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.2s;
}
.codex-tab-btn:hover {
  background: #f3f4f6;
}
.codex-tab-btn.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.codex-era-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
}
.codex-era-section.current {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
  background: #f8fafc;
}
.codex-era-section.completed {
  border-color: #10b981;
}
.codex-era-section.locked {
  opacity: 0.6;
}
.codex-era-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.codex-era-title-wrap {
  display: flex;
  align-items: baseline;
}
.codex-era-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}
.codex-era-year {
  font-size: 12px;
  color: #64748b;
  margin-left: 8px;
}
.codex-era-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.codex-era-pill.current {
  background: #dbeafe;
  color: #1d4ed8;
}
.codex-era-pill.completed {
  background: #d1fae5;
  color: #065f46;
}
.codex-era-pill.locked {
  background: #f1f5f9;
  color: #94a3b8;
}
.codex-era-techs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.codex-item-card {
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
}
.codex-item-card.unlocked {
  border-color: #cbd5e1;
  background: #fff;
}
.codex-item-card.locked {
  opacity: 0.6;
}
.codex-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.codex-item-emoji {
  font-size: 16px;
}
.codex-item-name {
  font-size: 13px;
  color: #1e293b;
}
.codex-item-year {
  font-size: 11px;
  color: #64748b;
  margin-left: auto;
}
.codex-item-lv {
  font-size: 10px;
  background: #e2e8f0;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}
.codex-item-lore {
  font-size: 12px;
  color: #475569;
  margin: 0;
  line-height: 1.45;
}
.codex-branch-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: auto;
}
.codex-branch-tag.chosen {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}
.codex-branch-tag.locked {
  background: #f1f5f9;
  color: #94a3b8;
}

/* Codex Techs Tab */
.codex-search-bar {
  margin-bottom: 12px;
}
.codex-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.codex-search-input:focus {
  border-color: #2563eb;
}
.codex-techs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.codex-tech-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.codex-tech-card.unlocked {
  border-color: #cbd5e1;
}
.codex-tech-card.locked {
  opacity: 0.6;
  background: #f9fafb;
}
.codex-tech-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.codex-tech-emoji {
  font-size: 24px;
}
.codex-tech-meta {
  flex: 1;
}
.codex-tech-title {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
}
.codex-tech-sub {
  font-size: 11px;
}
.codex-tech-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.codex-tech-badge.lv {
  background: #e0f2fe;
  color: #0369a1;
}
.codex-tech-badge.locked {
  color: #94a3b8;
}
.codex-tech-lore {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  margin: 0 0 8px;
}
.codex-tech-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.codex-tech-prod-tag {
  font-size: 11px;
  background: #f0fdf4;
  color: #15803d;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #bbf7d0;
}

/* Codex Branches Tab */
.codex-branch-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
}
.codex-branch-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.codex-branch-section-header h4 {
  margin: 0;
  font-size: 15px;
  color: #1e293b;
}
.codex-branch-meta {
  font-size: 12px;
  color: #64748b;
}
.codex-branch-choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.codex-branch-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.codex-branch-card.chosen {
  border-color: #10b981;
  background: #f0fdf4;
}
.codex-branch-card.alternate {
  border-color: #cbd5e1;
  background: #fafafa;
  opacity: 0.85;
}
.codex-branch-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.codex-branch-emoji {
  font-size: 18px;
}
.codex-branch-name {
  font-size: 14px;
  color: #1e293b;
}
.codex-branch-status-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: auto;
}
.codex-branch-status-tag.chosen {
  background: #dcfce7;
  color: #166534;
}
.codex-branch-status-tag.alt {
  background: #f3f4f6;
  color: #6b7280;
}
.codex-branch-bonus {
  font-size: 12px;
  color: #d97706;
  font-weight: 600;
  margin-bottom: 4px;
}
.codex-branch-desc {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
  margin: 0 0 6px;
}
.codex-branch-preview {
  font-size: 11px;
}

/* Codex Events Tab */
.codex-events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.codex-event-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.codex-event-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.codex-event-emoji {
  font-size: 22px;
}
.codex-event-title {
  margin: 0;
  font-size: 14px;
  color: #1e293b;
}
.codex-event-era {
  font-size: 11px;
}
.codex-event-desc {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.45;
  margin: 0 0 8px;
}
.codex-event-choices {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.codex-event-choice-pill {
  font-size: 11px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  border-radius: 4px;
  color: #334155;
}

/* ── CODEX SECTION INTRO & SHARED ── */
.codex-section-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(184, 134, 11, 0.05);
  border: 1px solid rgba(184, 134, 11, 0.15);
  border-radius: 8px;
}
.codex-sub-title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: bold;
  color: #2c3e50;
}
.codex-sub-desc {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}
.codex-sub-progress .progress-pill {
  font-size: 11px;
  font-weight: 600;
  color: #b8860b;
  background: rgba(184, 134, 11, 0.12);
  border: 1px solid rgba(184, 134, 11, 0.25);
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ── CODEX THINKERS TAB ── */
.codex-thinkers-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.thinkers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.thinker-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
}
.thinker-card.unlocked {
  border-color: rgba(184, 134, 11, 0.35);
  background: linear-gradient(135deg, #ffffff, #fdfbf7);
  box-shadow: 0 2px 6px rgba(184, 134, 11, 0.05);
}
.thinker-card.locked {
  opacity: 0.65;
  background: #f8fafc;
  border-color: #e2e8f0;
}
.thinker-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.thinker-emoji {
  font-size: 24px;
  line-height: 1.1;
}
.thinker-identity {
  flex: 1;
  min-width: 0;
}
.thinker-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.thinker-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}
.thinker-period-pill {
  font-size: 10.5px;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
}
.thinker-title {
  font-size: 11.5px;
  color: #b8860b;
  font-weight: 500;
  margin-top: 2px;
}
.thinker-status-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.thinker-status-badge.unlocked {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.thinker-status-badge.locked {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.thinker-era-tag {
  font-size: 11px;
  color: #78716c;
  background: #fafaf9;
  border: 1px dashed #e7e5e4;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  align-self: flex-start;
}
.thinker-quote-box {
  background: #fdfaf3;
  border-left: 3px solid #d97706;
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  font-style: italic;
}
.thinker-quote {
  font-size: 12.5px;
  color: #451a03;
  line-height: 1.5;
  margin: 0 0 4px;
}
.thinker-source {
  font-size: 11px;
  color: #92400e;
  text-align: right;
  font-weight: 500;
}
.thinker-contribution {
  font-size: 12px;
  color: #334155;
  line-height: 1.5;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  padding: 8px 10px;
}
.thinker-contrib-label, .thinker-section-label {
  font-weight: 600;
  color: #1e293b;
  display: block;
  margin-bottom: 2px;
  font-size: 11.5px;
}
.thinker-contrib-text {
  margin: 0;
  font-size: 11.5px;
  color: #475569;
}
.thinker-locked-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
}

/* ── CODEX MANUSCRIPTS & ARCHAEOLOGY TAB ── */
.codex-manuscripts-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.manuscripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.manuscript-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}
.manuscript-card.unlocked {
  border-color: rgba(59, 130, 246, 0.3);
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}
.manuscript-card.locked {
  opacity: 0.65;
  background: #f8fafc;
}
.manuscript-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.manuscript-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.manuscript-emoji {
  font-size: 22px;
}
.manuscript-head-meta {
  display: flex;
  flex-direction: column;
}
.manuscript-node-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}
.manuscript-node-era {
  font-size: 11px;
}
.manuscript-status-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.manuscript-status-badge.unlocked {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.manuscript-status-badge.locked {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.archaeology-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
}
.archaeology-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
  font-size: 11.5px;
}
.archaeology-site-name {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
  font-size: 12px;
}
.archaeology-period {
  font-size: 11px;
  margin-bottom: 6px;
}
.archaeology-discovery {
  border-top: 1px dashed #e2e8f0;
  padding-top: 4px;
}
.archaeology-sub-label {
  font-weight: 600;
  color: #475569;
  font-size: 11px;
}
.archaeology-desc {
  margin: 2px 0 0;
  color: #334155;
  line-height: 1.45;
  font-size: 11.5px;
}
.primary-manuscript-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12px;
}
.manuscript-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 4px;
  font-size: 11.5px;
}
.manuscript-doc-title {
  font-weight: 700;
  color: #78350f;
  margin-bottom: 6px;
  font-size: 12px;
}
.manuscript-quote-content {
  border-left: 2px solid #f59e0b;
  padding-left: 8px;
  font-style: italic;
}
.manuscript-quote {
  margin: 0 0 3px;
  color: #451a03;
  line-height: 1.45;
  font-size: 11.5px;
}
.manuscript-source-tag {
  font-size: 10.5px;
  color: #b45309;
  text-align: right;
  font-weight: 500;
}
.manuscript-locked-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
}

/* ── CODEX TRADE ROUTES TAB ── */
.codex-trade-routes-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.trade-routes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.trade-route-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
}
.trade-route-card.unlocked {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.06);
}
.trade-route-card.locked {
  opacity: 0.65;
  background: #f8fafc;
  border-color: #e2e8f0;
}
.trade-route-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.trade-route-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.trade-route-card.unlocked .trade-route-icon-box {
  background: #dcfce7;
}
.trade-route-title-wrap {
  flex: 1;
  min-width: 0;
}
.trade-route-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.trade-route-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}
.trade-route-status-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.trade-route-status-pill.active {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.trade-route-status-pill.dormant {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.trade-route-period-meta {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}
.trade-corridor-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}
.corridor-point {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.corridor-badge {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
}
.corridor-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}
.corridor-arrow {
  color: #94a3b8;
  font-weight: bold;
  font-size: 14px;
}
.trade-sub-heading {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.commodities-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.commodity-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11.5px;
  color: #334155;
  cursor: help;
  transition: background 0.15s ease;
}
.trade-route-card.unlocked .commodity-chip {
  background: #ffffff;
  border-color: #cbd5e1;
}
.commodity-chip:hover {
  background: #e2e8f0;
}
.commodity-emoji {
  font-size: 12px;
}
.commodity-name {
  font-weight: 500;
}
.trade-prosperity-box {
  background: #ecfdf5;
  border-left: 3px solid #10b981;
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.prosperity-label {
  font-weight: 600;
  color: #047857;
}
.prosperity-val {
  color: #065f46;
  font-weight: 500;
}
.trade-archaeology-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
}
.trade-artifact-desc {
  margin: 0;
  color: #334155;
  line-height: 1.45;
}
.trade-significance-box {
  background: #fafaf9;
  border: 1px solid #f5f5f4;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
}
.trade-context-desc {
  margin: 0;
  color: #44403c;
  line-height: 1.45;
}
.trade-locked-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
}

.theme-future .trade-route-card, .theme-cosmic .trade-route-card {
  background: #191932;
  border-color: #2b2b48;
  color: #c8c8e0;
}
.theme-future .trade-route-card.unlocked, .theme-cosmic .trade-route-card.unlocked {
  background: linear-gradient(135deg, #191932, #142428);
  border-color: rgba(16, 185, 129, 0.4);
}
.theme-future .trade-route-name, .theme-cosmic .trade-route-name {
  color: #e0e0ff;
}
.theme-future .trade-corridor-box, .theme-cosmic .trade-corridor-box,
.theme-future .trade-archaeology-box, .theme-cosmic .trade-archaeology-box,
.theme-future .trade-significance-box, .theme-cosmic .trade-significance-box {
  background: #131326;
  border-color: #262644;
}
.theme-future .corridor-label, .theme-cosmic .corridor-label {
  color: #d0d0f0;
}
.theme-future .commodity-chip, .theme-cosmic .commodity-chip {
  background: #20203a;
  border-color: #323258;
  color: #c0c0e0;
}

/* Codex Visual Tech Atlas */
.codex-atlas-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.atlas-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.03);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  color: #555;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.mastered { background: #f39c12; box-shadow: 0 0 6px #f1c40f; }
.legend-dot.active { background: #2ecc71; box-shadow: 0 0 6px #27ae60; }
.legend-dot.locked { background: #bbb; }
.legend-dot.alternate { background: #9b59b6; }

.atlas-tree-stream {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.atlas-era-column {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}
.atlas-era-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}
.atlas-era-badge {
  background: #b8860b;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 10px;
}
.atlas-era-title {
  font-size: 13px;
  font-weight: bold;
  color: #1e293b;
}
.atlas-era-nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 8px;
}
.atlas-node-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}
.atlas-node-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.atlas-node-card.mastered {
  border-color: #f1c40f;
  background: linear-gradient(135deg, #fffdf8, #fff9e6);
  box-shadow: 0 0 8px rgba(241, 196, 15, 0.2);
}
.atlas-node-card.active {
  border-color: #2ecc71;
  background: linear-gradient(135deg, #f8fff9, #effff2);
}
.atlas-node-card.locked {
  opacity: 0.55;
  background: #f8fafc;
}
.atlas-node-card.alternate {
  border-color: #9b59b6;
  background: linear-gradient(135deg, #fdfaff, #f7efff);
}
.atlas-node-card.branch-node {
  border-style: dashed;
}
.atlas-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.atlas-node-emoji {
  font-size: 16px;
}
.atlas-node-status-badge {
  font-size: 9px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 3px;
}
.atlas-node-status-badge.mastered { color: #d68910; background: rgba(241, 196, 15, 0.15); }
.atlas-node-status-badge.active { color: #27ae60; background: rgba(46, 204, 113, 0.15); }
.atlas-node-status-badge.locked { color: #888; background: #eee; }
.atlas-node-status-badge.alternate { color: #8e44ad; background: rgba(155, 89, 182, 0.15); }
.atlas-node-name {
  font-size: 12px;
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atlas-node-year {
  font-size: 10px;
  color: #888;
  margin-top: 1px;
}
.atlas-node-lv {
  font-size: 10px;
  color: #b8860b;
  margin-top: 3px;
  font-weight: 500;
}

.atlas-detail-meta {
  font-size: 12px;
  margin-bottom: 8px;
}
.atlas-detail-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  margin-bottom: 12px;
}
.atlas-detail-lv {
  font-size: 12px;
  color: #b8860b;
  background: rgba(184, 134, 11, 0.08);
  padding: 6px 10px;
  border-radius: 4px;
}

/* ── THEME OVERRIDES FOR MODALS & CODEX ── */
.theme-future .ach-item-card, .theme-cosmic .ach-item-card,
.theme-future .codex-era-section, .theme-cosmic .codex-era-section,
.theme-future .codex-tech-card, .theme-cosmic .codex-tech-card,
.theme-future .codex-branch-card, .theme-cosmic .codex-branch-card,
.theme-future .codex-event-card, .theme-cosmic .codex-event-card {
  background: #18182c;
  border-color: #2e2e50;
  color: #c0c0e0;
}
.theme-future .ach-item-card.unlocked, .theme-cosmic .ach-item-card.unlocked {
  background: linear-gradient(135deg, #222240, #18182c);
  border-color: #f59e0b;
}
.theme-future .ach-item-card.locked, .theme-cosmic .ach-item-card.locked {
  background: #131322;
  border-color: #222238;
}
.theme-future .ach-card-name, .theme-cosmic .ach-card-name,
.theme-future .codex-era-name, .theme-cosmic .codex-era-name,
.theme-future .codex-tech-title, .theme-cosmic .codex-tech-title,
.theme-future .codex-branch-name, .theme-cosmic .codex-branch-name,
.theme-future .codex-event-title, .theme-cosmic .codex-event-title {
  color: #e2e8f0;
}
.theme-future .ach-filter-btn, .theme-cosmic .ach-filter-btn,
.theme-future .codex-search-input, .theme-cosmic .codex-search-input {
  background: #18182c;
  border-color: #333355;
  color: #c0c0e0;
}
.theme-future .codex-item-card, .theme-cosmic .codex-item-card {
  background: #141424;
  border-color: #25253e;
}
.theme-future .codex-item-name, .theme-cosmic .codex-item-name {
  color: #cbd5e1;
}
.theme-future .codex-item-lore, .theme-cosmic .codex-item-lore {
  color: #8888aa;
}
.theme-future .modal-close-btn, .theme-cosmic .modal-close-btn {
  color: #8888aa;
}
.theme-future .modal-close-btn:hover, .theme-cosmic .modal-close-btn:hover {
  color: #fff;
  background: #252545;
}

.theme-future .era-pop-badge, .theme-cosmic .era-pop-badge {
  background: rgba(120, 140, 200, 0.12);
  border-color: rgba(120, 140, 200, 0.25);
  color: #9bb0dc;
}
.theme-future .era-pop-badge:hover, .theme-cosmic .era-pop-badge:hover {
  background: rgba(120, 140, 200, 0.2);
  border-color: rgba(120, 140, 200, 0.4);
  color: #bfdbfe;
}

.theme-future .codex-section-intro, .theme-cosmic .codex-section-intro {
  background: rgba(184, 134, 11, 0.08);
  border-color: rgba(184, 134, 11, 0.25);
}
.theme-future .codex-sub-title, .theme-cosmic .codex-sub-title {
  color: #f1f5f9;
}
.theme-future .codex-sub-desc, .theme-cosmic .codex-sub-desc {
  color: #94a3b8;
}
.theme-future .thinker-card, .theme-cosmic .thinker-card,
.theme-future .manuscript-card, .theme-cosmic .manuscript-card {
  background: #18182c;
  border-color: #2e2e50;
  color: #c0c0e0;
}
.theme-future .thinker-card.unlocked, .theme-cosmic .thinker-card.unlocked {
  background: linear-gradient(135deg, #1c1c34, #18182c);
  border-color: rgba(245, 158, 11, 0.4);
}
.theme-future .thinker-card.locked, .theme-cosmic .thinker-card.locked,
.theme-future .manuscript-card.locked, .theme-cosmic .manuscript-card.locked {
  background: #131322;
  border-color: #222238;
}
.theme-future .thinker-name, .theme-cosmic .thinker-name,
.theme-future .manuscript-node-name, .theme-cosmic .manuscript-node-name {
  color: #e2e8f0;
}
.theme-future .thinker-period-pill, .theme-cosmic .thinker-period-pill {
  background: #252545;
  color: #94a3b8;
}
.theme-future .thinker-era-tag, .theme-cosmic .thinker-era-tag {
  background: #1e1e38;
  border-color: #333355;
  color: #a8a29e;
}
.theme-future .thinker-quote-box, .theme-cosmic .thinker-quote-box {
  background: #1f1b2e;
  border-left-color: #f59e0b;
}
.theme-future .thinker-quote, .theme-cosmic .thinker-quote {
  color: #fef3c7;
}
.theme-future .thinker-source, .theme-cosmic .thinker-source {
  color: #fde68a;
}
.theme-future .thinker-contribution, .theme-cosmic .thinker-contribution {
  background: #141426;
  border-color: #252540;
}
.theme-future .thinker-contrib-label, .theme-cosmic .thinker-contrib-label {
  color: #cbd5e1;
}
.theme-future .thinker-contrib-text, .theme-cosmic .thinker-contrib-text {
  color: #94a3b8;
}
.theme-future .thinker-locked-hint, .theme-cosmic .thinker-locked-hint,
.theme-future .manuscript-locked-hint, .theme-cosmic .manuscript-locked-hint {
  background: #141424;
  border-color: #282845;
  color: #64748b;
}
.theme-future .archaeology-box, .theme-cosmic .archaeology-box {
  background: #141426;
  border-color: #252540;
}
.theme-future .archaeology-head, .theme-cosmic .archaeology-head {
  color: #94a3b8;
}
.theme-future .archaeology-site-name, .theme-cosmic .archaeology-site-name {
  color: #e2e8f0;
}
.theme-future .archaeology-discovery, .theme-cosmic .archaeology-discovery {
  border-top-color: #252540;
}
.theme-future .archaeology-desc, .theme-cosmic .archaeology-desc {
  color: #94a3b8;
}
.theme-future .primary-manuscript-box, .theme-cosmic .primary-manuscript-box {
  background: #1e1b2c;
  border-color: #3b3045;
}
.theme-future .manuscript-head, .theme-cosmic .manuscript-head {
  color: #fde68a;
}
.theme-future .manuscript-doc-title, .theme-cosmic .manuscript-doc-title {
  color: #fef3c7;
}
.theme-future .manuscript-quote, .theme-cosmic .manuscript-quote {
  color: #fef08a;
}
.theme-future .manuscript-source-tag, .theme-cosmic .manuscript-source-tag {
  color: #fcd34d;
}

/* ── PRESTIGE & ASCENSION SYSTEM ── */
.prestige-modal-card {
  width: 90%;
  max-width: 680px;
  max-height: 88vh;
  border: 1.5px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 15px 40px rgba(147, 51, 234, 0.25);
}
.prestige-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.prestige-summary-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.12));
  border: 1px solid rgba(168, 85, 247, 0.25);
}
.prestige-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.prestige-stat-val {
  font-size: 17px;
  font-weight: bold;
  color: #7c3aed;
}
.prestige-stat-item.highlight-stardust .prestige-stat-val {
  font-size: 20px;
  color: #d97706;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}
.prestige-stat-lbl {
  font-size: 11px;
  color: #64748b;
}
.prestige-rebirth-card {
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prestige-rebirth-card.ready {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.12), rgba(79, 70, 229, 0.1));
  border: 1.5px solid #a855f7;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.2);
}
.prestige-rebirth-card.locked {
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed #cbd5e1;
}
.rebirth-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.rebirth-status-badge {
  font-size: 13px;
  font-weight: bold;
}
.rebirth-status-badge.available {
  color: #9333ea;
}
.rebirth-status-badge.locked {
  color: #64748b;
}
.rebirth-gain-pill {
  background: #fef08a;
  color: #854d0e;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 12px;
  border: 1px solid #facc15;
}
.rebirth-warning-text {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}
.prestige-rebirth-btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.prestige-rebirth-btn.glow-pulse {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  border: none;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}
.prestige-rebirth-btn.glow-pulse:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
}
.prestige-rebirth-btn.confirming-rebirth {
  background: linear-gradient(135deg, #dc2626, #ea580c);
  color: #fff;
  border: none;
}
.prestige-rebirth-btn.disabled {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  cursor: not-allowed;
}
.prestige-talents-header h4 {
  font-size: 14px;
  font-weight: bold;
  color: #334155;
  margin: 0;
}
.prestige-talents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.talent-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}
.talent-card.talent-active {
  border-color: #c084fc;
  box-shadow: 0 2px 10px rgba(192, 132, 252, 0.15);
}
.talent-card.talent-maxed {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.3), rgba(255, 255, 255, 0.95));
}
.talent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.talent-card-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.talent-emoji {
  font-size: 22px;
}
.talent-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.talent-name {
  font-weight: bold;
  font-size: 13px;
  color: #1e293b;
}
.talent-lv-badge {
  font-size: 11px;
  font-weight: bold;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}
.talent-lv-badge.badge-max {
  color: #b45309;
  background: rgba(245, 158, 11, 0.2);
}
.talent-progress-track {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}
.talent-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #a855f7, #6366f1);
  transition: width 0.3s ease;
}
.talent-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
  margin: 0;
}
.talent-footer {
  margin-top: auto;
  padding-top: 4px;
}
.talent-buy-btn {
  width: 100%;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}
.talent-buy-btn.can-buy {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  border: none;
}
.talent-buy-btn.can-buy:hover {
  background: linear-gradient(135deg, #9333ea, #4f46e5);
  transform: translateY(-1px);
}
.talent-buy-btn.locked {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  cursor: not-allowed;
}
.talent-buy-btn.maxed {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border: 1px solid #facc15;
  cursor: default;
}

/* Future / Cosmic theme support for prestige */
.theme-future .prestige-modal-card, .theme-cosmic .prestige-modal-card {
  background: #0f0f1c;
  border-color: #7c3aed;
  box-shadow: 0 15px 40px rgba(124, 58, 237, 0.3);
}
.theme-future .prestige-summary-banner, .theme-cosmic .prestige-summary-banner {
  background: #18182c;
  border-color: #333355;
}
.theme-future .prestige-stat-lbl, .theme-cosmic .prestige-stat-lbl {
  color: #8888aa;
}
.theme-future .prestige-rebirth-card.ready, .theme-cosmic .prestige-rebirth-card.ready {
  background: #1c1432;
  border-color: #a855f7;
}
.theme-future .prestige-rebirth-card.locked, .theme-cosmic .prestige-rebirth-card.locked {
  background: #141424;
  border-color: #25253e;
}
.theme-future .rebirth-warning-text, .theme-cosmic .rebirth-warning-text {
  color: #8888aa;
}
.theme-future .prestige-talents-header h4, .theme-cosmic .prestige-talents-header h4 {
  color: #c0c0e0;
}
.theme-future .talent-card, .theme-cosmic .talent-card {
  background: #141424;
  border-color: #25253e;
}
.theme-future .talent-card.talent-active, .theme-cosmic .talent-card.talent-active {
  border-color: #7c3aed;
}
.theme-future .talent-card.talent-maxed, .theme-cosmic .talent-card.talent-maxed {
  border-color: #f59e0b;
  background: #1f1a10;
}
.theme-future .talent-name, .theme-cosmic .talent-name {
  color: #e2e8f0;
}
.theme-future .talent-desc, .theme-cosmic .talent-desc {
  color: #94a3b8;
}
.theme-future .talent-buy-btn.locked, .theme-cosmic .talent-buy-btn.locked {
  background: #18182c;
  color: #64748b;
  border-color: #2e2e4a;
}
.theme-future .talent-progress-track, .theme-cosmic .talent-progress-track {
  background: #25253e;
}

/* =========================================
   Task 7: Modern Multi-Tab HUD Navigation
   ========================================= */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(212, 207, 201, 0.7);
  border-radius: 8px;
  padding: 5px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  transition: background 0.3s, border-color 0.3s;
}
.nav-tabs::-webkit-scrollbar {
  display: none;
}
.nav-tab {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-tab:hover {
  color: #222;
  background: rgba(0, 0, 0, 0.04);
}
.nav-tab:active {
  transform: scale(0.96);
}
.nav-tab.active {
  color: #b8860b;
  font-weight: 700;
  background: #fff;
  border-color: rgba(184, 134, 11, 0.35);
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.12);
}
.tab-icon {
  font-size: 15px;
  line-height: 1;
}
.tab-label {
  font-size: 13px;
}
.nav-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(184, 134, 11, 0.15);
  color: #b8860b;
  min-width: 16px;
  text-align: center;
}
.nav-tab.active .nav-badge {
  background: #b8860b;
  color: #fff;
}

/* Header & Quick Controls */
.brand-title {
  font-size: 15px;
  font-weight: bold;
  color: #b8860b;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.brand-title:hover {
  opacity: 0.85;
}
.brand-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.brand-title-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
#header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
#header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.quick-header-btn {
  cursor: pointer;
  color: #888;
  font-size: 12px;
  user-select: none;
  padding: 2px 8px;
  border: 1px solid #ddd8d0;
  border-radius: 3px;
  background: none;
  font-family: inherit;
  transition: all 0.15s;
}
.quick-header-btn:hover {
  color: #3a3a3a;
  background: #f0ece6;
}

/* Tab Panes */
#tab-content {
  width: 100%;
  position: relative;
  min-height: 360px;
}
.tab-pane {
  display: none;
  opacity: 0;
}
.tab-pane.active {
  display: block;
  opacity: 1;
  animation: tabFadeIn 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Floating Numbers & Sparkle Particles */
.floating-number {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 10px currentColor;
  animation: floatUpBounce 0.95s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  transform: translate(-50%, 0);
  white-space: nowrap;
}
.floating-number.crit-float {
  font-size: 18px;
  font-weight: 900;
  color: #f1c40f !important;
  text-shadow: 0 0 12px rgba(241, 196, 15, 0.8), 0 2px 5px rgba(0,0,0,0.5);
  animation: floatUpCrit 1.05s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}
@keyframes floatUpCrit {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -15px) scale(1.35);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -45px) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70px) scale(0.95);
  }
}

.sparkle-particle {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  border-radius: 50%;
  animation: particleBurst 0.68s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, 0)) scale(0.2);
  }
}

/* Tactile Click Feel */
.action-btn:active,
.branch-card:active,
.talent-buy-btn:active,
.modal-btn:active,
.settings-action-btn:active {
  transform: scale(0.96) !important;
  transition: transform 0.08s ease !important;
}

/* Stats View Dashboard */
.stats-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stats-header-banner, .settings-header-banner {
  padding: 6px 0 2px;
  border-bottom: 1px solid #e8e4df;
}
.stats-header-banner h3, .settings-header-banner h3 {
  font-size: 16px;
  color: #b8860b;
}
.stats-card, .settings-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid #e0dcd6;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.stats-section-title, .settings-section-title {
  font-size: 14px;
  font-weight: bold;
  color: #3a3a3a;
  margin-bottom: 10px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.stat-tile {
  background: rgba(250, 248, 245, 0.85);
  border: 1px solid #e8e4df;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat-tile-val {
  font-size: 15px;
  font-weight: bold;
  color: #3a3a3a;
  word-break: break-all;
}
.stat-tile-lbl {
  font-size: 11px;
  color: #888;
}
.stat-tile.highlight-stardust {
  border-color: rgba(155, 89, 182, 0.4);
  background: rgba(155, 89, 182, 0.05);
}
.stat-tile.highlight-stardust .stat-tile-val {
  color: #9b59b6;
}
.text-green { color: #27ae60 !important; }
.text-gold { color: #b8860b !important; }

/* Settings View Controls */
.settings-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #ede8e2;
  gap: 12px;
}
.settings-row:last-child {
  border-bottom: none;
}
.settings-label-wrap {
  flex: 1;
}
.settings-label {
  font-size: 13px;
  color: #444;
}
.settings-toggle-btn {
  padding: 4px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  border-radius: 20px;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.15s;
}
.settings-toggle-btn.on {
  background: #27ae60;
  color: #fff;
  border-color: #27ae60;
  box-shadow: 0 2px 6px rgba(39, 174, 96, 0.25);
}
.settings-toggle-btn.off {
  background: #95a5a6;
  color: #fff;
  border-color: #95a5a6;
}
.volume-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.volume-slider-wrap {
  width: 100%;
}
.volume-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  accent-color: #b8860b;
  cursor: pointer;
}
.settings-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.settings-grid-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.settings-action-btn {
  padding: 8px 12px;
  border: 1px solid #d4cfc9;
  background: #fff;
  color: #3a3a3a;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.settings-action-btn:hover {
  background: #f5f1eb;
  border-color: #bbb;
}
.settings-action-btn.primary-btn {
  background: #b8860b;
  color: #fff;
  border-color: #b8860b;
}
.settings-action-btn.primary-btn:hover {
  background: #9c7109;
}
.settings-action-btn.danger-btn {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.4);
}
.settings-action-btn.danger-btn:hover {
  background: rgba(192, 57, 43, 0.08);
}
.shortcuts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.key-badge {
  display: inline-block;
  padding: 2px 6px;
  background: #ede8e2;
  border: 1px solid #d4cfc9;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  color: #444;
  margin-right: 6px;
}
.settings-card-desc {
  font-size: 12px;
  line-height: 1.6;
  margin-top: 4px;
}

/* Modals & Dialogs */
.save-code-box {
  width: 100%;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 11px;
  padding: 8px;
  border: 1px solid #d4cfc9;
  border-radius: 4px;
  background: #faf8f5;
  color: #333;
  resize: vertical;
  word-break: break-all;
}
.reset-danger-card {
  border-color: #c0392b !important;
}
.text-danger-notice {
  color: #c0392b !important;
  font-weight: 500;
}

/* Theme Future & Cosmic Overrides for Task 7 */
.theme-future .nav-tabs, .theme-cosmic .nav-tabs {
  background: rgba(22, 22, 42, 0.75);
  border-color: rgba(58, 58, 96, 0.8);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.theme-future .nav-tab, .theme-cosmic .nav-tab {
  color: #8888aa;
}
.theme-future .nav-tab:hover, .theme-cosmic .nav-tab:hover {
  color: #e0e0ff;
  background: rgba(255, 255, 255, 0.06);
}
.theme-future .nav-tab.active, .theme-cosmic .nav-tab.active {
  background: #252542;
  color: #f1c40f;
  border-color: rgba(241, 196, 15, 0.5);
  box-shadow: 0 2px 12px rgba(241, 196, 15, 0.2);
}
.theme-future .stats-card, .theme-cosmic .stats-card,
.theme-future .settings-card, .theme-cosmic .settings-card {
  background: rgba(25, 25, 45, 0.75);
  border-color: #323254;
  color: #c8c8e0;
}
.theme-future .stats-section-title, .theme-cosmic .stats-section-title,
.theme-future .settings-section-title, .theme-cosmic .settings-section-title {
  color: #f0f0ff;
}
.theme-future .stat-tile, .theme-cosmic .stat-tile {
  background: #191932;
  border-color: #2b2b48;
}
.theme-future .stat-tile-val, .theme-cosmic .stat-tile-val {
  color: #e0e0ff;
}
.theme-future .stat-tile-lbl, .theme-cosmic .stat-tile-lbl {
  color: #7878a0;
}
.theme-future .settings-label, .theme-cosmic .settings-label {
  color: #b0b0d0;
}
.theme-future .settings-row, .theme-cosmic .settings-row {
  border-bottom-color: #282844;
}
.theme-future .settings-action-btn, .theme-cosmic .settings-action-btn {
  background: #22223c;
  border-color: #3a3a5c;
  color: #d0d0ec;
}
.theme-future .settings-action-btn:hover, .theme-cosmic .settings-action-btn:hover {
  background: #2c2c4c;
  border-color: #555580;
}
.theme-future .save-code-box, .theme-cosmic .save-code-box {
  background: #141424;
  border-color: #2d2d4c;
  color: #d0d0f0;
}
.theme-future .key-badge, .theme-cosmic .key-badge {
  background: #252542;
  border-color: #3a3a5c;
  color: #b0b0d8;
}
.theme-future .quick-header-btn, .theme-cosmic .quick-header-btn {
  border-color: #333;
  color: #888;
}
.theme-future .quick-header-btn:hover, .theme-cosmic .quick-header-btn:hover {
  color: #ddd;
  background: #222;
}

@media (max-width: 600px) {
  body { padding: 10px 8px; font-size: 13px; line-height: 1.5; }
  #header { padding-bottom: 6px; margin-bottom: 8px; }
  #header #lang-toggle { font-size: 11px; padding: 1px 5px; }
  .nav-header-btn { font-size: 11px; padding: 1px 6px; }
  .nav-tabs { gap: 4px; padding: 3px; margin-bottom: 10px; }
  .nav-tab { padding: 6px 8px; font-size: 11px; gap: 4px; }
  .tab-icon { font-size: 13px; }
  .tab-label { font-size: 11px; }
  .brand-title { font-size: 13px; }
  .settings-grid-actions { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  #resources { font-size: 12px; line-height: 1.6; }
  .resource { margin-left: 8px; }
  .res-pps { font-size: 10px; margin-left: 2px; }
  .modal-card { padding: 16px 12px; }
  .ach-modal-card, .codex-modal-card, .prestige-modal-card { width: 95%; max-height: 90vh; padding: 14px 12px; }
  .ach-cards-grid, .codex-era-techs, .codex-techs-grid, .codex-branch-choices-grid, .codex-events-list, .prestige-talents-grid {
    grid-template-columns: 1fr;
  }
  .ach-summary-stats, .prestige-summary-banner { flex-direction: column; gap: 8px; }
  .codex-overview-bar { flex-direction: column; gap: 6px; }
  .achievement-toast { padding: 10px 12px; gap: 10px; }
  .ach-toast-name { font-size: 13px; }
  .ach-toast-desc { font-size: 11px; }
  .auto-toggle { font-size: 11px; padding: 1px 5px; margin-right: 5px; }
  #era { padding: 6px 10px; margin-bottom: 6px; }
  .era-emoji { font-size: 16px; }
  .era-name { font-size: 14px; }
  .era-era, .era-year { font-size: 11px; }
  .era-bar { margin-top: 2px; }
  #story { margin-bottom: 6px; min-height: 30px; font-size: 13px; line-height: 1.5; }
  #story p { margin-bottom: 4px; font-size: 13px; line-height: 1.5; }
  .story-era-name { font-size: 13px; margin-bottom: 3px; }
  .story-detail { font-size: 12px; line-height: 1.5; }
  .story-timeline { padding-top: 4px; }
  .story-timeline-label { font-size: 11px; margin-bottom: 2px; }
  .story-past-era { font-size: 11px; margin-right: 6px; }
  #buildings-info { margin: 3px 0; }
  .building-tag { font-size: 12px; }
  #actions { margin: 6px 0 4px; gap: 4px; }
  .action-btn { padding: 5px 10px; font-size: 12px; }
  .branch-card { padding: 6px 10px; min-width: 140px; }
  .branch-choice-title { font-size: 13px; }
  .branch-choice-bonus { font-size: 11px; }
  .branch-choice-desc { font-size: 11px; line-height: 1.4; margin-bottom: 3px; }
  .branch-choice-preview { font-size: 11px; }
  .branch-header { margin-bottom: 4px; font-size: 13px; }
  .branch-header p { font-size: 12px; margin-top: 1px; }
  #log { margin-top: 6px; padding-top: 4px; max-height: 120px; font-size: 12px; }
  #log p { margin-bottom: 1px; }
  .auto-indicator { padding: 8px 0; font-size: 12px; }
  .era-overlay-emoji { font-size: 60px; }
  .era-overlay-name { font-size: 22px; }
  .era-overlay-era { font-size: 13px; }
  .at-void .era-deco-ring { display: none; }
}

/* ── Embedded Historical Event Card (Non-Modal) ── */
#active-event-container {
  margin: 12px 0;
  display: none;
  animation: fadeInQuiet 0.35s ease-out;
}

.embedded-event-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  color: #f1f5f9;
}

.embedded-event-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.embedded-event-icon {
  font-size: 24px;
  line-height: 1;
}

.embedded-event-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.embedded-event-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  color: #fbbf24;
}

.embedded-event-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #f8fafc;
}

.embedded-event-desc {
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
  margin: 0 0 14px 0;
}

.embedded-event-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.embedded-choice-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.embedded-choice-btn {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 7px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  line-height: 1.4;
  font-family: inherit;
}

.embedded-choice-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #fbbf24;
}

.embedded-choice-btn:disabled,
.embedded-choice-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.05);
}

.choice-req-warning {
  font-size: 11px;
  color: #f87171;
  padding-left: 2px;
}

@keyframes fadeInQuiet {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}


