:root {
  color-scheme: dark;
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: #d8d5ce;
  background: #121414;
  font-synthesis: none;
  --bg: #121414;
  --surface: #171918;
  --surface-2: #1c1e1c;
  --line: #31332f;
  --line-soft: #272926;
  --text: #d8d5ce;
  --muted: #96978f;
  --faint: #666862;
  --gold: #c7a75e;
  --moss: #667f39;
  --moss-bright: #9abd61;
  --blue: #5a95b1;
  --green: #689c64;
  --purple: #9b5ab1;
  --orange: #e5b043;
  --white-rarity: #9c9c9c;
  --danger: #c87461;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button { font-family: inherit; }

/* ---------- header ---------- */
.app-header {
  height: 52px; display: grid; grid-template-columns: 52px max-content minmax(0, 1fr) max-content;
  align-items: stretch; border-bottom: 1px solid var(--line); background: #141615;
  position: sticky; top: 0; z-index: 30;
}
.platform-logo { display: grid; place-items: center; border-right: 1px solid var(--line); }
.platform-logo img { width: 32px; height: 32px; display: block; }
.app-header nav { min-width: 0; display: flex; align-items: stretch; }
.nav-link {
  display: flex; align-items: center; text-decoration: none;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  padding: 0 22px; color: #a6a59d; font-family: Georgia, "Times New Roman", serif; font-size: 15px;
}
.nav-link:hover { color: #dad8d0; }
.nav-link--active { color: var(--moss-bright); border-bottom-color: var(--moss-bright); }
.header-actions { display: flex; align-items: stretch; }
.header-feedback-button {
  min-width: 0; border: 0; border-left: 1px solid var(--line); background: transparent;
  padding: 0 15px; display: inline-flex; align-items: center; gap: 7px;
  color: #aaa9a3; font: 13px Georgia, serif; white-space: nowrap; cursor: pointer;
}
.header-feedback-button:hover { background: #1b1d1b; }
.signin-button {
  border: 0; border-left: 1px solid var(--line); background: transparent;
  padding: 0 18px; color: #d8d5ce; font: 13px Georgia, serif; cursor: pointer;
}
.signin-button:hover { background: #1b1d1b; }

/* ---------- layout ---------- */
.editor-layout { max-width: 1440px; margin: 18px auto 0; padding: 0 18px; }
.embedded-optimizer { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.workspace { display: grid; grid-template-columns: minmax(520px, 38.25%) minmax(760px, 61.75%); min-height: calc(100vh - 52px); }
.workspace--embedded { grid-template-columns: minmax(420px, 38.25%) minmax(0, 61.75%); min-height: 0; }
.forge-panel { border-right: 1px solid var(--line); background: #171918; padding: 9px 16px 14px 26px; min-width: 0; }
.results-panel { position: relative; isolation: isolate; padding: 22px 22px 26px; background: #151716; min-width: 0; }

/* ---------- steps ---------- */
.step-section, .optimize-section { position: relative; padding: 4px 0 6px 48px; border-left: 1px solid #4a4d45; margin-left: 9px; }
.optimize-section { padding-top: 3px; border-left-color: transparent; }
.step-section + .step-section { margin-top: 8px; }
.optimize-section { margin-top: 10px; }
.step-marker {
  position: absolute; left: -15px; top: 5px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: #4b5b2e; color: #eef2df;
  font: 15px Georgia, serif; box-shadow: 0 0 0 4px #171918;
}
.optimize-section .step-marker { top: 8px; }
.section-heading { display: flex; align-items: baseline; gap: 14px; margin: 0 0 5px; }
.section-heading h2 { margin: 0; color: #ece9e1; font: 19px/1.15 Georgia, "Times New Roman", serif; font-weight: 500; }
.section-heading p { margin: 0; color: var(--muted); font: 12px/1.3 Georgia, serif; }
.control-label { display: block; margin-bottom: 4px; color: #b4b2aa; font: 12px Georgia, serif; }
.control-label--parts { margin-top: 7px; }

/* ---------- select-field (class + wine) ---------- */
.select-field { height: 36px; max-width: 390px; display: grid; grid-template-columns: 42px 1fr 30px; align-items: center; border: 1px solid #363934; background: #191b1a; }
.select-field > svg:first-child { justify-self: center; color: var(--gold); font-size: 22px; }
.class-icon { width: 29px; height: 29px; object-fit: contain; justify-self: center; }
.select-field select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 100%; height: 100%; border: 0; outline: 0; background: transparent;
  color: #ded7c8; font: 15px Georgia, serif; padding: 0 8px;
}
.select-field select option { background: #191b1a; color: #ded7c8; }
.select-field:after { content: "⌄"; justify-self: center; color: #c6c6c0; grid-column: 3; grid-row: 1; pointer-events: none; }

/* ---------- weapons ---------- */
.weapon-checkboxes { max-width: 390px; display: grid; gap: 6px; }
.weapon-checkbox {
  min-height: 38px; display: grid; grid-template-columns: 18px 26px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 5px 10px; border: 1px solid #363934; background: #191b1a; color: #c9c5bc; cursor: pointer;
}
.weapon-checkbox:hover { border-color: #656554; background: #1e211d; }
.weapon-checkbox.is-selected { border-color: #81703f; background: #24251d; color: #eee7d5; }
.weapon-checkbox input { width: 16px; height: 16px; margin: 0; accent-color: #b99a4d; }
.weapon-checkbox svg { color: var(--gold); }
.weapon-checkbox span { min-width: 0; font: 15px Georgia, serif; }
.weapon-checkbox em {
  padding: 2px 7px; border: 1px solid #706139; color: #d7bd79;
  font: 10px "Segoe UI", sans-serif; letter-spacing: .06em; text-transform: uppercase; font-style: normal;
}
.multi-weapon-confirmation { margin: 12px 18px 0; display: flex; align-items: center; gap: 7px; color: #a9be79; font: 12px "Segoe UI", sans-serif; }
.multi-weapon-confirmation svg { font-size: 16px; }

/* ---------- affix goal table ---------- */
.goal-table { width: 100%; }
.goal-table__header, .goal-row { display: grid; grid-template-columns: 76px minmax(126px, 1fr) 102px 24px; align-items: center; }
.goal-table__header { height: 21px; color: #92938b; font: 11px Georgia, serif; border-bottom: 1px solid #343632; }
.goal-table__header span:nth-child(n+3) { text-align: center; }
.goal-row { min-height: 35px; border-bottom: 1px solid #2f312e; transition: background .14s ease; }
.goal-row:hover { background: #1c1e1c; }
.goal-priority { color: #92938b; font: 11px Georgia, serif; padding-left: 2px; }
.priority-cell { display: grid; grid-template-columns: 24px 36px; align-items: center; gap: 6px; }
.priority-cell > span { height: 28px; border: 1px solid #373a35; display: grid; place-items: center; color: #eeeae1; background: #1b1d1b; font: 13px Georgia, serif; }
.drag-handle { width: 22px; height: 28px; padding: 0; border: 0; background: transparent; display: grid; grid-template-columns: repeat(2, 5px); justify-content: center; align-content: center; gap: 3px; color: #858780; cursor: grab; }
.drag-handle svg { width: 5px; height: 5px; }
.goal-affix { display: flex; align-items: center; gap: 8px; min-width: 0; font: 15px Georgia, serif; color: #e4dfd2; }
.goal-affix > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { width: 24px; height: 30px; border: 0; background: transparent; color: #aaa9a2; font-size: 19px; cursor: pointer; }
.icon-button:hover { color: #e59a89; }
.level-control { width: 92px; height: 28px; display: grid; grid-template-columns: 28px 36px 28px; border: 1px solid #393c37; background: #1b1d1b; justify-self: center; }
.level-control button { border: 0; background: #232522; color: #d5c49d; font-size: 18px; cursor: pointer; }
.level-control button:hover { background: #30332d; }
.level-control output { display: grid; place-items: center; color: #f0eee8; font-weight: 600; }
.add-affix-wrap { display: flex; align-items: center; gap: 12px; margin-top: 6px; position: relative; }
.secondary-button { border: 1px solid #4e543f; background: #242720; color: #cfc5a9; padding: 6px 13px; font: 13px Georgia, serif; cursor: pointer; }
.secondary-button:hover { border-color: #7d8f53; color: #edf1e2; }
.secondary-button:disabled { cursor: not-allowed; opacity: .5; }
.affix-count { margin-left: auto; color: var(--muted); font: 12px Georgia, serif; }
.affix-menu {
  position: absolute; left: 0; top: 38px; min-width: 220px;
  max-height: min(480px, calc(100vh - 96px)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  padding: 5px; background: #20231f; border: 1px solid #4b4e47; box-shadow: 0 16px 38px #0000007a; z-index: 20;
}
.affix-menu__row { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 6px; padding: 3px; }
.affix-menu__row:hover, .affix-menu__row:focus-within { background: #2c3028; }
.affix-menu__row > button { width: 100%; min-height: 28px; border: 0; background: transparent; color: #ddd9ce; padding: 3px; display: flex; align-items: center; text-align: left; font: 13px Georgia, serif; cursor: pointer; }
.affix-menu__row > button:hover { background: transparent; color: #fff; }

/* ---------- affix-icon ---------- */
.affix-icon { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #4b4d47; color: #eee; background: #242725; }
.affix-icon--defense { background: #24303a; border-color: #365166; }
.affix-icon--offense { background: #3a2624; border-color: #633932; }
.affix-icon--utility { background: #392d24; border-color: #58412e; }
.affix-icon--neutral { background: #2d2d2b; border-color: #4b4c47; }
.affix-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* ---------- rarities ---------- */
.rarity-segments { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 390px; }
.rarity-button { min-height: 38px; border: 1px solid #3b3e39; border-right: 0; background: #1b1d1b; color: #b8b7b0; font: 11px/1.15 Georgia, serif; padding: 4px 3px; cursor: pointer; }
.rarity-button:last-child { border-right: 1px solid #3b3e39; }
.rarity-button small { display: block; margin-top: 3px; font-size: 10px; }
.rarity-button:hover { background: #262925; }
.rarity-button.is-selected { border-color: currentColor; background: #252a27; box-shadow: inset 0 -2px 0 currentColor; }
.rarity-button.is-mixed { border-color: currentColor; background: linear-gradient(135deg, #252a27 0, #252a27 50%, #1b1d1b 50%); box-shadow: inset 0 -1px 0 currentColor; }
.rarity-button:disabled { cursor: not-allowed; opacity: .78; }
.part-overrides { border: 1px solid #383b36; max-width: 390px; }
.part-row { min-height: 34px; display: grid; grid-template-columns: 96px minmax(0, 1fr) 58px; align-items: center; border-bottom: 1px solid #30332e; background: #1a1c1a; }
.part-row:last-child { border-bottom: 0; }
.part-name { display: flex; align-items: center; gap: 6px; padding-left: 7px; color: #c5c2b9; font: 12px Georgia, serif; }
.part-name svg { width: 16px; height: 16px; color: #a79670; }
.part-rarity-options { align-self: stretch; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-left: 1px solid #30332e; border-right: 1px solid #30332e; }
.part-rarity-toggle { min-width: 0; border: 0; border-right: 1px solid #30332e; background: #1d1f1d; padding: 0 2px; overflow: hidden; opacity: .42; font: 9px Georgia, serif; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; }
.part-rarity-toggle:last-child { border-right: 0; }
.part-rarity-toggle:hover { background: #292c28; opacity: .7; }
.part-rarity-toggle.is-selected { background: #252a27; opacity: 1; box-shadow: inset 0 -2px 0 currentColor; }
.part-rarity-toggle:disabled { cursor: not-allowed; opacity: .3; }
.part-row > em { color: #898b84; font: 11px Georgia, serif; font-style: normal; text-align: center; }
.rarity-common { color: var(--white-rarity) !important; }
.rarity-rare { color: var(--green) !important; }
.rarity-excellent { color: var(--blue) !important; }
.rarity-epic { color: var(--purple) !important; }
.rarity-legendary { color: var(--orange) !important; }

/* ---------- jewelry ---------- */
.jewelry-controls { display: grid; gap: 5px; border: 1px solid #383b36; background: #1a1c1a; max-width: 390px; }
.jewelry-row { min-height: 38px; display: grid; grid-template-columns: 82px minmax(112px, .75fr) minmax(190px, 1.25fr); align-items: stretch; border-bottom: 1px solid #30332e; }
.jewelry-row:last-child { border-bottom: 0; }
.jewelry-row > strong { display: flex; align-items: center; padding-left: 9px; color: #c5c2b9; font: 12px Georgia, serif; font-weight: 500; }
.jewelry-choice-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid #30332e; }
.jewelry-choice-group button { min-width: 0; border: 0; border-right: 1px solid #30332e; background: #1d1f1d; color: #83857e; padding: 3px 5px; font: 10px/1.15 Georgia, serif; cursor: pointer; }
.jewelry-choice-group button:last-child { border-right: 0; }
.jewelry-choice-group button:hover { background: #292c28; color: #d4d0c5; }
.jewelry-choice-group button.is-selected { background: #252a27; color: #d8c783; box-shadow: inset 0 -2px #99aa61; }
.jewelry-note { margin: 5px 0 0; color: #777b72; font: 10px/1.35 "Segoe UI", sans-serif; max-width: 390px; }

/* ---------- optimize section ---------- */
.live-optimization {
  min-height: 44px; border: 1px solid #4f5b3b; background: #20251c; color: #d8d5cb;
  display: flex; align-items: center; gap: 11px; padding: 7px 12px; box-shadow: inset 0 1px #ffffff0a;
  max-width: 390px;
}
.live-optimization > svg { flex: 0 0 auto; color: #93ad5e; font-size: 22px; }
.live-optimization div { display: grid; gap: 2px; }
.live-optimization strong { font: 16px Georgia, serif; font-weight: 500; }
.live-optimization span { color: #898f7d; font: 11px "Segoe UI", sans-serif; letter-spacing: .02em; }
.live-optimization.is-loading > svg { color: #d1b568; animation: spin 1.2s linear infinite; }
.live-optimization.has-error { border-color: #725047; background: #2a201e; }
.live-optimization.has-error > svg { color: #c18272; }
@keyframes spin { to { transform: rotate(360deg); } }
.primary-action {
  margin-top: 10px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 22px;
  border: 1px solid #829b50; background: #536833; color: #f0ecdd; cursor: pointer; font: 14px Georgia, serif;
}
.primary-action:hover { background: #617a3c; }
.primary-action:disabled { cursor: not-allowed; opacity: .5; }

/* ---------- results header ---------- */
.results-header { min-height: 72px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 0 8px 15px; }
.results-header h1 { margin: 0 0 7px; display: flex; align-items: center; gap: 9px; color: #dcc176; font: 22px Georgia, serif; font-weight: 500; }
.results-header h1 svg { color: #dcc176; }
.results-header h1 span { padding: 4px 9px; background: #303621; color: #91ae59; font: 11px "Segoe UI", sans-serif; text-transform: uppercase; letter-spacing: .03em; }
.results-header p { margin: 0; color: #a2a29a; font: 13px Georgia, serif; }
.result-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.solution-select, .game-code-button { height: 38px; border: 1px solid #3d403a; background: #1a1c1a; color: #cfc5ab; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px; font: 13px Georgia, serif; cursor: pointer; }
.game-code-button { color: #d1b768; border-color: #55503c; }
.game-code-button--copy { background: #292d20; color: #cbd9a5; border-color: #596442; }
.game-code-button:hover { background: #242722; border-color: #666b5d; }
.game-code-button svg { flex: 0 0 auto; font-size: 14px; }
.solution-select { padding: 0 8px; }
.solution-select span { color: #777a72; font: 10px "Segoe UI", sans-serif; text-transform: uppercase; }
.solution-select select { height: 100%; border: 0; background: transparent; color: #d9d5ca; font: 12px Georgia, serif; }
.solution-select select option { background: #1a1c1a; }
.import-export-actions { max-width: 100%; display: flex; flex: 0 1 auto; align-items: center; flex-wrap: nowrap; gap: 8px; overflow-x: auto; }
.import-export-actions > button { flex: 0 0 auto; white-space: nowrap; }

/* ---------- relaxed / dropped notice ---------- */
.relaxed-notice {
  margin: 12px 8px 0; display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border: 1px solid #725047; background: #2a201e;
  color: #e4b9ad; font: 13px Georgia, serif; line-height: 1.4;
}
.relaxed-notice > svg { flex: 0 0 auto; font-size: 18px; color: #c18272; }
.relaxed-notice strong { color: #f0c9bf; font-weight: 500; }
.live-optimization.is-relaxed { border-color: #725047; background: #2a201e; }
.live-optimization.is-relaxed > svg { color: #c18272; }

/* ---------- empty ---------- */
.empty-results { min-height: 500px; display: grid; place-items: center; align-content: center; gap: 10px; color: #999a92; text-align: center; }
.empty-results > svg { font-size: 64px; color: #856d4f; }
.empty-results h2 { margin: 0; font: 24px Georgia, serif; color: #ddd8cc; font-weight: 500; }
.empty-results p { margin: 0; max-width: 520px; color: var(--muted); }

/* ---------- result table ---------- */
.result-table { margin-top: 6px; overflow-x: auto; }
.result-table__header, .result-row { display: grid; grid-template-columns: minmax(220px, 1.05fr) minmax(145px, .72fr) minmax(270px, 1.2fr); }
.result-table__header { min-height: 44px; align-items: end; padding: 0 14px 10px; color: #b8b4aa; font: 12px Georgia, serif; border-bottom: 1px solid var(--line); }
.result-row { min-height: 91px; align-items: center; padding: 7px 14px; border-bottom: 1px solid #2e302d; }
.result-row:hover { background: #191b19; }
.item-cell { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 11px; min-width: 0; padding-right: 14px; }
.item-art { width: 62px; height: 70px; display: grid; place-items: center; background: #202522; border: 1px solid currentColor; color: #8098a8; box-shadow: inset 0 0 20px #00000059; }
.item-art svg { width: 44px; height: 44px; color: #b6a27b; filter: drop-shadow(0 2px 2px #000); }
.item-art.rarity-common { color: #9c9c9c; }
.item-art.rarity-rare { color: #689c64; }
.item-art.rarity-excellent { color: #5a95b1; }
.item-art.rarity-epic { color: #9b5ab1; }
.item-art.rarity-legendary { color: #e5b043; }
.item-cell > div:last-child { min-width: 0; display: grid; gap: 2px; }
.item-cell small { color: #b8b1a0; font: 11px Georgia, serif; text-transform: uppercase; letter-spacing: .06em; }
.item-cell strong { color: #6fb4f7; font: 16px Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-cell .rarity-text { font: 12px Georgia, serif; }
.rarity-text.rarity-common { color: #9c9c9c; }
.rarity-text.rarity-rare { color: #689c64; }
.rarity-text.rarity-excellent { color: #5a95b1; }
.rarity-text.rarity-epic { color: #9b5ab1; }
.rarity-text.rarity-legendary { color: #e5b043; }
.stats-affix-cell { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; padding-right: 14px; }
.stats-affix-cell > svg { width: 24px; height: 24px; color: #c9ae65; }
.stats-affix-cell > .affix-icon { width: 28px; height: 28px; }
.stats-affix-cell > div { min-width: 0; display: grid; gap: 3px; }
.stats-affix-cell strong { color: #d8cfb9; font: 13px Georgia, serif; }
.stats-affix-cell span { color: #96988f; font: 10px/1.2 "Segoe UI", sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- sockets ---------- */
.socket-gem-list { min-width: 0; display: grid; align-content: center; gap: 5px; padding: 3px 0; }
.no-sockets { color: #676a64; font: 11px Georgia, serif; }
.socket-gem-row { min-width: 0; min-height: 39px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 2px 7px 2px 2px; border: 1px solid #30332e; background: #181a18; }
.socket-gem-row.is-filled { border-color: #3a3d36; background: #1b1d1a; }
.socket-gem-row.is-free { opacity: .68; }
.socket-gem-art { display: block; width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.7)); }
.socket-gem-copy { min-width: 0; display: grid; gap: 2px; font-family: Georgia, serif; }
.socket-gem-copy strong { color: #cfb76e; font-size: 12px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.socket-gem-row.gem-agate .socket-gem-copy strong { color: #e7976e; }
.socket-gem-row.gem-amethyst .socket-gem-copy strong { color: #c77bea; }
.socket-gem-row.gem-moonstone .socket-gem-copy strong { color: #6db8e7; }
.socket-gem-row.gem-peridot .socket-gem-copy strong { color: #8fc574; }
.socket-gem-row.is-free .socket-gem-copy strong { color: #aaa99f; }
.socket-gem-copy em { color: #858780; font-size: 9px; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.socket-gem-affixes { display: flex; align-items: center; gap: 7px; }
.socket-gem-affixes .affix-icon { width: 18px; height: 18px; }

/* ---------- goals summary ---------- */
.goals-summary { margin-top: 14px; border: 1px solid #383b35; background: #191b19; padding: 13px 15px 15px; }
.goals-summary > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.goals-summary h2 { margin: 0; color: #ece8dd; font: 18px Georgia, serif; }
.goals-summary header > span { color: #bbb7aa; font: 12px Georgia, serif; }
.affix-meter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 26px; }
.affix-meter { display: grid; grid-template-columns: 44px 1fr; gap: 9px; min-width: 0; }
.affix-meter > .affix-icon { width: 44px; height: 44px; }
.affix-meter__body { min-width: 0; }
.affix-meter__title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-family: Georgia, serif; }
.affix-meter__title span { color: #dfd2b5; font-size: 16px; }
.affix-meter__title strong { color: #c6c4bd; font-size: 13px; font-weight: 400; white-space: nowrap; }
.affix-meter.is-unmet .affix-meter__title strong { color: #f06f69; font-weight: 700; text-shadow: 0 0 10px rgba(215,61,55,.28); }
.affix-meter.is-missing .affix-meter__title strong { color: #d8a55e; font-weight: 700; }
.affix-meter.is-missing > .affix-icon { opacity: .5; }
.affix-meter__meta .is-missing { color: #d8a55e; font-weight: 700; }
.affix-meter.is-reduced .affix-meter__title strong { color: #d8a55e; font-weight: 700; }
.affix-meter.is-reduced > .affix-icon { opacity: .72; }
.affix-meter__meta .is-reduced { color: #d8a55e; font-weight: 700; }
.affix-meter__meta { display: flex; justify-content: space-between; gap: 6px; color: #8c8e86; font: 10px Georgia, serif; }
.affix-meter__meta b { color: #d4d0c4; font-weight: 400; }
.affix-meter__meta .is-unmet, .affix-meter__meta .is-unmet b { color: #dd625d; font-weight: 700; }

/* ---------- possible additions ---------- */
.possible-additions { margin-top: 14px; border: 1px solid #3a4037; background: #181b18; padding: 13px 15px 15px; }
.possible-additions > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.possible-additions h2 { margin: 0; color: #ece8dd; font: 18px Georgia, serif; }
.possible-additions header p { margin: 3px 0 0; color: #858980; font: 11px Georgia, serif; }
.possible-additions header > span { color: #aebd92; font: 12px Georgia, serif; white-space: nowrap; }
.possible-addition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.possible-addition { min-width: 0; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 50px; padding: 7px 9px; border: 1px solid #30352d; background: #1d201c; text-align: left; }
.possible-addition:hover, .possible-addition:focus-within { border-color: #69774f; background: #23281f; }
.possible-addition.is-increase { border-color: #596747; background: #22271f; }
.possible-addition.is-increase em { color: #a9c56d; }
.possible-addition > .affix-icon { width: 36px; height: 36px; }
.possible-addition__action { grid-column: 2 / 4; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.possible-addition__copy { min-width: 0; display: grid; gap: 3px; font-family: Georgia, serif; }
.possible-addition strong { color: #d8cfba; font-size: 13px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.possible-addition span { color: #858980; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.possible-addition em { color: #baa76d; font: 10px Georgia, serif; white-space: nowrap; }

/* ---------- free slots ---------- */
.free-slots { margin-top: 14px; border: 1px solid #3d4238; background: #181b18; padding: 13px 15px 15px; }
.free-slots > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 11px; }
.free-slots h2 { margin: 0; color: #ece8dd; font: 18px Georgia, serif; }
.free-slots header p { margin: 3px 0 0; color: #858980; font: 11px Georgia, serif; }
.free-slots header > span { color: #aebd92; font: 12px Georgia, serif; white-space: nowrap; }
.free-slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.free-slot { min-width: 0; min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid #30352d; background: #1e211d; }
.free-slot__item { min-width: 0; display: flex; align-items: center; gap: 8px; }
.free-slot__item > svg { width: 24px; height: 24px; flex: 0 0 auto; color: #a79670; }
.free-slot__item > span { min-width: 0; display: grid; gap: 2px; }
.free-slot__item small { color: #858980; font: 9px Georgia, serif; text-transform: uppercase; letter-spacing: .06em; }
.free-slot__item strong { color: #cfc8b7; font: 12px Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.free-slot__socket { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.free-slot__socket svg { width: 32px; height: 32px; }
.free-slot__socket small { color: #8f9188; font: 9px Georgia, serif; white-space: nowrap; }

/* ---------- game code panel ---------- */
.game-code-panel { display: grid; gap: 11px; margin: 12px 8px 16px; padding: 14px 16px; border: 1px solid #56513e; background: linear-gradient(135deg, #2b2b22f5, #181a17fa); box-shadow: inset 0 1px #ffffff09; }
.game-code-panel__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.game-code-panel__heading > div { display: grid; gap: 3px; }
.game-code-panel__heading strong { color: #d5bf7b; font: 15px Georgia, serif; font-weight: 500; }
.game-code-panel__heading span, .game-code-panel > p { color: #97998f; font-size: 11px; }
.game-code-panel__heading button { border: 0; background: transparent; color: #aaa9a2; font-size: 19px; cursor: pointer; }
.game-code-panel__controls { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 8px; }
.game-code-panel__controls input { width: 100%; min-width: 0; height: 40px; border: 1px solid #474a42; outline: 0; background: #111310; color: #ded8c8; padding: 0 12px; font: 13px Consolas, monospace; letter-spacing: .035em; }
.game-code-panel__controls input:focus { border-color: #9b8955; box-shadow: 0 0 0 2px #9b895526; }
.game-code-panel__controls button { min-width: 112px; border: 1px solid #776b48; background: #3b3829; color: #e1cf98; padding: 0 15px; font: 13px Georgia, serif; cursor: pointer; }
.game-code-panel__controls button:hover { background: #494532; }
.game-code-panel > p { margin: -2px 0 0; }
.game-code-error { padding: 9px 11px; border: 1px solid #74473e; background: #35211d; color: #e6b2a8; font-size: 12px; }

/* ---------- affix tooltip ---------- */
.affix-tooltip {
  position: fixed; z-index: 70; width: min(340px, calc(100vw - 24px));
  pointer-events: none;
  background: #171917; border: 1px solid #52554b; box-shadow: 0 16px 38px #000a, inset 0 1px #ffffff0d;
  padding: 12px 14px 13px; color: #cfcabf; font: 12px/1.5 "Segoe UI", sans-serif;
}
.affix-tooltip::before {
  content: ""; position: absolute; left: -1px; top: -1px; right: -1px; height: 2px;
  background: linear-gradient(90deg, #879a57, #4e543f);
}
.affix-tooltip__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.affix-tooltip__head .affix-icon { width: 30px; height: 30px; }
.affix-tooltip__title { display: grid; gap: 1px; }
.affix-tooltip__title strong { color: #e9e4d8; font: 500 15px Georgia, serif; }
.affix-tooltip__title span { color: #8a8d85; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.affix-tooltip__desc { margin: 0 0 9px; color: #c4c0b4; }
.affix-tooltip__desc strong { color: #d9c98d; font-weight: 600; }
.affix-tooltip__tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; max-height: 240px; overflow-y: auto; }
.affix-tooltip__tiers li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 4px 6px; border-left: 2px solid transparent; color: #6d6f68; opacity: .62; }
.affix-tooltip__tiers li.is-active { background: #21271c; border-left-color: #93ad5e; color: #ece8dd; opacity: 1; }
.affix-tooltip__tiers li.is-active p { color: #e9e5da; }
.affix-tooltip__tiers li > span { color: #8f927f; font: 10px Georgia, serif; text-align: right; }
.affix-tooltip__tiers li.is-active > span { color: #c9d69b; }
.affix-tooltip__tiers li p { margin: 0; color: inherit; }
.affix-tooltip__note { margin: 0; color: #8a8d85; font: italic 11px Georgia, serif; }

/* ---------- toast ---------- */
.toast { position: fixed; top: 66px; right: 22px; z-index: 60; padding: 10px 15px; pointer-events: none; background: #293322; border: 1px solid #617847; color: #dbe6c9; box-shadow: 0 10px 30px #0006; font: 13px "Segoe UI", sans-serif; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line-soft); padding: 18px 24px 20px; background: #101211; color: var(--faint); text-align: center; font-size: 12px; line-height: 1.55; margin-top: 24px; }
.site-footer p { max-width: 900px; margin: 0 auto; }
.site-footer nav { display: flex; justify-content: center; gap: 18px; margin-top: 10px; }
.site-footer a { color: #91968d; text-decoration: none; }
.site-footer a:hover { color: #d5b45f; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 470px minmax(650px, 1fr); }
  .workspace--embedded { grid-template-columns: minmax(400px, 1fr); }
  .goal-table__header, .goal-row { grid-template-columns: 68px minmax(108px, 1fr) 90px 24px; }
  .level-control { width: 82px; grid-template-columns: 25px 32px 25px; }
  .affix-meter-grid, .possible-addition-grid, .free-slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .workspace, .workspace--embedded { display: block; }
  .forge-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .results-panel { padding: 18px 14px 24px; }
  .results-header { align-items: stretch; flex-direction: column; }
  .result-table { overflow-x: auto; }
  .result-table__header, .result-row { min-width: 820px; }
}
@media (max-width: 620px) {
  .app-header { height: 48px; grid-template-columns: 38px max-content minmax(0, 1fr) auto; }
  .platform-logo img { width: 26px; height: 26px; }
  .nav-link { min-width: 0; padding: 0 9px; font-size: 11px; white-space: nowrap; }
  .header-actions { display: none; }
  .forge-panel { padding: 12px 10px 20px 16px; }
  .step-section, .optimize-section { padding-left: 30px; margin-left: 5px; }
  .step-marker { width: 25px; height: 25px; left: -13px; font-size: 12px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 3px; }
  .goal-table { overflow-x: auto; }
  .goal-table__header, .goal-row { min-width: 300px; }
  .rarity-segments { overflow-x: auto; grid-template-columns: repeat(5, minmax(70px, 1fr)); }
  .part-row { grid-template-columns: 76px minmax(0, 1fr); }
  .part-row > em { display: none; }
  .jewelry-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jewelry-row > strong { grid-column: 1 / -1; min-height: 30px; border-bottom: 1px solid #30332e; }
  .affix-meter-grid, .possible-addition-grid, .free-slot-grid { grid-template-columns: 1fr; }
  .import-export-actions { width: 100%; }
}

/* ---------- Build Assistant ---------- */
.assistant-card { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.assistant-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 16px; cursor: pointer; background: none; border: 0; color: var(--text); text-align: left; font: inherit; }
.assistant-head:hover { background: rgba(255, 255, 255, 0.03); }
.assistant-head__title { display: inline-flex; align-items: center; gap: 8px; font: 500 15px Georgia, serif; color: #e3dcc9; white-space: nowrap; }
.assistant-head__title svg { color: var(--gold); }
.assistant-head__hint { flex: 1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-head__chevron { color: var(--faint); }
.assistant-body { padding: 4px 16px 14px; display: grid; gap: 10px; }
.assistant-field-label { font-size: 12px; color: var(--muted); }
.assistant-body textarea {
  width: 100%; min-height: 64px; resize: vertical; padding: 9px 11px;
  background: #101211; border: 1px solid var(--line); color: var(--text);
  font: 14px/1.5 inherit; border-radius: 0; outline: none;
}
.assistant-body textarea:focus { border-color: #4a5377; }
.assistant-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.assistant-settings { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 260px; }
.assistant-settings select, .assistant-settings input {
  background: #101211; border: 1px solid var(--line); color: var(--text);
  padding: 6px 8px; font-size: 12px; min-width: 120px;
}
.assistant-settings #agent-key { min-width: 150px; }
.assistant-progress { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.assistant-progress svg { animation: spin 1s linear infinite; color: var(--gold); }
@keyframes spin { to { transform: rotate(360deg); } }
.assistant-error { color: var(--danger); font-size: 13px; border: 1px solid rgba(200, 116, 97, 0.4); background: rgba(200, 116, 97, 0.08); padding: 8px 10px; white-space: pre-wrap; }
.assistant-note { color: var(--faint); font-size: 11px; margin: 0; }
.assistant-interp { color: #d8d5ce; font-size: 13px; font-style: italic; margin: 2px 0 0; }
.assistant-output { display: grid; gap: 12px; }
.assistant-builds { display: grid; gap: 10px; }
.assistant-build { border: 1px solid var(--line); background: #141615; padding: 12px 13px; display: grid; gap: 9px; }
.assistant-build.is-chosen { border-color: #4a5377; box-shadow: 0 0 0 1px #4a5377 inset; }
.assistant-build__head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; justify-content: space-between; }
.assistant-build__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.assistant-build__title strong { font: 600 14px Georgia, serif; color: #e3dcc9; }
.assistant-build__title span { color: var(--muted); font-size: 11px; }
.assistant-build__pick { color: var(--gold); font-weight: 600; font-size: 11px; letter-spacing: 0.4px; border: 1px solid var(--gold); padding: 1px 6px; }
.assistant-build__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 12px; }
.badge { font-size: 11px; padding: 1px 7px; }
.badge--good { color: var(--green); border: 1px solid var(--green); }
.badge--warn { color: var(--orange); border: 1px solid var(--orange); }
.assistant-build__goals { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-goal { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; background: #101211; border: 1px solid var(--line); padding: 3px 8px; color: var(--text); cursor: default; }
.ai-goal b { font-weight: 600; color: var(--muted); }
.ai-goal--ok b { color: var(--green); }
.ai-goal--short b { color: var(--orange); }
.assistant-build__items { display: flex; flex-wrap: wrap; gap: 5px; }
.ai-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); background: #101211; border: 1px solid var(--line-soft); padding: 3px 7px; }
.ai-item svg { color: #856d4f; }
.ai-item em { font-style: normal; color: var(--text); }
.ai-item small { color: var(--faint); text-transform: capitalize; }
.assistant-build__foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.assistant-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); word-break: break-all; background: #101211; border: 1px dashed var(--line); padding: 4px 8px; flex: 1; min-width: 160px; }
.assistant-build__actions { display: flex; gap: 8px; align-items: center; }
.assistant-suggestions { font-size: 12px; color: var(--muted); background: rgba(102, 127, 57, 0.08); border: 1px solid rgba(102, 127, 57, 0.35); padding: 8px 10px; }
.assistant-suggestions strong { color: var(--moss-bright); }
.assistant-summary { font-size: 13px; line-height: 1.55; color: #c9c6bd; }
.assistant-summary p { margin: 0 0 6px; }
.assistant-summary .asm-li { margin-left: 14px; padding-left: 10px; position: relative; }
.assistant-summary .asm-li::before { content: "–"; position: absolute; left: 0; color: var(--gold); }
.primary-action--small { padding: 7px 12px; font-size: 12px; }

.assistant-stops { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 7px 10px; }
.assistant-stops.is-complete { color: var(--green); background: rgba(102,127,57,0.10); border: 1px solid rgba(102,127,57,0.4); }
.assistant-stops.is-partial { color: var(--orange); background: rgba(229,176,67,0.08); border: 1px solid rgba(229,176,67,0.4); }
.assistant-stops span { line-height: 1.4; }
