:root {
  --page-bg: #0d1525;
  --surface: #132038;
  --surface-strong: #1a2946;
  --surface-border: rgba(139, 170, 224, 0.18);
  --text-main: #f4f7ff;
  --text-soft: #9aaccf;
  --text-muted: #7b8fb6;
  --line-base: #5f7cbf;
  --line-active: #7da2ff;
  --line-ee: #c8ab84;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  --track-off: rgba(255, 255, 255, 0.2);
  --track-on: #5d7ef0;
  --thumb: #ffffff;
  --content-width: 1320px;
  --title-font: "Trebuchet MS", "Segoe UI", sans-serif;
  --body-font: "Trebuchet MS", "Segoe UI", sans-serif;
}

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

html {
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.45;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--text-main);
  background: linear-gradient(180deg, #0b1322 0%, #101a2d 26%, #121d31 100%);
}

body.is-ee {
  --line-base: #a48867;
  --line-active: var(--line-ee);
  --track-on: #8e7658;
}

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

.catalog-page {
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 14px 12px 24px;
  display: grid;
  gap: 18px;
}

.catalog-page--landing {
  min-height: 100vh;
  align-content: start;
}

.topbar,
.map-card,
.details-card,
.info-card {
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(28, 41, 67, 0.86), rgba(19, 32, 56, 0.92));
  box-shadow: var(--shadow);
}

