/* ==========================================================================
   QuestLife — estilos
   1. Tokens (temas)      5. Home / quests     9. Mural / histórico
   2. Base                6. Herói e barras   10. Ajustes
   3. Layout              7. Objetivos        11. Modal, toasts, efeitos
   4. Controles           8. Personagem       12. Responsivo
   ========================================================================== */

/* 1. Tokens ------------------------------------------------------------- */
:root {
  /* Montserrat em tudo, a mesma família do logo. Os pesos fazem a hierarquia (400 texto, 600/700 títulos). */
  --font-body: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.625rem;
  --fs-xxl: 2.125rem;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --space: 1rem;
  --sidebar: 232px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);

  --easy: #5fb87a;
  --medium: #e9a23b;
  --hard: #e0566b;
  --hp: #e0566b;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171a2b;
  --surface: #212539;
  --surface-2: #2a2f47;
  --line: #363b5c;
  --text: #eceaf4;
  --muted: #9c9ebb;
  /* Marca (azul do logo): botões, navegação, foco, XP, destaques. */
  --brand: #4a9fd4;
  --brand-ink: #6bb8e6;       /* texto azul sobre as superfícies escuras (contraste ≥ 6.9) */
  --brand-strong: #1d5a85;
  --on-brand: #ffffff;        /* texto branco sobre --brand-fill (contraste 4.9) */
  --brand-fill: #2677ad;      /* fundo de botões e selos com texto (o azul do logo com branco não passa de 3.3) */
  --brand-fill-hover: #1f6a9c;
  /* Ouro do jogo: moeda, raridade lendária, medalha de ouro, crítico. Não é cor de interface. */
  --gold: #f2b33d;
  --gold-ink: #f5c460;
  --on-gold: #2b1d00;
  --accent: #6bb8e6;
  --stage: #1c2036;
  --stage-floor: #2d3352;
  --shadow: 0 10px 30px rgba(5, 6, 15, .45);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #e8eaf1;
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --line: #d0d4e2;
  --text: #1c2033;
  --muted: #5d6282;
  --brand: #3b95cc;           /* o azul exato do logo */
  --brand-ink: #1d6a9c;       /* texto azul sobre branco (contraste 5.4) */
  --brand-strong: #1d5a85;
  --on-brand: #ffffff;        /* texto branco sobre --brand-fill (contraste 4.9) */
  --brand-fill: #2677ad;
  --brand-fill-hover: #1f6a9c;
  --gold: #f2b33d;
  --gold-ink: #99620a;
  --on-gold: #2b1d00;
  --accent: #1d6a9c;
  --stage: #dfe3f2;
  --stage-floor: #c5cbe3;
  --shadow: 0 10px 30px rgba(40, 46, 80, .14);
  --easy: #3f9a5b;
  --medium: #c7801a;
  --hard: #c93d53;
}

/* 2. Base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  transition: background-color .25s, color .25s;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: var(--fs-xs); }
.center { text-align: center; margin-top: var(--space); }
.strike { text-decoration: line-through; color: var(--muted); }
.spacer { flex: 1; }
/* Personagem: arte pintada (docs/archive/ARTE-V2-SPEC.md), sem pixelado; o canvas tem o quadro do manifesto. */
.sprite { image-rendering: auto; object-fit: contain; }
.icon { width: 1.15em; height: 1.15em; flex: none; }

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

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--brand-fill); color: var(--on-brand); padding: .5rem 1rem; border-radius: var(--r-sm);
}
.skip-link:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 3. Layout ------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky; top: 0; height: 100vh; align-self: start;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.5rem 1rem;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  color: var(--text); text-decoration: none; padding: 0 .5rem;
}
.brand-name { font-size: var(--fs-lg); }
/* Marca: logo por tema (dark no claro, white no escuro) */
.logo-icon { width: 36px; height: 36px; flex: none; object-fit: contain; }
[data-theme="dark"] .logo-for-light,
[data-theme="light"] .logo-for-dark { display: none; }
.brand-name { line-height: 1.15; }
/* Logotipo em texto, como no logo: "XP" extranegrito e "NOTES" regular. */
.wordmark { font-family: var(--font-display); font-weight: 400; letter-spacing: .02em; text-transform: none; }
.wordmark b { font-weight: 800; letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .75rem; border-radius: var(--r-sm);
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: var(--fs-sm);
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] {
  color: var(--text); background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: .5rem; }
/* Desktop: HUD numa linha e os botões (tema, Ajustes, Sair) abaixo — com os três ao lado,
   a barra de XP era espremida. No celular (barra do topo) continua tudo numa linha. */
@media (min-width: 861px) {
  .sidebar-foot { flex-wrap: wrap; gap: .5rem .25rem; }
  .sidebar-foot .top-hud { flex: 1 1 100%; }
}
.top-hud { flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .25rem .5rem; }
.hud-level { font-size: var(--fs-sm); }
.hud-xp { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--muted); }

.main {
  padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem;
  outline: none;
  max-width: 1280px;
  width: 100%;
  /* Item do grid da casca: sem isto, uma linha larga (abas que rolam, tabelas) alarga a página. */
  min-width: 0;
}

.view { animation: view-in .25s var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem;
}
.page-head h1 { font-size: var(--fs-xxl); line-height: 1.1; }
.page-head p { margin-top: .35rem; max-width: 60ch; }
.date-line::first-letter { text-transform: uppercase; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
}
.panel-title {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: var(--fs-md); margin-bottom: .75rem;
}

.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: .75rem;
  padding: 2rem; border: 2px dashed var(--line); border-radius: var(--r-lg);
}
.empty-wide { align-items: center; text-align: center; }
.empty-title { font-size: var(--fs-lg); font-weight: 700; }

/* 4. Controles ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .5rem 1rem;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-weight: 700; font-size: var(--fs-sm); text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: transform .1s, background-color .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; filter: grayscale(.6); }
.btn-sm { min-height: 32px; padding: .25rem .65rem; font-size: var(--fs-xs); }

.btn-primary { background: var(--brand-fill); color: var(--on-brand); box-shadow: 0 3px 0 var(--brand-strong); }
.btn-primary:hover { background: var(--brand-fill-hover); }
.btn-primary:active { box-shadow: 0 1px 0 var(--brand-strong); transform: translateY(2px); }
.btn-gold { background: transparent; color: var(--brand-ink); border-color: var(--brand); }
.btn-gold:hover { background: var(--brand-fill); color: var(--on-brand); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: var(--hard); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--hard); border-color: transparent; }
.btn-danger-ghost:hover { border-color: var(--hard); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font-size: var(--fs-xs); font-weight: 700; text-decoration: none;
}

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field-label { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { resize: vertical; }
select { cursor: pointer; }

.select-inline select { width: auto; min-width: 190px; }

.inline-field { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.inline-field input, .inline-field select { width: auto !important; }
.inline-field input[type="number"] { width: 5rem !important; }

.form-error {
  color: var(--hard); font-size: var(--fs-sm); font-weight: 700;
  padding: .5rem .75rem; margin: .5rem 0;
  border-left: 3px solid var(--hard);
  background: color-mix(in srgb, var(--hard) 10%, transparent);
}

/* Switch */
.switch { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: var(--fs-sm); user-select: none; }
.switch input {
  appearance: none; width: 38px; height: 22px; margin: 0; flex: none;
  border-radius: 999px; background: var(--line); position: relative; cursor: pointer;
  transition: background-color .2s;
}
.switch input::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .2s var(--ease-back);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

/* Segmentado (dificuldade, tema) */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .65rem; border-radius: 4px; cursor: pointer;
  font-size: var(--fs-xs); font-weight: 700; color: var(--muted);
}
.seg span small { font-family: var(--font-display); opacity: .75; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

/* Pills (dias) */
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pills-month { display: grid; grid-template-columns: repeat(7, 1fr); }
.pill input { position: absolute; opacity: 0; }
.pill span {
  display: grid; place-items: center; min-width: 42px; height: 32px; padding: 0 .4rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 700; cursor: pointer; color: var(--muted);
}
.pill-num span { min-width: 0; }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.schedule .sch-panel { display: none; margin-bottom: .75rem; }
.schedule[data-type="daysOfWeek"] [data-for="daysOfWeek"],
.schedule[data-type="daysOfMonth"] [data-for="daysOfMonth"],
.schedule[data-type="interval"] [data-for="interval"],
.schedule[data-type="nthWeekday"] [data-for="nthWeekday"] { display: block; }

.chip {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .05rem .5rem; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 700;
}
.chip-goal { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chip-goal .icon { width: .9em; height: .9em; }

.chips-filter { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .9rem; }
.chip-btn {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: .2rem .7rem; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); cursor: pointer;
}
.chip-btn.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: 1rem; margin: 1rem 0 0; }
.fieldset legend { font-weight: 700; padding: 0 .35rem; }
.fieldset .hint { margin-bottom: .75rem; }

kbd {
  font-family: var(--font-display); font-size: .75rem;
  padding: 0 .35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--muted);
}

/* 5. Home / quests ------------------------------------------------------ */
.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2rem;
  align-items: start;
}
.home-side { position: sticky; top: 2rem; display: flex; flex-direction: column; gap: 1rem; }

.day-progress { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.day-count { color: var(--muted); font-size: var(--fs-sm); }
.day-count b { font-size: var(--fs-xl); color: var(--text); }
.day-count.is-complete b { color: var(--easy); }
.segments { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; max-width: 220px; }
.segments i { width: 12px; height: 6px; background: var(--line); border-radius: 1px; transition: background-color .3s; }
.segments i.on { background: var(--easy); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.toolbar-switches { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }

.quest-list { display: flex; flex-direction: column; gap: 6px; }

.quest {
  --diff: var(--easy);
  display: grid;
  /* alça de ordenação · check · corpo · lado */
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: start;
  gap: .85rem;
  padding: .75rem .75rem .75rem .5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--diff);
  border-radius: var(--r-sm);
  transition: opacity .25s, background-color .2s;
}
.quest:hover { background: var(--surface-2); }

.check {
  display: grid; place-items: center;
  width: 28px; height: 28px; margin-top: 1px;
  border: 2px solid var(--diff); border-radius: 50%; /* redonda, igual à linha de tarefa das notas */
  background: transparent; color: transparent; cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.check:hover { background: color-mix(in srgb, var(--diff) 18%, transparent); color: var(--diff); }
.check:active { transform: scale(.9); }
.check .icon { width: 18px; height: 18px; stroke-width: 3; }

.quest-body { cursor: pointer; min-width: 0; }
.quest-name { font-weight: 700; overflow-wrap: anywhere; }
.quest-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; margin-top: .35rem; }
.meta { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--fs-xs); color: var(--muted); }
.meta .icon { width: .95em; height: .95em; }
.streak { color: var(--medium); font-weight: 700; }
.streak small { font-family: var(--font-display); opacity: .8; }

.quest-side { display: flex; align-items: center; gap: .15rem; }
.xp-tag {
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm);
  color: var(--brand-ink); padding: 0 .3rem;
}

