:root {
  --bg: #0a0e12;
  --bg-card: #141b24;
  --border: #2a3544;
  --text: #e8eef4;
  --muted: #8b9cb3;
  --accent: #ff6b1a;
  --accent-dim: #c44e10;
  --accent-glow: rgba(255, 107, 26, 0.22);
  --link: #6ec8ff;
  --ok: #5cdb95;
  --radius: 12px;
  --radius-lg: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 100;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.55rem 1rem;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border-radius: var(--radius);
  background: var(--accent);
  color: #0a0e12;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 20px var(--accent-glow);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 900px 500px at 85% 0%, rgba(255, 107, 26, 0.07), transparent 55%),
    radial-gradient(ellipse 700px 400px at 10% 20%, rgba(110, 200, 255, 0.06), transparent 50%),
    radial-gradient(1200px 700px at 30% -15%, #1a2432 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.55;
}

body.page-calc {
  background:
    radial-gradient(ellipse 1000px 520px at 50% -5%, rgba(255, 107, 26, 0.09), transparent 58%),
    radial-gradient(ellipse 800px 480px at 100% 30%, rgba(94, 219, 149, 0.05), transparent 45%),
    radial-gradient(ellipse 600px 400px at 0% 60%, rgba(110, 200, 255, 0.06), transparent 50%),
    linear-gradient(180deg, #0f151c 0%, var(--bg) 35%, #0a0d11 100%);
}

body.item-picker-modal-open {
  overflow: hidden;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
}

a:hover {
  color: #9ad9ff;
}

.wrap {
  width: min(1040px, 100% - 2rem);
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
}

.logo-sub {
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover,
.nav a.is-active {
  color: var(--accent);
}

.main-content {
  flex: 1 0 auto;
  padding: 2rem 0 3rem;
}

body.page-calc .main-content {
  width: min(1180px, 100% - 2rem);
}

#main:focus {
  outline: none;
}

.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(8, 11, 15, 0.55);
}

.footer-inner {
  max-width: 72ch;
}

.footer-inner p {
  margin: 0;
  line-height: 1.6;
}

.page-home {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.hero {
  padding: 1.5rem 0 2rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
}

.lead {
  margin: 0;
  color: var(--muted);
  max-width: 58ch;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}

.card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
  color: var(--accent);
}

.card ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.card li + li {
  margin-top: 0.35rem;
}

.tips {
  margin-top: 2rem;
}

.tips h2 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.panel {
  background: linear-gradient(165deg, rgba(30, 39, 51, 0.95) 0%, rgba(20, 27, 36, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-glow {
  border-color: rgba(42, 53, 68, 0.9);
  box-shadow:
    0 0 0 1px rgba(255, 107, 26, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.35);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.panel-head + .panel-hint {
  margin-top: 0;
}

.panel-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 107, 26, 0.12);
  border: 1px solid rgba(255, 107, 26, 0.25);
}

.panel-calc-form {
  position: relative;
  /* не hidden — иначе обрезается выпадающий выбор предмета и нижняя часть формы */
  overflow: visible;
  border-color: rgba(255, 107, 26, 0.18);
  background: linear-gradient(155deg, rgba(28, 36, 48, 0.98) 0%, rgba(16, 22, 30, 0.99) 100%);
}

.panel-calc-form::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(500px 200px at 20% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
  opacity: 0.5;
}

.panel-calc-form > .calc-form {
  position: relative;
  z-index: 1;
}

.calc-hero {
  margin-bottom: 1.75rem;
}

.calc-title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(105deg, #fff 0%, #c5d4e8 45%, var(--accent) 160%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.calc-lead {
  margin: 0;
  max-width: 52ch;
  font-size: 0.95rem;
}

.calc-quick {
  margin: 0.85rem 0 0;
  max-width: 60ch;
  font-size: 0.9rem;
  line-height: 1.45;
}

.calc-quick-note {
  font-size: 0.82rem;
  opacity: 0.88;
}

#calc-results {
  scroll-margin-top: 5.5rem;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.calc-export-wrap {
  margin: 0.5rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.limits-list {
  margin: 0;
  padding-left: 1.15rem;
  max-width: 65ch;
  line-height: 1.55;
}

.limits-list li {
  margin: 0.35rem 0;
}

.field-recipe .field-input {
  max-width: none;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  max-width: 62ch;
}

.field-submit-row {
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.btn-ghost:hover {
  border-color: rgba(255, 107, 26, 0.45);
  background: rgba(255, 107, 26, 0.08);
}

.calc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.25rem;
  align-items: end;
  min-width: 0;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.field-submit {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
}

@media (max-width: 560px) {
  .panel-calc-form .field-submit,
  .panel-calc-form .field-submit-row {
    position: sticky;
    bottom: 0;
    z-index: 15;
    margin-top: 0.35rem;
    padding-top: 0.75rem;
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(20, 27, 36, 0) 0%, rgba(20, 27, 36, 0.94) 35%, rgba(14, 18, 24, 0.99) 100%);
  }

  .panel-calc-form .field-submit .btn-calc,
  .panel-calc-form .field-submit-row .btn-ghost {
    width: 100%;
    max-width: none;
  }
}

@media (min-width: 880px) {
  .calc-form-grid {
    grid-template-columns: 1.4fr 0.55fr;
  }

  .field-span-2 {
    grid-column: 1 / -1;
  }

  .field-submit,
  .field-submit-row {
    grid-column: 2 / 3;
    justify-content: flex-end;
    align-self: end;
  }
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.field-input {
  width: 100%;
  max-width: 200px;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 18, 0.65);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.field-input:focus {
  outline: none;
  border-color: rgba(255, 107, 26, 0.55);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 107, 26, 0.15);
}

.btn-calc {
  min-width: 160px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(255, 107, 26, 0.25);
}

.btn-calc:hover {
  box-shadow: 0 6px 28px rgba(255, 107, 26, 0.35);
}

.field-mode {
  margin-top: 0.15rem;
}

.calc-mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.calc-mode-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.9rem;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.calc-mode-opt:hover {
  border-color: rgba(255, 107, 26, 0.28);
}

.calc-mode-opt.is-selected {
  border-color: rgba(255, 107, 26, 0.5);
  background: rgba(255, 107, 26, 0.12);
}

.calc-mode-opt input {
  margin: 0;
  accent-color: var(--accent);
}

.calc-equiv-hint {
  margin: 0.35rem 0 0.85rem;
}

/* —— выбор предмета: одно модальное окно —— */
.item-picker {
  position: relative;
  z-index: 5;
}

.item-picker.is-open {
  z-index: 120;
}

.item-picker-ui {
  position: relative;
  z-index: 4;
}

.item-picker-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  background: rgba(6, 10, 16, 0.62);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  appearance: none;
}

@supports (backdrop-filter: blur(6px)) {
  .item-picker-backdrop {
    background: rgba(6, 10, 16, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

.item-picker-backdrop[hidden] {
  display: none !important;
}

.item-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(8, 11, 16, 0.75);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.item-picker-trigger:hover {
  border-color: rgba(255, 107, 26, 0.35);
}

.item-picker-trigger.is-placeholder .item-picker-trigger-text {
  color: var(--muted);
}

.item-picker-trigger-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.item-picker-trigger-icon {
  border-radius: 10px;
  background: #0d1117;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.item-picker-trigger-text {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
}

.item-picker-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  flex-shrink: 0;
  margin-right: 0.25rem;
  transition: transform 0.2s ease;
}

.item-picker-trigger[aria-expanded="true"] .item-picker-chevron {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}

.item-picker-popover {
  width: min(22rem, calc(100vw - 2rem));
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.item-picker.is-open .item-picker-popover {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-width: none;
  max-height: min(82dvh, 34rem);
  min-height: 0;
  animation: item-picker-in 0.2s ease-out;
}

@keyframes item-picker-in {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .item-picker.is-open .item-picker-popover {
    animation: none;
  }
}

.item-picker-modal {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, #1c2533 0%, #121820 55%, #0f141c 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.item-picker-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.75rem 0.85rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.15);
}

.item-picker-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.item-picker-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, color 0.15s;
}

.item-picker-close:hover {
  background: rgba(255, 107, 26, 0.15);
  color: var(--text);
}

.item-picker-close:focus-visible {
  outline: 2px solid rgba(255, 107, 26, 0.55);
  outline-offset: 2px;
}

.item-picker-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 0.65rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.item-picker-modal-foot {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.65rem 0.85rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.18);
}

.item-picker-done {
  min-width: 8.5rem;
  padding: 0.6rem 1.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 11px;
  border: 1px solid rgba(255, 107, 26, 0.5);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 4px 18px rgba(255, 107, 26, 0.22);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.item-picker-done:hover {
  filter: brightness(1.07);
}

.item-picker-done:focus-visible {
  outline: 2px solid rgba(255, 200, 150, 0.9);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .item-picker.is-open .item-picker-popover {
    width: min(calc(100vw - 1.25rem), 22rem);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1rem);
  }

  .item-picker-modal {
    border-radius: 16px;
  }
}

.item-picker-search {
  flex-shrink: 0;
  align-self: stretch;
  width: auto;
  margin: 0.65rem 0.65rem 0.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
}

.item-picker-search:focus {
  outline: none;
  border-color: rgba(255, 107, 26, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 107, 26, 0.12);
}

.item-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr));
  gap: 0.4rem;
  padding: 0.35rem 0 0.65rem;
  align-content: start;
}

.item-picker-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, transform 0.14s;
  min-width: 0;
}