.topbar {
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.topbar--landing {
  justify-content: flex-start;
}

.topbar__copy h1 {
  margin: 0;
  font-family: var(--title-font);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.topbar__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-top: 2px;
  border: 1px solid rgba(125, 162, 255, 0.24);
  border-radius: 999px;
  background: rgba(13, 22, 38, 0.78);
  color: var(--text-main);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.home-link:hover,
.home-link:focus-visible {
  border-color: var(--line-active);
  background: rgba(125, 162, 255, 0.12);
  color: var(--line-active);
  transform: translateY(-1px);
}

.home-link:focus-visible {
  outline: 2px solid rgba(125, 162, 255, 0.38);
  outline-offset: 2px;
}

.home-link__icon {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.topbar__copy p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.ee-panel {
  display: grid;
  gap: 6px;
  justify-items: end;
  max-width: 280px;
}

.ee-panel.is-hidden {
  display: none;
}

.ee-panel__control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ee-panel__label {
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.98rem;
  white-space: nowrap;
}

.ee-panel__note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  text-align: right;
}

.ee-toggle {
  display: inline-flex;
  cursor: pointer;
}

.ee-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ee-toggle input:disabled + .ee-toggle__track {
  opacity: 0.45;
}

.ee-toggle__track {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: var(--track-off);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background-color 180ms ease;
}

.ee-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
  transition: transform 180ms ease;
}

.ee-toggle input:checked + .ee-toggle__track {
  background: var(--track-on);
}

.ee-toggle input:checked + .ee-toggle__track .ee-toggle__thumb {
  transform: translateX(22px);
}

.map-card,
.details-card,
.info-card {
  padding: 12px;
}

.landing-card {
  padding: 18px;
}

.landing-status {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.landing-product {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(125, 162, 255, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(26, 41, 70, 0.86), rgba(18, 29, 49, 0.92));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  color: var(--text-main);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.landing-product:hover {
  border-color: rgba(125, 162, 255, 0.34);
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

.landing-product__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.landing-product__meta {
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.map-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.map-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.map-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.map-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.25;
}

.map-note.is-active {
  color: rgba(78, 195, 129, 0.96);
}

.section-heading {
  margin-bottom: 10px;
}

.section-heading--compact {
  margin-bottom: 12px;
}

.section-heading--inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.section-heading--inline .section-heading__eyebrow {
  margin: 0;
}

.section-heading__eyebrow {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-heading h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.map-warning {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(242, 190, 107, 0.24);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(62, 46, 18, 0.62), rgba(45, 34, 16, 0.78));
}

.map-warning__title {
  margin: 0 0 4px;
  color: #ffd79b;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-warning__text {
  margin: 0;
  color: var(--text-main);
}

.map-warning__list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-soft);
}

.map-warning__list li + li {
  margin-top: 4px;
}

.hierarchy-stage {
  position: relative;
  min-height: 860px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(11, 19, 34, 0.86), rgba(17, 28, 48, 0.94));
  border: 1px solid rgba(139, 170, 224, 0.12);
  overflow: hidden;
}

.hierarchy-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

.hierarchy-stage__lines,
.hierarchy-stage__nodes {
  position: absolute;
  inset: 0;
}

.hierarchy-stage__lines {
  width: 100%;
  height: 100%;
}

.hierarchy-stage__nodes {
  z-index: 1;
}

.load-error {
  position: absolute;
  inset: 24px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgba(255, 126, 126, 0.28);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(62, 20, 30, 0.92), rgba(40, 15, 24, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  z-index: 2;
}

.load-error__eyebrow {
  margin: 0;
  color: #ffb8b8;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.load-error h3 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.1;
}

.load-error p {
  margin: 0;
  max-width: 56ch;
  color: #ffdede;
}

.load-error code {
  padding: 0 0.3em;
  border-radius: 0.35em;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.ee-availability {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  display: inline-flex;
  box-sizing: border-box;
  text-decoration: none;
  color: #d8e6ff;
  font-size: 0.92rem;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(125, 162, 255, 0.25);
  z-index: 2;
}

.ee-availability.is-hidden {
  display: none;
}

.ee-availability.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ee-availability__label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 86px 8px 14px;
  border: 1px solid rgba(125, 162, 255, 0.18);
  border-radius: 999px;
  background: rgba(19, 32, 56, 0.72);
  box-shadow: 0 0 0 1px rgba(125, 162, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.ee-availability:hover .ee-availability__label {
  border-color: rgba(125, 162, 255, 0.34);
  background: rgba(23, 37, 64, 0.88);
}

.ee-availability__label::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 24px;
  width: 52px;
  border-top: 3px dashed var(--line-active);
  transform: translateY(-50%);
  filter: drop-shadow(0 0 6px rgba(125, 162, 255, 0.38));
}

.ee-availability__label::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid var(--line-active);
  transform: translateY(-50%);
  filter: drop-shadow(0 0 6px rgba(125, 162, 255, 0.38));
}

.upgrade-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upgrade-line--visual {
  stroke: var(--line-base);
  stroke-width: 3;
  transition: stroke 160ms ease, stroke-width 160ms ease, filter 160ms ease;
}

.upgrade-line--hit {
  stroke: transparent;
  stroke-width: 20;
  cursor: pointer;
}

.upgrade-line-group.is-related .upgrade-line--visual,
.upgrade-line-group.is-selected .upgrade-line--visual,
.upgrade-line-group.is-hovered .upgrade-line--visual {
  stroke: var(--line-active);
}

.upgrade-line-group.is-owned-chain .upgrade-line--visual {
  stroke: rgba(78, 195, 129, 0.92);
}

.upgrade-line-group.is-selected .upgrade-line--visual,
.upgrade-line-group.is-hovered .upgrade-line--visual {
  stroke-width: 4;
  filter: drop-shadow(0 0 6px rgba(125, 162, 255, 0.38));
}

.upgrade-line-group.is-hovered .upgrade-line--visual {
  stroke-width: 5.5;
  filter:
    drop-shadow(0 0 7px rgba(125, 162, 255, 0.42))
    drop-shadow(0 0 16px rgba(125, 162, 255, 0.2));
}

.upgrade-link {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(125, 162, 255, 0.3);
  border-radius: 999px;
  background: rgba(20, 31, 54, 0.96);
  color: var(--line-active);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
  overflow: visible;
  z-index: 2;
}

.upgrade-link:hover {
  border-color: var(--line-active);
  color: var(--text-main);
}

.upgrade-link.is-hovered {
  border-color: var(--line-active);
  color: var(--text-main);
}

.upgrade-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.upgrade-link__hint {
  position: absolute;
  display: none;
  width: max-content;
  max-width: min(360px, calc(100vw - 48px));
  padding: 7px 10px;
  border: 1px solid rgba(125, 162, 255, 0.2);
  border-radius: 12px;
  background: rgba(9, 16, 29, 0.96);
  color: var(--text-main);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
  white-space: pre-line;
  overflow-wrap: normal;
  box-shadow: 0 10px 28px rgba(3, 8, 18, 0.34);
  pointer-events: none;
}

.upgrade-link--vertical .upgrade-link__hint {
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
}

.upgrade-link--horizontal .upgrade-link__hint {
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
}

.upgrade-link:hover .upgrade-link__hint,
.upgrade-link:focus .upgrade-link__hint,
.upgrade-link.is-hovered .upgrade-link__hint {
  display: block;
}

.product-node {
  position: absolute;
  transform: translate(-50%, -50%);
}

.product-card {
  position: relative;
  width: fit-content;
  min-width: 0;
  padding: 14px 14px 12px;
  border: 1px solid rgba(125, 162, 255, 0.14);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(31, 46, 76, 0.96), rgba(28, 40, 67, 0.96));
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-2px);
}