.quest.is-done { opacity: .6; }
.quest.is-done .check { background: var(--diff); color: #fff; }
.quest.is-done .quest-name { text-decoration: line-through; text-decoration-thickness: 2px; }
.quest.just-done .check { animation: pop .45s var(--ease-back); }
.quest.just-done { animation: done-flash .6s ease-out; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes done-flash { 0% { background: color-mix(in srgb, var(--brand) 30%, var(--surface)); opacity: 1; } }

.quest-group + .quest-group { margin-top: 1.25rem; }
.group-head {
  display: flex; align-items: center; gap: .6rem;
  font-size: var(--fs-sm); margin-bottom: .5rem; color: var(--muted);
}
.group-head span::first-letter { text-transform: uppercase; }
.group-head small { margin-left: auto; font-family: var(--font-display); }
.group-thumb { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.group-thumb-empty { display: grid; place-items: center; background: var(--surface-2); }

/* Adição rápida */
.quick-add { margin-top: .75rem; }
.add-trigger {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .7rem .9rem; border: 1px dashed var(--line); border-radius: var(--r-sm);
  background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; text-align: left;
}
.add-trigger:hover { color: var(--text); border-color: var(--muted); background: var(--surface); }
.add-trigger kbd { margin-left: auto; }

.add-card {
  padding: .75rem; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--accent);
  box-shadow: var(--shadow);
  animation: card-open .18s var(--ease-out);
}
@keyframes card-open { from { opacity: 0; transform: translateY(-4px); } }
.add-card textarea { border: 0; background: transparent; padding: .2rem; font-weight: 700; resize: none; box-shadow: none !important; }
.add-card textarea[data-qa-desc] { font-weight: 400; font-size: var(--fs-sm); }
.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.add-row select { width: auto; flex: 1 1 180px; }
.add-row-toggles { justify-content: space-between; }
[data-qa-schedule] { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.add-actions { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; }
.add-actions .hint { margin-left: auto; }

/* Mini objetivos */
.mini-goals { display: flex; flex-direction: column; gap: .8rem; }
.mini-goals li { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: center; }
.mini-title { font-weight: 700; font-size: var(--fs-sm); line-height: 1.3; }
.mini-meta { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin-top: .15rem; }
.side-goals .btn { margin-top: .75rem; }

/* 6. Herói e barras ----------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.hero-stage {
  position: relative;
  width: 128px; height: 128px;
  border-radius: var(--r-md);
  background:
    linear-gradient(transparent 76%, var(--stage-floor) 76%),
    var(--stage);
  overflow: hidden;
}
.hero-stage .sprite { width: 128px; height: 128px; position: relative; }
.hero-stage .sprite { animation: idle 2.4s steps(2) infinite; }
@keyframes idle { 50% { transform: translateY(-2px); } }

.hero-info { min-width: 0; display: flex; flex-direction: column; }
.hero-name { font-weight: 700; font-size: var(--fs-lg); line-height: 1.2; overflow-wrap: anywhere; }
.hero-class { color: var(--muted); font-size: var(--fs-xs); }
.hero-level { font-size: var(--fs-xl); line-height: 1.1; margin: .35rem 0 .5rem; color: var(--brand-ink); }

.bar {
  position: relative; height: 12px;
  background: var(--surface-2);
  border: 2px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill { height: 100%; transition: width .6s var(--ease-out); }
/* Barra de XP segmentada, como num jogo */
.bar-xp .bar-fill {
  background:
    repeating-linear-gradient(90deg, transparent 0 9px, rgba(0,0,0,.18) 9px 10px),
    linear-gradient(var(--brand), var(--brand-strong));
}
.bar-hp .bar-fill { background: linear-gradient(#ef7688, var(--hp)); }
.bar-thin { height: 6px; border-width: 1px; margin-top: .3rem; }
.bar-thin .bar-fill, .bar-tier .bar-fill { background: var(--accent); }
.bar-mini { height: 8px; border-width: 1px; }
.bar-caption { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin: .1rem 0 .4rem; font-family: var(--font-display); }
.bar.pulse { animation: bar-pulse .6s ease-out; }
@keyframes bar-pulse { 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 55%, transparent); } }

.attrs {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  padding-top: .75rem; border-top: 1px solid var(--line);
}
.attrs li { display: flex; flex-direction: column; align-items: center; text-align: center; }
.attrs span { font-size: .6875rem; color: var(--muted); }
.attrs b { font-family: var(--font-display); font-size: var(--fs-lg); line-height: 1.1; }
.class-attrs { border-top: 0; padding-top: 0; margin: .2rem 0 .4rem; list-style: none; padding-left: 0; }
.attrs li.is-main span { color: var(--brand, var(--accent)); font-weight: 700; }
/* A estrela do atributo principal fica fora do fluxo: o rótulo não quebra linha nem sai do alinhamento. */
.attrs li span { position: relative; white-space: nowrap; }
.attr-star { position: absolute; left: 100%; top: 0; margin-left: .15em; font-style: normal; font-size: .9em; line-height: inherit; }
.attr-mod { font-size: .66rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.attr-mod.up { color: var(--easy, #2f9e62); }
.attr-mod.down { color: var(--hard); }

.hero-lg { grid-template-columns: 1fr; justify-items: center; text-align: center; border: 0; padding: 0; background: none; }
.hero-lg .hero-stage { width: 192px; height: 192px; }
.hero-lg .hero-stage .sprite { width: 128px; height: 128px; margin: 32px; }
.hero-lg .hero-info { width: 100%; }

/* 7. Objetivos ---------------------------------------------------------- */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.goal-card {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.25rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
}
.goal-top { display: flex; gap: 1rem; align-items: flex-start; }
.goal-headline { min-width: 0; }
.goal-headline h2 { font-size: var(--fs-lg); line-height: 1.25; margin: .2rem 0; overflow-wrap: anywhere; }
.goal-headline p { font-size: var(--fs-sm); }
.goal-xp-row { display: flex; align-items: baseline; justify-content: space-between; }
.goal-xp-row b { font-size: var(--fs-xl); }
.bar-tier { margin: .35rem 0; }
.tier-label { font-weight: 700; font-size: var(--fs-sm); }

.goal-quests { display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: .5rem; }
.link-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center;
  width: 100%; padding: .4rem .35rem; border: 0; border-radius: var(--r-sm);
  background: none; cursor: pointer; text-align: left; font-size: var(--fs-sm);
}
.link-row:hover { background: var(--surface-2); }
.link-row .icon { color: var(--muted); }
.link-row small { color: var(--muted); font-size: var(--fs-xs); }
.goal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: auto; }

.goal-form { display: grid; grid-template-columns: 180px 1fr; gap: 1.25rem; }
.photo-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  width: 180px; aspect-ratio: 1; padding: 0; overflow: hidden;
  border: 2px dashed var(--line); border-radius: 50%;
  background: var(--surface-2); color: var(--muted); cursor: pointer; font-weight: 700; font-size: var(--fs-sm);
}
.photo-drop:hover { border-color: var(--accent); color: var(--text); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-drop .icon { width: 2rem; height: 2rem; }
.photo-drop { position: relative; }
.photo-drop:disabled { cursor: progress; }
/* Envio da foto ao servidor (docs/archive/CLOUDFLARE-SPEC.md 1.3): véu sobre a prévia. */
.photo-sending {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgb(0 0 0 / .5); color: #fff;
}
.photo-pick .hint { margin-top: .5rem; text-align: center; }

.tangible { border-collapse: collapse; margin: .5rem 0 1rem; font-size: var(--fs-sm); text-align: left; }
.tangible th, .tangible td { padding: .45rem .9rem; border-bottom: 1px solid var(--line); }
.tangible th { color: var(--muted); font-size: var(--fs-xs); }
.tangible td:first-child { color: var(--muted); text-decoration: line-through; }

.streak-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-bottom: 1rem; }
.streak-box div { background: var(--surface-2); border-radius: var(--r-sm); padding: .6rem; text-align: center; }
.streak-box b { display: block; font-family: var(--font-display); font-size: var(--fs-xl); color: var(--medium); line-height: 1.1; }
.streak-box span { font-size: var(--fs-xs); color: var(--muted); }

/* Medalhas: a peça central do mural */
.medal {
  --ring: #6b7090; --ring-2: #3c4060;
  width: 56px; aspect-ratio: 1; flex: none;
  padding: 4px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--ring), var(--ring-2), var(--ring), var(--ring-2), var(--ring));
  box-shadow: 0 0 0 2px var(--ring-2), 0 3px 0 var(--ring-2);
}
.medal-ring { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: var(--surface-2); box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); }
.medal-ring img { width: 100%; height: 100%; object-fit: cover; }
/* Objetivo sem foto: a logo do XPNotes, inteira e com respiro. */
.medal-ring img.is-placeholder, .group-thumb.is-placeholder { object-fit: contain; background: var(--surface-2); }
.medal-ring img.is-placeholder { padding: 20%; }
.group-thumb.is-placeholder { padding: 3px; }
.medal-sm { width: 40px; padding: 3px; }
.medal-md { width: 72px; padding: 5px; }
.medal-lg { width: 132px; padding: 9px; }
.medal-xl { width: 168px; padding: 11px; }