.item-picker-option:hover {
  background: rgba(255, 107, 26, 0.1);
  border-color: rgba(255, 107, 26, 0.22);
}

.item-picker-option.is-selected {
  border-color: rgba(255, 107, 26, 0.65);
  background: rgba(255, 107, 26, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 26, 0.2);
}

.item-picker-option img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #0d1117;
  object-fit: contain;
}

.item-picker-option-name {
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.item-picker-option.is-selected .item-picker-option-name {
  color: var(--text);
}

.item-picker-option-ph {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #2a3544;
}

/* —— излишки / побочные выходы (внутри узла дерева) —— */
.tree-surplus {
  margin-top: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 190, 120, 0.08) 0%, rgba(255, 160, 80, 0.04) 100%);
  border: 1px solid rgba(255, 200, 140, 0.22);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.tree-surplus-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #f5d4a8;
  margin-bottom: 0.35rem;
}

.tree-surplus-drain {
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 0.55rem;
}

.tree-surplus-drain a {
  color: var(--link);
}

.tree-surplus-item-drain {
  font-size: 0.72rem;
  margin-top: 0.28rem;
}

.tree-surplus-item-drain a {
  color: var(--link);
}

.tree-surplus-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-surplus-item {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.4rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tree-surplus-item:first-child {
  border-top: none;
  padding-top: 0;
}

.tree-surplus-icon img {
  border-radius: 8px;
  background: #0d1117;
  display: block;
}

.tree-surplus-body {
  min-width: 0;
  flex: 1;
}

.tree-surplus-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
}

