:root {
  color-scheme: dark;
  --bg-top: #100f18;
  --bg-bottom: #090b11;
  --panel: rgba(18, 19, 31, 0.94);
  --panel-soft: rgba(24, 26, 40, 0.98);
  --panel-border: rgba(205, 173, 104, 0.18);
  --text: #f6efdf;
  --muted: #b8ad96;
  --accent: #d3a65b;
  --accent-bright: #f4d188;
  --accent-soft: rgba(211, 166, 91, 0.16);
  --secondary: #8ec5ba;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.26);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(211, 166, 91, 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(142, 197, 186, 0.06), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, #0d1420 45%, var(--bg-bottom) 100%);
  color: var(--text);
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.background-glow {
  position: fixed;
  width: 26rem;
  height: 26rem;
  border-radius: 999px;
  filter: blur(34px);
  opacity: 0.08;
  pointer-events: none;
}

.background-glow-left {
  top: -9rem;
  left: -9rem;
  background: rgba(142, 197, 186, 0.18);
}

.background-glow-right {
  right: -8rem;
  bottom: -8rem;
  background: rgba(211, 166, 91, 0.2);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 2rem));
  height: 100vh;
  margin: 0 auto;
  padding: 1rem 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.9rem;
}

.hero-panel,
.panel,
.stat-card,
.subpanel,
.perk-card,
.dynasty-summary {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 1.4rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-xl);
  animation: fade-up 400ms ease;
}

.hero-copy-block {
  max-width: 47rem;
}

.hero-controls {
  display: grid;
  justify-items: end;
  align-content: space-between;
  gap: 0.9rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.76rem;
  color: var(--accent-bright);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(2.3rem, 4.5vw, 4.4rem);
  line-height: 0.92;
}

h2 {
  margin-bottom: 0.2rem;
  font-size: 1.85rem;
}

h3 {
  margin-bottom: 0;
  font-size: 0.88rem;
}

h4 {
  margin: 0 0 0.28rem;
  font-size: 0.8rem;
}

.hero-copy,
.panel-copy,
.prestige-copy,
.subpanel-heading p {
  color: var(--muted);
  line-height: 1.42;
}

.hero-copy {
  margin-bottom: 0;
  max-width: 35rem;
  font-size: 0.96rem;
}

.hero-actions,
.menu-tabs,
.dynasty-summary {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.menu-tabs {
  justify-content: flex-end;
}

.button,
.tab-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 90ms ease,
    opacity 90ms ease,
    background 90ms ease,
    border-color 90ms ease;
}

.button:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.button:active,
.tab-button:active,
.button.is-bursting {
  transform: scale(0.97);
}

.button:disabled,
.tab-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button {
  padding: 0.62rem 0.95rem;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-bright) 100%);
  color: #241704;
  font-weight: 700;
}

.button-secondary {
  background: linear-gradient(135deg, #9ecf91 0%, #d9eba4 100%);
  color: #1a250f;
  font-weight: 700;
}

.button-ghost,
.tab-button,
.item-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-button {
  min-width: 5.5rem;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
  text-align: center;
}

.tab-button.is-active {
  background: var(--accent-soft);
  border-color: rgba(211, 166, 91, 0.45);
  color: var(--accent-bright);
}

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

.stats-grid.stats-grid-5,
.stats-grid.stats-grid-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-grid.stats-grid-3,
.stats-grid.stats-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 0.45rem 0.62rem 0.5rem;
  border-radius: 16px;
  min-height: 4.4rem;
}

.stat-card.is-hidden {
  display: none;
}

.stat-card-accent {
  background:
    linear-gradient(135deg, rgba(211, 166, 91, 0.12), transparent 55%),
    var(--panel-soft);
}

.stat-label,
.stat-detail,
.item-owned,
.perk-label {
  display: block;
}

.stat-label {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.1;
}

.stat-value {
  display: block;
  margin: 0.08rem 0;
  font-size: clamp(1.1rem, 1.55vw, 1.55rem);
  line-height: 1;
}

.stat-detail,
.item-owned {
  color: var(--secondary);
  font-size: 0.68rem;
  line-height: 1.1;
}

.content-panel {
  border-radius: var(--radius-xl);
  padding: 0.9rem;
  min-height: 0;
  overflow: visible;
}

.menu-panel {
  display: none;
  min-height: 0;
  overflow: visible;
  animation: fade-up 220ms ease;
}

.menu-panel.is-active {
  display: flex;
  flex-direction: column;
}

.panel-heading,
.subpanel-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}

.panel-heading {
  margin-bottom: 0.65rem;
}

.subpanel-heading {
  margin-bottom: 0.55rem;
}