.tier-bronze   { --ring: #e0a070; --ring-2: #8a4f24; }
.tier-silver   { --ring: #eef1f6; --ring-2: #8b93a6; }
.tier-gold     { --ring: #ffe083; --ring-2: #b5800f; }
.tier-platinum { --ring: #d8fbf6; --ring-2: #5f9e98; }
.tier-diamond  { --ring: #c9e6ff; --ring-2: #6a5acd; }

.tier-text-bronze { color: #c98150; }
.tier-text-silver { color: var(--muted); }
.tier-text-gold { color: var(--gold-ink); }
.tier-text-platinum { color: #4fa59c; }
.tier-text-diamond { color: #7b6ef0; }
.tier-text-none { color: var(--muted); }

/* 8. Personagem --------------------------------------------------------- */
.char-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  /* `char-class` precisa estar declarada aqui: sem área nomeada ela era posicionada
     automaticamente na coluna de 300px e a árvore de classes ficava espremida. */
  grid-template-areas: "hero equip" "inv inv";
  gap: 1rem;
}
.char-hero { grid-area: hero; }
.char-equip { grid-area: equip; }
.char-inv { grid-area: inv; }

.swatches { display: flex; gap: 6px; }
.swatch {
  width: 32px; height: 32px; border-radius: var(--r-sm); cursor: pointer;
  background: var(--c); border: 2px solid var(--line);
}
.swatch.is-active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }


.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.slot {
  display: flex; align-items: center; gap: .6rem;
  padding: .4rem; border: 1px solid var(--line); border-radius: var(--r-sm);
}
.slot-icon {
  width: 48px; height: 48px; flex: none; border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
/* Espaço vazio: borda tracejada e a silhueta de um item do tipo (sem cor, bem apagada). */
.slot-icon.is-empty { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--muted) 45%, transparent); }
.slot-ghost { display: block; width: 100%; height: 100%; filter: brightness(0) saturate(0); opacity: .18; }
[data-theme="dark"] .slot-ghost { filter: brightness(0) invert(1); opacity: .16; }
.slot-ghost > *, .slot-ghost img, .slot-ghost canvas { width: 100%; height: 100%; }
.slot-icon { padding: 4px; }
.slot-icon img, .slot-icon canvas { width: 100%; height: 100%; }
.slot-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.slot-text small { color: var(--muted); font-size: var(--fs-xs); }
.slot-text span { font-weight: 700; font-size: var(--fs-sm); }

.inventory { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.item {
  --rar: var(--line);
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .5rem .4rem .6rem; cursor: pointer; text-align: center;
  background: var(--surface-2); border: 2px solid var(--rar); border-radius: var(--r-md);
  transition: transform .12s var(--ease-back);
}
.item:hover:not(:disabled) { transform: translateY(-2px); }
.item.is-equipped { background: color-mix(in srgb, var(--rar) 18%, var(--surface-2)); }
.item.is-locked { opacity: .45; cursor: not-allowed; }
.item.is-locked .item-art { filter: grayscale(1) brightness(.5); }
.item-art { width: 64px; height: 64px; }
.item-art img, .item-art canvas { width: 100%; height: 100%; }
/* Arte pintada dos equipamentos (docs/archive/ARTE-V2-SPEC.md 10): suave, nunca pixelada. */
canvas.art-icon { image-rendering: auto; display: block; }
.slot.is-core { align-items: stretch; }
.slot-pick .slot-icon { display: block; }
.slot-pick { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.slot-pick .item-stats { font-size: .6875rem; color: var(--easy); font-weight: 600; }
.core-list { display: flex; flex-direction: column; gap: 6px; }
.core-opt { display: flex; gap: .7rem; align-items: center; width: 100%; padding: .5rem; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: inherit; }
.core-opt:disabled { opacity: .5; cursor: not-allowed; }
.core-opt.is-active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.core-opt .core-icon { width: 48px; height: 48px; flex: none; }
.core-opt-text { display: flex; flex-direction: column; min-width: 0; }
.core-opt-text small { color: var(--muted); font-size: var(--fs-xs); }
.slot-note { list-style: none; padding: 2px 4px; }
.inv-more { grid-column: 1 / -1; justify-self: center; }
.item-name { font-weight: 700; font-size: var(--fs-xs); line-height: 1.25; }
.item-sub { font-size: .6875rem; color: var(--muted); }

/* 9. Mural / histórico -------------------------------------------------- */
/* Mural dentro da aba Conquistas de Personagem: título de seção, não de página. */
.wall-head h2 { font-size: var(--fs-xl); line-height: 1.15; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 2rem; }
.stat { background: var(--surface); padding: 1rem 1.1rem; display: flex; flex-direction: column; }
.stat b { font-size: var(--fs-xl); line-height: 1.15; }
.stat span { color: var(--muted); font-size: var(--fs-xs); }

.wall {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2rem 1rem; padding: 2rem 1rem;
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 50% 0, color-mix(in srgb, var(--gold) 10%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
}
.trophy { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; }
.trophy .medal { margin-bottom: .5rem; transition: transform .3s var(--ease-back); }
.trophy:hover .medal { transform: rotate(-4deg) scale(1.04); }
.trophy h2 { font-size: var(--fs-md); line-height: 1.3; max-width: 22ch; }
.trophy-date { font-family: var(--font-display); color: var(--gold-ink); font-size: var(--fs-sm); }
.trophy-meta { display: flex; gap: .75rem; font-size: var(--fs-xs); color: var(--muted); font-weight: 700; }
.ghost-medal { opacity: .35; }

.history-day + .history-day { margin-top: 1.5rem; }
.history-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.h-item {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .75rem;
  padding: .6rem .9rem;
}
.h-item + .h-item { border-top: 1px solid var(--line); }
.h-item b { display: block; font-size: var(--fs-sm); }
.h-item small { color: var(--muted); font-size: var(--fs-xs); }
.h-dot { width: 10px; height: 10px; border-radius: 2px; background: var(--easy); }
.h-goal { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.h-goal .icon { color: var(--brand-ink); }
.h-time { font-size: var(--fs-xs); color: var(--muted); font-family: var(--font-display); }

/* 10. Ajustes ----------------------------------------------------------- */
.tabs { display: flex; gap: .25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem .9rem; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 700; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.history-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.link-inline { font-size: inherit; }

.settings { display: flex; flex-direction: column; gap: 1rem; max-width: 760px; }
.setting-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .75rem 0;
}
.setting-row + .setting-row { border-top: 1px solid var(--line); }
.setting-row p { font-size: var(--fs-sm); }
.storage-status { font-size: var(--fs-xs); margin-top: .5rem; }
.rules { list-style: disc; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; font-size: var(--fs-sm); max-width: 70ch; }
.panel-danger { border-color: color-mix(in srgb, var(--hard) 45%, var(--line)); }

/* Pré-requisitos e vínculo entre objetivos */
.prereqs { border-top: 1px solid var(--line); padding-top: .75rem; }
.prereq-title { display: flex; align-items: center; gap: .4rem; font-size: var(--fs-xs); color: var(--muted); margin-bottom: .5rem; }
.prereq-chain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.prereq-chain li { position: relative; }
/* linha ligando as medalhas, do mais antigo para o atual */
.prereq-chain li + li::before {
  content: ''; position: absolute; left: 25px; top: -6px; height: 12px;
  border-left: 2px dashed var(--line);
}
.prereq {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .3rem .35rem; border: 0; border-radius: var(--r-sm);
  background: none; cursor: pointer; text-align: left;
}
.prereq:hover { background: var(--surface-2); }
.prereq-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.prereq-name { font-weight: 700; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.prereq small { color: var(--muted); font-size: var(--fs-xs); }

.goal-detail { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; margin-bottom: 1rem; }
.goal-detail h3 { font-size: var(--fs-lg); }
.detail-list { width: 100%; margin: .5rem 0 0; text-align: left; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.detail-list .link-btn { font-size: inherit; }

.complete-summary { display: flex; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.complete-summary h3 { font-size: var(--fs-lg); }
.choice-list { display: flex; flex-direction: column; gap: 6px; }
.choice {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .7rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}
.choice input { margin-top: .25rem; accent-color: var(--accent); }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-size: var(--fs-xs); }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.choice.is-disabled { opacity: .5; cursor: not-allowed; }

.link-panel { display: none; margin-top: 1rem; }
.link-choice[data-mode="existing"] [data-panel="existing"],
.link-choice[data-mode="new"] [data-panel="new"],
.link-choice[data-mode="existing"] [data-panel="quests"],
.link-choice[data-mode="new"] [data-panel="quests"] { display: block; }
.link-quests h3 { margin-bottom: .2rem; }
.keep-list { display: flex; flex-direction: column; gap: 4px; margin: .6rem 0 .4rem; }
.keep-quest {
  display: flex; align-items: center; gap: .7rem;
  padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}
.keep-quest input { accent-color: var(--easy); width: 18px; height: 18px; }
.keep-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.keep-text small { color: var(--muted); font-size: var(--fs-xs); }
.keep-state { font-size: var(--fs-xs); font-weight: 700; color: var(--easy); }
.keep-state::after { content: 'segue junto'; }
.keep-quest:has(input:not(:checked)) .keep-text b { text-decoration: line-through; color: var(--muted); }
.keep-quest:has(input:not(:checked)) .keep-state { color: var(--muted); }
.keep-quest:has(input:not(:checked)) .keep-state::after { content: 'será arquivada'; }

.trophy-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.trophy-next { font-size: var(--fs-xs); color: var(--muted); }
.celebration-next { font-size: var(--fs-sm); padding: .5rem .75rem; border-radius: var(--r-sm); background: var(--surface-2); }

/* Combate ---------------------------------------------------------------- */
.hud-res { grid-column: 1 / -1; display: flex; gap: .75rem; color: var(--muted); text-decoration: none; font-size: var(--fs-xs); font-weight: 700; }
.hud-res span { display: inline-flex; align-items: center; gap: .2rem; }
.hud-res span:first-child { color: var(--gold-ink); }

.wallet { display: flex; gap: .5rem; flex-wrap: wrap; }
.wallet-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .85rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
}
.wallet-item > .icon { width: 1.6rem; height: 1.6rem; color: var(--accent); }
.wallet-item.gold > .icon { color: var(--gold-ink); }
.wallet-item b { display: block; font-size: var(--fs-xl); line-height: 1; }
.wallet-item b small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.wallet-item span { display: block; font-size: .6875rem; color: var(--muted); line-height: 1.3; margin-top: .15rem; }

.section-title { font-size: var(--fs-lg); margin: 1.5rem 0 .5rem; }
.shop section:first-child > .section-title { margin-top: 0; }

.arena-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1rem; align-items: start; }
.fighter-card { position: sticky; top: 1rem; }
.fighter-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.fighter-sprite .sprite { width: 96px; height: 96px; }
.record { display: flex; gap: .6rem; font-size: var(--fs-xs); color: var(--muted); margin-top: .2rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; margin: 0 0 .5rem; }
.stat-grid div { background: var(--surface-2); border-radius: var(--r-sm); padding: .3rem .5rem; }
.stat-grid dt { font-size: .6875rem; color: var(--muted); font-weight: 700; }
.stat-grid dd { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); }

.monster-list { display: flex; flex-direction: column; gap: .6rem; }
/* Regiões (docs/archive/ARTE-V2-SPEC.md 6.1) e fundos pintados (6.5) */
.arena-main { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.region-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.region-tab {
  display: flex; flex-direction: column; align-items: flex-start; flex: none; gap: 0;
  padding: .35rem .65rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: var(--fs-sm); cursor: pointer;
}
.region-tab small { font-weight: 500; color: var(--muted); font-size: .6875rem; }
.region-tab[aria-selected="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.region-tab.is-locked { opacity: .5; cursor: not-allowed; flex-direction: row; align-items: center; gap: .3rem; }
.region-tab.is-locked small { display: none; }
.region-tab .icon { width: .9em; height: .9em; }
.region-banner {
  display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem;
  min-height: 84px; padding: .7rem .9rem; border-radius: var(--r-lg);
  background: radial-gradient(circle at 50% 70%, var(--stage-floor), var(--stage) 70%) center / cover no-repeat;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.region-banner.has-bg { background-size: cover; background-position: center 60%; }
.region-banner h2 { font-size: var(--fs-lg); }
.region-banner span { font-size: var(--fs-xs); font-weight: 700; }
.monster-art canvas.monster-img { width: 96px; height: 96px; }
.monster.is-locked .monster-art canvas { filter: brightness(0) opacity(.5); }
.vs-art canvas.monster-img { width: 112px; height: 112px; }
.c-art canvas.monster-img {
  /* Tamanho e altura por monstro (editor visual, aba Monstros): --mon-scale e --mon-dy. */
  width: calc(150px * var(--mon-scale, 1)); height: calc(150px * var(--mon-scale, 1)); display: block;
  transform: translateY(calc(var(--mon-dy, 0) * 100%));
}
.stage.has-bg { background-size: cover; background-position: center 65%; }
/* Véu branco leve sobre o fundo da região: destaca personagem e monstro (igual nos dois temas). */
.stage.has-bg::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: rgba(255, 255, 255, .18);
}
.stage.has-bg > * { position: relative; z-index: 1; }
.stage.has-bg .c-name { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.85); }
.drop-chip.is-core { border-color: var(--brand); }
.chip-core { font-size: .625rem; padding: .05rem .35rem; border-radius: 999px; background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-ink); vertical-align: middle; }
.monster {
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1rem;
  padding: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.monster.is-locked { opacity: .55; }
.monster.is-locked .monster-art img { filter: brightness(0) opacity(.5); }
.monster-art {
  display: grid; place-items: center; border-radius: var(--r-md);
  background: radial-gradient(circle at 50% 70%, var(--stage-floor), var(--stage) 70%);
}
.monster-art img { width: 96px; height: 96px; }
.monster-title { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.monster-title h2 { font-size: var(--fs-lg); margin-right: .2rem; }
.monster-title .chip { background: var(--surface-2); }
.chip-hint.hint-easy { color: var(--easy); }
.chip-hint.hint-mid { color: var(--medium); }
.chip-hint.hint-hard { color: var(--hard); }
.monster-info > p { font-size: var(--fs-sm); margin: .15rem 0 .4rem; }
.monster-stats { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: var(--fs-xs); color: var(--muted); }
.monster-stats b { color: var(--text); font-family: var(--font-display); }
.monster-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .6rem; }
.drops { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.drops > .hint:first-child { margin-right: .2rem; }
.gold-range { margin-left: .4rem; color: var(--gold-ink); font-weight: 700; }
.drop-chip {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); color: var(--accent);
}
.drop-chip.is-equip { border-color: #9b5de5; }
.drop-chip.is-owned { opacity: .45; }
.drop-chip .item-icon { width: 22px; height: 22px; }
.monster-action { display: flex; align-items: center; gap: .6rem; }

.item-icon { width: 28px; height: 28px; flex: none; }

/* Preparação */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; min-width: 0; }
.vs-side .stat-grid { width: 100%; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); }
.vs-art .sprite, .vs-art img { width: 96px; height: 96px; }
.vs-mark { font-size: var(--fs-xl); color: var(--hard); }
.prep-section { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.prep-section h3 { font-size: var(--fs-md); }
.prep-section .hint { margin: .15rem 0 .6rem; }
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.skill-opt {
  display: flex; gap: .6rem; align-items: flex-start; text-align: left;
  padding: .6rem; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); cursor: pointer;
}
.skill-opt:disabled { opacity: .45; cursor: not-allowed; }
.skill-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.skill-order {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px dashed var(--line); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xs);
}
.skill-opt[aria-pressed="true"] .skill-order { background: var(--accent); border: 0; color: #fff; }
.skill-body { display: flex; flex-direction: column; }
.skill-body small { color: var(--muted); font-size: var(--fs-xs); }
.kind-heal b { color: var(--easy); }
.kind-buff b { color: var(--medium); }

.item-rows { display: flex; flex-direction: column; gap: 4px; }
.item-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .6rem;
  padding: .4rem .6rem; border: 1px solid var(--line); border-radius: var(--r-sm);
}
.item-row.is-selected { border-color: var(--accent); }
.item-row-text { display: flex; flex-direction: column; min-width: 0; }
.item-row-text small { color: var(--muted); font-size: var(--fs-xs); }
.stepper { display: flex; align-items: center; gap: .15rem; }
.stepper .icon-btn { width: 30px; height: 30px; border: 1px solid var(--line); font-size: 1.1rem; font-weight: 700; color: var(--text); }
.stepper .icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 1.6rem; text-align: center; font-family: var(--font-display); font-weight: 700; }

/* Luta */
.battle { display: flex; flex-direction: column; gap: .75rem; }
.c-name { font-weight: 700; font-size: var(--fs-sm); }
/*
 * Palco N contra M (docs/archive/EVOLUCAO-SPEC.md 1.7). Todo lutador tem o mesmo tamanho no solo e em
 * grupo (--fighter-size). Time à esquerda em 3 linhas (trás · meio · frente, a frente perto do
 * centro); monstros à direita. Nome, HP e energia ficam no HUD embaixo do palco.
 */
.stage {
  --fighter-size: clamp(76px, 20vw, 128px);
  container-type: inline-size;
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: .5rem;
  min-height: calc(var(--fighter-size) * 1.9);
  padding: 1.2rem 1rem .9rem; border-radius: var(--r-md);
  background:
    linear-gradient(transparent 70%, var(--stage-floor) 70%),
    var(--stage);
}
/* O sprite cabe na coluna: metade do palco ÷ colunas ocupadas daquele lado (no máximo 128 px).
 * A arte tem margem transparente, então 1,1× a coluna ainda não encosta no vizinho. */
.stage > .side { --fighter-size: min(128px, calc((50cqw - 1.25rem) / var(--side-cols, 1) * 1.1)); }
.side { display: flex; align-items: flex-end; min-width: 0; gap: calc(var(--fighter-size) * .06); }
.side-team { justify-content: flex-end; padding-right: calc(var(--fighter-size) * .1); }
.side-foes { justify-content: flex-start; padding-left: calc(var(--fighter-size) * .1); }
.line { display: flex; flex-direction: column; align-items: center; flex: 0 1 calc(100% / var(--side-cols, 1)); min-width: 0; }
/* Dois na mesma linha: um atrás (em cima, recuado) e outro na frente (embaixo), quase sem cobrir. */
.line .fighter + .fighter { margin-top: calc(var(--fighter-size) * -.28); z-index: 2; }
.side-team .line .fighter:first-child:not(:last-child) { transform: translateX(calc(var(--fighter-size) * -.18)); }
.side-foes .line .fighter:first-child:not(:last-child) { transform: translateX(calc(var(--fighter-size) * .18)); }
.fighter { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; z-index: 1; }
.fighter .c-art { margin: 0; }
.fighter .c-art .sprite, .fighter .c-art img, .fighter .c-art .party-sprite { width: var(--fighter-size); height: var(--fighter-size); display: block; }
.fighter .c-art .party-sprite canvas { width: 100%; height: 100%; display: block; }
.fighter.right .c-art canvas.monster-img {
  /* Nunca maior que a coluna do monstro: monstros largos não invadem a linha vizinha. */
  --mon-size: min(calc(var(--fighter-size) * 1.15 * var(--mon-scale, 1)), calc((50cqw - .75rem) / var(--side-cols, 1) * 1.05));
  width: var(--mon-size); height: var(--mon-size);
}
.fighter.is-acting .c-art { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--gold) 70%, transparent)); }
.fighter.is-down .c-art { opacity: .35; filter: grayscale(1); }
/* Invocações (fase 6): ícone pequeno ao pé do dono, com a quantidade. */
.c-summons {
  position: absolute; right: -6px; bottom: 2px; z-index: 3;
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25); font-size: .7rem;
}
.c-summons[hidden] { display: none; }
.c-summons .summon-icon { width: 20px; height: 20px; border-radius: 4px; }
/* Combate V3: anel de foco no alvo do time (menor HP%). */
.fighter.is-focus::before {
  content: ''; position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  width: calc(var(--fighter-size) * .9); height: calc(var(--fighter-size) * .22);
  border: 2px solid var(--hard); border-radius: 50%;
  box-shadow: 0 0 8px color-mix(in srgb, var(--hard) 60%, transparent);
  pointer-events: none; z-index: -1;
}
.fighter.is-focus.is-down::before { display: none; }
.hud-card.right.is-focus { border-color: var(--hard); }
.hud-card.right.is-focus .c-name::before { content: '◎ '; color: var(--hard); }
.fighter.defeated .c-art { opacity: .25; filter: grayscale(1); transform: translateY(8px) rotate(-6deg); transition: all .5s; }

/* HUD embaixo do palco: um cartão por lutador (time à esquerda, monstros à direita). */
.hud { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .5rem; }
.hud-team, .hud-foes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .35rem; align-content: start; }
.hud-foes { grid-template-columns: repeat(auto-fill, minmax(140px, 180px)); justify-content: end; }
.hud-card {
  display: grid; gap: .2rem; padding: .4rem .55rem .45rem; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s;
}
.hud-card .c-name { font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-card .bar { width: 100%; max-width: none; }
.hud-card.right { border-color: color-mix(in srgb, var(--hard) 35%, var(--line)); }
.hud-card.is-acting { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.hud-card.is-down { opacity: .5; }
.hud-card.is-down .c-name::after { content: ' ✕'; color: var(--hard); }
@media (max-width: 640px) {
  .stage { --fighter-size: clamp(64px, 19vw, 96px); padding: 1rem .5rem .7rem; }
  .stage > .side { --fighter-size: min(104px, calc((50cqw - .5rem) / var(--side-cols, 1) * 1.25)); }
  .stage { min-height: calc(var(--fighter-size) * 2.2); }
  .rot-item { grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: .4rem; padding: .45rem .5rem; }
  .rot-item .sort-handle { display: none; }
  .hud { grid-template-columns: 1fr; }
  .hud-team, .hud-foes { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }
}
.bar-hp .bar-fill.low { background: linear-gradient(#ff9f9f, #d62828); }
.c-hp { font-family: var(--font-display); font-size: var(--fs-xs); color: var(--muted); }
.c-art { margin-top: .25rem; }
.c-art.lunge { animation: lunge-r .3s ease-out; }
.right .c-art.lunge { animation-name: lunge-l; }
.c-art.shake { animation: shake .35s ease-in-out; }
@keyframes lunge-r { 40% { transform: translateX(24px); } }
@keyframes lunge-l { 40% { transform: translateX(-24px); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); filter: brightness(1.8) saturate(.4); } 40%, 80% { transform: translateX(5px); } }
.c-fx { position: absolute; inset: 40% 0 auto; display: flex; justify-content: center; pointer-events: none; }
.c-float {
  position: absolute; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  text-shadow: 0 2px 0 rgba(0,0,0,.4); white-space: nowrap;
  animation: float-up-small 1s ease-out forwards;
}
.c-float.dmg { color: var(--hard); }
.c-float.crit { color: var(--gold); font-size: 1.7rem; }
.c-float.heal { color: #7ee2a0; }
.c-float.buff { color: var(--medium); font-size: 1rem; }
.c-float.miss { color: var(--muted); font-size: 1rem; }
@keyframes float-up-small { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 20% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-40px); } }

.battle-log {
  list-style: none; margin: 0; padding: .5rem .75rem; height: 150px; overflow-y: auto;
  background: var(--surface-2); border-radius: var(--r-sm); font-size: var(--fs-sm);
}
.battle-log li { padding: .15rem 0; }
.battle-log .log-monster { color: var(--muted); }
.battle-log .log-heal, .battle-log .log-buff { color: var(--easy); }
.battle-log .log-sys, .battle-log .log-end { font-weight: 700; }
.battle-result { text-align: center; }
/* Resultado da luta em pop-up por cima do palco (visível sem rolar, no desktop e no celular). */
.result-pop {
  position: absolute; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 1rem;
  background: color-mix(in srgb, var(--bg, #0b0c18) 55%, transparent);
  backdrop-filter: blur(2px); border-radius: inherit;
  animation: pop-in .22s ease-out;
}
.result-pop[hidden] { display: none; }
.result-card {
  width: min(420px, 100%); max-height: calc(100% - 1rem); overflow-y: auto;
  padding: 1.1rem 1.1rem 1rem; border-radius: var(--r-lg, 16px);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1.2rem 2.4rem rgba(0, 0, 0, .35);
}
.result-card.is-win { border-top: 4px solid var(--gold); }
.result-card.is-lose { border-top: 4px solid var(--hard); }
.result-card .result-title { margin-top: 0; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .9rem; }
.result-actions .btn-primary { flex: 1 1 100%; justify-content: center; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .result-pop { animation: none; } }
.result-title { font-size: var(--fs-xxl); margin-bottom: .5rem; }
.result-title.win { color: var(--gold-ink); }
.result-title.lose { color: var(--hard); }
.rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: .5rem; }
.reward {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: 999px; background: var(--surface-2); font-size: var(--fs-sm);
  animation: celebrate .4s var(--ease-back) both;
}
.reward:nth-child(2) { animation-delay: .1s; } .reward:nth-child(3) { animation-delay: .2s; } .reward:nth-child(4) { animation-delay: .3s; }
.reward .item-icon { width: 22px; height: 22px; }
.reward.gold { color: var(--gold-ink); font-weight: 700; }
.reward.new { box-shadow: inset 0 0 0 1px var(--accent); }

/* Loja */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; }
.shop-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
  padding: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.shop-card.is-owned { opacity: .6; }
.shop-icon { width: 52px; height: 52px; display: grid; place-items: center; background: var(--surface-2); border-radius: var(--r-sm); }
.shop-icon .item-icon { width: 40px; height: 40px; }
.shop-body h3 { font-size: var(--fs-md); }
.shop-body .hint { margin: .1rem 0; }
.stats-line { font-size: var(--fs-xs); color: var(--easy); font-weight: 700; }
.shop-meta { display: flex; align-items: center; gap: .75rem; margin-top: .2rem; }
.price { display: inline-flex; align-items: center; gap: .2rem; font-weight: 700; color: var(--gold-ink); }
.shop-actions { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.mat-reqs, .class-reqs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: .3rem; }
.mat-req {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .05rem .45rem .05rem .2rem; border-radius: 999px;
  font-size: .6875rem; font-weight: 700; color: var(--hard);
  background: color-mix(in srgb, var(--hard) 10%, transparent);
}
.mat-req.ok { color: var(--easy); background: color-mix(in srgb, var(--easy) 12%, transparent); }
.mat-req .item-icon { width: 16px; height: 16px; }
.mat-req .icon { width: .95em; height: .95em; }

/* Mochila */
.skill-class { margin: .75rem 0 1.25rem; }
.skill-class h3 { display: flex; align-items: baseline; gap: .5rem; font-size: var(--fs-md); margin-bottom: .4rem; }
.skill-class h3 .hint { margin-left: auto; }
.skill-class:not(.is-current) .skill-known { opacity: .6; }
.skill-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.skill-list li {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .55rem .65rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
}
.skill-list li > .icon { margin-top: .15rem; color: var(--accent); }
.skill-list div { display: flex; flex-direction: column; }
.skill-list small { font-size: var(--fs-xs); color: var(--muted); }
.skill-unknown { border-style: dashed !important; background: transparent !important; }
.skill-unknown b { color: var(--muted); }
.skill-unknown > .icon { color: var(--muted) !important; }

/* Classes no personagem */
.class-list { display: flex; flex-direction: column; gap: 6px; }
.item-stats { font-size: .6875rem; color: var(--easy); font-weight: 700; line-height: 1.25; }

/* 11. Modal, toasts, efeitos ------------------------------------------- */
.modal {
  width: min(560px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
  animation: modal-in .2s var(--ease-out);
}
.modal-wide { width: min(720px, calc(100vw - 1.5rem)); }
.modal::backdrop { background: rgba(8, 9, 20, .6); backdrop-filter: blur(2px); }
.modal.leaving { animation: modal-out .16s ease-in forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem .5rem; }
.modal-head h2 { font-size: var(--fs-lg); }
.modal-body { padding: .5rem 1.25rem 1rem; overflow-y: auto; max-height: calc(100vh - 12rem); }
.modal-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); }

.toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: .5rem; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: .75rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: .6rem .6rem .6rem 1rem;
  background: var(--text); color: var(--bg);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  font-size: var(--fs-sm); font-weight: 700;
  animation: toast-in .25s var(--ease-back);
}
.toast .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.toast.gold { background: var(--brand-fill); color: var(--on-brand); }
.toast.danger { background: var(--hard); color: #fff; }
.toast.leaving { animation: toast-out .25s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.fx-float {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 700; font-size: 1.375rem;
  color: var(--brand); white-space: nowrap;
  text-shadow: 2px 2px 0 rgba(0,0,0,.35);
  animation: float-up 1.1s var(--ease-out) forwards;
}
.fx-float.goal { color: var(--accent); font-size: 1rem; }
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, -80%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -260%) scale(1); }
}
.fx-particle {
  position: absolute; width: 6px; height: 6px;
  animation: particle .7s var(--ease-out) forwards;
}
@keyframes particle { to { transform: translate(var(--dx), var(--dy)) rotate(90deg); opacity: 0; } }
.fx-confetti { position: absolute; inset: 0; }

