@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #0b0f14;
  --bg-2: #111821;
  --panel: #151d28;
  --panel-2: #1b2532;
  --line: #263243;
  --line-2: #33435a;
  --text: #e6edf5;
  --muted: #8b9bb0;
  --dim: #5d6c80;
  --accent: #c3cdd8;      /* neutral silver (HP bars stay green) */
  --accent-ink: #0b0f14;
  --warn: #ffcc33;
  --danger: #ff4d5e;
  --info: #4db8ff;
  --violet: #b98cff;
  --gold: #ffc94d;
  --hb-green: #2ee68a;
  --hb-yellow: #ffd23f;
  --hb-red: #ff4d5e;
  --mana: #4d8dff;
  --tier-bronze: #c98a52;
  --tier-silver: #c7d2de;
  --tier-gold: #ffc94d;
  --tier-platinum: #9fe7ff;
  --tier-legendary: #ff8c3a;
  --tier-celestial: #e59bff;
  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Chakra Petch', 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: .02em; margin: 0; font-weight: 600; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.hidden { display: none !important; }

.btn {
  appearance: none; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 14px; min-height: 40px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; touch-action: manipulation; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 60%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-icon { min-width: 40px; padding: 0 10px; }
.btn-live { background: var(--danger); border-color: var(--danger); color: #fff; }

input[type=text], input[type=number], input[type=password], input[type=email], input[type=tel], input[type=url], input[type=search], input[type=date], input[type=time], input[type=datetime-local], input:not([type]), select, textarea {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 9px 11px; min-height: 40px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--info); outline-offset: 1px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
/* The box sits in the margin and the label text flows normally, so inline tags (HOMEBREW, links) don't split it into columns. */
label.check { display: block; position: relative; padding-left: 30px; min-height: 22px; line-height: 1.45; cursor: pointer; }
label.check > input:is([type=checkbox], [type=radio]) { position: absolute; left: 0; top: 1px; margin: 0; width: 20px; height: 20px; accent-color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-2); background: var(--bg-2); }
.chip-buff { border-color: color-mix(in srgb, var(--info) 55%, transparent); color: #bfe4ff; background: color-mix(in srgb, var(--info) 12%, transparent); }
.chip-debuff { border-color: color-mix(in srgb, var(--danger) 55%, transparent); color: #ffc2c8; background: color-mix(in srgb, var(--danger) 12%, transparent); }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; align-items: center; justify-content: center; }
.tier-bronze { color: var(--tier-bronze); } .tier-silver { color: var(--tier-silver); } .tier-gold { color: var(--tier-gold); }
.tier-platinum { color: var(--tier-platinum); } .tier-legendary { color: var(--tier-legendary); } .tier-celestial { color: var(--tier-celestial); }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--info); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: 0 8px 30px #0008; transition: opacity .3s, transform .3s; }
.toast-ok { border-left-color: var(--accent); } .toast-err { border-left-color: var(--danger); } .toast-warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 16px; padding: 0; width: min(94vw, 640px); max-height: 90vh; box-shadow: 0 30px 80px #000a; }
dialog::backdrop { background: #02050acc; backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal-head h3 { font-size: 19px; flex: 1; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }
.section-label { font-family: var(--font-display); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.disclaimer { font-size: 12px; color: var(--dim); }

/* --- pictures (avatars) --- */
.av { --s: 32px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden; background: var(--panel-2); border: 1px solid #ffffff22; vertical-align: middle; line-height: 1; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av .av-e { font-size: calc(var(--s) * .58); }
.av.av-ini span { font-size: calc(var(--s) * .38); font-weight: 700; color: #fff; letter-spacing: .02em; }
.av-sm { --s: 24px; } .av-md { --s: 40px; } .av-lg { --s: 56px; } .av-xl { --s: 112px; } .av-xxl { --s: 168px; border-radius: 18px; }
button.av, .av[data-avedit] { cursor: pointer; }
.av[data-avedit]:hover { outline: 2px solid var(--accent); }
.avp-back { position: fixed; inset: 0; background: #000a; z-index: 1000; display: grid; place-items: center; padding: 12px; }
.avp { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; width: min(460px, 100%); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.avp-h { display: flex; align-items: center; } .avp-h b { flex: 1; font-size: 17px; }
.avp-x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.avp-cur { display: flex; gap: 14px; align-items: center; } .avp-btns { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.avp-up { cursor: pointer; text-align: center; } .avp-note { font-size: 12px; color: var(--muted); }
.avp-sec { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.avp-colors { display: flex; gap: 6px; flex-wrap: wrap; } .avp-c { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; } .avp-c.on { border-color: #fff; }
.avp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.avp-e { aspect-ratio: 1; border-radius: 50%; border: 0; font-size: 22px; cursor: pointer; } .avp-e:hover { outline: 2px solid #fff; }
.avp-err { color: var(--danger); font-size: 13px; min-height: 1em; }