.tree-surplus-name {
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

.tree-surplus-name:hover {
  text-decoration: underline;
}

.tree-surplus-rate {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}

.tree-surplus-uses {
  font-size: 0.78rem;
  margin-top: 0.2rem;
  line-height: 1.45;
}

.tree-surplus-use {
  display: inline;
}

.tree-surplus-use-m {
  opacity: 0.75;
}

.tree-surplus-more {
  color: var(--accent);
  font-weight: 600;
}

.panel-surplus-summary .panel-hint code {
  font-size: 0.82em;
}

.surplus-summary-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.surplus-summary-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.surplus-summary-row:last-child {
  border-bottom: none;
}

.surplus-summary-icon img {
  border-radius: 10px;
  background: #0d1117;
  display: block;
}

.surplus-summary-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}

.surplus-summary-name {
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

.surplus-summary-name:hover {
  text-decoration: underline;
}

.surplus-summary-rate {
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  color: #f0c080;
}

.surplus-summary-uses {
  font-size: 0.82rem;
  margin-top: 0.25rem;
  line-height: 1.45;
}

.surplus-summary-m {
  opacity: 0.75;
}

.surplus-summary-more {
  color: var(--accent);
  font-weight: 600;
}

.raw-uses {
  font-size: 0.76rem;
  margin-top: 0.35rem;
  line-height: 1.35;
  max-width: 42rem;
}

.raw-use-name {
  color: var(--muted);
}

.raw-use-more {
  color: var(--accent);
  font-weight: 600;
}

.table-premium thead th {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}

.table-premium tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.th-num,
.td-num {
  text-align: right;
}

.td-strong {
  font-weight: 600;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field select,
.field input[type="number"] {
  min-width: 220px;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121820;
  color: var(--text);
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font: inherit;
}

.btn:hover {
  filter: brightness(1.08);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(255, 107, 26, 0.12);
  border: 1px solid rgba(255, 107, 26, 0.35);
  color: #ffd4bf;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.item-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.item-cell img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: #0d1117;
}

.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.panel-hint {
  margin: -0.35rem 0 1rem;
  font-size: 0.88rem;
  max-width: 70ch;
}

.panel-tree {
  overflow: hidden;
}

.tree-flow-from {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.75rem 0.55rem;
  margin: 0;
  font-size: 0.78rem;
  color: #b8cfe6;
  background: linear-gradient(90deg, rgba(110, 200, 255, 0.12) 0%, transparent 100%);
  border-bottom: 1px solid rgba(110, 200, 255, 0.15);
}

.tree-li-rawflow > .tree-flow-from {
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, rgba(94, 219, 149, 0.14) 0%, transparent 100%);
  border-bottom-color: rgba(94, 219, 149, 0.22);
  color: #b8e8d0;
}

.tree-li-rawflow:has(> .tree-flow-from) > .tree-raw-flow {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tree-flow-from-icon {
  font-size: 1rem;
  opacity: 0.85;
  flex-shrink: 0;
}

.tree-flow-from-arr {
  opacity: 0.55;
  margin: 0 0.15rem;
}

.tree-col-arrow {
  opacity: 0.55;
  font-weight: 400;
  margin-left: 0.12rem;
}

.tree-descend-label {
  font-size: 0.76rem;
  color: #b8c9de;
  margin-bottom: 0.35rem;
  padding-left: 0.15rem;
  line-height: 1.35;
}

.tree-descend-arr {
  color: var(--accent);
  margin-right: 0.28rem;
}

.tree-scroll {
  overflow-x: auto;
  margin: 0;
  padding: 0.35rem 0.15rem 0.85rem;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, transparent 40%);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.tree-root,
.tree-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-root {
  padding-left: 0.15rem;
}

.tree-li-flow {
  margin: 0.75rem 0;
  list-style: none;
}

.tree-li-flow > .tree-flow-from + .tree-node-flow {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tree-node-flow {
  position: relative;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(160deg, rgba(36, 46, 60, 0.98) 0%, rgba(18, 24, 32, 0.99) 100%);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 8px 32px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tree-node-flow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #ff9a5c, var(--accent) 45%, rgba(110, 200, 255, 0.45));
  border-radius: 16px 0 0 16px;
  opacity: 0.95;
}

.tree-node-flow[open] {
  border-color: rgba(255, 107, 26, 0.3);
  box-shadow:
    0 0 0 1px rgba(255, 107, 26, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.38);
}

.tree-node-flow > summary {
  list-style: none;
  cursor: pointer;
  padding: 0;
  outline: none;
}

.tree-node-flow > summary::-webkit-details-marker {
  display: none;
}

.tree-node-flow > summary:hover .tree-flow-summary-inner {
  background: rgba(255, 255, 255, 0.02);
}

.tree-node-flow > summary:focus-visible .tree-flow-summary-inner {
  box-shadow: inset 0 0 0 2px rgba(255, 107, 26, 0.35);
}

.tree-flow-summary-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  padding: 0.85rem 0.65rem 0.85rem 0.85rem;
  min-width: min-content;
  overflow-x: auto;
  scrollbar-gutter: stable;
}

.tree-flow-summary-inner > .tree-col-goal {
  flex: 0 1 13.5rem;
  min-width: 9rem;
}

.tree-flow-summary-inner > .tree-col-mac {
  flex: 0 1 15rem;
  min-width: 11rem;
}

.tree-flow-summary-inner > .tree-col-in {
  flex: 1.15 1 12rem;
  min-width: 9rem;
}

.tree-flow-summary-inner > .tree-flow-chev {
  margin-left: 0.35rem;
}

.tree-arrow-join {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 0 1 4.5rem;
  min-width: 2rem;
  max-width: 6rem;
  padding: 0 0.2rem;
  align-self: center;
}

.tree-arrow-line-h {
  flex: 1;
  height: 3px;
  min-width: 0.35rem;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 200, 150, 0.12), rgba(255, 140, 80, 0.95));
  box-shadow: 0 0 12px rgba(255, 107, 26, 0.28);
}