.celebration {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center; padding: 1rem;
  background: rgba(8, 9, 20, .72);
  animation: fade-in .25s ease-out;
}
.celebration.leaving { animation: fade-out .25s ease-in forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.celebration-card {
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  width: min(380px, 100%); padding: 2rem 1.5rem 1.5rem; text-align: center;
  background: var(--surface); border: 2px solid var(--brand); border-radius: var(--r-lg);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow);
  animation: celebrate .5s var(--ease-back);
}
@keyframes celebrate { from { transform: scale(.7); opacity: 0; } }
.celebration-card h2 { font-size: var(--fs-xxl); line-height: 1.1; color: var(--brand-ink); }
.celebration-title { font-weight: 700; font-size: var(--fs-lg); }
.celebration-card .btn { margin-top: .75rem; min-width: 160px; }
.celebration .sprite-lg { width: 128px; height: 128px; animation: hop .6s steps(3) 2; }
@keyframes hop { 50% { transform: translateY(-10px); } }
.is-achievement .medal { animation: medal-spin 1s var(--ease-out); }
@keyframes medal-spin { from { transform: rotateY(180deg) scale(.6); } }
.lvl-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 1rem; width: 100%; margin-top: .5rem; }
.lvl-stats li { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }
.lvl-stats b { color: var(--easy); font-family: var(--font-display); }
.lvl-stats b::before { content: '▲ '; font-size: .7em; }

