:root {
  --bg: #0c0a11;
  --bg-2: #141019;
  --card: #1a1622;
  --card-2: #221c2d;
  --field: #0f0c15;
  --line: #2f2840;
  --line-2: #3d3452;
  --text: #ede9f6;
  --muted: #9b92b1;
  --accent: #ff3d7f;
  --accent-ink: #1a0610;
  --gold: #ffd23f;
  --hp: #e5484d;
  --hp-2: #ff7a59;
  --mp: #3e8bff;
  --mp-2: #6cd4ff;
  --ok: #3ccf91;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bungee", "Impact", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --tier-bronce: #cd8a4f;
  --tier-plata: #c3ccd6;
  --tier-oro: #ffd23f;
  --tier-platino: #9fe7e0;
  --tier-legendario: #b46cff;
  --tier-celestial: #6cd4ff;

  /* Colores de texto y superficies que cambian con el tema */
  --gold-text: var(--gold);
  --gold-ink: #ffe796;
  --accent-text: var(--accent);
  --accent-ink-soft: #ffc2d6;
  --hp-text: var(--hp-2);
  --danger-ink: #ffb3b5;
  --ok-text: var(--ok);
  --ok-ink: #a8f0cf;
  --mana-ink: #b7d3ff;
  --btn-hover: #2a2337;
  --placeholder: #5f5775;
  --well: #0b0910;
  --topbar-bg: rgba(12, 10, 17, .85);
  --toast-bg: rgba(20, 14, 26, .96);
  --nav-bg: rgba(14, 11, 19, .94);
  --tint: 255, 255, 255;
  color-scheme: dark;
}

/* ---------- Modo normal (claro) ---------- */
:root[data-theme="light"] {
  --bg: #f4f1f8;
  --bg-2: #f7f4fb;
  --card: #ffffff;
  --card-2: #f8f6fb;
  --field: #ffffff;
  --line: #e3dcec;
  --line-2: #cfc5dd;
  --text: #1d1726;
  --muted: #675d7c;
  --accent: #e3266a;
  --accent-ink: #ffffff;
  --gold: #f5c518;
  --hp: #d93a40;
  --hp-2: #e8603f;
  --mp: #2f7bf0;
  --mp-2: #4fb8e8;
  --ok: #1fae74;
  --shadow: 0 6px 20px rgba(45, 25, 80, .08);

  --tier-plata: #8f9aa6;
  --tier-platino: #3fb3a8;
  --tier-celestial: #2a9fd6;

  --gold-text: #946500;
  --gold-ink: #7d5500;
  --accent-text: #c4185a;
  --accent-ink-soft: #a8124c;
  --hp-text: #b8262c;
  --danger-ink: #a91f25;
  --ok-text: #0f7d52;
  --ok-ink: #0d6e48;
  --mana-ink: #1a56b8;
  --btn-hover: #efe9f6;
  --placeholder: #a99fb9;
  --well: #f3eff8;
  --topbar-bg: rgba(255, 255, 255, .88);
  --toast-bg: rgba(255, 255, 255, .98);
  --nav-bg: rgba(255, 255, 255, .95);
  --tint: 40, 20, 70;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 61, 127, .12), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(62, 139, 255, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-ui);
}

