:root {
  --bg: #0f1115;
  --surface: #161a22;
  --border: #2a3140;
  --text: #e8eaef;
  --muted: #8b93a7;
  --accent: #5eead4;
  --accent-dim: #2dd4bf33;
  --danger: #f87171;
  --topbar-h: 52px;
  --sidebar-w: 240px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #d8dde8;
  --text: #1a1d24;
  --muted: #5c6478;
  --accent: #0d9488;
  --accent-dim: #0d948822;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app-shell {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.topbar {
  height: var(--topbar-h);
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.topbar-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
}

.topbar-center {
  flex: 1;
  text-align: center;
  font-size: 0.8rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.account {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dropdown styles for account menu */
.dropdown {
  position: relative;
}

.dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.25em;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-left: 0.3em solid transparent;
  vertical-align: middle;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 160px;
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

[data-theme="light"] .dropdown-menu {
  background: rgba(13, 148, 136, 0.08);
}

.dropdown.show .dropdown-menu,
.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}

.dropdown-item:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.dropdown-divider {
  height: 1px;
  margin: 0.5rem 0;
  background: var(--border);
}

.link {
  color: var(--muted);
  text-decoration: none;
}

.link:hover {
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background: var(--accent);
  color: #0f1115;
  text-decoration: none;
  font-weight: 700;
  border: 1px solid transparent;
}

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

.btn:hover {
  filter: brightness(1.03);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

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

.btn-small {
  padding: 0.45rem 0.7rem;
  border-radius: 9px;
  font-size: 0.85rem;
}

.icon-btn {
  display: none;
  background: none;
  border: 0;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 6px;
}

.icon-btn:hover {
  background: var(--border);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

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

.theme-icon {
  font-size: 1rem;
  line-height: 1;
}

[data-theme="dark"] .theme-icon-light,
[data-theme="light"] .theme-icon-dark {
  display: none;
}

.body-row {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--topbar-h);
  background: rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.sidebar-backdrop:not([hidden]) {
  display: block;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.game-menu {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.game-menu a {
  color: var(--text);
  text-decoration: none;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  font-size: 0.925rem;
}

.game-menu a:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.menu-label {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.main-content {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.section {
  margin: 1.25rem 0;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  align-items: stretch;
  background: radial-gradient(900px 420px at 20% 0%, rgba(94, 234, 212, 0.12), transparent 55%),
    radial-gradient(700px 380px at 90% 10%, rgba(94, 234, 212, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(94, 234, 212, 0.05), transparent 60%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}

.hero-copy h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2rem, 3.8vw, 3.25rem);
  letter-spacing: -0.02em;
}

.kicker {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.lead {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.hero-stats {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.stat {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 12px;
  padding: 0.75rem;
}

[data-theme="light"] .stat {
  background: rgba(255, 255, 255, 0.7);
}

.stat-num {
  display: block;
  font-weight: 800;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.hero-media {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.population-hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.population-hero-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.breeding-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

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

.breeding-toggle.active {
  background: var(--accent);
  color: #0f1115;
  border-color: var(--accent);
}

.breeding-graphic {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  width: 3.1rem;
  height: 2rem;
  position: relative;
}

.breeding-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: currentColor;
}

.breeding-arrow {
  position: relative;
  width: 1rem;
  height: 2px;
  background: currentColor;
}

.breeding-arrow::before {
  content: '';
  position: absolute;
  right: -0.2rem;
  top: -0.25rem;
  width: 0.4rem;
  height: 0.4rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.breeding-toggle.active .breeding-graphic {
  animation: breeding-flow 1s linear infinite;
}

@keyframes breeding-flow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(0.15rem); }
}

.birth-countdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: flex-start;
}

.countdown-timer {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}

.countdown-bar-wrapper {
  width: 100%;
  max-width: 200px;
  height: 0.45rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.countdown-bar {
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width 0.1s linear;
}

.shot {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.command-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.command-title {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.9rem;
  overflow: hidden;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.stat-k {
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.stat-v {
  margin-top: 0.35rem;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}

.stat-sub {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  align-items: start;
}

.map-panel h2 {
  margin-bottom: 0.25rem;
}

.map-img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  margin-top: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
}

.table-wrap {
  margin-top: 0.75rem;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 360px;
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .table {
  background: rgba(255, 255, 255, 0.65);
}

.unit-row:hover, .worker-row:hover {
  background: rgba(34, 197, 94, 0.1);
}

[data-theme="light"] .unit-row:hover, [data-theme="light"] .worker-row:hover {
  background: rgba(34, 197, 94, 0.05);
}

.table th,
.table td {
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.t-right {
  text-align: right !important;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.9rem;
}

.card-img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
  margin-bottom: 0.75rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.t-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .t-item {
  background: rgba(255, 255, 255, 0.7);
}

.fineprint {
  font-size: 0.9rem;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.account.account-profile {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.45rem;
  border-radius: 10px;
  background: rgba(94, 234, 212, 0.08);
  color: var(--text);
  text-decoration: none;
}

.account.account-profile:hover {
  background: rgba(94, 234, 212, 0.16);
}

/* placeholder to find line */
.population-count {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: rgba(94, 234, 212, 0.08);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.population-count:hover {
  background: rgba(94, 234, 212, 0.16);
}

.lumber-count {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: rgba(94, 234, 212, 0.08);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.lumber-count:hover {
  background: rgba(94, 234, 212, 0.16);
}

.profile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--accent);
  color: #0f1115;
  font-weight: 800;
  font-size: 0.85rem;
}

.profile-icon-large {
  width: 4rem;
  height: 4rem;
  font-size: 1.2rem;
}

.profile-name {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-hero-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-header-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.xp-meter {
  width: 100%;
  background: var(--border);
  border-radius: 999px;
  height: 1rem;
  overflow: hidden;
  margin-top: 0.75rem;
}

.xp-meter-fill {
  height: 100%;
  background: var(--accent);
  min-width: 4%;
}

.profile-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

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

.profile-list small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.profile-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-hero-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.grid-hint ul {
  margin-bottom: 0;
}

.muted {
  color: var(--muted);
}

.tagline {
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 0.95rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
}

.era-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  text-transform: capitalize;
}

.threat-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-transform: capitalize;
}

.threat-low {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.threat-medium {
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
}

.threat-high {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.production-badge, .yield-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(94, 234, 212, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.health-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
}

.health-good {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.health-fair {
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
}

.health-poor {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.list-compact {
  padding-left: 1.25rem;
}

.hide-mobile {
  display: block;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 100dvh;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.auth-card h1 {
  margin: 0;
  font-size: 1.65rem;
}

.auth-card .stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.auth-card input {
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.auth-card button {
  margin-top: 0.25rem;
  padding: 0.65rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #0f1115;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

[data-theme="light"] .auth-card button {
  color: #fff;
}

.auth-footer {
  margin-top: 1rem;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--accent);
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 210px;
  }
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }

  .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar-right .account {
    max-width: 72px;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  }

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

  .main-content {
    padding: 0.75rem;
  }

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

  .hero-stats {
    grid-template-columns: 1fr;
  }

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

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

  .command-hero {
    flex-direction: column;
    align-items: flex-start;
  }

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

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

  .map-img {
    height: 240px;
  }
}

@media (min-width: 769px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}

/* Wiki Eras Page */
.wiki-eras h1 {
  margin-top: 0;
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.wiki-eras .intro {
  font-size: 1rem;
  color: var(--muted);
  max-width: 75ch;
  line-height: 1.6;
}

.eras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.era-card {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.04), transparent);
  border-radius: 12px;
  padding: 1.1rem;
  transition: all 0.2s ease;
}

.era-card:hover {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.08), transparent);
  box-shadow: 0 4px 12px rgba(94, 234, 212, 0.08);
}

.era-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.era-card h2 {
  margin: 0;
  font-size: 1.35rem;
  flex: 1;
}

.era-number {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.era-card > p {
  margin: 0.6rem 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

.era-unlocks {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(94, 234, 212, 0.06);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

[data-theme="light"] .era-unlocks {
  background: rgba(13, 148, 136, 0.08);
}

.era-unlocks strong {
  color: var(--accent);
  display: block;
  margin-top: 0.35rem;
}

.era-unlocks strong:first-child {
  margin-top: 0;
}

.era-progression {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.04), transparent);
}

.era-progression h2 {
  margin-top: 0;
  font-size: 1.55rem;
}

.era-progression p {
  line-height: 1.65;
  color: var(--text);
}

@media (max-width: 768px) {
  .eras-grid {
    grid-template-columns: 1fr;
  }

  .wiki-eras h1 {
    font-size: 1.8rem;
  }

  .era-card h2 {
    font-size: 1.2rem;
  }
}

/* Era Organization Section */
.era-organization {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.04), transparent);
}

.era-organization h2 {
  margin-top: 0;
  font-size: 1.55rem;
  margin-bottom: 1rem;
}

.era-organization > p {
  line-height: 1.65;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.era-periods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.era-period {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(94, 234, 212, 0.02);
  transition: all 0.2s ease;
}

.era-period:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.06);
}

.era-period h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 700;
}

.era-period p {
  margin: 0;
  line-height: 1.6;
  color: var(--text);
  font-size: 0.95rem;
}

.era-organization strong {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 768px) {
  .era-periods {
    grid-template-columns: 1fr;
  }

  .era-period h3 {
    font-size: 1.1rem;
  }
}

/* Chief Section Styles */
.chief-hero {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), transparent);
}

.chief-title {
  color: #fbbf24;
}

.bonus-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.bonus-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.bonus-text {
  color: #fbbf24;
  font-weight: 600;
  font-size: 0.9rem;
}

.governance-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.action-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
}

.action-item h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent);
}

.action-item p {
  margin: 0 0 1rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.action-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.name-input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  flex: 1;
}

/* War Section Styles */
.war-hero {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), transparent);
}

.war-hero-dashboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
}

.war-hero-dashboard .war-hero-left {
  flex: 1 1 280px;
  min-width: 0;
}

.war-build-queue {
  flex: 0 1 320px;
  min-width: 240px;
  max-width: 100%;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: rgba(0, 0, 0, 0.06);
  text-align: right;
}

[data-theme="light"] .war-build-queue {
  background: rgba(255, 255, 255, 0.55);
}

.war-queue-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.war-queue-empty {
  margin: 0;
  font-size: 0.9rem;
}

.war-queue-list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
  width: 100%;
}

.war-queue-item {
  display: flex;
  flex-direction: row-reverse;
  gap: 0.65rem;
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  max-width: 100%;
}

.war-queue-icon {
  font-size: 1.35rem;
  line-height: 1;
  min-width: 2rem;
  text-align: center;
  flex-shrink: 0;
}

.war-queue-info {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.war-queue-unit {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.war-queue-amount {
  font-weight: 600;
  color: var(--muted);
}

.war-queue-countdown {
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.war-queue-countdown .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}

.war-queue-countdown-label {
  margin-right: 0.25rem;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  background: #22c55e;
  transition: width 0.4s ease;
}

.war-queue-progress.progress-bar {
  height: 8px;
}

.unit-training-status {
  margin: 1rem 0 0.75rem;
}

.training-details {
  margin-bottom: 0.5rem;
}

.unit-card .countdown {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .war-build-queue {
    flex: 1 1 100%;
    min-width: 0;
  }
}

.war-title {
  color: #ef4444;
}

.power-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-weight: 600;
}

.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.unit-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.unit-card:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.unit-card h3 {
  margin: 0;
  color: var(--accent);
  font-size: 1.1rem;
}

.unit-count {
  font-weight: 700;
  color: var(--text);
  font-size: 1.2rem;
}

.unit-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.unit-stat {
  color: var(--muted);
}

.unit-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.unit-input {
  width: 60px;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  font-size: 0.9rem;
}

.tactics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tactic-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.tactic-item:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.tactic-item h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent);
}

.tactic-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tactic-status {
  margin-top: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.tactic-status[data-status="unlocked"] {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.tactic-status[data-status="available"] {
  background: rgba(251, 191, 36, 0.15);
  color: #f59e0b;
}

.tactic-status[data-status="locked"] {
  background: rgba(156, 163, 175, 0.15);
  color: #6b7280;
}

/* Lumber Section Styles */
.lumber-hero {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), transparent);
}

.lumber-hero-split {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
}

.lumber-hero-main {
  flex: 1 1 280px;
  min-width: 0;
}

.lumber-chop-panel {
  flex: 0 1 260px;
  min-width: 220px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .lumber-chop-panel {
  background: rgba(255, 255, 255, 0.55);
}

.chop-tree-graphic {
  aspect-ratio: 1;
  width: 100%;
  max-width: 200px;
  margin: 0 auto 0.75rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.chop-tree-svg {
  width: 100%;
  height: 100%;
  display: block;
  vertical-align: top;
}

.chop-tree-graphic.is-chopping .chop-axe-group {
  animation: lumber-chop-swing 0.55s ease-in-out infinite alternate;
  transform-origin: 78px 78px;
}

@keyframes lumber-chop-swing {
  from {
    transform: rotate(-16deg);
  }
  to {
    transform: rotate(14deg);
  }
}

.chop-tree-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.chop-tree-select {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.chop-tree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.chop-idle-status {
  font-size: 0.85rem;
  margin: 0.35rem 0 0.75rem;
}

.chop-inventory-title {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  color: var(--accent);
}

.chop-inventory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  max-height: 12rem;
  overflow-y: auto;
}

.chop-inventory-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--border);
}

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

.chop-inv-qty {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}

@media (max-width: 640px) {
  .lumber-chop-panel {
    flex: 1 1 100%;
  }
}

.lumber-title {
  color: #22c55e;
}

.production-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.control-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
}

.control-item h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent);
}