/* 12. Responsivo -------------------------------------------------------- */
@media (max-width: 1080px) {
  .home { grid-template-columns: minmax(0, 1fr) 280px; gap: 1.25rem; }
  .char-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hero" "equip" "inv"; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 40; height: auto;
    flex-direction: row; align-items: center; gap: .75rem;
    padding: .5rem 1rem; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand-name { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; flex: 1; justify-content: flex-end; }
  .top-hud { max-width: 280px; grid-template-columns: auto 1fr auto; }
  .hud-xp { display: none; }

  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    flex-direction: row; justify-content: space-around; gap: 0;
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .nav a { flex-direction: column; gap: .1rem; padding: .35rem .25rem; font-size: .625rem; flex: 1; }
  .nav a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--brand); background: none; }
  .nav .icon { width: 1.35em; height: 1.35em; }

  .main { padding: 1.25rem 1rem 6rem; }
  .page-head h1 { font-size: var(--fs-xl); }
  .toasts { bottom: 5rem; left: 1rem; right: 1rem; align-items: stretch; }

  .home { grid-template-columns: 1fr; }
  .home-side { position: static; order: -1; }
  .side-goals { display: none; }

  .goal-form { grid-template-columns: 1fr; justify-items: center; }
  .arena-layout { grid-template-columns: 1fr; }
  .fighter-card { position: static; }
  .hud-res { grid-column: auto; }
  .goal-form-fields { width: 100%; }
  .goal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  /* Barra do topo no celular: o tema também está em Ajustes; sem ele cabem o sininho e o sair
     (docs/ADMIN-V2-SPEC.md 6.4) sem rolagem horizontal. */
  .sidebar { gap: .5rem; padding: .5rem .75rem; }
  .sidebar-foot { gap: .15rem; }
  #theme-toggle { display: none; }
  .hero { gap: .75rem; padding: .75rem; }
  .hero-lg .hero-stage { width: 160px; height: 160px; }
  .hero-lg .hero-stage .sprite { width: 128px; height: 128px; margin: 16px; }
  .quest-side .icon-btn:not(.focus-eye) { display: none; }
  .add-actions .hint { display: none; }
  .streak-box b { font-size: var(--fs-lg); }
  .lvl-stats { grid-template-columns: repeat(2, 1fr); }
  .top-hud .hud-xp { display: none; }
  .monster { grid-template-columns: 72px minmax(0, 1fr); gap: .6rem; }
  .monster-art img, .monster-art canvas.monster-img { width: 64px; height: 64px; }
  .versus { grid-template-columns: 1fr; }
  .vs-mark { text-align: center; }
  .item-row { grid-template-columns: auto 1fr auto; }
  .item-row > .hint { display: none; }
  .shop-card { grid-template-columns: auto 1fr; }
  .shop-actions { grid-column: 1 / -1; flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* ===== Ordenação manual (release 2) ===== */
.sort-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.1rem; height: 1.8rem; padding: 0; flex: none; margin-top: 2px;
  border: 0; border-radius: .4rem; background: none; color: var(--muted);
  cursor: grab; touch-action: none; opacity: 0; transition: opacity .12s ease;
}
.sort-handle:disabled { cursor: not-allowed; opacity: .25; }
.quest .sort-handle { opacity: .35; }
.quest:hover .sort-handle,
.goal-card:hover .sort-handle,
.sort-handle:focus-visible { opacity: 1; }
.sort-handle:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: 2px; }
.goal-card .sort-handle { position: absolute; top: .5rem; left: .35rem; }
.goal-card { position: relative; }
.is-dragging { opacity: .85; cursor: grabbing; box-shadow: 0 .6rem 1.4rem rgba(0, 0, 0, .28); }
.is-grabbed { outline: 2px dashed var(--accent, currentColor); outline-offset: 2px; }
.sort-placeholder {
  list-style: none; box-sizing: border-box;
  border-radius: var(--r-sm); border: 2px dashed var(--line);
  background: color-mix(in srgb, var(--line) 12%, transparent);
}

/* Toque: a alça fica sempre visível (não existe hover). */
@media (hover: none) {
  .sort-handle { opacity: .6; }
}
@media (prefers-reduced-motion: reduce) {
  .sort-handle { transition: none; }
  .is-dragging { box-shadow: none; }
}


/* ===== Preparar combate: solo x em grupo (release 2) ===== */
.prep-mode { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .8rem; }
.seg { display: inline-flex; gap: .2rem; padding: .2rem; border: 1px solid var(--line); border-radius: .6rem; align-self: flex-start; }
.seg-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border: 0; border-radius: .45rem;
  background: none; color: inherit; font: inherit; cursor: pointer;
}
.seg-btn[aria-pressed="true"] { background: var(--brand-fill); color: var(--on-brand); font-weight: 700; }
.seg-btn:disabled { opacity: .45; cursor: not-allowed; }

