:root {
  color-scheme: dark;
  --bg: #0f0c10;
  --panel: #17131a;
  --panel-2: #1d1821;
  --panel-3: #251f2a;
  --line: #3a313f;
  --line-soft: #2a232e;
  --text: #f1e9df;
  --muted: #a99dab;
  --faint: #8f8493;
  --gold: #ff6f3c;
  --gold-soft: #ffb07a;
  --green: #86d98f;
  --orange: #f2a15e;
  --purple: #c084fc;
  --red: #ff6b5e;
  --blue: #6fa8e8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --font-ui: "Source Sans 3", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Cinzel", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 15% -5%, rgba(255, 111, 60, 0.08), transparent 68%),
    radial-gradient(900px 600px at 90% 105%, rgba(92, 62, 112, 0.08), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  overflow: auto;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1 {
  font-size: 24px;
  letter-spacing: 0.015em;
}

h1 em {
  color: var(--gold-soft);
  font-style: normal;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 16px;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(32, 26, 36, 0.96), rgba(15, 12, 16, 0.92));
  backdrop-filter: blur(12px);
  flex: 0 0 auto;
  position: relative;
}

.app-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold-soft) 50%, transparent 85%);
  opacity: 0.75;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  justify-self: start;
}

.header-help {
  justify-self: center;
}

.brand-mark {
  width: 38px;
  height: 42px;
  flex: 0 0 auto;
  background: linear-gradient(160deg, #ffd0a8, #ff6f3c 55%, #c94a1e);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  box-shadow: 0 0 18px rgba(255, 111, 60, 0.35);
}

.subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.header-stat {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.header-stat strong {
  color: var(--gold-soft);
  font-weight: 600;
}

.level-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 7px 18px;
  border-bottom: 1px solid rgba(255, 111, 60, 0.32);
  background:
    linear-gradient(90deg, rgba(255, 111, 60, 0.13), rgba(255, 111, 60, 0.03) 55%, rgba(255, 111, 60, 0.08)),
    rgba(18, 14, 22, 0.92);
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
}

.level-banner-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gold-soft);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.level-banner-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255, 111, 60, 0.8);
}

.level-banner-levels {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.level-banner-levels strong {
  color: var(--text);
}

.level-stepper {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.level-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.14);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.level-step:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.level-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.level-banner-points {
  margin-left: auto;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body.is-levelling .app-header {
  border-bottom-color: rgba(255, 111, 60, 0.28);
}

.page-section {
  padding: 14px 12px 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 10px;
}

.section-heading h2 {
  font-size: 16px;
}

.section-hint {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.build-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.build-card-wide {
  grid-column: 1 / -1;
}

.build-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.build-card h3 {
  margin-bottom: 9px;
  color: var(--gold-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.build-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.build-level-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line-soft);
}

.build-level-stepper {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.build-level-line strong {
  color: var(--gold-soft);
  font-size: 13px;
}

.build-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  margin-bottom: 8px;
}

.build-label {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.build-field input,
.build-field select,
.build-field textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.build-field textarea {
  resize: vertical;
}

.build-field select:disabled {
  color: var(--faint);
}

.build-field input:focus,
.build-field select:focus,
.build-field textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.build-ability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.build-ability {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--muted);
  font-size: 11px;
}

.build-ability strong {
  color: var(--faint);
  font-weight: 600;
}

.attribute-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.attribute-head,
.proficiency-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 11.5px;
}

.attribute-stats {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.attribute-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.attribute-stat > span {
  color: var(--faint);
}

.proficiency-head > span:first-child {
  flex: 1;
}

.attribute-head strong,
.proficiency-head strong {
  color: var(--gold-soft);
  font-weight: 650;
}

.attribute-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.attribute-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 111, 60, 0.18);
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 700;
}

.attribute-list {
  display: grid;
  gap: 4px;
}

.attribute-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.attribute-row > span:first-child {
  color: var(--muted);
  font-size: 12px;
}

.attribute-row > strong {
  color: var(--text);
  font-size: 13px;
  text-align: right;
}

.attribute-controls {
  display: flex;
  gap: 3px;
}

.attribute-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--gold-soft);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.attribute-step:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(255, 111, 60, 0.1);
}

.attribute-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.attribute-level-gains {
  margin-top: 3px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.attribute-level-gains-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 10px;
}

.attribute-level-gains-head strong {
  color: var(--gold-soft);
  font-weight: 650;
}

.attribute-level-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.attribute-level-button {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 9.5px;
  cursor: pointer;
}

.attribute-level-button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.attribute-level-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.proficiency-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.proficiency-list {
  display: grid;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 3px;
  gap: 2px;
}