.control-item p {
  margin: 0 0 1rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.assignment-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.harvest-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.forest-management {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.management-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.management-item:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.management-item h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent);
}

.management-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.usage-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
}

.usage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.usage-label {
  font-weight: 600;
}

.usage-amount {
  color: var(--accent);
  font-weight: 700;
}

/* Farm Section Styles */
.farm-hero {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.08), transparent);
}

.farm-title {
  color: #a855f7;
}

.farm-locked {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.1), transparent);
  border: 2px dashed var(--border);
  border-radius: 12px;
}

.locked-content {
  max-width: 500px;
  margin: 0 auto;
}

.locked-content h1 {
  color: var(--muted);
  margin-bottom: 1rem;
}

.lock-icon {
  font-size: 3rem;
  margin: 1rem 0;
  opacity: 0.6;
}

.locked-message {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.progress-info {
  background: rgba(0, 0, 0, 0.05);
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.progress-info p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
}

.farm-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tech-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.tech-item:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.tech-item h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent);
}

.tech-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Population Section Styles */
.population-hero {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent);
}

.population-title {
  color: #3b82f6;
}

.growth-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  font-weight: 600;
}

.breeding-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.housing-health {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.health-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.health-item:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.health-item h3 {
  margin: 0 0 0.5rem 0;
  color: var(--accent);
}

.health-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.skill-trees {
  margin-top: 1.5rem;
}

.skill-tree {
  margin-bottom: 2rem;
}

.skill-tree h2 {
  margin-bottom: 1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.skill-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.skill-branch h4 {
  margin: 0 0 0.75rem 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.skill-levels {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skill-level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.skill-level.unlocked {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.skill-level.unlocked:hover {
  background: rgba(34, 197, 94, 0.15);
}

.skill-level.locked {
  background: rgba(156, 163, 175, 0.05);
  border-color: rgba(156, 163, 175, 0.2);
  opacity: 0.6;
}

.skill-name {
  font-weight: 600;
  color: var(--text);
}

.skill-points {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

/* Wiki Section Styles */
.wiki-hero {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), transparent);
}

.wiki-title {
  color: #8b5cf6;
}

.wiki-section {
  margin-top: 1.5rem;
}

.wiki-category {
  margin-bottom: 2rem;
}

.wiki-category h2 {
  margin-bottom: 1rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.wiki-links {
  list-style: none;
  padding: 0;
}

.wiki-links li {
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.wiki-links li:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.wiki-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  display: block;
}

.wiki-link:hover {
  color: var(--accent);
}

.wiki-link.disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.wiki-link.disabled:hover {
  color: var(--muted);
}

.wiki-status {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.06), transparent);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.status-item h3 {
  margin: 0 0 1rem 0;
  color: var(--accent);
}

.status-item ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.status-item li {
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.95rem;
}

/* War Units - New Responsive System */
.unit-grid-responsive {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  grid-auto-rows: 1fr; /* Ensures cards in the same row have equal height */
}

.unit-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%; /* Fill grid cell */
  min-height: 380px;
}

.unit-card-image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unit-card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.unit-card-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.unit-card-title {
  margin: 0;
  font-size: 1.3rem;
  color: white;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  flex: 1;
}

.unit-card-footer-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: linear-gradient(to top, rgba(13, 17, 23, 0.95), rgba(13, 17, 23, 0.75));
  padding: 1.5rem 1rem 5.5rem;
  backdrop-filter: blur(4px);
}

.unit-card.unit-unlocked {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.05), transparent);
}

