:root {
  color-scheme: dark;
  --bg: #171716;
  --surface: #20201f;
  --surface-2: #292826;
  --surface-3: #32302d;
  --line: #3a3835;
  --text: #f1ede6;
  --muted: #aaa49b;
  --accent: #bd5b32;
  --accent-light: #df7a4f;
  --accent-wash: rgba(189, 91, 50, 0.12);
  --success: #b5c58b;
  --radius: 14px;
  font-family: Inter, system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 3px; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
}

.site-header, main { width: min(1320px, calc(100% - 40px)); margin-inline: auto; }
.site-header { height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; aspect-ratio: 1; background: var(--accent); font-family: "Barlow Condensed", sans-serif; font-size: 1.65rem; font-weight: 800; transform: rotate(-3deg); }
.brand strong, .brand small { display: block; text-transform: uppercase; line-height: .9; }
.brand strong { font-family: "Barlow Condensed", sans-serif; font-size: 1.25rem; letter-spacing: .04em; }
.brand small { margin-top: 4px; color: var(--muted); font-size: .66rem; letter-spacing: .18em; }
.vanilla-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.vanilla-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(181,197,139,.1); }

.intro { display: flex; justify-content: space-between; align-items: end; gap: 40px; padding: 46px 0 34px; }
.intro > p { width: min(430px, 42%); color: var(--muted); line-height: 1.65; margin: 0 0 4px; }
.eyebrow { margin: 0 0 8px; color: var(--accent-light); font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Barlow Condensed", sans-serif; }
h1 { margin-bottom: 0; font-size: clamp(2.9rem, 6vw, 5.4rem); line-height: .86; letter-spacing: -.035em; text-transform: uppercase; }
h1 em { color: var(--accent-light); font-style: normal; }
h2 { margin-bottom: 0; font-size: 1.75rem; text-transform: uppercase; letter-spacing: .02em; }
h3 { margin-bottom: 0; }

.tabs { display: flex; border: 1px solid var(--line); border-bottom: 0; width: max-content; border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.tab { min-width: 180px; padding: 15px 26px; border: 0; border-right: 1px solid var(--line); background: #1b1b1a; color: var(--muted); cursor: pointer; font-weight: 700; text-align: left; }
.tab:last-child { border-right: 0; }
.tab span { color: #69645e; font-size: .7rem; margin-right: 10px; }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: inset 0 -2px var(--accent); }
.tab.is-active span { color: var(--accent-light); }

.panel { border-top: 1px solid var(--line); }
.workspace-grid, .raid-layout { display: grid; grid-template-columns: minmax(0, .92fr) minmax(460px, 1.08fr); gap: 18px; padding: 18px 0 58px; }
.work-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.section-heading { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.section-heading .eyebrow { margin-bottom: 4px; }
.text-button { border: 0; background: none; padding: 7px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--text); }

.item-input-list { padding: 8px 14px 14px; }
.item-input-row { display: grid; grid-template-columns: 50px minmax(0, 1fr) 112px; align-items: center; gap: 13px; padding: 10px 8px; border-bottom: 1px solid #302f2d; }
.item-input-row:last-child { border-bottom: 0; }
.item-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #48443f, #2c2b29); border: 1px solid #484540; overflow: hidden; }
.item-icon img { width: 88%; height: 88%; object-fit: contain; }
.item-name { min-width: 0; }
.item-name strong { display: block; font-size: .93rem; line-height: 1.25; }
.item-name small { color: var(--muted); font-size: .72rem; }
.number-control { display: grid; grid-template-columns: 30px 1fr 30px; height: 40px; background: #171716; border: 1px solid #45423e; border-radius: 8px; overflow: hidden; }
.number-control button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.05rem; }
.number-control button:hover { background: var(--surface-3); color: var(--text); }
.number-control input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text); text-align: center; font-weight: 700; -moz-appearance: textfield; }
.number-control input::-webkit-inner-spin-button { appearance: none; }

.button { border: 1px solid transparent; border-radius: 8px; padding: 10px 14px; cursor: pointer; font-weight: 700; font-size: .78rem; }
.button-secondary { background: var(--surface-3); border-color: #4a4742; }
.button-secondary:hover { background: #3a3835; }
.empty-state { display: grid; place-items: center; min-height: 438px; padding: 42px; text-align: center; color: var(--muted); }
.empty-state span { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 14px; border: 1px dashed #5b5650; border-radius: 50%; color: var(--accent-light); font-size: 1.7rem; }
.empty-state h3 { color: var(--text); font-size: 1.35rem; text-transform: uppercase; }
.empty-state p { margin: 7px 0 0; font-size: .85rem; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.summary-metric { padding: 18px 22px; border-right: 1px solid var(--line); }
.summary-metric:last-child { border-right: 0; }
.summary-metric strong { display: block; font-family: "Barlow Condensed", sans-serif; font-size: 2rem; line-height: 1; color: var(--text); }
.summary-metric span { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.summary-metric.accent strong { color: var(--accent-light); }
.result-section { padding: 20px 22px 8px; border-bottom: 1px solid var(--line); }
.result-section:last-child { border-bottom: 0; }
.subheading { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.subheading h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; }
.subheading span { color: var(--muted); font-size: .67rem; }
.material-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 54px; border-top: 1px solid #302f2d; }
.material-row:first-child { border-top: 0; }
.material-row .item-icon { width: 38px; height: 38px; border-radius: 8px; }
.material-row strong { display: block; font-size: .86rem; }
.material-row small { color: var(--muted); font-size: .68rem; }
.material-amount { font-family: "Barlow Condensed", sans-serif; font-size: 1.42rem; font-weight: 700; letter-spacing: .02em; }
.surplus { color: var(--success); }

.raid-layout { grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr); }
.quantity-label { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.quantity-label input { width: 72px; height: 42px; border: 1px solid #4a4742; border-radius: 8px; background: #171716; color: var(--text); text-align: center; font-size: 1rem; font-weight: 700; }
.target-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 14px; }
.target-option { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 12px; min-height: 76px; padding: 9px; border: 1px solid #373532; border-radius: 10px; background: #252422; text-align: left; cursor: pointer; }
.target-option:hover { border-color: #59544e; background: #2b2a27; }
.target-option.is-active { border-color: var(--accent); background: var(--accent-wash); box-shadow: inset 0 0 0 1px rgba(189,91,50,.15); }
.target-option .item-icon { width: 58px; height: 58px; }
.target-option strong { display: block; font-size: .84rem; }
.target-option small { display: block; margin-top: 3px; color: var(--muted); font-size: .68rem; }
.target-summary { min-height: 102px; display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.target-summary .item-icon { width: 66px; height: 66px; }
.target-summary h2 { font-size: 1.85rem; }
.target-summary p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }
.compare-note { margin: 14px 16px 6px; padding: 10px 12px; border-radius: 8px; background: #1a1a19; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.compare-note span { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.method-list { padding: 6px 16px 8px; }
.method-row { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 77px; padding: 9px 10px; border-bottom: 1px solid #34322f; }
.method-row:last-child { border-bottom: 0; }
.method-row.is-cheapest { margin: 4px 0; border: 1px solid rgba(181,197,139,.45); border-radius: 10px; background: rgba(181,197,139,.06); }
.method-row .item-icon { width: 46px; height: 46px; }
.method-copy strong { display: block; font-size: .82rem; }
.method-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: .68rem; }
.method-copy .best-label { color: var(--success); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.method-action { text-align: right; }
.method-action strong { display: block; font-family: "Barlow Condensed", sans-serif; font-size: 1.45rem; color: var(--accent-light); }
.use-button { margin-top: 5px; padding: 5px 8px; border: 1px solid #4a4742; border-radius: 6px; background: #302e2b; color: var(--text); cursor: pointer; font-size: .65rem; font-weight: 700; }
.use-button:hover { border-color: var(--accent); }
.method-disclaimer { margin: 4px 20px 18px; color: #77716a; font-size: .65rem; line-height: 1.45; }

.how-it-works { padding: 42px 0 52px; border-top: 1px solid var(--line); }
.explain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 20px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.explain-grid > div { padding: 24px; background: var(--surface); }
.explain-grid strong { color: var(--accent-light); font-family: "Barlow Condensed", sans-serif; }
.explain-grid h3 { margin: 18px 0 5px; font-size: 1.15rem; text-transform: uppercase; }
.explain-grid p { margin-bottom: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
footer { display: flex; justify-content: space-between; gap: 30px; padding: 28px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
footer strong { color: var(--text); text-transform: uppercase; }
footer p { margin: 6px 0 0; }
.sources { display: flex; align-items: center; gap: 16px; }
.sources span { color: #736e68; text-transform: uppercase; letter-spacing: .12em; }
.sources a { color: var(--muted); text-underline-offset: 3px; }
.sources a:hover { color: var(--text); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(360px, calc(100% - 44px)); padding: 12px 16px; border: 1px solid #5d584f; border-radius: 8px; background: #292725; color: var(--text); font-size: .78rem; box-shadow: 0 16px 40px rgba(0,0,0,.35); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .workspace-grid, .raid-layout { grid-template-columns: 1fr; }
  .result-card { min-height: 420px; }
  .intro { align-items: start; }
}

@media (max-width: 680px) {
  .site-header, main { width: min(100% - 24px, 1320px); }
  .site-header { height: 66px; }
  .vanilla-pill { font-size: .64rem; }
  .intro { display: block; padding: 32px 0 26px; }
  .intro > p { width: 100%; margin-top: 20px; font-size: .88rem; }
  h1 { font-size: clamp(2.75rem, 14vw, 4rem); }
  .tabs { width: 100%; }
  .tab { flex: 1; min-width: 0; padding: 14px 16px; }
  .workspace-grid, .raid-layout { padding-top: 12px; gap: 12px; }
  .section-heading { min-height: 78px; padding: 16px; }
  .section-heading h2 { font-size: 1.5rem; }
  .section-heading .button { width: 112px; padding-inline: 8px; }
  .item-input-list { padding: 5px 8px 10px; }
  .item-input-row { grid-template-columns: 44px minmax(0, 1fr) 105px; gap: 9px; padding: 9px 4px; }
  .item-icon { width: 44px; height: 44px; }
  .item-name strong { font-size: .82rem; }
  .summary-metric { padding: 15px 13px; }
  .summary-metric strong { font-size: 1.65rem; }
  .result-section { padding-inline: 15px; }
  .target-grid { grid-template-columns: 1fr 1fr; padding: 8px; gap: 6px; }
  .target-option { grid-template-columns: 44px 1fr; min-height: 64px; gap: 8px; padding: 7px; }
  .target-option .item-icon { width: 44px; height: 44px; }
  .target-option strong { font-size: .72rem; line-height: 1.2; }
  .target-option small { font-size: .62rem; }
  .quantity-label { display: block; text-align: right; }
  .quantity-label input { display: block; width: 66px; height: 38px; margin-top: 4px; }
  .method-list { padding-inline: 9px; }
  .method-row { grid-template-columns: 43px minmax(0, 1fr) auto; gap: 8px; padding-inline: 7px; }
  .method-row .item-icon { width: 41px; height: 41px; }
  .method-action strong { font-size: 1.25rem; }
  .explain-grid { grid-template-columns: 1fr; }
  footer { display: block; }
  .sources { margin-top: 22px; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