.tree-arrow-chevr {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  color: #ff9a5c;
  text-shadow:
    0 0 10px rgba(255, 107, 26, 0.55),
    0 0 20px rgba(255, 80, 40, 0.25);
  margin-left: -0.08rem;
  font-weight: 700;
}

.tree-arrow-join-muted .tree-arrow-line-h {
  background: linear-gradient(90deg, rgba(120, 180, 220, 0.08), rgba(110, 200, 255, 0.42));
  box-shadow: none;
}

.tree-arrow-join-muted .tree-arrow-chevr {
  color: rgba(140, 200, 240, 0.55);
  text-shadow: none;
}

.tree-arrow-join-raw .tree-arrow-line-h {
  background: linear-gradient(90deg, rgba(150, 230, 180, 0.12), rgba(94, 219, 149, 0.88));
  box-shadow: 0 0 12px rgba(94, 219, 149, 0.22);
}

.tree-arrow-join-raw .tree-arrow-chevr {
  color: #7ae8a8;
  text-shadow: 0 0 10px rgba(94, 219, 149, 0.4);
}

@media (max-width: 960px) {
  .tree-flow-summary-inner {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    overflow-x: visible;
    gap: 0;
  }

  .tree-flow-summary-inner > .tree-arrow-join {
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
    height: 2.25rem;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0.15rem 0;
  }

  .tree-flow-summary-inner > .tree-arrow-join .tree-arrow-line-h {
    width: 3px;
    height: 0.85rem;
    min-height: 0.85rem;
    min-width: 3px;
    flex: 0 0 auto;
    background: linear-gradient(180deg, rgba(255, 200, 150, 0.15), rgba(255, 140, 80, 0.95));
  }

  .tree-flow-summary-inner > .tree-arrow-join .tree-arrow-chevr {
    transform: rotate(90deg);
    margin-left: 0;
    margin-top: -0.15rem;
  }

  .tree-flow-summary-inner > .tree-arrow-join-muted .tree-arrow-line-h {
    background: linear-gradient(180deg, rgba(120, 180, 220, 0.1), rgba(110, 200, 255, 0.4));
  }

  .tree-col-goal {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.65rem;
  }

  .tree-col-mac {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.65rem;
  }
}