.proficiency-columns {
  display: grid;
  grid-template-columns: 110px 58px minmax(0, 1fr) auto 44px auto;
  gap: 4px 10px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.proficiency-row {
  display: grid;
  grid-template-columns: 110px 58px minmax(0, 1fr) auto 44px auto;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  padding: 5px 0;
  border-bottom: 1px solid rgba(58, 42, 34, 0.35);
}

.proficiency-row > span:first-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proficiency-rank {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  color: var(--faint);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.proficiency-next {
  color: var(--faint);
  font-size: 10px;
  opacity: 0.9;
}

.proficiency-attributes {
  overflow: hidden;
  color: var(--faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proficiency-actions {
  overflow: hidden;
  color: var(--faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proficiency-value {
  color: var(--text);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.build-note {
  margin-top: 8px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
}

.build-placeholder-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.build-placeholder-list div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line-soft);
}

.build-placeholder-list dt {
  color: var(--muted);
  font-size: 11px;
}

.build-placeholder-list dd {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
}

.build-summary-section {
  padding-bottom: 26px;
}

.build-summary-card {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-level-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}

.summary-level-label {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  min-width: 0;
}

.summary-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.summary-identity strong {
  color: var(--text);
  font-size: 14px;
}

.summary-level-number {
  color: var(--gold-soft);
  font-size: 13px;
  font-weight: 650;
}

.summary-new {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 111, 60, 0.28);
  border-radius: 8px;
  background: rgba(255, 111, 60, 0.06);
}

.summary-new-title {
  margin-bottom: 5px;
  color: var(--gold-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-new-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.summary-change {
  padding: 3px 8px;
  border: 1px solid rgba(255, 176, 122, 0.28);
  border-radius: 999px;
  background: rgba(255, 111, 60, 0.05);
  color: var(--text);
  font-size: 12px;
}

.summary-change.is-leftover {
  border-color: rgba(240, 163, 94, 0.35);
  color: var(--orange);
}

.summary-change.is-ability {
  border-color: rgba(255, 176, 122, 0.35);
  color: var(--gold-soft);
}

.summary-change.is-proficiency {
  border-color: rgba(255, 176, 122, 0.2);
  color: #d4c8c0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.summary-block {
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.summary-block h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-rows {
  display: grid;
  gap: 4px;
}

.summary-rows div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.summary-rows strong {
  color: var(--text);
  font-weight: 600;
}

.summary-empty {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.summary-talent-list {
  display: grid;
  gap: 4px;
}

.summary-talent {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.summary-talent > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 11px;
}

.summary-action-list span:not(:last-child)::after {
  color: var(--faint);
  content: " ·";
}

.foundation-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.foundation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-tab {
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

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

.foundation-tab.is-active {
  border-color: var(--line);
  background: rgba(255, 111, 60, 0.08);
  color: var(--gold-soft);
}

.foundation-tab.is-chosen::after {
  margin-left: 5px;
  color: var(--green);
  content: "✓";
}

.foundation-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.foundation-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--gold-soft);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.foundation-arrow:hover {
  border-color: var(--gold);
}

.foundation-title {
  flex: 1;
  min-width: 0;
}

.foundation-title h4 {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundation-title span {
  color: var(--faint);
  font-size: 10px;
}

.foundation-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 12px;
  max-height: 430px;
  padding: 10px;
  overflow: auto;
}

.foundation-overview p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.foundation-details {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.foundation-facts {
  display: grid;
  gap: 3px;
  margin: 0;
}

.foundation-facts div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.foundation-facts dt {
  color: var(--faint);
}

.foundation-facts dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.foundation-features {
  display: grid;
  gap: 8px;
}

.foundation-feature {
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.foundation-feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.foundation-feature-head strong {
  color: var(--text);
  font-size: 11px;
}

.foundation-feature p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.foundation-feature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.foundation-feature-actions span {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.foundation-stories {
  border-top: 1px solid var(--line-soft);
  padding-top: 7px;
}

.foundation-stories summary {
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.foundation-story {
  margin-top: 6px;
}

.foundation-story strong {
  color: var(--text);
  font-size: 10.5px;
}

.foundation-story p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.foundation-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  border-top: 1px solid var(--line-soft);
}

.foundation-selected {
  color: var(--faint);
  font-size: 10px;
}

.foundation-effects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.foundation-effects-group {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-effects-group > span {
  flex: 0 0 68px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.foundation-effects-values {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  color: var(--text);
  font-size: 11px;
}

.foundation-effects-values span:not(:last-child)::after {
  color: var(--faint);
  content: " ·";
}

.workbench-section .layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.85fr) minmax(360px, 1fr);
  gap: 12px;
  height: clamp(1024px, 122vh, 1376px);
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.015);
  flex: 0 0 auto;
}

.panel-hint {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

/* ── Grid ─────────────────────────────────────────────────── */

.grid-panel {
  position: relative;
}

.grid-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(92, 55, 35, 0.22), transparent 55%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 111, 60, 0.03) 0 1px, transparent 1px 90px),
    #100b09;
  cursor: grab;
}

.grid-stage.is-dragging {
  cursor: grabbing;
}

.grid-stage svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

.edge {
  stroke: #4a352a;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease;
}

.edge.is-path {
  stroke: rgba(123, 216, 143, 0.95);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 3px rgba(123, 216, 143, 0.5));
}

.bridge-edge {
  stroke: rgba(192, 132, 252, 0.95);
  stroke-width: 2.2;
  stroke-dasharray: 6 4;
  filter: drop-shadow(0 0 3px rgba(192, 132, 252, 0.55));
  pointer-events: none;
}

.node {
  cursor: pointer;
  transition: opacity 160ms ease, filter 160ms ease;
}

.node .shape {
  transition: stroke 140ms ease, stroke-width 140ms ease, fill-opacity 140ms ease, filter 140ms ease;
}

.node .node-label {
  fill: rgba(14, 10, 8, 0.9);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.node .node-sub {
  fill: rgba(255, 250, 240, 0.72);
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.node.is-target .shape {
  stroke: var(--gold-soft);
  stroke-width: 4;
  filter: drop-shadow(0 0 8px rgba(241, 203, 124, 0.7));
}

.node.is-hover .shape {
  stroke: #fff6e2;
  stroke-width: 3;
  filter: drop-shadow(0 0 9px rgba(255, 245, 224, 0.65));
}

.node.is-path .shape {
  stroke: var(--green);
  stroke-width: 3;
}

.node.is-purchased .shape {
  fill-opacity: 1;
}

.node.is-leftover .shape {
  stroke: var(--orange);
  stroke-dasharray: 5 3;
}

.node.is-bridge .shape {
  stroke: var(--purple);
  stroke-dasharray: 2 2;
}

.node.is-focused .shape {
  stroke: #fff;
  stroke-width: 3;
}

.grid-stage.has-plan .node:not(.is-path):not(.is-target) {
  opacity: 0.28;
}

.grid-stage.has-plan .node.is-reachable:not(.is-path):not(.is-target) {
  opacity: 1;
}

.grid-stage.has-plan .node.is-reachable {
  opacity: 1;
}

.node.is-reachable .shape {
  stroke: #ffe2a0;
  stroke-width: 4;
  filter: drop-shadow(0 0 7px rgba(241, 203, 124, 0.85));
}

.grid-stage.has-plan .node.is-level-locked {
  opacity: 0.22;
}

.grid-stage.is-level-mode .node.is-level-locked,
.grid-stage.is-level-mode .node.is-level-blocked {
  cursor: default;
}

.node.is-level-locked .shape {
  filter: grayscale(0.7);
}

.tooltip-reach {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 10px;
}

.tooltip-reach.is-reachable {
  color: var(--gold-soft);
}

.grid-stage.has-plan .edge:not(.is-path) {
  opacity: 0.22;
}

.grid-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  max-width: 76%;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(16, 12, 20, 0.78);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(255, 255, 255, 0.15);
}

.grid-tooltip {
  position: absolute;
  z-index: 20;
  max-width: 340px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 16, 25, 0.97);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
}

.grid-tooltip h3 {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
}

.grid-tooltip .tooltip-meta {
  margin-top: 3px;
  color: var(--muted);
}

.grid-tooltip ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
}

.grid-tooltip li {
  color: var(--text);
}

.grid-tooltip .tooltip-empty {
  margin-top: 6px;
  color: var(--faint);
  font-style: italic;
}

.node-popover {
  position: absolute;
  z-index: 40;
  width: 330px;
  max-height: calc(100% - 24px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 16, 25, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.node-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.02);
}

.node-popover-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.node-popover-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.node-popover-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.node-popover-close:hover {
  color: var(--text);
  border-color: var(--faint);
}

.node-popover-list {
  display: grid;
  gap: 4px;
  padding: 6px;
  overflow-y: auto;
}

.node-popover-note {
  margin-bottom: 4px;
  padding: 6px 8px;
  border: 1px solid rgba(240, 163, 94, 0.25);
  border-radius: 6px;
  background: rgba(240, 163, 94, 0.06);
  color: var(--orange);
  font-size: 11px;
  line-height: 1.4;
}

.node-popover-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 12px;
}

.node-choice {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.node-choice:hover {
  background: rgba(255, 111, 60, 0.07);
}

.node-choice.is-selected {
  border-color: rgba(255, 111, 60, 0.35);
  background: rgba(255, 111, 60, 0.1);
}

.node-choice input {
  margin-top: 2px;
  accent-color: var(--gold);
  cursor: pointer;
}

.node-choice-content {
  display: block;
  min-width: 0;
}

.node-choice-name {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.node-choice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.node-choice-desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.node-popover-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.12);
}

/* ── Talent list ──────────────────────────────────────────── */

.list-panel {
  min-height: 0;
}

.list-controls {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.1);
  flex: 0 0 auto;
}

.search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 11px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #120d0a;
  color: var(--text);
  outline: none;
}

.search-input::placeholder {
  color: var(--faint);
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 111, 60, 0.12);
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 10px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.filter-field.is-wide {
  grid-column: 1 / -1;
}

.filter-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.filter-select {
  width: 100%;
  padding: 6px 28px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #120d0a;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a28f7b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: var(--text);
  font-size: 12px;
  outline: none;
  appearance: none;
}

.filter-select:focus,
.level-range input:focus,
.range-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 111, 60, 0.1);
}

.level-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.level-range input,
.range-input {
  width: 62px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #120d0a;
  color: var(--text);
  font-size: 12px;
  text-align: center;
  outline: none;
}

.range-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-prefix,
.range-suffix {
  color: var(--muted);
  font-size: 12px;
}

.range-input {
  width: 70px;
}

.area-toggle {
  margin-left: auto;
}

.range-dash {
  color: var(--muted);
  font-size: 12px;
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.funnel-icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.list-out-of-reach {
  color: var(--orange);
}

.list-hint {
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.toggle input {
  accent-color: var(--gold);
}

.bonus-pick-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.active-filters {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.node-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 111, 60, 0.1);
  color: var(--gold-soft);
  font-size: 11px;
  cursor: pointer;
}

.talent-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.talent-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto 16px;
  align-items: start;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(58, 42, 34, 0.45);
  transition: background 120ms ease, border-color 120ms ease;
}

.talent-row:hover,
.talent-row.is-hover {
  background: rgba(255, 111, 60, 0.07);
}

.talent-row.is-selected {
  background: rgba(255, 111, 60, 0.13);
  box-shadow: inset 3px 0 0 var(--gold);
}

.talent-row.is-expanded {
  background: rgba(255, 111, 60, 0.08);
}

.talent-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--gold-soft);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.talent-add:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(255, 111, 60, 0.12);
}