h1, h2, h3, h4 { margin: 0; font-weight: 400; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 12px 24px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: var(--accent-ink);
  font: 15px var(--font-display);
  transform: rotate(-6deg);
  box-shadow: 0 6px 18px rgba(255, 61, 127, .35);
}
.brand h1 { font: 20px/1.1 var(--font-display); letter-spacing: .5px; }
.brand-sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-theme .theme-icon { font-size: 15px; line-height: 1; }
html { transition: background-color .2s ease; }
.save-status { color: var(--muted); font-size: 12px; min-width: 70px; text-align: right; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--muted); background: var(--btn-hover); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible, .die-btn:focus-visible, .hbox:focus-visible, .seg button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #ff5a93; border-color: #ff5a93; }
.btn-danger { background: rgba(229, 72, 77, .15); border-color: rgba(229, 72, 77, .55); color: var(--danger-ink); }
.btn-danger:hover { background: rgba(229, 72, 77, .28); border-color: var(--hp); }
.btn-ok { background: rgba(60, 207, 145, .12); border-color: rgba(60, 207, 145, .5); color: var(--ok-ink); }
.btn-ok:hover { background: rgba(60, 207, 145, .24); border-color: var(--ok); }
.btn-mana { background: rgba(62, 139, 255, .14); border-color: rgba(62, 139, 255, .55); color: var(--mana-ink); }
.btn-mana:hover { background: rgba(62, 139, 255, .26); border-color: var(--mp); }
.btn-gold { background: rgba(255, 210, 63, .12); border-color: rgba(255, 210, 63, .5); color: var(--gold-ink); }
.btn-gold:hover { background: rgba(255, 210, 63, .24); border-color: var(--gold); }
.btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1c1500; }

