/* Tema escuro (pedra + âmbar). Sem build: variáveis CSS e classes de componente. */
:root {
    --bg: #0c0a09; --panel: #1c1917; --panel-2: #292524; --line: #44403c;
    --text: #e7e5e4; --muted: #a8a29e; --accent: #f59e0b; --accent-ink: #1c1917;
    --ok: #4ade80; --warn: #fb923c; --danger: #f87171;
    --gold: #facc15; --elixir: #f472b6; --dark: #a8a29e;
    --radius: 10px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
img { vertical-align: middle; object-fit: contain; }
button, input, textarea { font: inherit; color: inherit; }
b { font-weight: 700; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 16px; padding-bottom: 48px; }
.narrow { max-width: 760px; margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok { color: var(--ok); }
.h1 { font-size: 20px; margin: 0 0 12px; }

/* Topo */
.topbar { position: sticky; top: 0; z-index: 20; background: #0c0a09ee; border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.topbar__inner { display: flex; align-items: center; gap: 16px; height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.brand__logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav__link { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.nav__link:hover { color: var(--text); background: var(--panel-2); }
.nav__link.is-active { color: var(--accent); background: var(--panel); }
.switch { position: relative; }
.switch__btn { list-style: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.switch__btn::-webkit-details-marker { display: none; }
.switch__name { font-weight: 700; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch__menu { position: absolute; right: 0; top: calc(100% + 6px); width: 270px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 30px #000a; }
.switch__item { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 9px 12px; background: none; border: 0; text-align: left; cursor: pointer; }
.switch__item:hover, .switch__item.is-active { background: var(--panel-2); }
.switch__item.is-active > span:first-child { color: var(--accent); font-weight: 700; }
.switch__empty { padding: 12px; }
.switch__add { display: block; padding: 9px 12px; border-top: 1px solid var(--line); color: var(--accent); font-weight: 600; }

/* Componentes base */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card__title { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.card__title:not(:first-child) { margin-top: 14px; }
.card__sub { margin: 14px 0 6px; font-size: 13px; }
.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); margin-bottom: 12px; }
.notice--ok { border-color: #166534; color: var(--ok); }
.notice--error { border-color: #7f1d1d; color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip--ok { color: var(--ok); border-color: #166534; }
.chip--warn { color: var(--warn); border-color: #9a3412; }
.chip--muted { color: var(--muted); }
.btn { padding: 8px 14px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn--ghost:hover { color: var(--danger); border-color: var(--danger); filter: none; }
.btn--block { width: 100%; }
.input { width: 100%; margin-top: 4px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.input:focus, .num:focus { outline: 2px solid var(--accent); border-color: transparent; }
.input--mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.num { width: 64px; padding: 3px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.form { display: grid; gap: 12px; }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row.is-active { border-color: var(--accent); }
.row__actions { display: flex; gap: 8px; }
.row__actions.center { justify-content: center; }
.unit { display: flex; align-items: center; gap: 8px; }
.diff { list-style: none; padding: 0; margin: 0 0 12px; }
.diff li { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.diff li:last-child { border: 0; }

/* Seletores e toggles */
.seg { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg__label { padding: 5px 10px; color: var(--muted); background: var(--panel-2); }
.seg__btn { padding: 5px 12px; background: transparent; border: 0; border-left: 1px solid var(--line); cursor: pointer; }
.seg__btn:hover { background: var(--panel-2); }
.seg__btn.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.switch-input { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; }
.switch-input input { accent-color: var(--accent); width: 16px; height: 16px; }
.hammer { display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; }

/* Tracker */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.sticky { position: sticky; top: 68px; }
.grid-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; margin-bottom: 14px; }
.profile { display: flex; gap: 12px; }
.profile__img { width: 72px; height: 72px; flex: none; }
.profile__name { margin: 0; font-size: 18px; }
.profile__body { flex: 1; min-width: 0; }
.bars { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.bars li { display: grid; grid-template-columns: 70px 1fr 38px; gap: 8px; align-items: center; font-size: 12px; }
.bars b { text-align: right; }
.bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.next-th { display: flex; align-items: center; gap: 12px; }
.builders { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.builders li { display: flex; align-items: center; gap: 8px; }
.builders li > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.builders .is-free { padding: 4px 0 4px 36px; }
.builders .is-helper { opacity: .7; }
.totals { list-style: none; padding: 0; margin: 0 0 4px; display: grid; gap: 4px; }
.totals li { display: flex; justify-content: space-between; }
.big { font-size: 24px; font-weight: 800; color: var(--accent); margin: 8px 0 2px; }
.potions { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.potions summary { cursor: pointer; font-weight: 700; }
.potions label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { padding: 8px 12px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-color: var(--accent); }
.tab__count { margin-left: 4px; padding: 1px 6px; border-radius: 99px; background: var(--panel-2); color: var(--text); font-size: 11px; }
.tabs__toggle { margin-left: auto; font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl thead th { padding: 8px 10px; text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--panel-2); }
.tbl td, .tbl tbody th { padding: 7px 10px; text-align: center; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl .group th { text-align: center; background: var(--panel-2); font-weight: 400; }
.tbl .group th > * { margin: 0 6px; }
.group__name { font-weight: 800; font-size: 15px; }
.tbl th.unit { display: table-cell; font-weight: 600; text-align: left; }
.tbl th.unit img { margin-right: 8px; }
.tbl th.unit .chip { margin-left: 6px; }
.lvl { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.is-ready { background: #14532d33; }
.amt { display: inline-flex; align-items: center; gap: 4px; margin: 0 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt s { color: var(--muted); font-size: 11px; }
.amt[class*="res-"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.res-elixir::before { background: var(--elixir) !important; }
.res-dark-elixir::before { background: var(--dark) !important; border: 1px solid #fff4; }
.res-gold-or-elixir::before { background: linear-gradient(90deg, var(--gold) 50%, var(--elixir) 50%) !important; }
.actions { white-space: nowrap; }
.act { width: 28px; height: 28px; margin: 0 1px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); cursor: pointer; }
.act:hover { border-color: var(--accent); color: var(--accent); }
.act--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.act--primary:hover { color: var(--accent-ink); filter: brightness(1.1); }
.act--ok:hover { color: var(--ok); border-color: var(--ok); }
.act--danger:hover { color: var(--danger); border-color: var(--danger); }
.progress { position: relative; height: 18px; background: var(--bg); border-radius: 99px; overflow: hidden; min-width: 160px; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: #166534; }
.progress span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 18px; }

body:not(.show-maxed) [data-maxed] { display: none; }

@media (max-width: 1000px) {
    .layout, .two-col { grid-template-columns: 1fr; }
    .sticky { position: static; }
    .layout__side { order: -1; }
}
@media (max-width: 600px) {
    .brand__text { display: none; }
}