.vs-team { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.vs-allies { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.vs-ally { display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .8rem; text-align: center; }
.vs-ally .sprite, .vs-ally .party-sprite { width: 56px; height: 56px; }

/* =====================================================================
 * Combate V2 — Rotação, energia e balão de fala (docs/archive/COMBATE-V2-SPEC.md)
 * ===================================================================== */

/* --- Preparação: Rotação --- */
.rotation { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .4rem; counter-reset: rot; }
.rot-item {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto auto;
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  align-items: center;
  gap: .5rem;
  padding: .45rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 10px);
  background: var(--surface-2, var(--surface));
  counter-increment: rot;
}
.rot-item::before {
  content: counter(rot);
  position: absolute;
  margin-left: -.15rem;
  opacity: 0;                       /* a ordem é visível pela posição; isto é só para copiar/colar */
}
.rot-item .sort-handle { opacity: .7; }
.rot-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.rot-item.is-dragging { cursor: grabbing; border-color: var(--accent); background: var(--surface); }
body.is-sorting, body.is-sorting * { cursor: grabbing !important; }
.rot-pos {
  width: 1.5rem; height: 1.5rem; display: inline-grid; place-items: center; border-radius: 50%;
  background: var(--brand-fill); color: var(--on-brand); font-weight: 800; font-size: .8rem;
}
.rot-remove {
  width: 2.1rem; height: 2.1rem; display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--hard) 55%, transparent);
  background: color-mix(in srgb, var(--hard) 10%, transparent); color: var(--hard); cursor: pointer;
  transition: background .12s, color .12s;
}
.rot-remove svg { width: 1rem; height: 1rem; }
.rot-remove:hover, .rot-remove:focus-visible { background: var(--hard); color: #fff; }
.rot-remove:focus-visible { outline: 2px solid var(--hard); outline-offset: 2px; }
.rot-body { min-width: 0; display: grid; }
.rot-body small { color: var(--muted); }
.rot-turns { font-variant-numeric: tabular-nums; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.rot-sub { margin: .8rem 0 .4rem; font-size: .9rem; color: var(--muted); }
.skill-cd { color: var(--muted); font-size: var(--fs-xs, .78rem); }
.prep-encounter { margin: 0 0 .8rem; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm, .5rem); background: var(--surface-2); }
.prep-encounter p { margin: 0; }
.prep-encounter p + p { margin-top: .25rem; }
.prep-encounter .hint svg { vertical-align: -2px; }
.form-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name seg" "cls seg"; align-items: center; gap: 0 .6rem; }
.form-row > b { grid-area: name; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-row > small { grid-area: cls; }
.form-row > .seg { grid-area: seg; align-self: center; }
.seg-sm .seg-btn { padding: .3rem .6rem; font-size: .85rem; }
.encounter-line { text-align: center; color: var(--muted); margin: .2rem 0 .6rem; }
.skill-energy {
  min-width: 1.6rem; height: 1.6rem;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  background: var(--accent-soft, rgba(120, 150, 255, .18));
  color: var(--accent);
  font-weight: 700; font-size: .85rem;
}
.prep-order { display: flex; align-items: center; gap: .35rem; color: var(--muted); margin: .2rem 0 .8rem; }
.stat-details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.check-row { display: flex; gap: .5rem; align-items: flex-start; margin-top: .6rem; }

/* --- Luta: número dentro da barra de HP --- */
.bar-hp { position: relative; }
/**
 * Barra com número dentro. A barra padrão tem 12px de altura: texto legível não cabe ali,
 * então quem carrega número cresce. A legibilidade vem de um contorno escuro em volta do
 * texto branco, que funciona tanto sobre a parte preenchida (dourado/vermelho) quanto sobre
 * o trilho vazio, claro no tema claro e escuro no tema escuro.
 */
.bar.has-num { height: 20px; border-radius: 4px; }
.bar-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  paint-order: stroke fill;
  -webkit-text-stroke: 3px rgba(0, 0, 0, .65);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
  pointer-events: none;
}

/* --- Luta: energia em segmentos --- */
.bar-energy {
  position: relative;
  display: flex; gap: 2px;
  height: 8px; margin-top: 3px;
}
.bar-energy .seg {
  flex: 1;
  border-radius: 2px;
  background: var(--line);
  transition: background .18s ease;
}
.bar-energy .seg.on { background: var(--accent); }
.bar-energy b {
  position: absolute; right: -.9rem; top: -.25rem;
  font-size: .68rem; color: var(--muted);
}

/* --- Luta: balão de fala --- */
/**
 * Balão do nome da habilidade.
 *
 * Ancorado na DIAGONAL superior direita do sprite, não acima do combatente inteiro: como o
 * bloco de nome e barras fica no topo, `bottom: 100%` jogava o balão para fora do palco e
 * ele aparecia cortado na borda do modal. Aqui ele nasce ao lado da cabeça, dentro do palco,
 * com a seta apontando para baixo e para a esquerda, na direção de quem conjurou.
 */
.c-bubble {
  position: absolute; left: 62%; top: 42%;
  z-index: 5;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: var(--ink, #2a2238);
  color: #fff;
  border: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  font-family: var(--font-display); font-weight: 700;
  font-size: .85rem; letter-spacing: .01em; white-space: nowrap;
  animation: bubble-in .2s ease-out;
}
.c-bubble::after {
  content: '';
  position: absolute; top: 100%; left: 14px;
  border: 6px solid transparent;
  border-top-color: var(--gold);
}
/* Em grupo os sprites se sobrepõem: o balão sobe um pouco e fica menor. */
.party-stage .side-team .c-bubble { top: 8%; font-size: .78rem; padding: .22rem .55rem; }

/* O inimigo fica à direita do palco: o balão dele abre para a esquerda, senão sai da tela. */
.fighter.right .c-bubble { left: auto; right: 62%; }
.fighter.right .c-bubble::after { left: auto; right: 14px; }
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .c-bubble { animation: none; } }

/* Fogo de conjuração: anel colorido por tipo de efeito, some sozinho. */
.c-cast {
  position: absolute; left: 50%; top: 55%;
  width: 90px; height: 90px; margin: -45px 0 0 -45px;
  border-radius: 999px;
  border: 3px solid currentColor;
  pointer-events: none;
  animation: cast-ring .45s ease-out forwards;
}
.c-cast.damage { color: #f2762b; }
.c-cast.heal { color: #3fa96a; }
.c-cast.buff { color: #b07ae8; }
.c-cast.shield { color: #4b7bec; }
.c-cast.taunt { color: #e0566b; }
.c-cast.dot { color: #7cb342; }
@keyframes cast-ring {
  from { opacity: .9; transform: scale(.3); }
  to { opacity: 0; transform: scale(1.25); }
}
@media (prefers-reduced-motion: reduce) { .c-cast { display: none; } }

/* --- Log oculto por padrão --- */
.battle-log[hidden] { display: none; }
[data-log-toggle] { align-self: flex-start; margin: .4rem 0; }

/* --- Painel de administrador (views/admin.js) --- */
.admin-warn { border-left: 3px solid var(--brand); }
.admin-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem;
  margin-bottom: .6rem;
}
.admin-row label { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }
.admin-row input, .admin-row select { min-width: 8rem; }

/* --- Verificação em duas etapas (views/two-factor.js; docs/archive/2FA-SPEC.md 3.2) --- */
.tfa-warn { color: var(--medium); }
.tfa-on { display: inline-flex; align-items: center; gap: .35rem; color: var(--easy); }
.tfa-ok { display: flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--easy); margin-bottom: .6rem; }
.tfa-form { display: grid; gap: .8rem; }
.tfa-steps { display: grid; gap: 1rem; padding-left: 1.2rem; margin: 0; }
.tfa-steps li { display: grid; gap: .5rem; }
.tfa-qr {
  display: grid; place-items: center;
  width: min(220px, 100%); aspect-ratio: 1; margin: .2rem 0;
  background: #fff; border-radius: var(--r-md); padding: .4rem;
}
.tfa-qr svg { width: 100%; height: 100%; display: block; }
.tfa-key { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.tfa-key code, .tfa-codes code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: var(--fs-sm); letter-spacing: .04em; overflow-wrap: anywhere;
  padding: .3rem .5rem; border-radius: var(--r-sm); background: var(--surface-2);
}
.tfa-field { display: grid; gap: .3rem; font-size: var(--fs-sm); font-weight: 700; }
.tfa-field input {
  font: inherit; font-weight: 400; padding: .6rem .75rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md);
}
.tfa-field input.tfa-code, .net-field input.net-code {
  font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums;
}
.tfa-codes {
  list-style: none; padding: 0; margin: .8rem 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem;
}
.tfa-codes code { display: block; text-align: center; }
.tfa-check { display: flex; align-items: center; gap: .5rem; font-weight: 700; margin-top: .4rem; }

/* --- Excluir a conta (views/privacy.js; docs/SITE-SPEC.md 4.5) --- */
.del-list { display: grid; gap: .3rem; margin: 0; padding-left: 1.2rem; list-style: disc; font-size: var(--fs-sm); }
.del-warn { color: var(--hard); font-weight: 700; }

/* =====================================================================
 * Tela de Personagem: papel, classe, habilidades e árvore
 * ===================================================================== */

/* --- Papel: ícone com rótulo acessível --- */
.role-icon {
  display: inline-grid; place-items: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  flex: none;
}
.role-icon svg { width: 1rem; height: 1rem; }
.role-tank { color: #4b7bec; }
.role-attacker { color: #e0566b; }
.role-support { color: #b07ae8; }
.role-healer { color: #3fa96a; }
.role-text { font-size: .85rem; color: var(--muted); }

/* --- Barra de EXP da classe (no card do herói) --- */
.bar-class .bar-fill { background: linear-gradient(#7fd1ae, #3fa96a); }
.class-maxed-inline {
  display: flex; align-items: center; gap: .35rem;
  font-size: .85rem; color: var(--brand);
}

/* --- Grade de habilidades --- */
.skill-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .6rem;
  margin-bottom: 1rem;
}
.skill-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: .6rem;
  padding: .6rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 10px);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.skill-card:hover, .skill-card:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.skill-card.is-locked { opacity: .55; }
.skill-card-art { position: relative; display: grid; place-items: center; }
.skill-card-art .skill-art, .skill-art { width: 40px; height: 40px; border-radius: 8px; flex: none; }
.skill-art.fallback { display: grid; place-items: center; color: var(--muted); }
.skill-card.is-locked .skill-card-art .skill-art { filter: grayscale(1); }
.skill-card-art svg { position: absolute; right: -2px; bottom: -2px; width: .9rem; height: .9rem; color: var(--muted); }
.skill-card-body { min-width: 0; display: grid; gap: .25rem; }
.skill-card-body small { color: var(--muted); }
.skill-lock { color: var(--muted); font-weight: 600; }
.skill-card-energy {
  min-width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--accent-soft, rgba(120, 150, 255, .18));
  color: var(--accent); font-weight: 700; font-size: .8rem;
}
/* Moeda discreta: marca "dá para melhorar" sem poluir com botão em cada card. */
.skill-up {
  position: absolute; left: .4rem; top: .4rem;
  display: grid; place-items: center;
  width: 1.1rem; height: 1.1rem;
  border-radius: 999px; background: var(--gold); color: #3a2b00;
}
.skill-up svg { width: .75rem; height: .75rem; }

/* --- Tier em pontinhos --- */
.tier-pips { display: inline-flex; gap: 2px; align-items: center; }
.tier-pips i {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--line);
}
.tier-pips i.on { background: var(--brand); }

/* --- Painel de detalhe da habilidade --- */
.skill-detail-top { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: .8rem; }
.skill-detail-top .skill-art { width: 56px; height: 56px; }
.skill-tier-box {
  padding: .7rem; border: 1px solid var(--line); border-radius: var(--r-sm, 10px);
  background: var(--surface-2); display: grid; gap: .5rem;
}
.skill-tier-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; font-weight: 600; }
.skill-gain { margin: 0; color: var(--muted); }
.skill-gain b { color: var(--text); }

/* --- Passivas --- */
.passive-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .4rem; }
.passive-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: .6rem;
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--r-sm, 10px);
}
.passive-row small { display: block; color: var(--muted); }
.passive-row.is-locked { opacity: .55; }
.passive-art { position: relative; display: grid; place-items: center; }
.passive-art .skill-art { width: 32px; height: 32px; border-radius: 6px; }
.passive-row.is-locked .passive-art .skill-art { filter: grayscale(1); }
.passive-art > svg { position: absolute; right: -3px; bottom: -3px; width: .8rem; height: .8rem; color: var(--muted); }
.chip-on { background: var(--accent); color: #fff; }

/* --- Árvore de classes por linhagem --- */


/* Quests antigas de um objetivo, atrás de um "ver todas". */
.goal-quests-more > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--muted); padding: .25rem 0; }
.goal-quests-more[open] > summary { margin-bottom: .25rem; }


/* ============================ Árvore de classes (brackets) ============= */
.class-tree { display: grid; gap: 10px; }
.class-tree-root { display: flex; justify-content: flex-start; }
.class-tree-branches { display: grid; gap: 8px; }
.class-tree-row { display: grid; grid-template-columns: auto 22px 1fr; align-items: center; gap: 0; }
.class-tree-col { display: grid; gap: 6px; }
.class-tree-adv { gap: 6px; }

.class-tree-node {
  display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px;
  width: 100%; min-width: 0; text-align: left; cursor: pointer;
  padding: 6px 10px 6px 6px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: inherit;
  font: inherit; transition: border-color .15s, transform .15s;
}
.class-tree-node:hover { border-color: var(--accent); transform: translateX(2px); }
.class-tree-node.is-owned { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.class-tree-node.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.class-tree-node.is-locked { opacity: .55; }
.class-tree-sprite { width: 34px; height: 34px; display: block; }
.class-tree-silhouette { width: 34px; height: 34px; display: grid; place-items: center; opacity: .5; }
.class-tree-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-sm { font-size: .7rem; padding: 1px 6px; }

/* O bracket: haste que sai da base, espinha vertical e um braço por avançada. */
.class-tree-bracket { position: relative; align-self: stretch; }
.class-tree-bracket .ctb-stem {
  position: absolute; left: 0; top: 50%; width: 10px; height: 2px;
  background: var(--line);
}
.class-tree-bracket .ctb-spine {
  position: absolute; left: 10px; top: 18px; bottom: 18px; width: 2px; background: var(--line);
}
.class-tree-bracket .ctb-arm { display: none; }
.class-tree-adv > * { position: relative; }
.class-tree-adv > *::before {
  content: ''; position: absolute; left: -12px; top: 50%; width: 12px; height: 2px;
  background: var(--line);
}

@media (max-width: 560px) {
  .class-tree-row { grid-template-columns: auto 16px 1fr; }
  .class-tree-bracket .ctb-spine { left: 7px; }
  .class-tree-adv > *::before { left: -9px; width: 9px; }
  .class-tree-node { grid-template-columns: 28px 1fr auto; padding: 5px 8px 5px 5px; }
  .class-tree-sprite, .class-tree-silhouette { width: 28px; height: 28px; }
}

/* Arte V2, fase 4: ícones de habilidade do núcleo no picker */
.core-skill { display: flex; align-items: center; gap: .4rem; margin-top: .25rem; }
.core-skill .skill-art { width: 24px; height: 24px; border-radius: 5px; }
.skill-opt .skill-opt-icon, .rot-item .rot-icon { width: 36px; height: 36px; border-radius: 7px; }
.monster-skills b { display: inline-flex; align-items: center; gap: .25rem; margin-right: .35rem; }
.monster-skills .mskill-icon { width: 20px; height: 20px; border-radius: 4px; }
.c-bubble { display: inline-flex; align-items: center; gap: .3rem; }
.c-bubble[hidden] { display: none; }
.c-bubble .bubble-icon { width: 22px; height: 22px; border-radius: 4px; flex: none; }
.food-line { display: flex; align-items: center; gap: .5rem; margin: .3rem 0; font-size: var(--fs-xs); }
.food-line .item-icon { width: 32px; height: 32px; }
.shop-card.is-locked { opacity: .6; }
.shop-card.is-current { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.shop-card.is-exclusive { border-left: 3px solid var(--gold); }

/* =====================================================================
 * Ajustes pós-Arte V2 (docs/archive/AJUSTES-POS-ARTE-SPEC.md)
 * ===================================================================== */
/* Dica dos núcleos (UI.tips): fixa na tela, acima (ou abaixo) do ícone. */
.tip {
  position: fixed; z-index: 1000; max-width: min(320px, calc(100vw - 16px));
  display: grid; gap: .2rem; padding: .55rem .7rem; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); font-size: var(--fs-xs); line-height: 1.35; pointer-events: none;
}
.tip b { font-size: var(--fs-sm); }
.tip small { color: var(--muted); }
[data-tip-core] { cursor: help; }
button [data-tip-core], a [data-tip-core] { cursor: inherit; }

/* Preparação: "Lutar X vezes" com "Pular batalha". */
.skip-block { display: grid; gap: .5rem; }
.skip-times { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding-left: 1.6rem; }
.skip-times[hidden] { display: none; }
.skip-times .hint { flex-basis: 100%; }

/* Botão "Pular" na tela da luta: ícone do item do tamanho do texto. */
[data-skip-now] .art-icon { width: 20px; height: 20px; }

/* Resultado de várias lutas. */
.multi-result { display: grid; gap: .75rem; }
.multi-head { display: flex; align-items: center; gap: .75rem; }
.multi-head .monster-art canvas.monster-img { width: 72px; height: 72px; }
.multi-runs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .25rem .75rem; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.multi-runs li.win { color: var(--easy); }
.multi-runs li.lose { color: var(--hard); }
.multi-result .result-title { font-size: var(--fs-xl); margin: 0; }

/* =====================================================================
 * Evolução, fase 1 (docs/archive/EVOLUCAO-SPEC.md 1.2–1.5, 1.9): folha, Personagem com abas,
 * inventário único, aba Classes e Loja em segmentos.
 * ===================================================================== */
/* Folha: diálogo centralizado no desktop; no celular desliza de baixo com rodapé fixo. */
.sheet { display: flex; flex-direction: column; }
.sheet[open] { display: flex; }
.sheet .modal-body { flex: 1 1 auto; max-height: none; min-height: 0; }
.sheet .modal-foot { position: sticky; bottom: 0; background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.sheet .modal-foot:has(> .spacer:only-child) { display: none; }
.sheet-grip { display: none; }
@media (max-width: 640px) {
  .sheet, .sheet.modal-wide {
    width: 100vw; max-width: 100vw; max-height: 88vh; margin: auto 0 0; inset: auto 0 0 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0;
    animation: sheet-in .24s var(--ease-out);
    transition: transform .2s var(--ease-out);
  }
  .sheet.leaving { animation: sheet-out .16s ease-in forwards; }
  .sheet .modal-foot { border-radius: 0; padding-bottom: calc(.9rem + env(safe-area-inset-bottom, 0px)); }
  .sheet .modal-foot .btn { flex: 1 1 auto; min-height: 44px; }
  .sheet .modal-foot .spacer { display: none; }
  .sheet-grip { display: block; width: 40px; height: 5px; margin: .5rem auto 0; border-radius: 999px; background: var(--line); flex: none; }
  .sheet .modal-head { padding-top: .5rem; touch-action: none; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .sheet, .sheet.leaving { animation: none; } }

.sheet-item { display: flex; align-items: flex-start; gap: .9rem; margin-bottom: .8rem; }
.sheet-item p { margin: 0 0 .25rem; }
.sheet-art {
  width: 96px; height: 96px; flex: none; display: grid; place-items: center; padding: 6px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2);
}
.sheet-art canvas, .sheet-art .item-icon, .sheet-art .item-icon-lg { width: 84px; height: 84px; }
.sheet-sub { font-size: var(--fs-sm); margin: 1rem 0 .4rem; }
.sheet-stats { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; }
.sheet-stats li { display: flex; align-items: baseline; gap: .4rem; padding: .35rem .55rem; border-radius: var(--r-sm); background: var(--surface-2); }
.sheet-stats span { font-size: var(--fs-xs); color: var(--muted); }
.sheet-stats b { font-family: var(--font-display); }
.sheet-stats .cmp { margin-left: auto; font-style: normal; font-weight: 700; font-size: var(--fs-xs); }
.sheet-stats .cmp.up { color: var(--easy); }
.sheet-stats .cmp.down { color: var(--hard); }
.sheet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.sheet-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: var(--fs-sm); }
.sheet-list li > .icon { width: 1rem; height: 1rem; color: var(--muted); flex: none; }
.sheet-skill { display: flex; gap: .6rem; align-items: flex-start; margin: .4rem 0; }
.sheet-skill small { display: block; color: var(--muted); }
.sell-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-top: 1rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.sell-box > span:first-child { font-weight: 700; }
.sell-total { margin-left: auto; display: inline-flex; align-items: center; gap: .25rem; color: var(--gold-ink); }
.sell-total .icon { width: 1rem; height: 1rem; }

/* Personagem: 4 abas; no celular só o ícone + rótulo curto, sem rolar. */
/* Abas que precisam caber no celular (Personagem, Ajustes): rolam de lado e, estreitas, ficam com o ícone em cima. */
.char-tabs, .settings-tabs { overflow-x: auto; scrollbar-width: none; }
.char-tabs::-webkit-scrollbar, .settings-tabs::-webkit-scrollbar { display: none; }
@media (max-width: 420px) {
  .char-tabs .tab, .settings-tabs .tab { flex: 1 1 0; justify-content: center; flex-direction: column; gap: .15rem; padding: .5rem .25rem; font-size: .75rem; }
}
.char-appearance { display: flex; flex-direction: column; align-items: center; gap: .35rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); text-align: center; }

/* Inventário único. */
.inv-filters { margin-bottom: .5rem; }
.inv-sub { margin-bottom: .9rem; }
.inv-sub[hidden] { display: none; }
.chip-count { opacity: .7; font-weight: 600; margin-left: .15rem; }
.chip-btn.chip-sm { font-size: .7rem; padding: .2rem .55rem; }
.chip-toggle { display: inline-flex; align-items: center; gap: .25rem; }
.chip-toggle .icon { width: .85rem; height: .85rem; }
.item { position: relative; }
.item-qty {
  position: absolute; top: 4px; right: 4px; min-width: 1.4rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: .6875rem; font-weight: 800; line-height: 1.3rem; text-align: center;
}
.item-flag {
  position: absolute; top: 4px; left: 4px; width: 1.3rem; height: 1.3rem; display: grid; place-items: center;
  border-radius: 999px; background: var(--brand-fill); color: var(--on-brand);
}
.item-flag .icon { width: .8rem; height: .8rem; }
.item.is-missing { opacity: .55; border-style: dashed; }
.item.is-missing .item-art { filter: grayscale(1); }
.inv-empty { grid-column: 1 / -1; padding: 1rem 0; }
.slot-pick .slot-icon .art-icon { width: 100%; height: 100%; }

/* Aba Classes. */
.class-mine { margin-bottom: 1rem; }
.class-mine-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.class-mine-art { width: 112px; height: 112px; flex: none; display: block; }
.class-mine-art canvas, .class-sheet-art canvas { width: 100%; height: 100%; }
.class-mine-info { flex: 1; min-width: 0; display: grid; gap: .3rem; }
.class-mine-info h2 { font-size: var(--fs-xl); line-height: 1.1; }
.class-mine-info .hint { margin: 0; }
.class-mine-info .bar { max-width: 360px; }
.class-role { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; }
.class-next { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.class-next .icon { width: 1rem; height: 1rem; color: var(--gold-ink); }
.class-next b { color: var(--text); }
.class-tree-node.is-ready { border-color: color-mix(in srgb, var(--easy) 60%, var(--line)); }
.chip-ready { background: color-mix(in srgb, var(--easy) 18%, transparent); color: var(--easy); }
.class-sheet-top { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .5rem; }
.class-sheet-art { width: 128px; height: 128px; flex: none; display: block; border-radius: var(--r-md); background: var(--surface-2); }
.class-sheet-info { display: grid; gap: .45rem; min-width: 0; }
.class-sheet-info p { margin: 0; }
.class-mechanic { display: flex; gap: .45rem; align-items: flex-start; padding: .5rem .65rem; border-radius: var(--r-sm); background: color-mix(in srgb, var(--brand) 10%, transparent); font-weight: 600; font-size: var(--fs-sm); }
.class-mechanic .icon { width: 1rem; height: 1rem; color: var(--brand-ink); flex: none; margin-top: .15rem; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.req-list li { display: flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); }
.req-list li .item-icon { display: inline-block; width: 20px; height: 20px; vertical-align: middle; margin-right: .2rem; }
.req-list li .icon { width: .95rem; height: .95rem; vertical-align: -2px; }
.req-mark { width: 1.35rem; height: 1.35rem; flex: none; display: grid; place-items: center; border-radius: 999px; }
.req-list .ok .req-mark { background: color-mix(in srgb, var(--easy) 20%, transparent); color: var(--easy); }
.req-list .miss .req-mark { background: color-mix(in srgb, var(--hard) 16%, transparent); color: var(--hard); }
.req-list .miss { color: var(--text); }
.class-sheet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.class-sheet-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: var(--r-sm); }
.class-sheet-list li small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.class-sheet-list li.is-locked { opacity: .6; }
.class-sheet-list .skill-art { width: 36px; height: 36px; }
.btn.is-armed { background: var(--medium); border-color: var(--medium); color: #2b1d00; }
@media (max-width: 560px) {
  .class-sheet-top { flex-direction: column; align-items: center; text-align: center; }
  .class-sheet-top .class-role { justify-content: center; }
  .class-mine-art { width: 84px; height: 84px; }
  .class-sheet-list li { grid-template-columns: auto minmax(0, 1fr); }
  .class-sheet-list li > .chip { grid-column: 2; justify-self: start; }
}

/* Loja em segmentos + aviso de volta ao combate. */
.shop-seg { margin-bottom: 1rem; }
.shop-back {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem;
  padding: .6rem .75rem; border-radius: var(--r-md); border: 1px solid var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}
.shop-back[hidden] { display: none; }
.shop-back > span { display: inline-flex; align-items: center; gap: .4rem; flex: 1 1 220px; font-size: var(--fs-sm); }
.shop-back > span .icon { width: 1rem; height: 1rem; color: var(--brand-ink); }
.prep-shop { margin-left: .5rem; font-size: var(--fs-xs); font-weight: 600; }

.char-equip { align-self: start; }
@media (max-width: 640px) {
  [data-char-wallet] { display: none; }           /* o gold já está na barra do topo */
  .char-equip .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .char-equip .slot { padding: .35rem; gap: .45rem; }
  .char-equip .slot-icon { width: 40px; height: 40px; }
  .char-equip .slot-pick { gap: .45rem; }
  .char-equip .slot-text span { font-size: var(--fs-xs); }
  .char-equip .item-stats { display: none; }
  .char-equip .slot > .icon-btn { display: none; }  /* tirar fica na folha do item */
  .inventory { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
  .inventory .item { padding: .45rem .3rem .5rem; }
  .inventory .item-art { width: 52px; height: 52px; }
  .inv-filters, .inv-sub { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding-inline: 4px; }
  .inv-filters::-webkit-scrollbar, .inv-sub::-webkit-scrollbar { display: none; }
  .inv-filters .chip-btn, .inv-sub .chip-btn { flex: none; white-space: nowrap; }
}
.char-layout > * { min-width: 0; }
.class-ready {
  display: flex; gap: .6rem; align-items: flex-start; margin: 0 0 1rem; padding: .65rem .8rem;
  border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--easy) 55%, var(--line));
  background: color-mix(in srgb, var(--easy) 10%, var(--surface));
}
.class-ready > .icon { width: 1.3rem; height: 1.3rem; color: var(--easy); flex: none; }
.class-ready b { display: block; }
.class-ready span { font-size: var(--fs-sm); color: var(--muted); }
.class-ready .link-btn { font-size: inherit; font-weight: 700; }
.hud-card .bar-energy { margin-right: 1rem; }
/* Número flutuante do monstro (na borda direita do palco): nasce mais para a esquerda. */
.fighter.right .c-fx { inset: 35% 25% auto -45%; }

/* Comemorações são <dialog> (camada do topo, por cima de qualquer diálogo aberto). */
dialog.celebration {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; color: var(--text);
}
dialog.celebration:not([open]) { display: none; }
dialog.celebration::backdrop { background: transparent; }
.celebration-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .75rem; }
.celebration-actions .btn { margin-top: 0; min-width: 130px; flex: 1 1 0; }