.tree-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.tree-col-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8aa4c4;
}

.tree-ingrid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.25rem 0.35rem;
}

.tree-ingrid-empty {
  font-size: 0.85rem;
  padding: 0.35rem 0;
}

.tree-ingrid-plus {
  font-size: 0.75rem;
  padding: 0 0.1rem;
}

.tree-ingrid-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  max-width: 4.5rem;
}

.tree-ingrid-cell img {
  border-radius: 9px;
  background: #0d1117;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
  object-fit: contain;
  min-width: 32px;
  min-height: 32px;
}

.tree-ingrid-name {
  font-size: 0.62rem;
  line-height: 1.15;
  color: var(--muted);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tree-ingrid-ph {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #2a3544;
}

.tree-ingrid-more {
  font-size: 0.72rem;
  align-self: center;
  padding: 0 0.2rem;
}

/* Вертикальная стрелка к дочерним шагам */
.tree-arrow-col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
}

.tree-arrow {
  display: block;
}

.tree-arrow-v {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 13px solid rgba(255, 140, 80, 0.92);
  filter: drop-shadow(0 0 8px rgba(255, 107, 26, 0.45));
}

.tree-mac-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 107, 26, 0.14) 0%, rgba(0, 0, 0, 0.45) 100%);
  border: 1px solid rgba(255, 107, 26, 0.28);
  min-height: 4.5rem;
}

.tree-mac-img {
  border-radius: 12px;
  background: #0d1117;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  min-width: 56px;
  min-height: 56px;
}

.tree-mac-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.tree-mac-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: #ffc9a8;
  line-height: 1.2;
}

