#crafting-page {
  min-width: 0;
}
.crafting-calculate {
  margin-top: 16px;
  display: inline-flex;
}
.calc-back {
  display: block;
  margin-bottom: 18px;
  color: #dec88f;
  font-size: 13px;
}
.calc-target {
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 18px 24px;
  align-items: center;
}
.calc-target .eyebrow {
  display: block;
  margin-bottom: 12px;
}
.calc-fields {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 14px;
}
.calc-target .calc-fields {
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
}
#craft-calculator label {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
#craft-calculator .calc-fields > label {
  justify-content: flex-end;
}
#craft-calculator label > input,
#craft-calculator label > .custom-select {
  margin: 0;
}
#craft-calculator label.calc-check {
  flex-direction: row;
  align-items: center;
  color: var(--text);
  font-size: 13px;
}
#craft-calculator input:not([type="checkbox"]),
#craft-calculator .select-trigger {
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
}
.calc-accept {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.calc-accept p {
  margin: 0;
}
.calc-accept strong {
  color: #dec88f;
}
.calc-mastery {
  padding: 24px;
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: 18px 24px;
  align-items: start;
}
.calc-mastery h2 {
  margin: 0 0 6px;
}
.calc-mastery p {
  margin: 0;
}
.calc-mastery .calc-fields > :is(label, .skeleton-field) {
  max-width: 260px;
}
.calc-mastery-footer {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.calc-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.calc-actions [aria-pressed="true"] {
  border-color: #cbb47d;
  color: #dec88f;
}
.calc-section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 30px 0 14px;
}
.calc-section-heading h2,
.calc-section-heading h3 {
  margin: 0;
}
.calc-section-heading .calc-actions {
  align-self: center;
}
#calc-results {
  scroll-margin-top: 130px;
}
#calc-results [data-calc-summary],
#calc-results .calc-table td[data-cell],
#calc-results [data-calc-byproducts] {
  transition: opacity 0.15s ease;
}
#calc-results.is-stale [data-calc-summary],
#calc-results.is-stale .calc-table td[data-cell],
#calc-results.is-stale [data-calc-byproducts] {
  opacity: 0.5;
}
.calc-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 8px;
}
.calc-metrics .panel {
  padding: 20px 22px;
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  gap: 10px;
  min-width: 0;
}
.calc-metrics span,
.calc-metrics small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.calc-metrics strong {
  font-size: 30px;
  color: #dec88f;
  font-variant-numeric: tabular-nums;
}
.calc-table-wrap {
  padding: 0;
  overflow-x: auto;
  margin-top: 12px;
}
.calc-table-wrap > .skeleton-row {
  padding: 12px 16px;
}
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.calc-table th,
.calc-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.calc-table tbody tr:last-child > * {
  border-bottom: 0;
}
.calc-table th:first-child {
  text-align: left;
  font-weight: 400;
  white-space: normal;
  min-width: 220px;
}
.calc-table thead th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}
.calc-table td:last-child {
  color: #dec88f;
  background: #cbb47d08;
  font-weight: 600;
}
#craft-calculator .calc-owned input {
  width: 110px;
  min-height: 36px;
  text-align: right;
}
.calc-target .item-recipe-item,
.calc-step-item .item-recipe-item,
.calc-table .item-recipe-item,
.calc-byproducts .item-recipe-item {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
}
.calc-target .item-recipe-icon,
.calc-step-item .item-recipe-icon,
.calc-table .item-recipe-icon,
.calc-byproducts .item-recipe-icon {
  width: 44px;
  height: 44px;
}
.calc-target .item-recipe-quantity,
.calc-step-item .item-recipe-quantity,
.calc-table .item-recipe-quantity,
.calc-byproducts .item-recipe-quantity {
  display: none;
}
.calc-budget-note {
  margin-top: 16px;
  line-height: 1.6;
}
.calc-byproducts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}
.calc-byproducts li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  min-width: 0;
}
.calc-byproducts li > a {
  min-width: 0;
}
.calc-byproducts li > strong {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.calc-chain-help {
  margin: -6px 0 14px;
}
/* Tree lines: each child draws the trunk beside it and an elbow to its card;
   the last child stops the trunk at its elbow. */
.calc-tree {
  --tree-indent: 32px;
  --tree-elbow: 44px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.calc-tree .calc-tree {
  padding-left: var(--tree-indent);
}
.calc-tree .calc-tree > li {
  position: relative;
  padding-top: 10px;
}
.calc-tree .calc-tree > li::before,
.calc-tree .calc-tree > li::after {
  content: "";
  position: absolute;
  left: calc(var(--tree-indent) / -2);
  border: 0 solid #686146;
  pointer-events: none;
}
.calc-tree .calc-tree > li::before {
  top: 0;
  bottom: 0;
  border-left-width: 1px;
}
.calc-tree .calc-tree > li:last-child::before {
  bottom: auto;
  height: var(--tree-elbow);
}
.calc-tree .calc-tree > li::after {
  top: var(--tree-elbow);
  width: calc(var(--tree-indent) / 2);
  border-top-width: 1px;
}
.calc-step {
  padding: 12px 16px;
  min-width: 0;
  container-type: inline-size;
}
.calc-step-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}
.calc-step-number {
  border: 1px solid #686146;
  color: #dec88f;
  width: 26px;
  height: 26px;
  margin-top: 9px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.calc-step-item {
  min-width: 0;
}
.calc-step-item .item-recipe-item {
  align-items: start;
}
.calc-step-item p {
  margin: 4px 0 0 56px;
}
.calc-step-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, auto));
  gap: 4px 22px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
}
.calc-step-stats > span {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}
.calc-step-stats strong {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.calc-step-stats .calc-warn strong {
  color: #e3a85c;
}
.calc-label {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.calc-step-ingredients {
  margin: 14px 0;
}
.calc-ingredients {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 10px 18px;
  align-items: start;
  min-width: 0;
}
.calc-ingredients > li {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.calc-ingredients > li > .microcopy {
  padding-left: 42px;
  font-size: 11px;
}
.calc-ingredients .item-recipe-item {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.calc-ingredients .item-recipe-icon {
  width: 32px;
  height: 32px;
}
.calc-ingredients .item-recipe-quantity {
  padding-top: 6px;
}
.calc-step-settings {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 12px;
}
.calc-step-settings summary,
.calc-assumptions summary {
  cursor: pointer;
  font-size: 13px;
}
.calc-step-settings summary {
  color: var(--muted);
}
.calc-step-settings [data-step-rates] p {
  margin: 4px 0 0;
}
.calc-step-settings .calc-fields {
  margin-top: 16px;
}
.calc-step-settings .calc-fields > label:has(select) {
  grid-column: 1 / -1;
}
.calc-entered {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 3px solid #e3a85c;
  background: #e3a85c0f;
  font-size: 13px;
  line-height: 1.6;
}
#craft-calculator .calc-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #dec88f;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.calc-blockers {
  padding: 18px 20px;
  margin-bottom: 16px;
  border-left: 3px solid #e3a85c;
}
.calc-blockers > p {
  margin: 6px 0 0;
}
.calc-blockers ul {
  list-style: none;
  padding: 0;
  margin: 14px 0;
  display: grid;
  gap: 10px;
}
.calc-blockers li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 13px;
  line-height: 1.5;
}
.calc-assumptions {
  background: #242923;
  border-left: 3px solid #cbb47d;
  padding: 16px 24px;
  margin: 30px 0 0;
  font-size: 13px;
  line-height: 1.6;
}
.calc-assumptions p {
  margin: 10px 0 0;
}
@media (prefers-reduced-motion: reduce) {
  #calc-results [data-calc-summary],
  #calc-results .calc-table td[data-cell],
  #calc-results [data-calc-byproducts] {
    transition: none;
  }
}
/* Deep branches need the compact header even on a wide screen. */
@container (max-width: 720px) {
  .calc-step-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 12px;
  }
  .calc-step-item p {
    margin-left: 0;
  }
  .calc-step-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px 12px;
    text-align: left;
  }
}
@container (max-width: 300px) {
  .calc-step-stats {
    gap: 4px 8px;
  }
  .calc-step-stats strong {
    font-size: 14px;
  }
}
@media (max-width: 1000px) {
  .calc-target,
  .calc-mastery {
    grid-template-columns: minmax(0, 1fr);
  }
  .calc-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .calc-target,
  .calc-mastery,
  .calc-assumptions {
    padding: 16px;
  }
  .calc-target .calc-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calc-target .calc-fields > :first-child {
    grid-column: 1 / -1;
  }
  .calc-mastery .calc-fields > :is(label, .skeleton-field) {
    max-width: none;
  }
  .calc-metrics {
    gap: 10px;
  }
  .calc-metrics .panel {
    padding: 14px;
    gap: 6px;
  }
  .calc-metrics strong {
    font-size: 24px;
  }
  .calc-tree {
    --tree-indent: 12px;
  }
  /* Materials become one card per row: name first, then labelled values. */
  .calc-table-wrap {
    overflow: visible;
  }
  .calc-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .calc-table,
  .calc-table tbody {
    display: block;
  }
  .calc-table tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
  }
  .calc-table tbody tr:last-child {
    border-bottom: 0;
  }
  .calc-table th,
  .calc-table td {
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
  }
  .calc-table th[scope="row"] {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .calc-table td {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }
  .calc-table td::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
  }
  .calc-table td.calc-owned {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .calc-table td:last-child {
    background: none;
  }
  .calc-table .item-recipe-item {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
  }
  .calc-table .item-recipe-icon {
    width: 32px;
    height: 32px;
  }
}
@media (max-width: 340px) {
  .calc-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
  .calc-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.crafting-professions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.crafting-profession {
  padding: 18px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.crafting-profession strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.crafting-profession span {
  color: var(--muted);
  font-size: 12px;
}
.crafting-profession.active {
  border-color: #cbb47d;
  background: #292c29;
}
.crafting-profession.active strong {
  color: #dec88f;
}
.crafting-profession:hover {
  border-color: #cbb47d;
}
.crafting-controls {
  padding: 24px;
}
.crafting-search {
  display: flex;
  align-items: end;
  gap: 14px;
  margin-bottom: 20px;
}
.crafting-search label {
  flex: 1;
}
.crafting-controls label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.crafting-controls input,
.crafting-controls .select-control {
  min-width: 0;
  width: 100%;
}
.crafting-controls input {
  min-height: 42px;
}
.crafting-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.crafting-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 18px;
  margin: 20px 0 6px;
  font-size: 13px;
}
.crafting-summary p {
  margin: 0;
}
.crafting-summary a {
  color: #dec88f;
}
.crafting-note {
  margin-bottom: 24px;
}
.crafting-path {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 8px;
}
.crafting-result {
  min-width: 0;
}
.crafting-pagination {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.crafting-empty {
  padding: 28px;
}
.crafting-profession:focus-visible {
  outline: 2px solid #dec88f;
  outline-offset: 3px;
}
@media (max-width: 1100px) {
  .crafting-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .crafting-professions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .crafting-professions,
  .crafting-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .crafting-controls {
    padding: 16px;
  }
  .crafting-search {
    align-items: stretch;
    flex-direction: column;
  }
  .crafting-profession {
    padding: 14px;
  }
}
@media (max-width: 360px) {
  .crafting-filters {
    grid-template-columns: minmax(0, 1fr);
  }
}