/* Revelação do núcleo (docs/archive/EVOLUCAO-SPEC.md 1.10). */
.is-core .celebration-card { border-color: var(--gold); box-shadow: 0 0 0 6px color-mix(in srgb, var(--gold) 20%, transparent), var(--shadow); overflow: hidden; }
.is-core .celebration-card h2 { color: var(--gold-ink); }
.core-reveal { position: relative; width: 180px; height: 180px; display: grid; place-items: center; margin-top: -.5rem; }
.core-rays {
  position: absolute; inset: -40px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--gold) 55%, transparent) 0 8deg, transparent 8deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 68%); mask: radial-gradient(circle, #000 25%, transparent 68%);
  animation: core-rays 6s linear infinite, core-rays-in .6s var(--ease-out);
}
.core-orb { position: relative; display: grid; place-items: center; animation: core-pop .8s var(--ease-back) both; filter: drop-shadow(0 0 18px color-mix(in srgb, var(--gold) 70%, transparent)); }
.core-orb .core-icon { width: 150px; height: 150px; }
.core-kicker { margin: 0; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: var(--fs-xs); color: var(--gold-ink); animation: fade-in .4s .35s both; }
.is-core .celebration-card h2, .is-core .celebration-card > p, .core-reveal-skill { animation: fade-in .4s .45s both; }
.core-pity { margin: 0; background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand-ink); }
.core-reveal-skill { display: flex; align-items: center; gap: .5rem; font-size: var(--fs-sm); }
.core-reveal-skill .skill-art { width: 32px; height: 32px; }
@keyframes core-pop { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.15) rotate(4deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }
@keyframes core-rays { to { transform: rotate(360deg); } }
@keyframes core-rays-in { from { opacity: 0; transform: scale(.4); } }
@media (prefers-reduced-motion: reduce) {
  .core-rays, .core-orb, .core-kicker, .is-core .celebration-card h2, .is-core .celebration-card > p, .core-reveal-skill { animation: none; }
}