.tree-mac-count {
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.tree-mac-cycle {
  font-size: 0.72rem;
}

/* Карточка здания в духе игрового UI: тёмный фон, персиковая обводка, иконка слева */
.tree-mac-card-building {
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  min-height: 5.25rem;
  border-radius: 16px;
  border: 2px solid #b87a52;
  background: linear-gradient(165deg, #222831 0%, #11151c 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 8px 26px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.tree-mac-card-building .tree-mac-img {
  width: 64px;
  height: 64px;
}

.tree-mac-card-building .tree-mac-title {
  color: #e8a878;
  font-size: 0.93rem;
}

.tree-mac-card-building .tree-mac-count {
  color: #f0f2f7;
  font-size: 0.96rem;
  font-weight: 800;
}

.tree-mac-card-building .tree-mac-cycle {
  color: #949dad;
  font-size: 0.74rem;
  font-weight: 500;
}

.tree-mac-count-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.tree-mac-count-hint {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tree-out-target {
  display: block;
  font-size: 0.72rem;
  margin-top: 0.12rem;
}

.tree-mac-img-ph {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(145deg, #2c3848 0%, #171c24 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.tree-mac-raw {
  border-color: rgba(94, 219, 149, 0.35);
  background: linear-gradient(135deg, rgba(94, 219, 149, 0.12) 0%, rgba(0, 0, 0, 0.4) 100%);
  min-height: 5.25rem;
}

.tree-mac-raw .tree-mac-title {
  color: #9ee9bc;
}

.tree-out-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(110, 200, 255, 0.2);
  min-height: 4.5rem;
}

.tree-goal-card {
  min-height: 5.25rem;
  padding: 0.65rem 0.8rem;
  border-radius: 16px;
  border: 1px solid rgba(115, 185, 255, 0.4);
  background: linear-gradient(165deg, rgba(26, 34, 46, 0.98) 0%, #10141a 100%);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.32);
}

.tree-goal-card .tree-out-name {
  font-size: 1.02rem;
}

.tree-goal-img {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
}

.tree-out-img {
  border-radius: 11px;
  background: #0d1117;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
  min-width: 48px;
  min-height: 48px;
}

.tree-out-ph {
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 11px;
  background: #2a3544;
}

.tree-out-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.tree-out-name {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.tree-out-badge {
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #8af0b4;
  width: fit-content;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(94, 219, 149, 0.12);
  border: 1px solid rgba(94, 219, 149, 0.25);
}

.tree-out-recipe {
  font-size: 0.72rem;
  line-height: 1.3;
}

.tree-raw-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7ae8a8;
  margin-top: 0.1rem;
}

.tree-flow-chev {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-left: 0.15rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
}

.tree-flow-chev::after {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -0.2rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.tree-node-flow[open] > .tree-flow-summary .tree-flow-chev::after {
  transform: rotate(225deg);
  margin-top: 0.15rem;
  border-color: var(--accent);
}

.tree-node-flow[open] > .tree-flow-summary .tree-flow-chev {
  border-color: rgba(255, 107, 26, 0.35);
  background: rgba(255, 107, 26, 0.1);
}

.tree-flow-body {
  padding: 0.65rem 1rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.35) 100%);
}

@media (min-width: 780px) {
  .tree-flow-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1.25rem;
    align-items: start;
  }

  .tree-flow-body > .tree-io-detail:nth-of-type(1) {
    grid-column: 1;
  }

  .tree-flow-body > .tree-io-detail:nth-of-type(2) {
    grid-column: 2;
  }

  .tree-flow-body > .tree-surplus,
  .tree-flow-body > .tree-descend {
    grid-column: 1 / -1;
  }
}

.tree-io-detail {
  margin-top: 0.35rem;
}

.tree-io-detail:first-child {
  margin-top: 0;
}

.tree-io {
  margin-top: 0.35rem;
}

.tree-io:first-child {
  margin-top: 0;
}

.tree-io-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ab6d4;
  margin-bottom: 0.45rem;
  padding-left: 0.15rem;
  border-left: 3px solid rgba(110, 200, 255, 0.45);
}

.tree-io:first-of-type .tree-io-label {
  border-left-color: rgba(110, 200, 255, 0.55);
}

.tree-io:nth-of-type(2) .tree-io-label {
  border-left-color: rgba(255, 140, 80, 0.55);
}

.tree-io-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.tree-io-row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 0.45rem 0.55rem;
  align-items: center;
  font-size: 0.87rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.12s ease;
}

.tree-io-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tree-io-row:last-child {
  border-bottom: none;
}