.talent-add:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.talent-row.is-reachable {
  background: rgba(255, 111, 60, 0.045);
}

.talent-row.is-on-plan {
  background: rgba(123, 216, 143, 0.06);
}

.talent-reach-paths {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 5px;
  margin: 2px 0 3px 26px;
}

.reach-filter-chip {
  cursor: default;
}

.talent-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--gold);
  cursor: pointer;
}

.talent-main {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.talent-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.talent-expand:hover {
  color: var(--text);
}

.talent-expand svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}

.talent-row.is-expanded .talent-expand svg {
  transform: rotate(90deg);
}

.talent-description {
  grid-column: 1 / -1;
  margin: 3px 0 2px 26px;
  padding: 8px 10px;
  border-left: 2px solid var(--line);
  border-radius: 0 6px 6px 0;
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.talent-description p {
  margin: 0 0 6px;
}

.talent-description p:last-child {
  margin-bottom: 0;
}

.talent-description strong {
  color: var(--text);
}

.talent-description em {
  color: var(--gold-soft);
}

.talent-description ul {
  margin: 4px 0 6px;
  padding-left: 16px;
}

.talent-description li {
  margin: 2px 0;
}

.talent-description h3 {
  margin: 8px 0 4px;
  color: var(--gold-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.talent-description section {
  margin: 0;
}

.talent-description .talent-action {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.talent-description .talent-action h4 {
  margin: 0 0 4px;
  color: var(--gold-soft);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.talent-action-condition {
  margin: 5px 0 0;
  color: var(--orange);
  font-size: 11px;
  font-style: italic;
}

.talent-description-empty {
  margin: 0;
  color: var(--faint);
  font-style: italic;
}

.talent-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

.talent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
}

.tag.is-signature {
  border-color: rgba(192, 132, 252, 0.45);
  color: var(--purple);
}

.tag.is-training {
  border-color: rgba(123, 216, 143, 0.35);
  color: var(--green);
}

.tag.is-level {
  border-color: rgba(111, 168, 232, 0.35);
  color: var(--blue);
}

.talent-nodes {
  color: var(--faint);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.empty-state {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* ── Summary ──────────────────────────────────────────────── */

.summary-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-notice {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid rgba(217, 172, 88, 0.35);
  border-radius: 8px;
  background: rgba(217, 172, 88, 0.08);
  color: var(--gold);
  font-size: 11px;
}

.save-plan-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.save-plan-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.save-plan-input:focus {
  outline: none;
  border-color: var(--gold);
}

.target-builder.is-locked {
  opacity: 0.55;
  pointer-events: none;
}

.bonus-budget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.ability-requirements {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.ability-requirements-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ability-requirements-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ability-chip {
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 11px;
  font-weight: 600;
}

.ability-chip.is-strength { color: #d9685a; }
.ability-chip.is-toughness { color: #d99b4a; }
.ability-chip.is-dexterity { color: #6fcf7a; }
.ability-chip.is-wisdom { color: #5aa9e6; }
.ability-chip.is-presence { color: #b07be0; }
.ability-chip.is-intellect { color: #4fd1c5; }

.level-allocation-unassigned {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 8px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--faint);
  font-size: 11px;
}

.level-allocation-unassigned strong {
  color: var(--muted);
  font-weight: 600;
}

.level-allocation-list {
  display: grid;
  gap: 5px;
}

.level-allocation-unassigned.is-complete {
  border-color: rgba(123, 216, 143, 0.28);
  color: var(--green);
}

.level-allocation-unassigned.is-complete strong {
  color: var(--green);
}

.level-allocation-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.level-allocation-candidates-label {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.level-candidate {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.level-candidate:hover {
  border-color: var(--gold);
  color: var(--gold-soft);
}

.level-allocation-row {
  display: flex;
  align-items: stretch;
  gap: 7px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.level-allocation-row.is-current {
  border-color: rgba(255, 111, 60, 0.25);
  background: rgba(255, 111, 60, 0.045);
}

.level-allocation-level {
  cursor: pointer;
  width: 24px;
  padding-top: 4px;
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 700;
}

.level-slots {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.level-slot {
  min-width: 0;
  padding: 4px 5px;
  overflow: hidden;
  border: 1px dashed var(--line-soft);
  border-radius: 5px;
  color: var(--faint);
  font-size: 10px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-slot.is-filled {
  border-style: solid;
  border-color: var(--line);
  background: rgba(255, 111, 60, 0.07);
  color: var(--text);
}

.level-slot.is-leftover {
  border-color: rgba(240, 163, 94, 0.4);
  color: var(--orange);
}

.level-slot-add {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--gold-soft);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.level-slot-add:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(255, 111, 60, 0.12);
}

.level-slot-add:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.level-slot.is-empty.is-bonus {
  border-color: rgba(255, 111, 60, 0.45);
  color: var(--gold-soft);
  cursor: pointer;
}

.level-slot.is-empty.is-bonus:hover,
.level-slot.is-empty.is-bonus:focus-visible {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 111, 60, 0.1);
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.saved-plan-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saved-plan {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.saved-plan-main {
  flex: 1;
  min-width: 0;
}

.saved-plan-name {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-plan-meta {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
}

.saved-plan-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 4px;
}

.saved-plan-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.saved-plan-delete:hover,
.saved-plan-delete.is-armed {
  border-color: var(--red);
  color: var(--red);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-size: 11px;
}

.chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.chip button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.16);
}

.selected-chip {
  border-color: rgba(255, 111, 60, 0.36);
  background: rgba(255, 111, 60, 0.1);
  color: var(--gold-soft);
}

.target-builder {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 9px;
}

.target-builder-note {
  margin: 0 0 1px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
}

.exactly-blocks {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.exactly-blocks .target-section + .target-section {
  border-top-style: none;
}

.block-label {
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.block-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--faint);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.block-remove:hover {
  color: var(--text);
  border-color: var(--faint);
}

.add-group-button {
  align-self: flex-start;
  margin-top: 1px;
}

.target-section.is-tie {
  border: 1px dashed rgba(192, 132, 252, 0.35);
}

.target-section.is-tie.has-chips {
  border-style: solid;
  border-color: rgba(192, 132, 252, 0.3);
  background: rgba(192, 132, 252, 0.05);
}

.tie-optional {
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.tie-chip {
  border-color: rgba(192, 132, 252, 0.45);
  background: rgba(192, 132, 252, 0.1);
  color: var(--purple);
}

.leftover-button {
  display: block;
  width: 100%;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.leftover-button:hover {
  border-color: rgba(240, 163, 94, 0.25);
  background: rgba(240, 163, 94, 0.08);
}

.leftover-button:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

.target-section {
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: border-color 120ms ease, background 120ms ease;
}

.target-section + .target-section {
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.target-section.is-exactly {
  border: 1px dashed var(--line);
}

.target-section.is-exactly.has-chips {
  border-style: solid;
  border-color: var(--line-soft);
  background: rgba(0, 0, 0, 0.08);
}

.target-section.is-drag-over {
  border-color: var(--gold);
  background: rgba(255, 111, 60, 0.08);
}

.target-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.exactly-count {
  width: 42px;
  padding: 3px 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #120d0a;
  color: var(--text);
  font-size: 11px;
  text-align: center;
  outline: none;
}

.exactly-count:focus {
  border-color: var(--gold);
}

.exactly-count:disabled {
  opacity: 0.5;
}

.target-chip {
  cursor: grab;
}

.target-chip:active {
  cursor: grabbing;
}

.target-chip.is-dragging {
  opacity: 0.4;
}

.target-drop-hint {
  padding-top: 4px;
  color: var(--faint);
  font-size: 10px;
  font-style: italic;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--gold);
  border-radius: 6px;
  background: linear-gradient(180deg, #ff9a62, #d2541f);
  color: #1a0d05;
  font-weight: 700;
  cursor: pointer;
  transition: filter 120ms ease, opacity 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:hover:not(:disabled) {
  filter: brightness(1.08);
  border-color: var(--gold-soft);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.button.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--gold);
  background: rgba(255, 111, 60, 0.08);
  filter: none;
}

.button.small {
  padding: 6px 9px;
  font-size: 12px;
}

.button.full {
  width: 100%;
}

.status {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status.is-error {
  color: var(--red);
}

.status.is-good {
  color: var(--green);
}

.status.is-warn {
  color: var(--orange);
}

.route-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 9px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.12);
}

.route-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.route-button:hover {
  color: var(--text);
  border-color: var(--faint);
}

.route-label {
  flex: 1;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.route-note {
  color: var(--faint);
  font-size: 10px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

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

.stat-grid.is-three .stat {
  min-width: 0;
}

.stat-grid.is-three .stat-label {
  font-size: 9px;
  letter-spacing: 0.02em;
}

.stat {
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
}

.stat-label {
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 2px;
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
}

.stat-value.is-small {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
}

.action-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.action-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(58, 42, 34, 0.4);
  font-size: 12px;
}

.action-item:last-child {
  border-bottom: 0;
}

.action-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 10px;
}

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

.action-node {
  color: var(--faint);
  font-size: 11px;
}

.action-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.tag.is-target {
  border-color: rgba(241, 203, 124, 0.45);
  color: var(--gold-soft);
}

.tag.is-leftover {
  border-color: rgba(240, 163, 94, 0.45);
  color: var(--orange);
}

.tag.is-bridge {
  border-color: rgba(192, 132, 252, 0.45);
  color: var(--purple);
}

.tag.is-empty {
  border-color: var(--line);
  color: var(--faint);
}

.tag.is-added {
  border-color: rgba(241, 203, 124, 0.35);
  color: var(--gold-soft);
}

.reach-search {
  width: 100%;
  margin: 6px 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

.reach-search:focus {
  outline: none;
  border-color: var(--gold);
}

.reach-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 3px;
}

.reach-item {
  padding: 7px 0;
  border-bottom: 1px solid rgba(58, 42, 34, 0.4);
}

.reach-item:last-child {
  border-bottom: 0;
}

.reach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reach-name {
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.reach-name:hover {
  color: var(--gold-soft);
}

.reach-expand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.reach-expand:hover {
  color: var(--text);
}

.reach-expand svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}

.reach-item.is-expanded .reach-expand svg {
  transform: rotate(90deg);
}

.reach-item.is-expanded {
  background: rgba(255, 111, 60, 0.05);
}

.reach-description {
  margin-left: 0;
  margin-top: 6px;
}

.reach-paths {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.reach-add {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.reach-add:hover {
  border-color: var(--gold);
  color: var(--text);
}

.leftover-item {
  padding: 7px 0;
  border-bottom: 1px solid rgba(58, 42, 34, 0.4);
  font-size: 12px;
}

.leftover-item:last-child {
  border-bottom: 0;
}

.leftover-title {
  color: var(--orange);
  font-weight: 600;
}

.leftover-choice {
  margin-top: 2px;
  color: var(--text);
  font-size: 11px;
}

.leftover-options {
  margin: 4px 0 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11px;
}

.leftover-options li.is-selected {
  color: var(--gold-soft);
}

.note {
  color: var(--faint);
  font-size: 10px;
  line-height: 1.4;
}

.missing-data {
  max-width: 580px;
  margin: 8vh auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-align: center;
}

.missing-data h1 {
  margin-bottom: 8px;
}

.missing-data p {
  color: var(--muted);
  margin: 8px 0;
}

.missing-data code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #0c0806;
  color: var(--gold-soft);
}

.sample-banner {
  margin: 0 12px 3px;
  padding: 7px 10px;
  border: 1px solid rgba(240, 163, 94, 0.35);
  border-radius: 8px;
  background: rgba(240, 163, 94, 0.08);
  color: var(--orange);
  font-size: 11px;
}

/* ── Scrollbars ───────────────────────────────────────────── */

* {
  scrollbar-width: thin;
  scrollbar-color: #4b362a transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #4b362a;
  background-clip: content-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1240px) {
  .build-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .foundation-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.foundation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-tab {
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

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

.foundation-tab.is-active {
  border-color: var(--line);
  background: rgba(255, 111, 60, 0.08);
  color: var(--gold-soft);
}

.foundation-tab.is-chosen::after {
  margin-left: 5px;
  color: var(--green);
  content: "✓";
}

.foundation-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.foundation-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--gold-soft);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.foundation-arrow:hover {
  border-color: var(--gold);
}

.foundation-title {
  flex: 1;
  min-width: 0;
}

.foundation-title h4 {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundation-title span {
  color: var(--faint);
  font-size: 10px;
}

.foundation-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 12px;
  max-height: 430px;
  padding: 10px;
  overflow: auto;
}

.foundation-overview p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.foundation-details {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.foundation-facts {
  display: grid;
  gap: 3px;
  margin: 0;
}

.foundation-facts div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.foundation-facts dt {
  color: var(--faint);
}

.foundation-facts dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.foundation-features {
  display: grid;
  gap: 8px;
}

.foundation-feature {
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.foundation-feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.foundation-feature-head strong {
  color: var(--text);
  font-size: 11px;
}

.foundation-feature p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.foundation-feature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.foundation-feature-actions span {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.foundation-stories {
  border-top: 1px solid var(--line-soft);
  padding-top: 7px;
}

.foundation-stories summary {
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.foundation-story {
  margin-top: 6px;
}

.foundation-story strong {
  color: var(--text);
  font-size: 10.5px;
}

.foundation-story p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.foundation-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  border-top: 1px solid var(--line-soft);
}

.foundation-selected {
  color: var(--faint);
  font-size: 10px;
}

.foundation-effects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.foundation-effects-group {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-effects-group > span {
  flex: 0 0 68px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.foundation-effects-values {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  color: var(--text);
  font-size: 11px;
}

.foundation-effects-values span:not(:last-child)::after {
  color: var(--faint);
  content: " ·";
}

.workbench-section .layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
    height: 1440px;
  }

  .summary-panel {
    grid-column: 1 / -1;
    max-height: 42vh;
  }
}

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

  .app {
    height: auto;
    min-height: 100%;
  }

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

  .foundation-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.foundation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-tab {
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

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

.foundation-tab.is-active {
  border-color: var(--line);
  background: rgba(255, 111, 60, 0.08);
  color: var(--gold-soft);
}

.foundation-tab.is-chosen::after {
  margin-left: 5px;
  color: var(--green);
  content: "✓";
}

.foundation-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
}

.foundation-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-arrow {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--gold-soft);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.foundation-arrow:hover {
  border-color: var(--gold);
}

.foundation-title {
  flex: 1;
  min-width: 0;
}

.foundation-title h4 {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foundation-title span {
  color: var(--faint);
  font-size: 10px;
}

.foundation-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 12px;
  max-height: 430px;
  padding: 10px;
  overflow: auto;
}

.foundation-overview p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.foundation-details {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.foundation-facts {
  display: grid;
  gap: 3px;
  margin: 0;
}

.foundation-facts div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.foundation-facts dt {
  color: var(--faint);
}

.foundation-facts dd {
  margin: 0;
  color: var(--text);
  text-align: right;
}

.foundation-features {
  display: grid;
  gap: 8px;
}

.foundation-feature {
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}

.foundation-feature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.foundation-feature-head strong {
  color: var(--text);
  font-size: 11px;
}

.foundation-feature p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.foundation-feature-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.foundation-feature-actions span {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
}

.foundation-stories {
  border-top: 1px solid var(--line-soft);
  padding-top: 7px;
}

.foundation-stories summary {
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.foundation-story {
  margin-top: 6px;
}

.foundation-story strong {
  color: var(--text);
  font-size: 10.5px;
}

.foundation-story p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.foundation-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 9px;
  border-top: 1px solid var(--line-soft);
}

.foundation-selected {
  color: var(--faint);
  font-size: 10px;
}

.foundation-effects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.foundation-effects-group {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.foundation-effects-group > span {
  flex: 0 0 68px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.foundation-effects-values {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
  color: var(--text);
  font-size: 11px;
}

.foundation-effects-values span:not(:last-child)::after {
  color: var(--faint);
  content: " ·";
}

.workbench-section .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .grid-panel {
    height: 58vh;
  }

  .list-panel {
    height: 60vh;
  }

  .summary-panel {
    grid-column: auto;
    max-height: none;
  }

  .header-stats {
    display: none;
  }

  .level-banner {
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 8px 12px;
  }

  .level-banner-points {
    margin-left: 0;
  }
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.summary-toggle {
  margin: 0 0 8px;
}

.vitals-rows {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.vitals-rows > div {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.vitals-rows strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.ui-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 360px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 8px;
  background: var(--panel-3);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}

.help-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: 86vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.help-dialog[open] {
  display: flex;
  flex-direction: column;
}

.help-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}

.help-header h2 {
  font-size: 20px;
}

.help-body {
  max-height: calc(86vh - 62px);
  overflow-y: auto;
  --help-gutter: max(24px, calc((100% - 72ch) / 2));
  padding: 10px var(--help-gutter) 28px;
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
}

.help-body > * {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.help-body > p:first-of-type {
  color: var(--text);
  font-size: 14.5px;
}

.help-body h3 {
  margin: 28px 0 8px;
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

.help-body p,
.help-body ul,
.help-body ol {
  margin: 0 0 10px;
  color: var(--muted);
}

.help-body ul,
.help-body ol {
  padding-left: 20px;
}

.help-body li {
  margin: 0 0 6px;
}

.help-body strong {
  color: inherit;
  font-weight: inherit;
}

.attribute-level-requirements {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.attribute-level-requirement {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 52px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--faint);
  font-size: 9.5px;
}

.attribute-level-requirement.is-current {
  box-shadow: inset 0 0 0 1px var(--gold);
}

.attribute-level-requirement-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.attribute-level-requirement-chip {
  color: var(--muted);
}

.attribute-level-requirement-chip.is-unmet {
  color: var(--orange);
}

.attribute-level-requirement-empty {
  color: var(--faint);
}

.attribute-row.is-unmet strong {
  color: var(--orange);
}

.level-minimums {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.level-minimum {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 54px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 9.5px;
}

.level-minimum-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.level-minimum-chip {
  color: var(--muted);
}

.level-minimum-empty {
  color: var(--faint);
}

.plan-conflict {
  margin-top: 8px;
  padding: 9px 10px;
  border-left: 2px solid var(--orange);
  border-radius: 6px;
  background: rgba(240, 163, 94, 0.08);
}

.plan-conflict-message {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.plan-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attribute-stat strong,
.summary-level-number,
.stat-value,
.proficiency-value,
.level-allocation-level,
.num,
.tag.is-level,
.attribute-level-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.level-slot.is-path {
  border-color: rgba(255, 111, 60, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 111, 60, 0.18);
  color: var(--gold-soft);
}

/* ── Iconic spells ─────────────────────────────────────────── */

.summary-panel-header {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.summary-tabs {
  display: flex;
  gap: 4px;
}

.summary-tab {
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

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

.summary-tab.is-active {
  border-color: var(--line);
  background: rgba(255, 111, 60, 0.08);
  color: var(--gold-soft);
}

.iconic-gallery {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

.iconic-summary-line {
  color: var(--muted);
  font-size: 12px;
}

.iconic-empty {
  padding: 10px;
  color: var(--faint);
  font-size: 12px;
}

.iconic-list {
  display: grid;
  gap: 8px;
}

.iconic-card {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.iconic-card.is-ready {
  border-color: rgba(134, 217, 143, 0.42);
  background: rgba(134, 217, 143, 0.06);
}

.iconic-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.iconic-row:hover {
  background: rgba(255, 255, 255, 0.045);
}

.iconic-gesture {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: hsl(var(--gesture-hue, 210) 55% 58%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.iconic-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iconic-reach {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.iconic-reach.is-ready {
  color: var(--green);
}

.iconic-reach.is-unlinked {
  color: var(--faint);
}

.iconic-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 10px 9px 28px;
}

.iconic-detail .iconic-reqs {
  padding: 6px 0 0;
}

.iconic-pip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.iconic-pip-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.iconic-pip.is-met {
  border-color: rgba(134, 217, 143, 0.4);
  color: var(--text);
}

.iconic-pip.is-missing {
  border-style: dashed;
  opacity: 0.7;
}

.iconic-pip-rune.is-met .iconic-pip-kind {
  background: rgba(255, 176, 122, 0.2);
  color: var(--gold-soft);
}

.iconic-pip-gesture.is-met .iconic-pip-kind {
  background: rgba(111, 168, 232, 0.2);
  color: var(--blue);
}

.iconic-pip-inflection.is-met .iconic-pip-kind {
  background: rgba(192, 132, 252, 0.2);
  color: var(--purple);
}

.iconic-detail {
  margin-top: 2px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line-soft);
}

.iconic-description {
  margin: 9px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.iconic-action h4 {
  margin: 9px 0 2px;
  color: var(--gold-soft);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
}

.iconic-action p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tag.is-slotted {
  border-color: rgba(255, 176, 122, 0.45);
  color: var(--gold-soft);
}

/* Summary symbolic slots */

.iconic-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 10px;
}

.iconic-slot {
  position: relative;
}

.iconic-slot-shape {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
}

.iconic-slot-shape::-webkit-details-marker {
  display: none;
}

.iconic-slot-shape:hover {
  border-color: var(--gold-soft);
  color: var(--text);
}

.iconic-slot-shape.is-filled {
  border-color: var(--gold-soft);
  background: rgba(255, 176, 122, 0.18);
  color: var(--gold-soft);
}

.iconic-slot[open] .iconic-slot-shape {
  border-color: var(--gold);
  color: var(--text);
}

.iconic-slot-menu {
  position: absolute;
  z-index: 30;
  top: 54px;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
}

.iconic-slot-option {
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.iconic-slot-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.iconic-slot-option.is-clear {
  color: var(--red);
}

.iconic-slot-empty {
  padding: 6px 8px;
  color: var(--faint);
  font-size: 12px;
}

.iconic-slot-picks {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

/* Provisional iconic route on the grid */

.node-halo {
  fill: none;
  stroke: #63e9ff;
  stroke-width: 3;
  opacity: 0;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.preview-edge {
  stroke: #63e9ff;
  stroke-width: 4.5;
  stroke-dasharray: 9 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(99, 233, 255, 0.9));
  animation: iconic-march 0.8s linear infinite;
  pointer-events: none;
}

.node.is-iconic-preview .node-halo {
  opacity: 0.95;
  filter: drop-shadow(0 0 7px rgba(99, 233, 255, 0.95));
}

.node.is-iconic-preview .shape {
  stroke: #63e9ff;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 7px rgba(99, 233, 255, 0.95))
    drop-shadow(0 0 16px rgba(99, 233, 255, 0.6));
}

.node.is-iconic-active-target .node-halo {
  opacity: 1;
  stroke: #ffffff;
  stroke-width: 4.5;
  filter: drop-shadow(0 0 9px #63e9ff) drop-shadow(0 0 22px rgba(99, 233, 255, 0.9));
  animation: iconic-pulse 0.8s ease-in-out infinite;
}

.node.is-iconic-active-target .shape {
  stroke: #ffffff;
  stroke-width: 4.5;
  filter: drop-shadow(0 0 10px #63e9ff) drop-shadow(0 0 24px rgba(99, 233, 255, 0.9));
}

.node.is-iconic-target .node-halo {
  opacity: 1;
  stroke: #d6fbff;
  stroke-width: 3.5;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px #63e9ff) drop-shadow(0 0 18px rgba(99, 233, 255, 0.8));
}

.node.is-iconic-target .shape {
  stroke: #d6fbff;
  stroke-width: 3.5;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 8px #63e9ff) drop-shadow(0 0 18px rgba(99, 233, 255, 0.8));
}

@keyframes iconic-march {
  to {
    stroke-dashoffset: -30;
  }
}

@keyframes iconic-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-edge,
  .node.is-iconic-active-target .node-halo {
    animation: none;
  }
}

/* ── Denser, larger build summary ─────────────────────────── */

.summary-level-bar {
  padding-bottom: 11px;
}

.summary-identity strong {
  font-size: 16px;
}

.summary-level-number {
  font-size: 14px;
}

.summary-new {
  margin-top: 11px;
  padding: 11px 13px;
}

.summary-new-title {
  font-size: 12px;
}

.summary-change {
  font-size: 12.5px;
}

.summary-grid {
  columns: 3;
  column-gap: 16px;
  margin-top: 14px;
}

.summary-block {
  break-inside: avoid;
  margin: 0 0 16px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.04);
}

.summary-block h3 {
  margin-bottom: 10px;
  font-size: 12px;
}

.summary-rows {
  gap: 6px;
}

.summary-rows div {
  font-size: 13.5px;
}

.summary-rows strong {
  font-size: 13.5px;
}

.summary-talent-list {
  gap: 6px;
}

.summary-talent {
  font-size: 13px;
}

.summary-action-list {
  gap: 5px 10px;
  font-size: 12.5px;
}

.summary-empty {
  font-size: 12px;
}

@media (max-width: 1240px) {
  .summary-grid {
    columns: 2;
  }
}

@media (max-width: 820px) {
  .summary-grid {
    columns: 1;
  }
}

/* Targets changed after a plan was computed */

.target-chip.is-pending-add {
  border-color: rgba(99, 233, 255, 0.65);
  background: rgba(99, 233, 255, 0.13);
  color: #9befff;
  box-shadow: inset 0 0 0 1px rgba(99, 233, 255, 0.18);
}

.target-chip.is-pending-add button {
  background: rgba(99, 233, 255, 0.18);
  color: #9befff;
}

.target-chip.is-pending-remove {
  border-style: dashed;
  border-color: rgba(255, 107, 94, 0.55);
  background: rgba(255, 107, 94, 0.06);
  color: var(--faint);
  cursor: default;
}

.target-chip.is-pending-remove > span {
  text-decoration: line-through;
}

.target-chip.is-pending-remove button {
  color: var(--red);
  background: rgba(255, 107, 94, 0.12);
}

/* Per-talent ability requirements */

.tag.is-ability {
  border-color: rgba(255, 176, 122, 0.4);
  color: var(--gold-soft);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tag.is-ability.is-extra {
  border-color: rgba(255, 176, 122, 0.8);
  background: rgba(255, 176, 122, 0.16);
  color: var(--gold);
}

.talent-requirement {
  margin: 0 0 7px;
  color: var(--gold-soft);
  font-size: 11.5px;
}

/* Signature talents tab */

.signature-gallery {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

.signature-intro {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.signature-list {
  display: grid;
  gap: 10px;
}

.signature-card {
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.signature-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.signature-name {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 650;
}

.signature-reqs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.signature-description {
  grid-column: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
}

/* Signature filter expression builder */

.signature-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
}

.signature-filter-label {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.signature-filter-op {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.signature-filter-select {
  width: auto;
  max-width: 118px;
  padding: 4px 24px 4px 8px;
  font-size: 11.5px;
}

.signature-filter-clear {
  margin-left: auto;
}

.signature-card[hidden] {
  display: none;
}

/* Action-reference highlights inside descriptions */

.talent-description mark {
  padding: 0 0.3em;
  border-radius: 3px;
  background: rgba(255, 176, 122, 0.18);
  color: var(--gold-soft);
}

/* Granted action cost / range / target chips */

.talent-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 6px;
}

.talent-action-meta .tag {
  font-size: 10px;
}

.tag.is-cost {
  border-color: rgba(255, 111, 60, 0.4);
  color: var(--gold-soft);
}

.tag.is-range {
  border-color: rgba(111, 168, 232, 0.4);
  color: var(--blue);
}

.tag.is-target {
  border-color: rgba(134, 217, 143, 0.35);
  color: var(--green);
}

/* ── Equipment panel ─────────────────────────────────────── */

.build-equipment-card {
  grid-column: 1;
  align-self: stretch;
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.build-side-column {
  display: grid;
  grid-column: 2;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.equipment-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.equipment-budget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.equipment-budget .equipment-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.equipment-budget input[type="number"] {
  width: 78px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.equipment-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.equipment-field > span {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equipment-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.equipment-select {
  width: 100%;
  min-width: 0;
  padding: 4px 22px 4px 7px;
  font-size: 11.5px;
}

.equipment-select.is-compact {
  padding: 3px 20px 3px 5px;
  font-size: 10.5px;
}

.equipment-hint {
  margin: 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.45;
}

.equipment-equipped {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.equipment-equipped-head,
.equipment-slot {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.25fr) minmax(0, 0.9fr) minmax(0, 1.25fr) 52px;
  align-items: center;
  gap: 6px;
}

.equipment-equipped-head {
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equipment-slot-label {
  color: var(--muted);
  font-size: 11px;
}

.equipment-slot-item {
  overflow: hidden;
  color: var(--text);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-defense-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 11.5px;
}

.equipment-defense-line strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.equipment-saves {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.equipment-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.equipment-compare-title {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equipment-verdict {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}

.equipment-verdict.is-better {
  border-color: rgba(134, 217, 143, 0.45);
  color: var(--green);
}

.equipment-verdict.is-worse {
  color: var(--faint);
}

.equipment-verdict.is-same {
  color: var(--muted);
}

.equipment-actions {
  display: flex;
}

.defense-suggestions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.defense-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 11.5px;
}

@media (max-width: 820px) {
  .build-equipment-card,
  .build-side-column {
    grid-column: auto;
  }

  .equipment-picker {
    grid-template-columns: 1fr;
  }

  .equipment-equipped-head {
    display: none;
  }

  .equipment-slot {
    grid-template-columns: 40px minmax(0, 1fr);
  }
}

.defense-suggestions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.defense-restore {
  flex: 0 0 auto;
}

.defense-suggestion > span:first-child {
  flex: 1 1 auto;
}

.defense-suggestion-dismiss {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.defense-suggestion-dismiss:hover {
  border-color: rgba(255, 107, 94, 0.45);
  color: var(--red);
}

/* Keep the right-hand stack's bottom aligned with the equipment card. */
.build-side-column {
  align-self: stretch;
  align-content: stretch;
  grid-template-rows: auto minmax(0, 1fr);
}

.build-side-column > .build-card:last-child {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.build-side-column > .build-card:last-child .proficiency-panel {
  flex: 1 1 auto;
  min-height: 0;
}

.build-side-column > .build-card:last-child .proficiency-list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}

@media (max-width: 820px) {
  .build-side-column {
    align-self: auto;
    grid-template-rows: auto;
  }

  .build-side-column > .build-card:last-child .proficiency-list {
    max-height: 380px;
  }
}

/* Best affordable armour callout */
.equipment-best {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.equipment-best.is-best {
  border-color: rgba(255, 176, 122, 0.28);
  background: rgba(255, 176, 122, 0.045);
}

.equipment-best-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 176, 122, 0.11);
  color: var(--gold-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equipment-best-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.equipment-best-price {
  margin-left: auto;
  color: var(--gold-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}

.equipment-best.is-ahead {
  border-color: rgba(134, 217, 143, 0.42);
  background: rgba(134, 217, 143, 0.06);
}

.equipment-best.is-ahead .equipment-best-name {
  color: var(--green);
}

.equipment-best.is-ahead .equipment-best-badge {
  background: rgba(134, 217, 143, 0.16);
  color: var(--green);
}

.equipment-best.is-none .equipment-best-name {
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}

/* Enriched equipment dropdowns */
.equipment-dropdown {
  position: relative;
  min-width: 0;
}

.equipment-dropdown-button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.equipment-dropdown-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.equipment-dropdown-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-dropdown-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel, #15181d);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.equipment-dropdown-group {
  padding: 6px 7px 3px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.equipment-dropdown-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 6px 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.equipment-dropdown-option:hover,
.equipment-dropdown-option:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.equipment-dropdown-option.is-selected {
  outline: 1px solid rgba(255, 176, 122, 0.45);
}

.equipment-dropdown-option.is-band-1 {
  background: rgba(255, 176, 122, 0.1);
}

.equipment-dropdown-option.is-band-2 {
  background: rgba(255, 176, 122, 0.055);
}

.equipment-dropdown-option.is-band-3 {
  background: rgba(255, 176, 122, 0.025);
}

.equipment-dropdown-option.is-band-4 {
  background: rgba(255, 255, 255, 0.018);
}

.equipment-dropdown-option.is-band-5 {
  background: transparent;
}

.equipment-dropdown-option-name {
  flex: 1;
  min-width: 60%;
}

.equipment-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.equipment-dropdown-button .equipment-tag {
  flex: none;
}

/* Summary talent warning */
.summary-warning {
  padding: 8px 10px;
  border: 1px solid rgba(230, 160, 90, 0.35);
  border-radius: 7px;
  background: rgba(230, 160, 90, 0.08);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.equipment-dropdown.equipment-select {
  padding: 0;
  background: none;
}

.equipment-conflict {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding: 7px 9px;
  border: 1px solid rgba(230, 160, 90, 0.35);
  border-radius: 7px;
  background: rgba(230, 160, 90, 0.08);
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.equipment-dropdown-button::after {
  content: "▾";
  flex: none;
  color: var(--faint);
  font-size: 10px;
}

.equipment-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 2px 0 1px;
}

.equipment-filter-label {
  margin-right: 2px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equipment-filter-chip {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.equipment-filter-chip:hover,
.equipment-filter-chip.is-active {
  border-color: rgba(255, 176, 122, 0.45);
  background: rgba(255, 176, 122, 0.08);
  color: var(--text);
}

.equipment-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.equipment-filter-group-label {
  margin-left: 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.equipment-filter-chip.is-clear {
  margin-left: auto;
  border-color: transparent;
  color: var(--faint);
}

.defense-suggestion {
  flex-wrap: wrap;
}

.defense-suggestion > span:first-child {
  flex: 1 1 130px;
}

.defense-suggestion-change {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.defense-suggestion-change .is-up {
  color: var(--green);
}

.defense-suggestion-change .is-down {
  color: var(--red);
}

.defense-suggestion-change span + span::before {
  content: "·";
  margin-right: 3px;
  color: var(--faint);
}

.equipment-picker-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.equipment-picker-column > .equipment-field {
  min-width: 0;
}

.equipment-best.is-suggestion {
  border-color: rgba(255, 176, 122, 0.24);
  background: rgba(255, 176, 122, 0.035);
}

.equipment-best-dismiss {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.equipment-best-dismiss:hover {
  border-color: rgba(255, 107, 94, 0.45);
  color: var(--red);
}