.link-btn {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { color: var(--danger-ink); background: rgba(229, 72, 77, .14); border-color: rgba(229, 72, 77, .4); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 24px 60px;
}
.col-side, .col-main { display: grid; gap: 20px; align-content: start; min-width: 0; }
.col-main { gap: 28px; }

@media (min-width: 960px) {
  .layout { grid-template-columns: 360px minmax(0, 1fr); }
  .col-side { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font: 18px/1.2 var(--font-display);
  letter-spacing: .8px;
  color: var(--text);
}
.group-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }

/* Columnas tipo "masonry": cada tarjeta ocupa solo su alto, sin huecos. */
.grid-lists { columns: 400px; column-gap: 20px; }
.grid-lists > .card {
  display: block;
  width: 100%;
  margin: 0 0 20px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.group, .card { scroll-margin-top: 90px; }
@media (max-width: 640px) { .group, .card { scroll-margin-top: 12px; } }

/* ---------- Cards ---------- */
.card {
  min-width: 0;
  padding: 18px;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h2, .card-title {
  margin-bottom: 14px;
  font: 15px/1.2 var(--font-display);
  letter-spacing: .8px;
  color: var(--gold-text);
}
h4.card-title { font-size: 13px; color: var(--text); }

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.card-head h2, .card-head .card-title { margin: 0; }

.count, .pill {
  display: inline-block;
  min-width: 24px;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--line);
  color: var(--text);
  font: 600 12px/1.5 var(--font-ui);
  text-align: center;
  vertical-align: 2px;
}
.pill { margin: 0; font: 700 13px/1.6 var(--font-mono); }
.group-title .count { margin-left: 0; }

.hint { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.hint-top { margin: 0; flex: 1; }

/* ---------- Fields ---------- */
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.fields + .fields, .field + .fields, .track + .field, .field + .track { margin-top: 10px; }
.fields-1 { grid-template-columns: minmax(0, 1fr); }
.fields-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.field { display: grid; gap: 4px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.field-row { grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 10px; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.check input, .field-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 61, 127, .18); }
input:disabled { opacity: .6; cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input[type="number"] { font-family: var(--font-mono); }

/* ---------- Stats ---------- */
.stats-head, .stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 62px 62px 62px;
  align-items: center;
  gap: 8px;
}
.stats-head { padding: 0 10px 6px; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; text-align: center; }
.stats { display: grid; gap: 8px; }
.stat {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(var(--tint), .02);
}
.stat-id { display: grid; min-width: 0; }
.stat-abbr { font: 14px var(--font-display); color: var(--accent-text); }
.stat-name { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat input { text-align: center; font-weight: 700; padding: 6px 4px; }
.stat .stat-mod { border-color: rgba(255, 210, 63, .45); color: var(--gold-text); }

/* Modo automático: Base · Equipo · Otros · Mejorado · Mod */
.stats.auto .stats-head, .stats.auto .stat { grid-template-columns: minmax(0, 1fr) repeat(5, 50px); gap: 6px; }
.stats.auto .stats-head { font-size: 10px; letter-spacing: .2px; }
.stat-out {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: var(--radius-sm);
  font: 700 15px var(--font-mono);
  color: var(--muted);
}
.stat-out.pos { color: var(--ok-text); }
.stat-out.neg { color: var(--hp-text); }
.stat-out.stat-enh { border: 1px dashed var(--line-2); color: var(--text); }
.stat-out.stat-modv { border: 1px solid rgba(255, 210, 63, .5); background: rgba(255, 210, 63, .08); color: var(--gold-text); font-size: 16px; }

/* Bonificadores de atributos en objetos del inventario */
.field-stats { gap: 6px; }
.stat-bonus { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sb { display: grid; gap: 3px; justify-items: center; }
.sb > span { color: var(--accent-text); font: 11px var(--font-display); }
.sb input { text-align: center; font-weight: 700; padding: 6px 2px; }
.sb-hint { color: var(--muted); font-size: 11.5px; }

/* ---------- Combat formulas ---------- */
.formula {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(var(--tint), .02);
}
.f-label { align-self: center; width: 100%; font: 13px var(--font-display); color: var(--accent-text); }
.f-op { align-self: center; color: var(--muted); font-weight: 700; padding-top: 14px; }
.f-chip, .f-input { display: grid; justify-items: center; gap: 2px; }
.f-chip small, .f-input small { color: var(--muted); font-size: 10.5px; font-weight: 600; text-transform: uppercase; }
.f-chip:not(:has(small)) { padding-top: 16px; }
.f-chip b, .f-chip:not(:has(b)) {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 38px;
  padding: 0 8px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  font: 700 15px var(--font-mono);
}
.f-input input { width: 70px; text-align: center; font-weight: 700; }
.f-total b { border: 1px solid var(--gold); color: var(--gold-text); background: rgba(255, 210, 63, .08); }

/* ---------- Health track (10 casillas) ---------- */
.track {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(229, 72, 77, .25), rgba(255, 210, 63, .18), rgba(60, 207, 145, .25));
}
.hbox {
  --c: hsl(var(--h) 80% 55%);
  position: relative;
  display: grid;
  place-items: center;
  gap: 0;
  min-height: 52px;
  padding: 4px 0;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--field);
  color: var(--muted);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.hbox.on {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 30%, var(--field));
  color: var(--text);
  box-shadow: inset 0 0 10px color-mix(in srgb, var(--c) 40%, transparent);
}
.hbox:not(.on)::after {
  content: "";
  position: absolute;
  inset: 6px;
  background: linear-gradient(to top right, transparent calc(50% - 1px), var(--line-2) 50%, transparent calc(50% + 1px));
  pointer-events: none;
}
.hbox-val { font: 700 15px var(--font-mono); }
.hbox-pct { font-size: 9.5px; font-weight: 600; opacity: .8; }
.track-sm .hbox { min-height: 40px; }
.track-sm .hbox-val { font-size: 12px; }

.track-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-top: 10px; }
.track-meta .field-row { grid-template-columns: auto 64px; flex: none; }
.track-meta input { text-align: center; }

.hit { animation: shake .35s ease; }
@keyframes shake {
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.dying {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--hp);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(-45deg, rgba(229, 72, 77, .18) 0 12px, rgba(229, 72, 77, .08) 12px 24px);
  color: var(--danger-ink);
  font-size: 13.5px;
  animation: pulse 1.2s ease-in-out infinite;
}
.dying strong { font-family: var(--font-display); font-weight: 400; color: var(--hp-text); margin-right: 4px; }
.dying.dead { animation: none; filter: grayscale(.3); }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px rgba(229, 72, 77, .3); } }