.panel-copy {
  max-width: 25rem;
  margin-bottom: 0;
}

.subpanel-heading p {
  max-width: 18rem;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.card-list {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  padding-top: 6.8rem;
  margin-top: -5.7rem;
  position: relative;
}

.card-list-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-list-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.item-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-height: 4.3rem;
  padding: 0.5rem 0.56rem;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition:
    border-color 120ms ease,
    background 120ms ease;
  overflow: visible;
}

.item-card:hover {
  z-index: 20;
  border-color: rgba(211, 166, 91, 0.22);
  background:
    linear-gradient(180deg, rgba(211, 166, 91, 0.04), transparent),
    rgba(255, 255, 255, 0.03);
}

.item-card.is-earned {
  border-color: rgba(142, 197, 186, 0.26);
}

.item-card.is-locked {
  opacity: 0.82;
}

.item-popup {
  position: absolute;
  left: -0.1rem;
  right: -0.1rem;
  bottom: calc(100% + 0.45rem);
  padding: 0.65rem 0.7rem;
  border-radius: 12px;
  background: rgba(11, 14, 22, 0.98);
  border: 1px solid rgba(211, 166, 91, 0.25);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

.item-card:hover .item-popup {
  opacity: 1;
  transform: translateY(0);
}

.item-popup-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.32;
}

.item-copy {
  min-width: 0;
  flex: 1;
}

.item-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  align-items: baseline;
  margin-bottom: 0.06rem;
}

.item-title {
  line-height: 1.05;
}

.item-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.18;
}

.item-button {
  min-width: 4.2rem;
  font-size: 0.66rem;
  padding: 0.34rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.region-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 0.7rem;
  min-height: 0;
}

.split-layout {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 0.7rem;
  min-height: 0;
}

.region-map-panel,
.region-detail-panel {
  min-height: 0;
}

.region-map {
  position: relative;
  min-height: 23rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(circle at 20% 24%, rgba(142, 197, 186, 0.08), transparent 20%),
    radial-gradient(circle at 76% 72%, rgba(211, 166, 91, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 55%),
    rgba(8, 12, 20, 0.82);
  overflow: hidden;
}

.region-link {
  position: absolute;
  height: 2px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(211, 166, 91, 0.18), rgba(142, 197, 186, 0.3));
  opacity: 0.7;
  pointer-events: none;
}

.region-node {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 8rem;
  padding: 0.62rem 0.72rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(18, 21, 34, 0.94);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    opacity 120ms ease;
}

.region-node:hover {
  transform: translate(-50%, -50%) translateY(-1px);
  border-color: rgba(211, 166, 91, 0.3);
}

.region-node.is-selected {
  border-color: rgba(211, 166, 91, 0.5);
  background:
    linear-gradient(180deg, rgba(211, 166, 91, 0.08), transparent),
    rgba(20, 23, 38, 0.96);
}

.region-node.is-governed {
  border-color: rgba(142, 197, 186, 0.36);
}

.region-node.is-hidden {
  opacity: 0.36;
}

.region-node-name {
  display: block;
  margin-bottom: 0.18rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.region-node-meta {
  display: block;
  color: var(--secondary);
  font-size: 0.72rem;
  line-height: 1.2;
}

.region-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0.9rem 0 0.8rem;
}

.region-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.region-notes {
  display: grid;
  gap: 0.28rem;
}

.region-notes p {
  margin-bottom: 0;
}

.subpanel {
  padding: 0.78rem;
  border-radius: var(--radius-lg);
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.subpanel-dynasty {
  display: grid;
  align-content: start;
  gap: 0.7rem;
}

.dynasty-summary {
  justify-content: space-between;
  padding: 0.8rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(211, 166, 91, 0.09), transparent 68%),
    rgba(255, 255, 255, 0.02);
}

.dynasty-button {
  min-width: 10rem;
}

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

.perk-card {
  padding: 0.75rem 0.82rem;
  border-radius: var(--radius-md);
}

.perk-label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.perk-value {
  font-size: 1.28rem;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    padding-bottom: 1rem;
  }

  .hero-panel,
  .panel-heading,
  .subpanel-heading,
  .item-card,
  .dynasty-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-controls {
    justify-items: stretch;
  }

  .menu-tabs {
    justify-content: flex-start;
  }

  .stats-grid,
  .card-list-three,
  .card-list-two,
  .region-layout,
  .split-layout,
  .dynasty-perks {
    grid-template-columns: 1fr;
  }

  .card-list {
    padding-top: 0;
    margin-top: 0;
  }

  .tab-button,
  .item-button,
  .dynasty-button {
    width: 100%;
  }
}
