:root {
  color-scheme: dark;
  --bg: #171713;
  --surface: #22221c;
  --surface-raised: #2b2a22;
  --surface-deep: #191a16;
  --line: #454439;
  --line-soft: #37372e;
  --text: #f3efdf;
  --muted: #b7b39f;
  --subtle: #888675;
  --green: #9ac85a;
  --green-deep: #638b38;
  --gold: #e9bd63;
  --red: #e98774;
  --focus: #c5e68e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -20%, #495136 0, transparent 52%),
    linear-gradient(180deg, #202019 0, var(--bg) 390px);
}
body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .19;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 32px 32px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.page-shell { position: relative; z-index: 1; width: min(1240px, 100%); margin: 0 auto; padding: 24px 24px 12px; }

.top {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 116px;
  padding: 20px 24px;
  border: 1px solid #55513f;
  border-radius: 16px;
  background: linear-gradient(125deg, #302e24, #24231d 58%, #27291e);
  box-shadow: 0 12px 30px #0003, inset 0 1px #ffffff0a;
}
.brand-mark { display: grid; flex: 0 0 68px; width: 68px; height: 68px; place-items: center; border: 1px solid #575444; border-radius: 12px; background: #171812; box-shadow: inset 0 0 0 4px #ffffff05; }
.brand-mark img { width: 48px; height: 48px; image-rendering: pixelated; }
.brand-copy { min-width: 0; }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .14em; line-height: 1.3; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 3px; font-size: clamp(23px, 3vw, 30px); letter-spacing: -.035em; line-height: 1.15; }
.sub { margin: 0; color: var(--muted); font-size: 14px; }
.edition-tag { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 8px 11px; border: 1px solid #504f40; border-radius: 99px; color: #d6d2c1; background: #17181266; font-size: 12px; white-space: nowrap; }
.edition-dot, .live-label span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px #9ac85a66; }

.grid { display: grid; grid-template-columns: minmax(330px, .86fr) minmax(0, 1.14fr); align-items: start; gap: 18px; margin-top: 18px; }
.work-column { display: grid; gap: 18px; min-width: 0; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(150deg, #292820, var(--surface) 55%); box-shadow: 0 8px 22px #0002, inset 0 1px #ffffff08; }
.setup-card, .items-card, .result-card { padding: 20px; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 19px; }
.section-heading > div { min-width: 0; }
.section-heading .eyebrow { margin-bottom: 2px; }
.section-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.step-mark { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border: 1px solid #668243; border-radius: 9px; color: #d4e8b3; background: #445d2d; font-size: 14px; font-weight: 800; box-shadow: inset 0 1px #ffffff1b; }
.field-block + .field-block { margin-top: 15px; }
.field-label { display: block; margin-bottom: 7px; color: #d5d1c1; font-size: 12px; font-weight: 700; }
.row { display: flex; align-items: stretch; gap: 8px; }
.combo-wrap { position: relative; flex: 1 1 160px; min-width: 0; }
.combo-in {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #555548;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-deep);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.combo-in::placeholder { color: #888675; }
.combo-in:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px #9ac85a20; }
.button { min-height: 42px; padding: 8px 13px; border: 1px solid #5b594a; border-radius: 8px; color: #f0eddf; background: linear-gradient(#39382e, #302f27); font-size: 12px; font-weight: 750; cursor: pointer; transition: transform .12s, border-color .12s, filter .12s; }
.button:hover { border-color: #8d8a70; filter: brightness(1.08); }
.button:active { transform: translateY(1px); }
.button-primary { border-color: #668941; color: #17200f; background: linear-gradient(#add875, #83ad4b); text-shadow: 0 1px #ffffff55; }
.button-primary:hover { border-color: #c0e28e; }
.settings { display: grid; gap: 11px; margin: 20px 0 0; padding: 14px 13px 13px; border: 1px solid var(--line-soft); border-radius: 10px; }
.settings legend { padding: 0 6px; color: var(--subtle); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.check-option { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check-option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--green); }
.check-copy { display: grid; gap: 2px; }
.check-copy strong { color: #e4e0d1; font-size: 12px; font-weight: 650; }
.check-copy small { color: var(--subtle); font-size: 11px; line-height: 1.35; }
.quick-section { margin-top: 20px; }
.quick-heading, .steps-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.quick-heading { margin-bottom: 9px; }
.quick-heading h3, .steps-heading h3 { margin: 0; color: #e4e0d1; font-size: 12px; font-weight: 750; }
.quick-heading > span, .steps-heading > span { color: var(--subtle); font-size: 10px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 7px; }
.qit { display: flex; min-width: 0; min-height: 77px; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 7px 4px; border: 1px solid var(--line-soft); border-radius: 9px; color: #dedaca; background: #1d1e19; cursor: pointer; transition: background .14s, border-color .14s, transform .14s; }
.qit:hover { transform: translateY(-1px); border-color: #7e995d; background: #292d20; }
.qit img { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; }
.qit span { max-width: 100%; color: #c6c2b2; font-size: 10px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.empty { display: grid; min-height: 128px; place-items: center; padding: 20px 16px; border: 1px dashed #4a493c; border-radius: 10px; color: var(--muted); background: #1c1d18a6; text-align: center; }
.empty-icon { margin-bottom: 6px; color: var(--gold); font-size: 22px; }
.empty strong { display: block; color: #e4e0d1; font-size: 13px; }
.empty p { max-width: 300px; margin: 5px 0 0; color: var(--subtle); font-size: 11px; line-height: 1.5; }
.compact-heading { margin-bottom: 14px; }
.item { margin-top: 10px; padding: 13px; border: 1px solid #4a493d; border-radius: 11px; background: linear-gradient(135deg, #303027, #25251f); }
.item:first-child { margin-top: 0; }
.item-h { display: flex; align-items: center; gap: 9px; min-width: 0; }
.item-h > img { flex: 0 0 auto; width: 34px; height: 34px; image-rendering: pixelated; }
.item-title { flex: 1; min-width: 0; color: var(--text); font-size: 14px; font-weight: 750; }
.pill { flex: 0 0 auto; padding: 4px 7px; border: 1px solid #5b5948; border-radius: 99px; color: #c8c2aa; background: #171812; font-size: 10px; white-space: nowrap; }
.icon-button { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border: 1px solid transparent; border-radius: 7px; color: #aaa693; background: transparent; font-size: 17px; cursor: pointer; }
.icon-button:hover { border-color: #764d42; color: #ffb2a1; background: #5a332c55; }
.prior-row { display: flex; align-items: center; gap: 9px; margin: 11px 0 7px; color: var(--muted); font-size: 11px; }
.prior-row input, .ench input { width: 68px; min-height: 33px; padding: 6px 8px; border: 1px solid #555548; border-radius: 7px; color: var(--text); background: var(--surface-deep); font-size: 12px; }
.combo-wrap-inline { position: relative; margin: 7px 0 3px; }
.combo-wrap-inline .combo-in { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.ench { display: grid; grid-template-columns: minmax(0, 1fr) 68px 30px; align-items: center; gap: 7px; padding: 8px 0 2px; border-top: 1px solid #ffffff10; }
.ench-name { min-width: 0; color: #e4e0d1; font-size: 12px; }
.ench-name small { display: inline-block; margin-left: 5px; color: var(--gold); font-size: 10px; }
.ench input { width: 100%; }

.result-card { min-height: 420px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.result-heading .section-heading { margin: 0; }
.result-mark { border-color: #75613a; color: #f2d99d; background: #51442d; }
.live-label { display: flex; align-items: center; gap: 7px; color: #9f9c89; font-size: 10px; white-space: nowrap; }
.live-label span { width: 6px; height: 6px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.kpi { display: flex; min-height: 86px; flex-direction: column-reverse; align-items: flex-start; justify-content: center; gap: 5px; padding: 12px 14px; border: 1px solid #4a493d; border-radius: 10px; background: linear-gradient(145deg, #1a1b16, #20211a); }
.kpi span { color: var(--muted); font-size: 10px; }
.kpi b { color: var(--green); font-size: clamp(19px, 2.5vw, 25px); line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.status { min-height: 18px; margin: 13px 0 10px; color: var(--gold); font-size: 12px; line-height: 1.45; }
.status:empty { min-height: 0; margin: 0; }
.steps-heading { margin: 9px 0 8px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 9px 7px; color: #bcb69e; font-size: 9px; font-weight: 800; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
td { padding: 10px 7px; border-top: 1px solid #ffffff10; color: #e0dccd; vertical-align: middle; }
td:first-child, th:first-child { width: 48px; }
td:last-child, th:last-child { white-space: nowrap; }
.step-n { color: var(--green); font-weight: 800; }
td img { width: 22px; height: 22px; image-rendering: pixelated; }
td small { color: var(--subtle); font-size: 10px; }
.steps-empty td { padding: 28px 12px; color: var(--subtle); text-align: center; line-height: 1.6; }
footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 22px 8px 8px; color: var(--subtle); font-size: 10px; text-align: center; }
footer > span:first-child { color: #c7c2af; font-weight: 700; }
footer a { color: #b9ce93; text-decoration-color: #b9ce9355; text-underline-offset: 3px; }
.footer-sep { color: #686757; }

.combo-list { position: absolute; z-index: 30; top: calc(100% + 5px); right: 0; left: 0; display: none; max-height: 250px; overflow-y: auto; padding: 4px; border: 1px solid #5a5949; border-radius: 9px; background: #1b1c17; box-shadow: 0 12px 28px #0009; }
.combo-hit { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 6px 8px; border-radius: 6px; color: #e7e3d4; font-size: 12px; cursor: pointer; }
.combo-hit img { flex: 0 0 auto; width: 22px; height: 22px; object-fit: contain; image-rendering: pixelated; }
.combo-hit:hover, .combo-hit.active { background: #34392a; }
.combo-hit.dim { color: var(--subtle); cursor: default; }

@media (max-width: 900px) {
  .page-shell { max-width: 760px; padding: 18px 18px 10px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .work-column { grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); align-items: start; }
  .result-card { min-height: 0; }
}
@media (max-width: 620px) {
  .page-shell { padding: 12px 12px 8px; }
  .top { min-height: 0; gap: 12px; padding: 15px; }
  .brand-mark { flex-basis: 52px; width: 52px; height: 52px; }
  .brand-mark img { width: 38px; height: 38px; }
  .edition-tag { display: none; }
  .sub { max-width: 35ch; font-size: 12px; line-height: 1.45; }
  .grid, .work-column { gap: 12px; margin-top: 12px; }
  .work-column { grid-template-columns: minmax(0, 1fr); }
  .setup-card, .items-card, .result-card { padding: 15px; }
  .section-heading { margin-bottom: 15px; }
  .result-heading { align-items: flex-start; }
  .live-label { padding-top: 5px; font-size: 9px; }
  .kpis { gap: 6px; }
  .kpi { min-height: 74px; padding: 10px 8px; }
  .kpi span { font-size: 9px; }
  .kpi b { font-size: 20px; }
  table { min-width: 500px; }
  footer { line-height: 1.5; }
}
@media (max-width: 390px) {
  .row { gap: 6px; }
  .button { padding-right: 9px; padding-left: 9px; font-size: 11px; }
  .kpi { align-items: center; text-align: center; }
  .live-label { max-width: 84px; white-space: normal; }
}