.tree-io-row img {
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tree-io-amt {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.tree-io-rate {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: #b8cfe6;
}

.tree-descend {
  position: relative;
  margin-top: 0.85rem;
  padding: 0.5rem 0 0.25rem 1.4rem;
  border-top: 1px dashed rgba(255, 107, 26, 0.22);
}

.tree-descend::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 2.5rem;
  bottom: 0.5rem;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 140, 80, 0.85), rgba(255, 140, 80, 0.08));
  box-shadow: 0 0 14px rgba(255, 107, 26, 0.18);
}

.tree-descend-cap {
  display: flex;
  justify-content: center;
  padding: 0.15rem 0 0.45rem;
}

.tree-children-flow {
  margin: 0;
  padding: 0.25rem 0 0.25rem 0.85rem;
  border-left: none;
}

.tree-raw-flow {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  padding: 0.85rem 0.75rem;
  border-radius: 16px;
  border: 1px solid rgba(94, 219, 149, 0.35);
  background: linear-gradient(130deg, rgba(94, 219, 149, 0.1) 0%, rgba(18, 26, 34, 0.95) 100%);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  min-width: min-content;
  overflow-x: auto;
}

.tree-raw-flow > .tree-col-in {
  flex: 1 1 10rem;
  min-width: 7rem;
}

.tree-raw-flow > .tree-col-mac {
  flex: 0 1 11rem;
  min-width: 8rem;
}

.tree-raw-flow > .tree-col-out {
  flex: 0 1 9rem;
  min-width: 6rem;
}

.tree-raw-flow > .tree-arrow-join {
  flex: 0 1 3.5rem;
  min-width: 1.75rem;
  max-width: 5rem;
}

@media (max-width: 960px) {
  .tree-raw-flow {
    flex-direction: column;
    min-width: 0;
    overflow-x: visible;
  }

  .tree-raw-flow > .tree-arrow-join {
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
    height: 2.25rem;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0.15rem 0;
  }

  .tree-raw-flow > .tree-arrow-join .tree-arrow-line-h {
    width: 3px;
    height: 0.85rem;
    min-height: 0.85rem;
    min-width: 3px;
    flex: 0 0 auto;
    background: linear-gradient(180deg, rgba(150, 230, 180, 0.2), rgba(94, 219, 149, 0.75));
  }

  .tree-raw-flow > .tree-arrow-join .tree-arrow-chevr {
    transform: rotate(90deg);
    margin-left: 0;
    margin-top: -0.15rem;
    color: #7ae8a8;
    text-shadow: 0 0 8px rgba(94, 219, 149, 0.35);
  }

  .tree-raw-flow > .tree-arrow-join-muted .tree-arrow-line-h {
    background: linear-gradient(180deg, rgba(120, 180, 220, 0.1), rgba(110, 200, 255, 0.35));
  }

  .tree-raw-flow > .tree-arrow-join-muted .tree-arrow-chevr {
    color: rgba(140, 200, 240, 0.5);
    text-shadow: none;
  }
}

.tree-li-rawflow {
  list-style: none;
}

.tree-out-rawhint {
  min-height: auto;
  justify-content: center;
  font-size: 0.82rem;
}

.tree-error {
  padding: 0.55rem 0.85rem;
  border-radius: 11px;
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 120, 120, 0.38);
  color: #ffc8c8;
  font-size: 0.9rem;
}

.table-machines .th-icon,
.table-machines .td-icon {
  width: 52px;
  padding-right: 0.25rem;
}

.machine-table-img {
  border-radius: 8px;
  background: #0d1117;
  object-fit: contain;
  vertical-align: middle;
}

.panel-power-conveyor .calc-power-total {
  margin: 0.35rem 0 0.75rem;
  font-size: 1.05rem;
}

.panel-power-conveyor .calc-power-table {
  margin-top: 0.35rem;
}

.panel-power-conveyor .calc-power-unknown {
  margin-top: 0.65rem;
}

.panel-power-conveyor .calc-conveyor-line {
  margin: 0.85rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(120, 180, 220, 0.2);
  font-size: 0.98rem;
}

.panel-power-conveyor .calc-pipe-line {
  margin: 0.65rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(120, 180, 220, 0.15);
  font-size: 0.98rem;
}