.unit-card.unit-unlocked:hover .unit-card-image-wrapper {
  background: rgba(94, 234, 212, 0.1);
}

.unit-card.unit-locked {
  opacity: 0.7;
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.04), transparent);
}

.unit-icon-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  width: 160px;
  height: 160px;
  margin: 0 auto 1rem;
}

.unit-header {
  display: none;
}

.unit-count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: rgba(94, 234, 212, 0.2);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  border: 1px solid rgba(94, 234, 212, 0.4);
}

.unit-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.unit-meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.meta-value {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
}

.unit-desc {
  margin: 0.5rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.unit-hint {
  font-size: 0.8rem;
  color: var(--muted);
}
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin: 1rem 0;
  padding: 0.875rem;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

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

.stat-bar {
  display: block;
  width: 100%;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

.stat-fill {
  display: block;
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
}

.stat-str .stat-fill {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

.stat-dex .stat-fill {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.stat-int .stat-fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.stat-chr .stat-fill {
  background: linear-gradient(90deg, #a855f7, #c084fc);
}

.stat-con .stat-fill {
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

.stat-num {
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text);
}

.unit-locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
  border-radius: 13px;
  padding: 1rem;
  text-align: center;
  gap: 0.5rem;
}

.unlock-text {
  margin: 0;
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}

.unlock-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.unit-controls {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.unit-training-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  background: rgba(0, 0, 0, 0.8);
  padding: 1rem;
  border-radius: 8px;
  min-width: 200px;
  text-align: center;
  border: 1px solid var(--accent);
}

.training-details {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.unit-input {
  width: 70px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  font-size: 0.9rem;
}
  font-weight: 600;
}

.unit-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.btn-primary {
  background: var(--accent);
  color: #0f1115;
  font-weight: 700;
}

[data-theme="light"] .btn-primary {
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.progression-chart {
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.05), transparent);
}

.progression-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: rgba(94, 234, 212, 0.02);
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.progression-row:last-child {
  margin-bottom: 0;
}

.progression-row:hover {
  background: rgba(94, 234, 212, 0.06);
  transform: translateX(4px);
}

.progression-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.progression-units {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.level-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Responsive adjustments for new components */
@media (max-width: 1024px) {
  .unit-grid-responsive {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .unit-stats-row {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .stat-bar {
    height: 22px;
  }
}

@media (max-width: 768px) {
  .unit-grid-responsive {
    grid-template-columns: 1fr;
  }

  .governance-actions,
  .unit-grid,
  .tactics-grid,
  .production-controls,
  .forest-management,
  .farm-controls,
  .tech-grid,
  .breeding-controls,
  .housing-health,
  .skill-branches,
  .wiki-section .wiki-category,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .unit-card {
    padding: 1rem;
  }

  .unit-icon-badge {
    position: static;
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    padding: 0.4rem 0.6rem;
  }

  .unit-header {
    margin-top: 0;
    gap: 0.75rem;
  }

  .unit-card h3 {
    font-size: 1.1rem;
  }

  .unit-meta {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .unit-stats-row {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    padding: 0.75rem;
    margin: 0.75rem 0;
  }

  .stat-label {
    font-size: 0.65rem;
  }

  .stat-bar {
    height: 20px;
  }

  .stat-num {
    font-size: 0.75rem;
  }

  .unit-controls {
    flex-direction: column;
    gap: 0.5rem;
  }

  .unit-input {
    width: 100%;
  }

  .unit-controls .btn {
    flex: 1;
  }

  .progression-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .progression-label {
    min-width: unset;
    width: 100%;
  }

  .progression-units {
    width: 100%;
    font-size: 1rem;
  }

  .bonus-list {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-controls,
  .assignment-controls,
  .unit-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .unit-stats {
    flex-direction: column;
    gap: 0.25rem;
  }

  .harvest-options {
    flex-direction: column;
  }

  .usage-breakdown {
    gap: 0.25rem;
  }

  .skill-levels {
    gap: 0.25rem;
  }

  .wiki-links li {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .unit-grid-responsive {
    gap: 1rem;
  }

  .unit-card {
    padding: 0.875rem;
  }

  .unit-header {
    flex-direction: column;
  }

  .unit-meta {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .unit-stats-row {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
    padding: 0.6rem;
  }

  .stat-bar {
    height: 18px;
  }

  .progression-chart {
    padding: 1rem;
  }

  .progression-row {
    padding: 0.6rem;
    border-left-width: 2px;
    gap: 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .stat-card {
    padding: 0.7rem;
  }

  .stat-v {
    font-size: 1.25rem;
  }
}

/* Mail System Styles */
.mail-container {
  max-width: 900px;
  margin: 0 auto;
}

.mail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.mail-header h1 {
  margin: 0;
  font-size: 1.75rem;
}

.mail-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.unread-badge {
  padding: 0.35rem 0.75rem;
  background: rgba(94, 234, 212, 0.15);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.mail-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.mail-nav a {
  padding: 0.5rem 1rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
}

.mail-nav a:hover {
  color: var(--text);
  background: var(--accent-dim);
}

.mail-nav a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 1rem;
}

.mail-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s;
}

.mail-item:hover {
  border-color: var(--accent);
}

.mail-item.unread {
  background: rgba(94, 234, 212, 0.05);
  border-color: var(--accent-dim);
}

.mail-actions {
  flex-shrink: 0;
}

.star-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0.25rem;
}

.star-btn.starred {
  color: #fbbf24;
}

.mail-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 2fr 2fr 1fr;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.mail-sender {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-subject {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-preview {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-date {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  white-space: nowrap;
}

.mail-item-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.icon-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Compose Form */
.compose-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 200px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* View Message */
.mail-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.mail-view-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(94, 234, 212, 0.03);
}

.mail-view-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.35rem;
}

.mail-meta {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.mail-body {
  padding: 1.5rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.mail-actions-bar {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

/* Population Management Stats Layout */
.population-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.population-stats .stat-row {
  display: flex;
  gap: 1.5rem;
  justify-content: space-around;
  flex-wrap: wrap;
}

.population-stats .stat-item {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 0.5rem;
}

.population-stats .stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.population-stats .stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

/* Breeding Management Controls Grid */
.breeding-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
  grid-auto-rows: 1fr; /* Ensures cards in the same row have equal height */
}

.control-item {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  height: 100%;
}

.control-item:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.03);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.control-item h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
  color: var(--accent);
}

.control-item p {
  margin: 0 0 1.25rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  flex-grow: 1;
}

.btn-toggle {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.btn-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-toggle.active {
  background: var(--accent);
  color: #0f1115;
  border-color: var(--accent);
}

.btn-toggle.active:hover {
  filter: brightness(1.1);
}

/* Responsive Grid */
@media (max-width: 640px) {
  .breeding-controls {
    grid-template-columns: 1fr;
  }

  .control-item {
    padding: 0.75rem;
  }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .breeding-controls {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .breeding-controls {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-auto-rows: auto;
  }
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.read-status {
  color: var(--accent);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .mail-content {
    grid-template-columns: 1fr 1fr;
  }
  
  .mail-preview {
    display: none;
  }
  
  .mail-date {
    display: none;
  }
  
  .mail-item {
    padding: 0.5rem;
  }
}

/* Breadcrumb navigation */
.breadcrumb-nav {
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.breadcrumb-nav a {
  color: var(--accent);
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.breadcrumb-nav a:hover {
  background-color: rgba(94, 234, 212, 0.1);
  text-decoration: underline;
}

/* Population Management Layout */
.population-hero {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .population-hero {
    grid-template-columns: 1fr;
  }
  .population-right {
    align-items: center !important;
  }
}

.population-left {
  flex: 1;
}

.population-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .population-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .population-stats {
    grid-template-columns: 1fr;
  }
}

.stat-item {
  background: rgba(0, 0, 0, 0.15);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-item.total-tribe-stat {
  grid-column: span 2;
  background: rgba(94, 234, 212, 0.05);
  border-color: rgba(94, 234, 212, 0.2);
}

@media (max-width: 768px) {
  .stat-item.total-tribe-stat {
    grid-column: span 1;
  }
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.stat-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.population-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

.population-title {
  margin: 0;
  color: #3b82f6;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

[data-pop-total].pop-tick-up {
  display: inline-block;
  animation: pop-total-pulse 0.55s ease;
}

.stat-v[data-pop-total].pop-tick-up {
  display: block;
}

@keyframes pop-total-pulse {
  0% {
    color: inherit;
    transform: scale(1);
  }
  45% {
    color: var(--accent);
    transform: scale(1.05);
  }
  100% {
    color: inherit;
    transform: scale(1);
  }
}

.growth-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
}

.death-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Breeding Graphic & Countdown */
.breeding-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 160px;
}

.breeding-toggle:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.breeding-toggle.active {
  background: rgba(94, 234, 212, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

.breeding-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.breeding-graphic {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 70px;
}

.breeding-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s ease;
}

.breeding-dot.source {
  background: #ef4444;
}

.breeding-dot.target {
  background: #22c55e;
}

.breeding-toggle.active .breeding-dot {
  animation: breeding-flow 1.2s infinite ease-in-out;
}

@keyframes breeding-flow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.breeding-arrow {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  position: relative;
  transition: background 0.3s ease;
}

.breeding-arrow::after {
  content: '▶';
  position: absolute;
  right: -8px;
  top: -5px;
  font-size: 0.7rem;
}

.breeding-toggle.active .breeding-arrow {
  background: var(--accent);
}

.breeding-label {
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Birth Countdown */
.birth-countdown {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 160px;
  animation: fadeIn 0.2s ease;
}

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

.countdown-timer {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  padding: 0.3rem 0;
}

.countdown-bar-wrapper {
  height: 6px;
  border-radius: 3px;
  background: rgba(94, 234, 212, 0.1);
  border: 1px solid var(--border);
  overflow: hidden;
}

.countdown-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #06b6d4);
  border-radius: 2px;
  width: 100%;
  transition: width 0.1s linear;
}

/* Panel Row Layout for Buffs & Breeding */
.panel-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Current Buffs Section */
.buffs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.buff-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.buff-item.active {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.3);
}

.buff-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  min-width: 40px;
}

.buff-info {
  flex: 1;
}

.buff-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.buff-effect {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Buff Toggle Buttons */
.btn-toggle {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
}

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

.btn-toggle.active {
  background: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
  color: #22c55e;
}

/* Breeding Controls Updated */
.breeding-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.control-item {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.control-item:hover {
  border-color: var(--accent);
  background: rgba(94, 234, 212, 0.05);
}

.control-item h3 {
  margin: 0 0 0.4rem 0;
  color: var(--text);
  font-size: 1rem;
}

.control-item p {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .population-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .population-right {
    width: 100%;
    align-items: flex-start;
  }

  .panel-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .population-title {
    font-size: 1.6rem;
  }

  .breeding-toggle {
    min-width: 140px;
    padding: 0.55rem 0.8rem;
    font-size: 0.9rem;
  }

  .breeding-graphic {
    min-width: 60px;
  }

  .breeding-dot {
    width: 14px;
    height: 14px;
  }

  .birth-countdown {
    width: 140px;
  }

  .breeding-controls {
    grid-template-columns: 1fr;
  }

  .panel-row {
    grid-template-columns: 1fr;
  }

  .buffs-list {
    margin-bottom: 1rem;
  }
}

/* ===== Paginated Units List Styles ===== */
.units-scrollable {
  max-height: 500px;
  overflow-y: auto !important;
  overflow-x: auto;
  display: block !important;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.units-scrollable table {
  margin-bottom: 0;
}

.unit-row {
  transition: background-color 0.2s ease;
}

.unit-row:hover {
  background-color: var(--accent-dim);
}

.pagination-controls {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--muted);
}

.pagination-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-buttons .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.pagination-buttons .btn:hover:not(.active) {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.pagination-buttons .btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.pagination-buttons .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes resource_pulse {
  0% {
    transform: scale(1);
    color: #ffffff;
  }
  30% {
    transform: scale(1.2); /* Pop out slightly */
    color: #4ade80;        /* Flash a golden/green success color */
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
  }
  100% {
    transform: scale(1);
    color: inherit;
  }
}

.pulse-update {
  display: inline-block; /* Required for transform scale to work */
  animation: resource_pulse 0.3s ease-in-out;
}