.vital-ctrl { display: grid; grid-template-columns: 76px 1fr 1fr; gap: 8px; margin-top: 12px; }
.vital-ctrl .amount { text-align: center; font-weight: 700; }
.sub-ctrl { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.sub-btns { display: flex; gap: 6px; }

/* ---------- Mana ---------- */
.vital-num { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.vital-num input { width: 68px; text-align: center; font-size: 16px; font-weight: 700; padding: 5px 4px; min-height: 36px; }
.bar { height: 20px; overflow: hidden; border: 1px solid var(--line-2); border-radius: 99px; background: var(--well); }
.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--mp), var(--mp-2));
  box-shadow: 0 0 16px rgba(62, 139, 255, .5);
  transition: width .35s cubic-bezier(.2, .8, .2, 1);
}

/* ---------- Defense ---------- */
.defense { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.def-box.def-favor {
  grid-column: 1 / -1;
  grid-template-columns: 1fr auto;
  justify-items: start;
  align-items: center;
  padding: 10px 12px;
  text-align: left;
}
.def-box {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(var(--tint), .02);
  text-align: center;
}
.def-label { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.def-value { font: 22px/1.1 var(--font-display); color: var(--gold-text); }
.def-sub { color: var(--muted); font-size: 11px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper input {
  width: 64px;
  min-height: 38px;
  padding: 4px 6px;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .btn { width: 38px; min-height: 38px; padding: 0; font-size: 18px; line-height: 1; }

/* ---------- Dice ---------- */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--field);
}
.seg button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); }

.dice-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.die-btn {
  min-width: 62px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 210, 63, .45);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 210, 63, .14), rgba(255, 210, 63, .04));
  color: var(--gold-ink);
  font: 700 14px var(--font-mono);
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}
.die-btn:hover { background: rgba(255, 210, 63, .25); }
.die-btn:active { transform: scale(.96); }
.die-edit { display: inline-flex; align-items: center; gap: 2px; }
.die-edit input { width: 86px; min-height: 36px; padding: 4px 8px; font-family: var(--font-mono); }
.dice-empty { display: grid; gap: 8px; justify-items: start; color: var(--muted); font-size: 13px; }

.chip-form { display: flex; gap: 6px; }
.chip-form input { flex: 1; font-family: var(--font-mono); }