/* ===== Jornada (docs/archive/EVOLUCAO-SPEC.md 2.5.4): cartão "Próxima etapa" na Home e a folha ===== */
.journey-slot:empty { display: none; }
.journey-card {
  margin: 0 0 1rem; padding: .85rem 1rem .95rem; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line));
}
.journey-card.is-ready {
  border-color: color-mix(in srgb, var(--easy) 60%, var(--line));
  background: color-mix(in srgb, var(--easy) 8%, var(--surface));
}
.jr-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.jr-kicker { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-xs); font-weight: 700; color: var(--brand-ink); text-transform: uppercase; letter-spacing: .04em; min-width: 0; }
.jr-kicker .icon { width: .95rem; height: .95rem; flex: none; }
.jr-kicker { flex: 1 1 0; width: 0; overflow: hidden; } /* width 0: não empurra a coluna da Home */
.journey-slot { min-width: 0; }
.jr-kicker > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.journey-card, .jr-head { min-width: 0; max-width: 100%; }
.jr-head .link-btn { font-size: var(--fs-sm); white-space: nowrap; }
.jr-collapse .icon { transform: rotate(-90deg); }
.jr-body { display: flex; gap: 1rem; align-items: center; }
.jr-text { flex: 1 1 auto; min-width: 0; display: grid; gap: .3rem; }
.jr-title { font-size: var(--fs-lg, 1.15rem); line-height: 1.25; margin: 0; }
.jr-text .hint { margin: 0; }
.jr-bar { width: 100%; max-width: none; }
.jr-meta { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.jr-meta b { color: var(--text); }
.jr-side { display: grid; gap: .45rem; justify-items: end; flex: none; max-width: 45%; }
.jr-reward { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .35rem .6rem; font-size: var(--fs-sm); }
.jr-rw { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.jr-rw b { font-weight: 800; }
.jr-rw.is-gold { color: var(--gold-ink); }
.jr-rw .icon { width: 1.05rem; height: 1.05rem; flex: none; }
.jr-rw .jr-rw-icon { display: inline-block; width: 26px; height: 26px; flex: none; }
.jr-rw-name { color: var(--muted); font-weight: 600; }
.jr-reward.is-small { justify-content: flex-start; font-size: var(--fs-xs); margin-top: .15rem; }
.jr-reward.is-small .jr-rw-icon { width: 18px; height: 18px; }
.jr-reward.is-small .icon { width: .85rem; height: .85rem; }
.journey-card.is-collapsed { padding: 0; }
.jr-expand {
  width: 100%; display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; min-height: 44px;
  background: none; border: 0; color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; border-radius: var(--r-lg);
}
.jr-expand > span { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-expand .icon { width: 1rem; height: 1rem; flex: none; color: var(--brand-ink); }
.jr-expand .icon:last-child { transform: rotate(90deg); color: var(--muted); }
@media (max-width: 640px) {
  .jr-body { flex-direction: column; align-items: stretch; gap: .6rem; }
  .jr-side { max-width: none; justify-items: stretch; grid-template-columns: 1fr auto; align-items: center; }
  .jr-reward { justify-content: flex-start; }
  .jr-pre { display: none; }
}

.jr-chapters { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .6rem; }
.jr-chapter { border: 1px solid var(--line); border-radius: var(--r-md); padding: .6rem .75rem; background: var(--surface); }
.jr-chapter.is-current { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.jr-chapter.is-locked { opacity: .65; }
.jr-chapter-head { display: flex; align-items: center; gap: .6rem; }
.jr-chapter-head > div { flex: 1 1 auto; min-width: 0; display: grid; }
.jr-chapter-head small { color: var(--muted); font-size: var(--fs-xs); }
.jr-num { width: 1.8rem; height: 1.8rem; flex: none; display: grid; place-items: center; border-radius: 999px; font-weight: 800; font-size: var(--fs-sm); background: var(--surface-2); color: var(--brand-ink); }
.jr-num .icon { width: 1rem; height: 1rem; }
.jr-chapter.is-done .jr-num { background: color-mix(in srgb, var(--easy) 20%, transparent); color: var(--easy); }
.jr-steps { list-style: none; margin: .5rem 0 0; padding: 0 0 0 .2rem; display: grid; gap: .35rem; }
.jr-steps li { display: flex; align-items: center; gap: .55rem; min-height: 36px; }
.jr-step-mark { width: 1.2rem; height: 1.2rem; flex: none; border-radius: 999px; border: 2px solid var(--line); display: grid; place-items: center; }
.jr-step-mark .icon { width: .8rem; height: .8rem; }
.jr-steps li.is-claimed .jr-step-mark { background: var(--easy); border-color: var(--easy); color: #fff; }
.jr-steps li.is-ready .jr-step-mark { border-color: var(--easy); }
.jr-step-text { flex: 1 1 auto; min-width: 0; display: grid; font-size: var(--fs-sm); }
.jr-steps li.is-claimed .jr-step-text > span { color: var(--muted); }

/* Modo foco numa tarefa (js/focus.js) ------------------------------------
   Tudo em .main que não contém a tarefa fica embaçado e ilegível; o menu (.sidebar) não muda. */
.focus-eye { opacity: .45; }
.quest:hover .focus-eye, .focus-eye:focus-visible { opacity: 1; }
.focus-eye.is-on { opacity: 1; color: var(--brand-ink); background: color-mix(in srgb, var(--brand) 16%, transparent); }
@media (hover: none) { .focus-eye { opacity: .7; } }
body.fm-on .main > :not(:has(.fm-target)),
body.fm-on .main :has(.fm-target) > :not(:has(.fm-target)):not(.fm-target) {
  filter: blur(7px) grayscale(.3); opacity: .45; user-select: none;
  transition: filter .2s ease, opacity .2s ease;
}
body.fm-on .fm-target {
  position: relative; z-index: 2;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 2px var(--brand), 0 14px 40px color-mix(in srgb, #000 35%, transparent);
  transition: box-shadow .2s ease;
}
@media (prefers-reduced-motion: reduce) {
  body.fm-on .main > :not(:has(.fm-target)),
  body.fm-on .main :has(.fm-target) > :not(:has(.fm-target)):not(.fm-target),
  body.fm-on .fm-target { transition: none; }
}
