:root {
  --bg: #12100e;
  --panel: #1c1916;
  --panel-2: #24201c;
  --line: #352f28;
  --text: #ece4d8;
  --muted: #9c9185;
  --accent: #e0a64b;
  --accent-ink: #1a1308;
  --good: #6fcf8a;
  --bad: #e2725b;
  --radius: 10px;
  --t4: #7aa6d6; --t5: #d66b5f; --t6: #e3a14a; --t7: #e9d86a; --t8: #f2f2f2;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 10px; }
h2:first-child { margin-top: 0; }

.topbar { padding: 16px 24px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 44px; height: 44px; filter: drop-shadow(0 2px 6px rgba(224, 166, 75, .25)); }
.brand-accent { color: var(--accent); }
h1 { letter-spacing: .01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
/* painel de configuração: rola sozinho e mantém os botões de ação sempre à vista */
.config { position: sticky; top: 16px; max-height: var(--config-max, calc(100vh - 32px)); overflow-y: auto; overscroll-behavior: contain; padding-bottom: 0; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.config-footer { position: sticky; bottom: 0; margin: 16px -18px 0; padding: 12px 18px 14px; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -10px 16px -10px rgba(0, 0, 0, .6); z-index: 5; }
.config-footer .actions { margin-top: 0; }
.config-footer .status { margin-top: 8px; min-height: 0; }
.config-footer .status:empty { display: none; }
@media (max-width: 900px) { .config { position: static; max-height: none; overflow: visible; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { color: var(--muted); font-size: 12px; }
select, input[type=text] {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; width: 100%;
}
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; font-size: 13px; background: var(--panel-2); }
.chip input { accent-color: var(--accent); margin: 0; }
.chip.off { opacity: .5; }

.slots { display: flex; flex-direction: column; gap: 8px; }
.slot { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
.slot .icon { width: 44px; height: 44px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 11px; }
.slot .icon img { width: 52px; height: 52px; }
.slot.disabled { opacity: .45; }

.picker { position: relative; }
.picker label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.picker .clear { position: absolute; right: 6px; bottom: 6px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; }
.dropdown { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 4px; max-height: 300px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.dropdown button { display: flex; width: 100%; align-items: center; gap: 8px; background: none; border: 0; color: var(--text); padding: 4px 8px; text-align: left; cursor: pointer; font: inherit; }
.dropdown button:hover, .dropdown button.active { background: #322b24; }
.dropdown img { width: 32px; height: 32px; }
.dropdown small { color: var(--muted); display: block; font-size: 11px; }

.actions { display: flex; gap: 8px; margin-top: 16px; }
button.primary, button.ghost { border-radius: 8px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; flex: 1; }
button.primary:disabled { opacity: .6; cursor: progress; }
button.ghost { background: none; color: var(--text); border: 1px solid var(--line); }
.status { color: var(--muted); min-height: 1.4em; margin: 10px 0 0; font-size: 13px; }
.status.error { color: var(--bad); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.hidden { display: none !important; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .value.accent { color: var(--accent); }
.stat .hint { color: var(--muted); font-size: 12px; }

.shopping { margin-bottom: 20px; }
.shopping ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.shopping > ul > li { padding: 8px 12px; background: var(--panel-2); border-radius: 8px; border: 1px solid var(--line); }
.shopping .city-head { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.shopping .city-items { list-style: none; margin: 4px 0 0; padding: 0; }
.shopping .city-items li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0 3px 12px; border-top: 1px dashed var(--line); color: var(--text); font-size: 13px; }
.shopping .city-items .price { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

.slot-card { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.slot-card header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.slot-card header img { width: 40px; height: 40px; }
.slot-card header .title { font-weight: 600; }
.slot-card header .title small { display: block; color: var(--muted); font-weight: 400; }
.slot-card header .best { margin-left: auto; text-align: right; }
.slot-card header .best b { color: var(--accent); font-size: 16px; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tr.selected { background: rgba(224, 166, 75, .06); }
tr.nodata td { color: var(--muted); }
.variant { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.variant img { width: 30px; height: 30px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-weight: 700; margin-left: 6px; }
.t4 { color: var(--t4); } .t5 { color: var(--t5); } .t6 { color: var(--t6); } .t7 { color: var(--t7); } .t8 { color: var(--t8); }
.age { color: var(--muted); font-size: 12px; }
.diff.up { color: var(--bad); } .diff.down { color: var(--good); }
.others { color: var(--muted); font-size: 12px; }

.chip.toggle { border-radius: 8px; margin-bottom: 12px; align-items: flex-start; padding: 8px 10px; }
td .age { font-weight: 400; }
td .age { white-space: normal; }
td.others { white-space: normal; min-width: 140px; }

.slot { grid-template-columns: 44px 1fr 132px; }
.slot-tier { align-self: end; padding: 8px 6px; font-size: 13px; }
.slot-tier.custom { border-color: var(--accent); color: var(--accent); }
.h2-hint { text-transform: none; letter-spacing: 0; font-weight: 400; }

.preset-save { display: flex; gap: 8px; margin-bottom: 8px; }
.preset-save input { flex: 1; min-width: 0; }
.preset-save button { padding: 8px 12px; white-space: nowrap; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.preset { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.preset button { background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 10px; }
.preset .preset-load:hover { color: var(--accent); }
.preset .preset-del { color: var(--muted); padding: 4px 9px 4px 4px; }
.preset .preset-del:hover { color: var(--bad); }
.recipe { list-style: none; margin: 2px 0 0; padding: 0; }
.recipe li { white-space: nowrap; }
.h2-total { float: right; color: var(--text); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.shopping.ready > ul > li { opacity: .8; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 16px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 14px; cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }

.craft-config { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-bottom: 16px; padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.craft-config .presets-rr, .craft-config .craft-help { grid-column: 1 / -1; }
.craft-config input { background: var(--panel); }
.craft-help { margin: 0; }
button.chip { color: var(--text); font: inherit; font-size: 13px; }
button.chip small { color: var(--muted); }
button.chip.on { border-color: var(--accent); color: var(--accent); }
.tag.muted { background: var(--line); color: var(--muted); }
.recipe li.good { color: var(--good); }
.craft-note { color: var(--muted); font-size: 13px; margin: 8px 2px 0; }
@media (max-width: 600px) { .craft-config { grid-template-columns: 1fr; } }
.craft-table td:nth-child(2) { white-space: normal; min-width: 260px; }
.craft-table .recipe li { white-space: normal; }
.share-box { margin-top: 10px; }
.share-box input { font-size: 12px; color: var(--accent); }
.stat .tip { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--accent); font-size: 12px; line-height: 1.35; }
.stat .tip::before { content: "i"; display: inline-grid; place-items: center; width: 14px; height: 14px; margin-right: 5px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 700; font-style: italic; vertical-align: 1px; }
.grid-2 .span-2 { grid-column: 1 / -1; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--panel); flex-shrink: 0; }
.lang-switch button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 600px) { .topbar { padding: 12px 16px; } .sub { display: none; } }
.foot .nick { color: var(--accent); letter-spacing: .02em; }
.table-wrap { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* rodapé fixo: barra fina com o crédito; a explicação abre acima dela */
body { padding-bottom: var(--foot-h, 44px); }
.foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; color: var(--muted); font-size: 12px; background: rgba(18, 16, 14, .94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.foot-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 24px; }
.foot-toggle { background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: inherit; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.foot-toggle:hover, .foot-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.foot-more { margin: 0; padding: 10px 24px 0; max-width: 1100px; line-height: 1.5; }
@media (max-width: 600px) { .foot-bar, .foot-more { padding-left: 16px; padding-right: 16px; } }
.brand-tag { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; margin-left: 6px; vertical-align: 3px; }
@media (max-width: 600px) { .brand-tag { display: none; } }

/* escolha da opção por peça */
td.pickable { cursor: pointer; position: relative; border-radius: 6px; transition: background .12s; }
td.pickable:hover { background: rgba(224, 166, 75, .07); }
td.pickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
td.pickable.picked { background: rgba(224, 166, 75, .14); box-shadow: inset 0 0 0 1px rgba(224, 166, 75, .55); }
.pick-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--muted); margin-right: 6px; vertical-align: -1px; }
td.pickable:hover .pick-dot { border-color: var(--accent); }
td.pickable.picked .pick-dot { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 45%, transparent 50%); }
tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.pick-hint { color: var(--muted); font-size: 12px; margin: 0 2px 12px; }
.stat .link { color: var(--accent); }

/* destino da peça: comprar / craftar / não incluir */
.slot-card header { flex-wrap: wrap; }
.dest { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.dest button { background: none; border: 0; border-right: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
.dest button:last-child { border-right: 0; }
.dest button:hover:not(:disabled) { color: var(--text); background: var(--panel-2); }
.dest button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.dest button[data-dest="none"][aria-pressed="true"] { background: var(--line); color: var(--text); }
.dest button:disabled { opacity: .35; cursor: not-allowed; }
.slot-card.excluded { border-style: dashed; }
.slot-card.excluded .table-wrap { opacity: .45; }
.slot-card.excluded .table-wrap:hover { opacity: .8; }
.excluded-note { color: var(--muted); font-size: 13px; margin: 0 2px 12px; }
.final-table { margin-bottom: 18px; }
.final-table td { vertical-align: middle; }
.final-table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }
.accent-text { color: var(--accent); font-size: 16px; }
.shopping.final h2 { display: flex; align-items: center; gap: 10px; }
.shopping.final h2 .h2-total { float: none; margin-left: auto; }
.shopping .copy-list { padding: 4px 10px; font-size: 12px; text-transform: none; letter-spacing: 0; color: var(--text); }

/* nome clicável que copia para a busca do mercado */
.copy-name { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: copy; text-align: left; border-bottom: 1px dashed var(--muted); }
.copy-name:hover { color: var(--accent); border-bottom-color: var(--accent); }
.copy-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.copy-name.copied { color: var(--good); border-bottom-color: var(--good); }
.copy-name.copied::after { content: " ✓"; }
.copy-tip { margin: -4px 2px 10px; }
.shopping.tab-end { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* comida/poção/montaria: tier exato + quantidade */
.slot-fixed { display: flex; gap: 4px; align-self: end; min-width: 0; }
.slot-fixed .slot-tier { flex: 1; min-width: 0; }
.qty-wrap { display: flex; align-items: center; position: relative; }
.qty-wrap span { position: absolute; right: 6px; font-size: 10px; color: var(--muted); pointer-events: none; }
.slot-qty { width: 58px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 22px 8px 6px; font: inherit; font-size: 13px; -moz-appearance: textfield; }
.slot-qty::-webkit-inner-spin-button, .slot-qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty-total { font-size: 12px; color: var(--text); }

/* aviso sobre a origem dos dados (abaixo do topo) */
.data-notice { display: flex; gap: 10px; align-items: flex-start; margin: 16px 24px 0; padding: 10px 14px; background: rgba(224, 166, 75, .08); border: 1px solid rgba(224, 166, 75, .35); border-radius: var(--radius); font-size: 13px; line-height: 1.45; }
.data-notice p { margin: 0; }
.data-notice a { white-space: nowrap; font-weight: 600; }
.data-notice-icon { flex-shrink: 0; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; font-style: italic; }
@media (max-width: 900px) { .data-notice { margin: 12px 16px 0; } }

/* página do guia do client */
.guide-page .brand { text-decoration: none; color: inherit; }
.guide { max-width: 820px; margin: 0 auto; padding: 24px 24px 80px; line-height: 1.6; }
.guide h1 { font-size: 26px; margin: 8px 0 12px; }
.guide h2 { font-size: 18px; margin: 28px 0 8px; color: var(--accent); text-transform: none; letter-spacing: 0; }
.guide .lead { font-size: 15px; }
.guide ol, .guide ul { padding-left: 22px; }
.guide li { margin-bottom: 8px; }
.guide code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.guide pre { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; overflow-x: auto; }
.guide pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.7; }
.back-link { font-size: 13px; }
@media (max-width: 600px) { .guide { padding: 16px 16px 80px; } .guide h1 { font-size: 21px; } }

/* telas médias: painel de configuração mais estreito e cards que quebram melhor */
@media (max-width: 1280px) and (min-width: 901px) {
  .layout { grid-template-columns: 330px minmax(0, 1fr); gap: 16px; padding: 16px; }
  .data-notice { margin: 12px 16px 0; }
  .slot { grid-template-columns: 40px minmax(0, 1fr) 112px; }
}
.summary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.slot-card header .title { min-width: 0; flex: 1 1 180px; }
.slot-card header .best { flex: 0 0 auto; }

/* rodapé: projeto gratuito + apoio */
.free-note { color: var(--muted); }
.support-links { display: inline-flex; gap: 6px; margin-left: 8px; vertical-align: middle; }
.support-links:empty { display: none; }
.support-btn { display: inline-block; background: none; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; padding: 2px 10px; cursor: pointer; text-decoration: none; }
.support-btn:hover { background: var(--accent); color: var(--accent-ink); }
@media (max-width: 600px) { .free-note { display: block; } .foot-bar .sep { display: none; } .foot-bar { align-items: flex-start; } }

/* topo: botão de ajuda + idioma */
.top-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.help-link { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; background: var(--panel); }
.help-link span[aria-hidden] { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; }
.help-link:hover, .help-link[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
@media (max-width: 600px) { .help-link span[data-i18n] { display: none; } .help-link { padding: 6px 8px; } }

/* página de ajuda */
.guide .toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 8px; }
.guide .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; text-decoration: none; background: var(--panel); }
.guide .toc a:hover { border-color: var(--accent); }
.guide h2[id] { scroll-margin-top: 16px; }
.guide dl { margin: 0; }
.guide dt { font-weight: 700; margin-top: 12px; }
.guide dd { margin: 4px 0 0; color: var(--text); }