.dice-result {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 92px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--well);
  text-align: center;
}
.dr-empty { align-self: center; color: var(--muted); font-size: 13px; }
.dr-title { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.dr-total { font: 40px/1.1 var(--font-display); color: var(--gold-text); animation: pop .25s ease; }
.dr-total.crit { color: var(--ok-text); text-shadow: 0 0 18px rgba(60, 207, 145, .6); }
.dr-total.fumble { color: var(--hp-text); text-shadow: 0 0 18px rgba(229, 72, 77, .6); }
.dr-detail { color: var(--muted); font: 12px/1.5 var(--font-mono); word-break: break-word; }
.dr-detail b { color: var(--text); }
.dr-note { margin-top: 4px; font-weight: 700; font-size: 13px; }
.dr-note.crit { color: var(--ok-text); }
.dr-note.fumble { color: var(--hp-text); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

/* ---------- Hotlist ---------- */
.hot-head { align-items: center; }
.hot-slots-ctrl { display: flex; align-items: center; gap: 8px; }
.stepper-out {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 38px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--field);
  font: 700 15px var(--font-mono);
}
.hotlist { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.hot-slot {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 4px;
  min-height: 118px;
  padding: 10px;
  border: 1px solid rgba(255, 61, 127, .45);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 61, 127, .1), var(--card-2));
  min-width: 0;
}
.hot-slot.empty {
  place-items: center;
  border: 1px dashed var(--line-2);
  background: transparent;
  color: var(--line-2);
  font: 18px var(--font-display);
}
.hot-icon { font-size: 18px; line-height: 1; }
.hot-name { max-width: 100%; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-sub { color: var(--muted); font: 12px var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.hot-btns { display: grid; gap: 4px; width: 100%; margin-top: auto; }
.hot-slot .btn { width: 100%; padding-inline: 6px; }
.hot-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.hot-remove:hover { background: rgba(var(--tint), .08); color: var(--text); }

/* ---------- Equipo ---------- */
.gear-slots { display: grid; gap: 6px; }
.gear-slot {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(var(--tint), .02);
}
.gear-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.gear-label small { color: var(--line-2); font: 600 11px var(--font-mono); }
.gear-items { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.gear-empty { color: var(--line-2); }
.gear-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 4px 3px 10px;
  border: 1px solid rgba(255, 210, 63, .5);
  border-radius: 99px;
  background: rgba(255, 210, 63, .1);
  color: var(--gold-ink);
  font-size: 13px;
  font-weight: 600;
}
.gear-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.gear-chip button:hover { background: rgba(var(--tint), .1); color: var(--text); }

/* ---------- Lists ---------- */
.items { display: grid; gap: 10px; container-type: inline-size; }
.sublist { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

.empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.item {
  --item-accent: var(--line-2);
  position: relative;
  padding: 12px 12px 12px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
}
.item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--item-accent);
}
.item.is-opened { opacity: .6; }
.item.equipped { --item-accent: var(--gold); border-color: rgba(255, 210, 63, .45); }
.item.new { animation: pop .3s ease; }

.item-top { display: flex; align-items: flex-start; gap: 8px; }
.item-top .fields { flex: 1; }
.item .fields { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.item .field.title input { font-weight: 700; font-size: 15px; }
.item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }

/* ---------- Acordeón (armas, hechizos, habilidades, inventario) ---------- */
.card-head-actions { display: flex; align-items: center; gap: 10px; }
.items:has(.acc) { gap: 8px; }

.item.acc { padding: 0; }
.item.acc::before { top: 8px; bottom: 8px; }

.acc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 4px;
}
.acc-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 6px 4px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.acc-toggle:hover { background: rgba(var(--tint), .04); }
.acc-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.acc-chevron {
  flex: none;
  display: grid;
  place-items: center;
  width: 18px;
  color: var(--muted);
  font-size: 16px;
  transition: transform .18s ease;
}
.item.acc.open .acc-chevron { transform: rotate(90deg); color: var(--accent-text); }
.acc-text { display: grid; min-width: 0; }
.acc-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-name.is-empty { color: var(--muted); font-style: italic; font-weight: 500; }
.acc-sub { color: var(--muted); font: 12px/1.4 var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.acc-actions { flex: none; display: flex; align-items: center; gap: 6px; }
.acc-actions .field-check { display: flex; align-items: center; gap: 6px; }
.acc-actions .field-check > span { color: var(--ok-text); font-size: 14px; }
.acc-actions .field-check input { margin: 0; }

.acc-body {
  padding: 12px 12px 12px 15px;
  border-top: 1px solid var(--line);
  animation: acc-in .18s ease;
}
@keyframes acc-in { from { opacity: 0; transform: translateY(-4px); } }

/* Tarjetas estrechas (móvil): los botones siguen al lado del nombre,
   pero solo con el icono para que quepan */
@container (max-width: 520px) {
  .acc-head { gap: 4px; padding-right: 6px; }
  .acc-toggle { gap: 6px; padding-left: 8px; padding-right: 2px; }
  .acc-actions { gap: 4px; }
  .acc-actions .btn-label { display: none; }
  .acc-actions .btn { width: 38px; min-height: 38px; padding: 0; font-size: 16px; }
  .acc-name { font-size: 14px; }
  .acc-sub { font-size: 11px; }
}

/* Filas compactas (listas simples) */
.item.row {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: end;
  gap: 8px;
  padding: 8px 8px 8px 13px;
}
.item.row .field > span { font-size: 10.5px; }
.item.row.simple { align-items: center; padding-block: 6px; }
.item.row .field.title input { font-size: 14px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.field-check { justify-items: center; }
.qty-infinite { text-align: center; font-size: 18px; font-weight: 700; color: var(--gold-text) !important; opacity: 1 !important; cursor: default !important; }
.field-check input { margin: 10px 0; }

/* Cuando la tarjeta es estrecha, las filas pasan a dos columnas */
@container (max-width: 900px) {
  .item.row:not(.simple) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item.row:not(.simple) .field:has(.note-wrap),
  .item.row:not(.simple) .field.title,
  .item.row:not(.simple) .row-actions { grid-column: 1 / -1; }
  .item.row:not(.simple) .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .item.row:not(.simple) .row-actions .icon-btn { margin-left: auto; }
}

/* Hotlist en elementos */
.hot-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 12px 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.item-actions .hot-toggle { margin-left: auto; }
.hot-toggle:hover { border-color: var(--muted); color: var(--text); }
.hot-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.hot-toggle:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.item.hot { --item-accent: var(--accent); border-color: rgba(255, 61, 127, .5); box-shadow: 0 0 18px rgba(255, 61, 127, .12); }
.item.hot .hot-toggle { border-color: rgba(255, 61, 127, .6); background: rgba(255, 61, 127, .12); color: var(--accent-ink-soft); }

.item[data-tier="Bronce"] { --item-accent: var(--tier-bronce); }
.item[data-tier="Plata"] { --item-accent: var(--tier-plata); }
.item[data-tier="Oro"] { --item-accent: var(--tier-oro); }
.item[data-tier="Platino"] { --item-accent: var(--tier-platino); }
.item[data-tier="Legendario"] { --item-accent: var(--tier-legendario); }
.item[data-tier="Celestial"] { --item-accent: var(--tier-celestial); }

/* ---------- Anotación manual ---------- */
.manual-form {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 110px auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: rgba(var(--tint), .02);
}
.manual-title { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.manual-link { display: block; margin: 10px auto 0; font-size: 12.5px; text-align: center; }

@media (max-width: 700px) {
  .manual-form { grid-template-columns: minmax(0, 1fr) 100px; }
  .manual-form select, .manual-form #manual-text { grid-column: 1 / -1; }
}

/* ---------- Log ---------- */
.log {
  display: grid;
  gap: 6px;
  max-height: 460px;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}
/* Los textos largos saltan de línea en vez de provocar scroll lateral */
.log li > span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.log:empty::before { content: "Nada que contar todavía. Ve y haz algo memorable."; color: var(--muted); font-size: 13px; }
.log li {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 10px;
  border-left: 3px solid var(--line-2);
  border-radius: 6px;
  background: rgba(var(--tint), .03);
  font-size: 13.5px;
}
.log time { color: var(--muted); font: 12px/1.6 var(--font-mono); }
.log .t-damage { border-left-color: var(--hp); }
.log .t-heal { border-left-color: var(--ok); }
.log .t-mana { border-left-color: var(--mp); }
.log .t-roll { border-left-color: var(--gold); }
.log .t-info { border-left-color: var(--accent); }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 10px 14px 12px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--toast-bg);
  box-shadow: var(--shadow), 0 0 24px rgba(255, 61, 127, .25);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in .25s ease;
}
.toast-label { display: block; margin-bottom: 3px; color: var(--accent-text); font: 11px var(--font-display); letter-spacing: 1px; }
.toast.danger { border-color: var(--hp); box-shadow: var(--shadow), 0 0 24px rgba(229, 72, 77, .35); }
.toast.danger .toast-label { color: var(--hp-text); }
.toast.gold { border-color: var(--gold); box-shadow: var(--shadow), 0 0 24px rgba(255, 210, 63, .3); }
.toast.gold .toast-label { color: var(--gold-text); }
.toast { cursor: pointer; }

/* Notificación de tirada */
.tr { display: flex; align-items: center; gap: 14px; }
.tr-info { flex: 1; min-width: 0; }
.tr-title { font-weight: 700; }
.tr-detail { margin-top: 2px; color: var(--muted); font: 12px/1.5 var(--font-mono); word-break: break-word; }
.tr-detail b { color: var(--text); }
.tr-note { margin-top: 4px; font-weight: 700; font-size: 13px; }
.tr-total {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 64px;
  min-height: 64px;
  padding: 0 8px;
  border: 1px solid rgba(255, 210, 63, .5);
  border-radius: 12px;
  background: rgba(255, 210, 63, .1);
  color: var(--gold-text);
  font: 30px/1 var(--font-display);
}
.tr-total.crit, .tr-note.crit { color: var(--ok-text); border-color: rgba(60, 207, 145, .6); }
.tr-total.crit { background: rgba(60, 207, 145, .12); }
.tr-total.fumble, .tr-note.fumble { color: var(--hp-text); border-color: rgba(229, 72, 77, .6); }
.tr-total.fumble { background: rgba(229, 72, 77, .12); }

.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Ventana de ayuda ---------- */
.help-dialog {
  width: min(860px, calc(100vw - 32px));
  height: min(88vh, 1000px);
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.help-dialog[open] { display: flex; flex-direction: column; animation: toast-in .2s ease; }
.help-dialog::backdrop { background: rgba(5, 3, 8, .72); backdrop-filter: blur(3px); }
.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.help-head h2 { font: 14px/1.2 var(--font-display); letter-spacing: .6px; color: var(--gold-text); }
.help-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.help-actions .icon-btn:hover { color: var(--text); background: rgba(var(--tint), .08); border-color: var(--line-2); }
.help-frame { flex: 1; width: 100%; border: 0; background: #f5f7fb; }

/* ---------- Selector del catálogo ---------- */
.picker-dialog {
  width: min(760px, calc(100vw - 32px));
  height: min(86vh, 900px);
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.picker-dialog[open] { display: flex; flex-direction: column; animation: toast-in .2s ease; }
.picker-dialog::backdrop { background: rgba(5, 3, 8, .72); backdrop-filter: blur(3px); }
.picker-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px auto;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.picker-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 8px; padding: 12px 16px 16px; scrollbar-width: thin; }
.picker-empty { margin: 0; padding: 18px; color: var(--muted); font-size: 14px; text-align: center; }
.picker-empty p { margin: 0 0 10px; }
.picker-empty code { font-family: var(--font-mono); color: var(--text); }

.pick {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.pick:hover, .pick:focus-visible { border-color: var(--accent); background: rgba(var(--tint), .04); outline: none; }
.pick-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.pick-name { font-weight: 700; font-size: 15px; }
.pick-en { color: var(--muted); font-size: 12px; font-style: italic; }
.pick-tier {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.pick-tier[data-tier="Bronce"] { color: var(--tier-bronce); border-color: var(--tier-bronce); }
.pick-tier[data-tier="Plata"] { color: var(--tier-plata); border-color: var(--tier-plata); }
.pick-tier[data-tier="Oro"] { color: var(--gold-text); border-color: var(--tier-oro); }
.pick-tier[data-tier="Platino"] { color: var(--tier-platino); border-color: var(--tier-platino); }
.pick-tier[data-tier="Legendario"] { color: var(--tier-legendario); border-color: var(--tier-legendario); }
.pick-tier[data-tier="Celestial"] { color: var(--tier-celestial); border-color: var(--tier-celestial); }
.pick-meta { color: var(--gold-text); font: 12px/1.45 var(--font-mono); }
.pick-desc { color: var(--muted); font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 640px) {
  .picker-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .picker-tools { grid-template-columns: minmax(0, 1fr) 140px; }
  .picker-tools .btn { grid-column: 1 / -1; }
}

/* ---------- Mejoras por rango ---------- */
.upgrades {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(var(--tint), .02);
}
.upgrades-title { color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.upgrades ul { display: grid; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.upgrades li b { display: inline-block; min-width: 30px; color: var(--muted); font-family: var(--font-mono); }
.upgrades li.reached { color: var(--text); }
.upgrades li.reached b { color: var(--ok-text); }
.up-ok { color: var(--ok-text); font-weight: 700; }
.upgrades-dice { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.upgrades-dice b { color: var(--gold-text); font-family: var(--font-mono); }

/* ---------- Nota completa ---------- */
.note-wrap { display: flex; gap: 4px; min-width: 0; }
.note-wrap input { flex: 1; }
.note-open {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.note-open:hover { border-color: var(--muted); color: var(--text); }
.note-open.has-note { border-color: rgba(255, 210, 63, .5); color: var(--gold-text); background: rgba(255, 210, 63, .08); }
.note-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.note-dialog {
  width: min(640px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.note-dialog[open] { animation: toast-in .2s ease; }
.note-dialog::backdrop { background: rgba(5, 3, 8, .72); backdrop-filter: blur(3px); }
.note-head { display: grid; gap: 2px; min-width: 0; }
.note-kicker { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.note-head h2 { font: 17px/1.2 var(--font-display); color: var(--gold-text); overflow-wrap: anywhere; }
.note-meta { color: var(--muted); font-size: 12.5px; }
.note-meta:empty { display: none; }
.note-body { display: grid; gap: 10px; padding: 14px 18px 16px; }
.note-body textarea { min-height: 260px; font-size: 15px; line-height: 1.55; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-foot .hint { margin: 0; }

/* ---------- Menú rápido inferior (móvil y escritorio) ---------- */
html { scroll-behavior: smooth; }
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }

.quicknav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.quicknav-links {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.quicknav-links::-webkit-scrollbar { display: none; }

.quicknav a, .quicknav-help {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 66px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.quicknav a { color: var(--muted); text-decoration: none; transition: background .15s ease, color .15s ease; }
.quicknav a span, .quicknav-help span { font-size: 18px; line-height: 1.1; }
.quicknav a:hover { color: var(--text); background: rgba(var(--tint), .05); }
.quicknav a.active { background: rgba(255, 61, 127, .16); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.quicknav a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.quicknav-help {
  min-width: 62px;
  border: 1px solid rgba(255, 210, 63, .45);
  background: rgba(255, 210, 63, .1);
  color: var(--gold-ink);
  cursor: pointer;
  box-shadow: -10px 0 14px -6px var(--nav-bg);
}
.quicknav-help:hover { background: rgba(255, 210, 63, .2); }
.quicknav-help:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* La ayuda vive en el menú inferior */
.toolbar .btn-help { display: none; }
.toast-stack { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* En escritorio: el menú se centra y los enlaces se reparten el ancho */
@media (min-width: 960px) {
  .quicknav { justify-content: center; padding-inline: 24px; }
  .quicknav-links { flex: 0 1 auto; max-width: 1200px; justify-content: center; }
  .quicknav a { flex: 1 1 0; min-width: 76px; max-width: 120px; font-size: 12px; }
  .quicknav-help { min-width: 76px; font-size: 12px; box-shadow: none; }
  .col-side { max-height: calc(100vh - 110px - 70px); }
}

@media (max-width: 959px) {
  .hotlist { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .topbar { position: static; padding: 12px 16px; }
  .toolbar { width: 100%; }
  .toolbar .btn { flex: 1; padding-inline: 8px; }
  .toolbar .btn-theme { flex: 0 0 auto; }
  .toolbar .btn-theme .theme-label { display: none; }
  .save-status { order: 10; width: 100%; text-align: left; }
  .layout { padding: 16px 16px 48px; gap: 16px; }
  .col-side { gap: 16px; }
  .col-main { gap: 22px; }
  .grid-lists > .card { margin-bottom: 16px; }
  .card { padding: 14px; }
  .help-dialog { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .vital-ctrl { grid-template-columns: 64px 1fr 1fr; }
  .track { gap: 3px; padding: 4px; }
  .hbox { min-height: 46px; }
  .hbox-val { font-size: 13px; }
  .hbox-pct { font-size: 8px; }
  .fields-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-head, .stat { grid-template-columns: minmax(0, 1fr) 54px 54px 54px; gap: 6px; }
  /* En móvil la tabla automática solo muestra la abreviatura del atributo */
  .stats.auto .stats-head, .stats.auto .stat { grid-template-columns: 38px repeat(5, minmax(0, 1fr)); gap: 4px; }
  .stats.auto .stat { padding: 6px; }
  .stats.auto .stat-name { display: none; }
  .stats.auto .stat input { padding: 6px 2px; }
  .hotlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
