:root {
  --bg: #1e1f22; --panel: #2b2d31; --line: #3f4147; --text: #dbdee1; --dim: #949ba4;
  --accent: #3f8f62; --accent-2: #2f5d42; --bad: #d8434b; --good: #3ba55d; --gold: #e0b04a;
  font: 14px/1.4 "gg sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
button, input { font: inherit; color: inherit; }
button {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
button:hover { border-color: var(--dim); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.good { background: var(--good); border-color: var(--good); color: #fff; }
button.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
button.on { background: var(--accent-2); border-color: var(--accent); }
input[type=number], input[type=text] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; width: 5em;
}
#top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
h1 { font-size: 18px; margin: 0; }
#sub { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.hp { min-width: 220px; flex: 1; max-width: 360px; }
.hpbar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
#hpfill { height: 100%; width: 0; background: var(--good); transition: width .3s; }
.hpnum { margin: 4px 0; font-variant-numeric: tabular-nums; }
.hpact { display: flex; gap: 6px; }
nav { display: flex; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
main { flex: 1; padding: 12px; overflow: auto; }
footer { min-height: 1.6em; padding: 6px 12px; color: var(--dim); border-top: 1px solid var(--line); font-size: 13px; }
.note { color: var(--dim); }
.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; text-align: center; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--dim); }
.stat.click { cursor: pointer; }
.stat.click:hover { border-color: var(--accent); }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); margin: 16px 0 6px; }
table { border-collapse: collapse; width: 100%; }
td, th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--dim); font-weight: 600; font-size: 12px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--dim); }
.star { color: var(--gold); }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); background: var(--accent); cursor: pointer; padding: 0; }
.pip.used { background: transparent; }
.pip.dom { border-radius: 3px; border-color: #5865f2; background: #5865f2; }
.pip.dom.used { background: transparent; }
.chip { display: inline-block; padding: 3px 8px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; margin: 2px; }
.chip.on { background: var(--accent-2); border-color: var(--accent); }
.chip.used { text-decoration: line-through; color: var(--dim); }
.roll { background: var(--panel); border-left: 3px solid var(--accent); padding: 4px 8px; margin: 4px 0; border-radius: 4px; }
.warn { color: var(--gold); }
nav .sep { flex: 0 0 1px; background: var(--line); margin: 0 4px; }
#banner { padding: 6px 12px; background: #4a3b12; color: #f5dfa0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 1px 6px; border-radius: 8px; background: #4a3b12; color: #f5dfa0; margin-left: 6px; vertical-align: middle; }
.cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.card.me { border-color: var(--accent); }
.card h3 { margin: 0 0 2px; font-size: 15px; display: flex; justify-content: space-between; gap: 6px; }
.card .mini { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; margin: 4px 0; }
.card .mini div { height: 100%; }
.card p { margin: 3px 0; font-size: 13px; }
.card .row input { width: 4em; }
.mapbox { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.mapbox img { max-width: 100%; max-height: 70vh; border-radius: 6px; border: 1px solid var(--line); }
.mapbox.edit img { cursor: crosshair; }
.marker { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; line-height: 22px;
  background: var(--bad); border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(0,0,0,.45); text-align: center; font-size: 14px;
  pointer-events: none; animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(216,67,75,.25); } }
select { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
table.enemies input { width: 4.2em; }
table.enemies input.wide { width: 100%; min-width: 8em; }
table.enemies td { vertical-align: top; }
.down { text-decoration: line-through; color: var(--dim); }
details { margin: 6px 0; }
summary { cursor: pointer; color: var(--dim); }
#feed { border-top: 1px solid var(--line); background: var(--panel); max-height: 132px; overflow-y: auto; padding: 4px 12px; font-size: 13px; }
#feed .ev { padding: 2px 0; border-bottom: 1px solid var(--line); }
#feed .ev:last-child { border-bottom: 0; }
#feed .ev.new { animation: flash 2.5s ease-out; }
#feed time { color: var(--dim); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }
@keyframes flash { from { background: rgba(63,143,98,.45); } to { background: transparent; } }
.attack { background: #3a2a14; border: 1px solid var(--gold); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.attack p { margin: 0 0 6px; }
.wedit { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 4px 0 8px; }
.wedit label { display: inline-flex; flex-direction: column; font-size: 12px; color: var(--dim); margin: 0 8px 6px 0; }
.wedit label input[type=text], .wedit label input[type=number], .wedit label select { margin-top: 2px; }
.wedit label.chk { flex-direction: row; align-items: center; gap: 4px; color: var(--text); }
@media (max-width: 420px) { .hp { max-width: none; } }