.product-card:focus-visible {
  outline: 2px solid var(--line-active);
  outline-offset: 2px;
}

.product-card.is-related {
  border-color: rgba(125, 162, 255, 0.28);
}

.product-card.is-owned {
  border-color: rgba(78, 195, 129, 0.72);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(78, 195, 129, 0.18);
}

.product-card.is-selected {
  border-color: var(--line-active);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(125, 162, 255, 0.22);
}

.product-card.is-owned.is-selected {
  border-color: #6fe0a2;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(111, 224, 162, 0.28);
}

.product-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.product-card__tier {
  display: block;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 700;
}

.product-card__owned-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  cursor: pointer;
}

.product-card__owned-input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.product-card__owned-marker {
  width: 15px;
  height: 15px;
  border: 1px solid rgba(125, 162, 255, 0.38);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.product-card__owned-marker::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  margin: 1px 0 0 4px;
  border-right: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(45deg);
}

.product-card__owned-input:checked + .product-card__owned-marker {
  border-color: rgba(78, 195, 129, 0.95);
  background: rgba(78, 195, 129, 0.24);
  box-shadow: 0 0 0 1px rgba(78, 195, 129, 0.16);
}

.product-card__owned-input:checked + .product-card__owned-marker::after {
  border-right-color: var(--text-main);
  border-bottom-color: var(--text-main);
}

.product-card__owned-input:focus-visible + .product-card__owned-marker,
.product-card__owned-toggle:hover .product-card__owned-marker {
  border-color: var(--line-active);
}

.product-card__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.28;
  white-space: normal;
  overflow-wrap: normal;
}

.product-card__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 0.98;
}

.product-node.is-history-hidden,
.upgrade-line-group.is-history-hidden,
.upgrade-link.is-history-hidden {
  visibility: hidden;
  pointer-events: none;
}

.product-card__item {
  overflow-wrap: normal;
}

.product-card__item--with-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  white-space: normal;
}

.product-card__item-text {
  min-width: 0;
  overflow-wrap: normal;
}

.product-card__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(125, 162, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.72rem;
  flex: 0 0 auto;
}

.product-card__link:hover {
  color: var(--text-main);
  border-color: var(--line-active);
}

.details-card {
  display: grid;
  gap: 10px;
}

.details-card__topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.details-card__header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.details-card__badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(125, 162, 255, 0.14);
  color: var(--line-active);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.details-card__title {
  margin: 0;
  min-width: 0;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  line-height: 1.2;
}

.details-card__section-title {
  margin: -2px 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.details-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.details-card__meta span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 0.8rem;
}

.sales-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(125, 162, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  text-decoration: none;
}

.sales-link:hover {
  border-color: var(--line-active);
}

.panel-toggle {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(125, 162, 255, 0.24);
  border-radius: 999px;
  background: rgba(13, 22, 38, 0.78);
  color: var(--text-main);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.panel-toggle:hover {
  border-color: var(--line-active);
}

.panel-toggle[aria-pressed="true"] {
  background: rgba(125, 162, 255, 0.12);
  border-color: rgba(125, 162, 255, 0.44);
  color: var(--line-active);
}

.sales-link.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.details-card__content,
.info-card__content {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.details-group,
.info-card__item {
  min-height: 100%;
  padding: 14px;
  border: 1px solid rgba(139, 170, 224, 0.12);
  border-radius: 16px;
  background: rgba(12, 20, 36, 0.42);
}

.details-group h4,
.info-card__item h3 {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.details-group p,
.details-group ul,
.info-card__item p {
  margin: 0;
  color: var(--text-main);
}

.details-group ul {
  padding-left: 16px;
}

.details-group li + li {
  margin-top: 4px;
}

@media only screen and (max-width: 980px) {
  .catalog-page {
    padding: 12px;
  }

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

  .ee-panel {
    justify-items: start;
    max-width: none;
  }

  .ee-panel__note {
    text-align: left;
  }

  .hierarchy-stage {
    min-height: 920px;
  }

  .details-card__content,
  .info-card__content {
    grid-template-columns: 1fr 1fr;
  }
}

@media only screen and (max-width: 680px) {
  .map-card__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .map-card__actions {
    justify-content: flex-start;
  }

  .hierarchy-stage {
    min-height: 980px;
  }

  .product-card {
    width: min(100%, 240px);
    min-width: 0;
    max-width: min(240px, calc(100vw - 48px));
    padding: 12px;
  }

  .details-card__topbar,
  .details-card__header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .details-card__content,
  .info-card__content {
    grid-template-columns: 1fr;
  }
}
