@font-face {
  font-family: 'Tormenta';
  /* Auto-hospedado no projeto (confiável); URL remota como fallback. */
  src: url('Tormenta.ttf') format('truetype'),
       url('https://raw.githubusercontent.com/bolognini/helladarion-codex/master/static/fonts/Tormenta.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* RESET E VARIÁVEIS DE DESIGN SYSTEM */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-page: #120a06;
  /* Fundo escuro terroso profundo */
  --bg-card: #1d130c;
  /* Painéis laterais */
  --bg-card-hi: #281a10;
  /* Hover de painéis e focos */
  --bg-input: #0d0704;
  /* Fundo de formulários */
  --border: rgba(200, 150, 60, 0.18);
  --border-hi: rgba(200, 150, 60, 0.45);
  --gold: #c8973a;
  /* Ouro medieval */
  --gold-light: #f4d08b;
  /* Ouro brilhante */
  --gold-dim: #8a6525;
  /* Ouro envelhecido */
  --red: #8c1c1c;
  /* Vermelho rubi Tormenta */
  --red-light: #c22d2d;
  /* Vermelho vibrante */
  --red-dark: #540c0c;
  /* Vermelho de fundo de ficha */
  --text-hi: #f5e9d3;
  /* Texto claro confortável */
  --text-mid: #bfa88f;
  /* Texto médio descritivo */
  --text-dim: #7a634e;
  /* Texto discreto */

  --font-t: 'Tormenta', 'Albertus', 'Albertus MT', 'Albertus Medium', 'Cinzel', 'Palatino Linotype', Georgia, serif;
  --font-logo: 'Tormenta', 'Albertus Decorative', 'Albertus', 'Albertus MT', 'Albertus Medium', 'Cinzel Decorative', 'Cinzel', serif;
  --font-b: 'Spectral', 'Palatino Linotype', serif;
  --font-ui: 'Inter', -apple-system, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: var(--font-b);
  background: var(--bg-page);
  color: var(--text-hi);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  padding: 0;
  overflow-x: hidden;
}

/* BARRA DO TOPO (MASTHEAD) */
.header-bar {
  background: linear-gradient(180deg, #1d130c 0%, #120a06 100%);
  border-bottom: 2px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  position: relative;
}

.header-bar::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.logo-mark {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.logo-text {
  text-align: left;
}

.logo-main {
  font-family: var(--font-logo);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  line-height: 1.1;
}

.logo-sub {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-top: 5px;
  font-weight: 500;
}

/* GRID DO LAYOUT PRINCIPAL */
.container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: stretch;
  flex-grow: 1;
}

/* COLUNA DA ESQUERDA: CONTROLE */
.panel-controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--bg-card);
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.panel-controls::-webkit-scrollbar {
  width: 6px;
}

.panel-controls::-webkit-scrollbar-track {
  background: var(--bg-card);
}

.panel-controls::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 3px;
}

.sec-title {
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.1rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 1.25rem;
  margin-top: 1.5rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.sec-content.collapsed {
  display: none;
}

.sec-title.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.sec-title:first-of-type {
  margin-top: 0;
}

.sec-title i {
  color: var(--gold-light);
}

/* ENTRADAS DE DADOS E FORMULÁRIOS */
.f-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.f-label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.f-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-hi);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-b);
  font-size: 14px;
  transition: var(--transition);
  width: 100%;
  box-sizing: border-box;
}

input.f-control,
select.f-control {
  height: 38px;
}

select.f-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%23c8973a' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: calc(100% - 10px) 50%;
  background-size: 20px;
  padding-right: 32px;
  cursor: pointer;
}

select.f-control::-ms-expand {
  display: none;
}

select.f-control option {
  background-color: var(--bg-card);
  color: var(--text-hi);
}

.f-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(200, 150, 60, 0.25);
}

.f-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.f-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.f-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.gap-5 {
  gap: 5px;
}

/* PÍLULAS DE SELEÇÃO */
.pills {
  display: flex;
  gap: 8px;
}

.pill {
  flex: 1;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-mid);
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  box-sizing: border-box;
}

.pill:hover {
  border-color: var(--border-hi);
  color: var(--text-hi);
}

.pill.on {
  background: var(--red);
  border-color: var(--red-light);
  color: var(--text-hi);
  box-shadow: 0 0 10px rgba(140, 28, 28, 0.4);
}

/* BOTÕES DE ND */
.nd-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
}

.ndbtn {
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.ndbtn:hover {
  border-color: var(--border-hi);
  color: var(--text-hi);
}

.ndbtn.on {
  background: var(--bg-card-hi);
  border-color: var(--gold);
  color: var(--gold-light);
  font-weight: 800;
}

/* GRADE DE ATRIBUTOS */
.attr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 6px 4px;
  border-radius: var(--radius-sm);
}

.attr-box span {
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 10px;
  color: var(--gold-dim);
  font-weight: bold;
}

.attr-box input {
  background: transparent;
  border: none;
  color: var(--text-hi);
  text-align: center;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: bold;
  outline: none;
}

/* EDICÃO DINÂMICA DE ATAQUES E HABILIDADES */
.list-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 1rem;
}

.item-painel-edit {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
}

.item-painel-edit:hover {
  border-color: var(--border-hi);
}

.card-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(200, 150, 60, 0.1);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.card-edit-title {
  font-family: var(--font-t);
  font-size: 11px;
  color: var(--gold-light);
  font-weight: bold;
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  letter-spacing: 0.05em;
}

.btn-card-save {
  background: linear-gradient(180deg, var(--gold-dim) 0%, #523a13 100%);
  border: 1px solid var(--gold);
  color: var(--text-hi);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
}

.btn-card-save:hover {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  box-shadow: 0 0 6px rgba(200, 150, 60, 0.2);
}

.card-view-mode {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-view-text {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-hi);
  line-height: 1.4;
}

.card-view-text b {
  color: var(--gold-light);
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
}

.card-view-text i {
  color: var(--text-dim);
  font-size: 11px;
}

.card-view-actions {
  display: flex;
  gap: 4px;
}

.form-group-row {
  display: flex;
  gap: 8px;
}

.input-grow {
  flex-grow: 1;
}

.margin-top-5 {
  margin-top: 5px;
}

.margin-top-10 {
  margin-top: 10px;
}

.mini-lbl {
  font-family: var(--font-ui);
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 500;
}

.textarea-sm {
  resize: vertical;
  min-height: 50px;
  height: 50px;
  font-size: 13px;
}

.btn-step {
  background: var(--bg-card-hi);
  border: 1px solid var(--border);
  color: var(--text-mid);
  font-family: var(--font-ui);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-step:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-gold-action {
  background: linear-gradient(180deg, var(--gold-dim) 0%, #523a13 100%);
  border: 1px solid var(--gold);
  color: var(--text-hi);
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: var(--transition);
  letter-spacing: 0.05em;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 44px;
}

.btn-gold-action:hover {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  box-shadow: 0 0 10px rgba(200, 150, 60, 0.3);
  transform: translateY(-2px);
}

.btn-gold-action:active {
  transform: translateY(0);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mid);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--border-hi);
  color: var(--text-hi);
}

.btn-icon.btn-red:hover {
  background: var(--red);
  color: var(--text-hi);
  border-color: var(--red-light);
}

.input-sm {
  font-size: 13px;
  padding: 5px 8px;
}

/* COLUNA DA DIREITA: PREVIEW DA FICHA */
.panel-preview {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;

  /* Sticky: flutua enquanto a coluna esquerda (maior) rola */
  align-self: start;
  position: sticky;
  top: 1.5rem;

  /* Fichas longas: limita ao viewport e rola internamente */
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

.panel-preview::-webkit-scrollbar {
  width: 4px;
}

.panel-preview::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 4px;
}

/* CARD DE QUICK PREVIEW NA SUPERIOR DIREITA (fluido/responsivo) */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
  gap: 6px;
}

.quick-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.quick-card i {
  font-size: 18px;
  color: var(--gold);
}

.quick-val {
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 18px;
  color: var(--text-hi);
  font-weight: 700;
  line-height: 1.1;
}

input.quick-val {
  background: transparent;
  border: none;
  width: 100%;
  text-align: center;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  outline: none;
  padding: 0;
  margin: 0;
  -moz-appearance: textfield; /* Firefox */
  appearance: textfield;
}

input.quick-val::-webkit-outer-spin-button,
input.quick-val::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0; /* Chrome, Safari, Opera, Edge */
}

input.quick-val:focus {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 1.5px var(--gold);
  border-radius: 4px;
}

.quick-lbl {
  font-family: var(--font-ui);
  font-size: 8px;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* QUICK-CARD: indicador de valor sobrescrito manualmente (vs. calculado pelo ND) */
.quick-card.is-overridden {
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(200, 150, 60, 0.25);
}

.quick-card.is-overridden .quick-val {
  color: var(--gold-light);
}

.quick-reset {
  position: absolute;
  top: 2px;
  right: 2px;
  display: none;
  background: transparent;
  border: none;
  color: var(--gold-dim);
  cursor: pointer;
  padding: 0 3px;
  font-size: 13px;
  line-height: 1.2;
  border-radius: 3px;
}

.quick-reset:hover {
  color: var(--gold-light);
  background: rgba(200, 150, 60, 0.15);
}

.quick-card.is-overridden .quick-reset {
  display: block;
}

/* FICHA ESTILO OFICIAL TORMENTA 20 */
.ficha-card {
  background: #faf3e6;
  /* Pergaminho claro oficial do livro */
  color: #1a1510;
  /* Texto quase preto para alto contraste oficial */
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow), 0 0 0 6px #120a06, 0 0 0 7px var(--gold-dim);
  overflow: hidden;
  border: 2px solid #523a13;
  font-family: 'Spectral', Palatino, Georgia, serif;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

/* CABEÇALHO DA FICHA OFICIAL (BARRA VERMELHA) */
.ficha-header {
  background: #8b0c0c;
  /* Tom exato do vermelho de Tormenta 20 */
  color: #ffffff;
  padding: 12px 18px;
  border-bottom: 3px solid var(--gold);
}

.ficha-header-main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.ficha-nome {
  font-family: var(--font-logo);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.6rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
  line-height: 1.1;
}

.ficha-nd {
  font-family: var(--font-logo);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--gold-light);
  margin-left: auto;
}

.ficha-sub {
  font-family: var(--font-b);
  font-style: italic;
  font-size: 13px;
  color: #ffd8a8;
  margin-top: 2px;
  font-weight: 500;
}

.ficha-section {
  padding: 12px 18px;
}

.ficha-stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
  gap: 12px;
}

.ficha-stats-row b {
  font-family: var(--font-b);
  font-size: 11px;
  color: #6a1a1a;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* SEPARADOR ORNAMENTADO */
.border-top-ornament {
  border-top: 1.5px solid #d4c0ab;
  position: relative;
  margin-top: 6px;
}

/* BARRA DE PONTOS DE VIDA */
.ficha-pv-row {
  margin-top: 8px;
}

.pv-bar {
  background: #7a1010;
  color: #ffffff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-b);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
  border-left: 5px solid var(--gold);
}

.pv-bar b {
  font-size: 14px;
}

/* TÍTULO DA SEÇÃO DA FICHA */
.ficha-sec-title {
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: bold;
  color: #7a1010;
  border-bottom: 1px solid #7a1010;
  padding-bottom: 2px;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* BADGES DE STATUS DE BALANCEAMENTO */
.badge {
  font-family: var(--font-ui);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: bold;
  text-transform: none;
  letter-spacing: 0;
}

.badge-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.badge-danger {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ATAQUES E HABILIDADES NO PREVIEW */
.ficha-ataque-linha {
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.45;
}

.ficha-ataque-linha b {
  font-family: var(--font-b);
  color: #1a1510;
  font-size: 13px;
}

.txt-detalhe {
  color: #554433;
  font-style: italic;
}

.dmg-tag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  color: #8c1c1c;
  font-weight: bold;
  background: rgba(140, 28, 28, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.ficha-hab-linha {
  font-size: 14px;
  margin-bottom: 6px;
  line-height: 1.45;
}

.ficha-hab-linha b {
  font-family: var(--font-b);
  color: #7a1010;
  font-size: 13px;
}

/* TEXTO JUSTIFICADO (emula diagramação de livro oficial) */
.ficha-hab-linha,
.ficha-ataque-linha,
.ficha-texto-corrido,
.tema-arton .ficha-hab-linha,
.tema-arton .ficha-ataque-linha,
.tema-arton .ficha-txt-inline-container {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
}

/* RODAPÉ DA FICHA (ATRIBUTOS) */
.ficha-footer {
  background: #ebdcc8;
  border-top: 2px solid #d4c0ab;
  padding: 8px 18px;
}

.ficha-atributos-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  font-family: var(--font-ui);
  font-weight: 500;
}

.ficha-atributos-row b {
  font-family: var(--font-b);
  color: #540c0c;
}

/* PAINEL DE CONTROLE DE EXPORTAÇÃO */
.action-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 1.5rem;
  width: 100%;
}

/* MENU AGRUPADO DE IMPORTAR/EXPORTAR */
.action-menu-wrap {
  position: relative;
  display: flex;
}

.action-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-card-hi);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.action-menu[hidden] {
  display: none;
}

.action-menu-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-hi);
  font-family: var(--font-ui);
  font-size: 12.5px;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: var(--transition);
}

.action-menu-item:hover {
  background: rgba(200, 150, 60, 0.15);
  border-color: var(--gold-dim);
}

.action-menu-item i {
  color: var(--gold);
}

/* DICA DE DESIGN */
.tip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-mid);
  line-height: 1.65;
}

.tip b {
  color: var(--gold-light);
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 14px;
  font-weight: normal;
}

.tip i {
  color: var(--gold);
  margin-right: 6px;
  vertical-align: -2px;
}

/* ESTILOS DE INTERATIVIDADE NA FICHA (CLICK-TO-EDIT) */
.ficha-card [onclick] {
  cursor: pointer !important;
  transition: background-color 0.2s, outline 0.2s, transform 0.1s;
}

.ficha-card [onclick]:hover {
  background-color: rgba(200, 150, 60, 0.12) !important;
  outline: 1.5px dashed var(--gold) !important;
  transform: scale(1.008);
}

.ficha-card [onclick]:active {
  transform: scale(0.995);
}

/* ANIMAÇÕES */
.animate-fade {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* DESIGN RESPONSIVO (MOBILE) */
@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .panel-controls {
    max-height: none;
  }

  .panel-preview {
    position: static;
  }

  .logo-main {
    font-size: 1.7rem;
  }
}

@media (max-width: 480px) {
  .nd-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .f-grid-6 {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .action-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* PRINT LAYOUT (PDF EXPORTAÇÃO DE ALTA QUALIDADE) */
@media print {

  body,
  html {
    background: #ffffff !important;
    color: #000000 !important;
    height: auto;
    font-size: 12pt;
  }

  .header-bar,
  .panel-controls,
  .quick-grid,
  .action-row,
  .tip,
  .sec-title,
  button,
  header,
  footer {
    display: none !important;
    /* Esconde todos os menus */
  }

  .container {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .panel-preview {
    position: static !important;
    width: 100% !important;
  }

  .ficha-card {
    box-shadow: none !important;
    /* Remove sombras escuras para economizar tinta */
    border: 2px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    page-break-inside: avoid;
    margin: 0 !important;
    width: 100% !important;
    /* Layout em duas colunas para melhor leitura no PDF */
    column-count: 2;
    column-gap: 2rem;
  }

  .ficha-header,
  .ficha-footer {
    column-span: all;
    -webkit-column-span: all;
  }

  .ficha-pv-row,
  .ficha-ataque-linha,
  .ficha-hab-linha,
  .ficha-stats-row,
  .ficha-sec-title {
    page-break-inside: avoid;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
  }

  .ficha-header {
    background: #8b0c0c !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .pv-bar {
    background: #7a1010 !important;
    color: #ffffff !important;
    border-left: 5px solid #c8973a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ficha-footer {
    background: #f0eae1 !important;
    border-top: 1px solid #aaa !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .badge-success {
    background: #d4edda !important;
    color: #155724 !important;
  }

  .badge-warning {
    background: #fff3cd !important;
    color: #856404 !important;
  }

  .badge-danger {
    background: #f8d7da !important;
    color: #721c24 !important;
  }

  .dmg-tag {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #000000 !important;
  }

  /* JUSTIFICAÇÃO PARA PDF EM 2 COLUNAS */
  .ficha-card {
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
  }

  /* Protege cabeçalhos e rótulos da justificação */
  .ficha-header,
  .ficha-sec-title,
  .ficha-nome,
  .ficha-nd,
  .ficha-sub,
  .ficha-stats-row,
  .pv-bar {
    text-align: left;
  }
}

/* TOGGLE DE LAYOUT DA FICHA (SEGMENTED CONTROL) */
.layout-toggle-container {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 0.5rem;
}

.layout-toggle {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.layout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: calc(var(--radius-md) - 2px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.layout-btn:hover:not(.active) {
  color: var(--text-mid);
  background: rgba(200, 150, 60, 0.06);
}

.layout-btn.active {
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%);
  border-color: rgba(194, 45, 45, 0.5);
  color: var(--text-hi);
  box-shadow: 0 2px 8px rgba(140, 28, 28, 0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}

.layout-btn i {
  font-size: 13px;
}

/* ESTILOS DO CÓDICE DO MESTRE MODAL */
.codice-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 5, 2, 0.75);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.codice-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.codice-modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(200, 150, 60, 0.05);
  display: flex;
  flex-direction: column;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.codice-modal-overlay.active .codice-modal {
  transform: scale(1);
}

.codice-header {
  background: linear-gradient(180deg, #1d130c 0%, #120a06 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.codice-title {
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.4rem;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
}

.codice-title i {
  color: var(--gold);
}

.codice-close {
  background: transparent;
  border: none;
  color: var(--text-mid);
  cursor: pointer;
  font-size: 20px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.codice-close:hover {
  color: var(--red-light);
}

.codice-search-box {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(200, 150, 60, 0.1);
  background: var(--bg-input);
  position: relative;
}

.codice-search-box input {
  padding-left: 36px;
}

.codice-search-box i {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
}

.codice-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex-grow: 1;
  max-height: 50vh;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--bg-card);
}

.codice-body::-webkit-scrollbar {
  width: 6px;
}

.codice-body::-webkit-scrollbar-track {
  background: var(--bg-card);
}

.codice-body::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 3px;
}

.codice-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.codice-item {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.codice-item:hover {
  border-color: var(--gold);
  background: var(--bg-card-hi);
}

.codice-item-info {
  flex-grow: 1;
}

.codice-item-name {
  font-family: var(--font-t);
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.1rem;
  color: var(--text-hi);
  font-weight: 700;
  margin-bottom: 2px;
}

.codice-item-meta {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-mid);
  display: flex;
  gap: 12px;
}

.codice-item-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.codice-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.codice-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 3rem 0;
  font-style: italic;
  font-family: var(--font-ui);
  font-size: 13.5px;
}

.codice-footer {
  background: linear-gradient(0deg, #1d130c 0%, #120a06 100%);
  padding: 1.25rem 1.5rem;
  border-top: 2px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.codice-footer-left {
  display: flex;
  gap: 8px;
}

.codice-footer-right {
  display: flex;
  gap: 8px;
}

/* Alinhamento uniforme para labels em colunas de grid */
.f-grid-2 .f-label,
.f-grid-3 .f-label {
  min-height: 42px;
  display: flex;
  align-items: flex-end;
}

/* Secondary gold button variant */
.btn-gold-secondary {
  background: var(--bg-input) !important;
  border-color: var(--border) !important;
  color: var(--text-mid) !important;
}

.btn-gold-secondary:hover {
  border-color: var(--gold) !important;
  color: var(--gold-light) !important;
  box-shadow: 0 0 6px rgba(200, 150, 60, 0.15) !important;
}

/* Variante destrutiva (vermelha) para confirmações de ações irreversíveis */
.btn-danger-action {
  background: linear-gradient(180deg, #8b1a1a 0%, #4a1010 100%) !important;
  border-color: #b34141 !important;
  color: #ffece8 !important;
}
.btn-danger-action:hover {
  background: linear-gradient(180deg, #a82424 0%, #6a1515 100%) !important;
  box-shadow: 0 0 10px rgba(179, 65, 65, 0.4) !important;
}

/* Modal footer buttons alignment and symmetry */
.codice-footer .btn-gold-action {
  width: auto !important;
  height: 38px !important;
  padding: 0 16px !important;
  font-size: 12px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Layout Ameaças de Arton */
.ficha-card.tema-arton {
  background: #f7ebd3 !important; /* Bege bem claro acobreado */
  color: #4a1e1b !important;      /* Acobreado escuro/marrom avermelhado */
  border: 1.5px solid #7a1010 !important;
  box-shadow: var(--shadow) !important;
  font-family: 'Spectral', 'Georgia', serif !important;
  padding: 16px !important;
  line-height: 1.45 !important;
}

.ficha-card.tema-arton .ficha-header {
  background: transparent !important;
  color: #7a1010 !important;
  padding: 0 0 6px 0 !important;
  border-bottom: 2px solid #7a1010 !important;
}

.ficha-card.tema-arton .ficha-header-main {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  flex-wrap: wrap !important;
}

.ficha-card.tema-arton .ficha-nome {
  color: #7a1010 !important;
  font-family: var(--font-logo) !important;
  text-transform: lowercase !important; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.4rem !important;
  font-weight: bold !important;
  text-shadow: none !important;
  line-height: 1.1 !important;
  flex: 1 !important;
  min-width: 0 !important;
  word-wrap: break-word !important;
}

.ficha-card.tema-arton .ficha-nd {
  color: #7a1010 !important;
  font-family: var(--font-logo) !important;
  text-transform: lowercase !important; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 1.1rem !important;
  font-weight: bold !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  text-align: right !important;
  margin-left: auto !important;
}

.ficha-card.tema-arton .ficha-sub {
  color: #4a1e1b !important;
  font-style: italic !important;
  font-weight: normal !important;
  font-size: 12.5px !important;
}

.ficha-card.tema-arton .ficha-section {
  padding: 8px 0 !important;
}

.ficha-card.tema-arton .border-top-ornament {
  border-top: 1.5px solid #cbb89b !important;
  margin-top: 4px !important;
}

.ficha-card.tema-arton .ficha-sec-title {
  font-family: 'Cinzel', 'Spectral', serif !important;
  font-size: 11.5px !important;
  font-weight: bold !important;
  color: #7a1010 !important;
  border-bottom: 1px solid #7a1010 !important;
  padding-bottom: 1px !important;
  margin-top: 8px !important;
  margin-bottom: 6px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

.ficha-card.tema-arton .ficha-stats-row {
  display: block !important;
  font-size: 13.5px !important;
  padding: 2px 0 !important;
  line-height: 1.4 !important;
  gap: 0 !important;
}

.ficha-card.tema-arton .ficha-stats-row b {
  font-size: 9.5px !important;
  color: #7a1010 !important;
  letter-spacing: 0.03em !important;
}

.ficha-card.tema-arton .ficha-stats-row span {
  display: inline !important;
}

.ficha-card.tema-arton .ficha-ataque-linha b,
.ficha-card.tema-arton .ficha-hab-linha b {
  color: #7a1010 !important;
}

.ficha-card.tema-arton .ficha-atributos-row {
  display: flex !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  border-top: 1px solid #7a1010 !important;
  border-bottom: 1px solid #7a1010 !important;
  padding: 6px 0 !important;
  margin: 10px 0 !important;
  width: 100% !important;
  gap: 8px !important;
  break-inside: avoid !important;
  page-break-inside: avoid !important;
}

.ficha-card.tema-arton .ficha-atributos-row b {
  color: #7a1010 !important;
}

.ficha-card.tema-arton .ficha-txt-inline-container {
  font-size: 13.5px !important;
  line-height: 1.45 !important;
}

/* ============================================================
   IMPRESSÃO / PDF
   ============================================================ */
@media print {

  /* --- Oculta o chrome da interface (comum a ambos os estilos) --- */
  .header-bar,
  .panel-controls,
  .quick-grid,
  .layout-toggle-container,
  .action-row,
  .tip,
  #print-all-container,
  /* Oculta badges de alerta de dano (não fazem parte da ficha do livro) */
  .badge,
  .badge-success,
  .badge-warning,
  .badge-danger {
    display: none !important;
  }

  /* Reseta o layout de página */
  body {
    display: block !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  main.container {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  section.panel-preview {
    display: block !important;
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  #ficha-preview-container {
    display: block !important;
  }

  /* -------------------------------------------------------
     LIVRO BÁSICO — cabeçalho full-width + corpo em 2 colunas
     ----------------------------------------------------- */
  .ficha-card:not(.tema-arton) {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    page-break-inside: avoid !important;
    box-shadow: var(--shadow), 0 0 0 6px #120a06, 0 0 0 7px var(--gold-dim) !important;
    background: #faf3e6 !important;
    color: #1a1510 !important;
    border: 2px solid #523a13 !important;
    width: 100% !important;
    column-count: 1 !important;
  }

  .ficha-card:not(.tema-arton) .ficha-footer {
    background: #ebdcc8 !important;
    border-top: 2px solid #d4c0ab !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    column-span: none !important;
    -webkit-column-span: none !important;
  }

  .ficha-card:not(.tema-arton) .dmg-tag {
    background: rgba(140, 28, 28, 0.08) !important;
    color: #8c1c1c !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .ficha-card:not(.tema-arton) .border-top-ornament {
    border-top: 1.5px solid #d4c0ab !important;
  }

  /* === 1ª barra vermelha: cabeçalho (título + ND + subtítulo) ===
     Ocupa toda a largura da página, acima das colunas */
  .ficha-card:not(.tema-arton) .ficha-header {
    column-span: none !important;
    -webkit-column-span: none !important;
  }

  /* === Seção de stats (logo após o cabeçalho) ===
     Inclui Iniciativa, Defesa, Perícias e a barra de PV (2ª barra vermelha).
     Ocupa toda a largura — mantém as duas barras vermelhas alinhadas. */
  .ficha-card:not(.tema-arton) .ficha-header + .ficha-section {
    column-span: none !important;
    -webkit-column-span: none !important;
  }

  /* === Ataques, Habilidades, Magias e Rodapé fluem nas 2 colunas === */


  /* -------------------------------------------------------
     AMEAÇAS DE ARTON — reprodução fiel do estilo do livro
     ----------------------------------------------------- */

  /* === CONTAINER GERAL DA FICHA === */
  .ficha-card.tema-arton {
    background: transparent !important;
    background-color: transparent !important;
    color: #4a1e1b !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
    /* Por padrão no bestiário, flui em 1 coluna para caber nas colunas da página */
    column-count: 1 !important;
    width: 100% !important;
    padding: 12px 0 !important;
    margin: 0 auto !important;
    font-family: 'Spectral', 'Georgia', Georgia, serif !important;
    font-size: 9.5pt !important;
    line-height: 1.35 !important;
  }

  /* Na ficha impressa individualmente no container do editor principal, mantemos as duas colunas oficiais do livro com preenchimento sequencial */
  #ficha-preview-container .ficha-card.tema-arton {
    column-count: 2 !important;
    column-gap: 1.8rem !important;
    column-rule: none !important;
    column-fill: auto !important;
    height: 23.5cm !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  @media (orientation: landscape) {
    #ficha-preview-container .ficha-card.tema-arton {
      height: 15.5cm !important;
    }
  }

  /* Cabeçalho ocupa toda a largura (acima das colunas) */
  .ficha-card.tema-arton .ficha-header {
    column-span: none !important;
    -webkit-column-span: none !important;
  }

  /* === CABEÇALHO: sem fundo (print-friendly) — título e ND em vermelho escuro === */
  .ficha-card.tema-arton .ficha-header {
    background: transparent !important;
    background-color: transparent !important;
    color: #7a1010 !important;
    padding: 10px 14px 8px 14px !important;
    border-bottom: 2.5pt solid #7a1010 !important;
    box-shadow: none !important;
    margin-bottom: 6px !important;
    /* Flexbox para alinhar título à esq. e ND à dir. */
    display: flex !important;
    flex-direction: column !important;
  }

  /* Linha interna título + ND lado a lado */
  .ficha-card.tema-arton .ficha-header-main {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 8px !important;
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  /* Nome da criatura — vermelho escuro sobre fundo branco, fonte Tormenta */
  .ficha-card.tema-arton .ficha-nome {
    font-family: 'Tormenta', 'Cinzel', Georgia, serif !important;
    font-size: 14pt !important;
    font-weight: bold !important;
    color: #7a1010 !important;
    text-shadow: none !important;
    text-transform: lowercase !important; /* usa as glifos minúsculas do Tormenta (cobrem ç/acentos) */
    letter-spacing: 0.04em !important;
    line-height: 1.1 !important;
    flex: 1 !important;
    min-width: 0 !important;
    word-wrap: break-word !important;
  }

  /* ND (canto direito) — vermelho escuro sobre fundo branco, fonte Tormenta */
  .ficha-card.tema-arton .ficha-nd {
    font-family: 'Tormenta', 'Cinzel', Georgia, serif !important;
    font-size: 11pt !important;
    font-weight: bold !important;
    color: #7a1010 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    text-align: right !important;
    margin-left: auto !important;
  }

  /* Subtítulo — marrom avermelhado sobre fundo branco, Spectral itálico */
  .ficha-card.tema-arton .ficha-sub {
    font-family: 'Spectral', Georgia, serif !important;
    font-style: italic !important;
    font-size: 8.5pt !important;
    color: #4a1e1b !important;
    font-weight: normal !important;
    margin-top: 3px !important;
    margin-bottom: 0 !important;
  }

  /* === SEÇÕES E SEPARADORES === */
  .ficha-card.tema-arton .ficha-section {
    background: transparent !important;
    padding: 3px 0 !important;
  }

  /* Linha separadora entre seções */
  .ficha-card.tema-arton .border-top-ornament {
    border-top: 1px solid #7a1010 !important;
    margin-top: 4px !important;
    padding-top: 2px !important;
  }

  /* === BLOCO DE STATS INLINE (Iniciativa, Percepção, Defesa, etc.) === */
  .ficha-card.tema-arton .ficha-txt-inline-container {
    font-family: 'Spectral', Georgia, serif !important;
    font-size: 9pt !important;
    line-height: 1.35 !important;
    color: #1a0f0f !important;
    text-align: justify !important;
    hyphens: auto !important;
    -webkit-hyphens: auto !important;
    margin-bottom: 2px !important;
  }

  /* Labels de stat em negrito (Iniciativa, Defesa, Fort, etc.) */
  .ficha-card.tema-arton .ficha-txt-inline-container b,
  .ficha-card.tema-arton .ficha-section > div b {
    font-family: 'Spectral', Georgia, serif !important;
    font-weight: bold !important;
    color: #1a0f0f !important;
    font-size: inherit !important;
  }

  /* === TÍTULOS DE SEÇÃO (AÇÕES & ATAQUES / HABILIDADES / MAGIAS) === */
  .ficha-card.tema-arton .ficha-sec-title {
    font-family: 'Cinzel', 'Spectral', Georgia, serif !important;
    font-size: 8pt !important;
    font-weight: bold !important;
    color: #5a0a0a !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    border-bottom: 0.75pt solid #5a0a0a !important;
    padding-bottom: 1px !important;
    margin-top: 5px !important;
    margin-bottom: 4px !important;
  }

  /* === LINHAS DE ATAQUE === */
  .ficha-card.tema-arton .ficha-txt-inline-container .ficha-ataque-linha,
  .ficha-card.tema-arton .ficha-ataque-linha {
    font-size: 9pt !important;
    line-height: 1.35 !important;
    margin-bottom: 2px !important;
    text-align: justify !important;
    hyphens: auto !important;
    color: #1a0f0f !important;
  }

  /* Nome do ataque em negrito */
  .ficha-card.tema-arton .ficha-ataque-linha b,
  .ficha-card.tema-arton .ficha-txt-inline-container b {
    font-weight: bold !important;
    color: #1a0f0f !important;
  }

  /* Oculta o dmg-tag (não existe no livro oficial) */
  .ficha-card.tema-arton .dmg-tag {
    display: none !important;
  }

  /* === LINHAS DE HABILIDADE E MAGIA === */
  .ficha-card.tema-arton .ficha-hab-linha {
    font-family: 'Spectral', Georgia, serif !important;
    font-size: 9pt !important;
    line-height: 1.35 !important;
    margin-bottom: 3px !important;
    color: #1a0f0f !important;
    text-align: justify !important;
    hyphens: auto !important;
    -webkit-hyphens: auto !important;
    display: block !important;
    padding: 0 !important;
  }

  /* Nome da habilidade/magia em negrito */
  .ficha-hab-linha b {
    font-family: 'Spectral', Georgia, serif !important;
    font-weight: bold !important;
    color: #7a1010 !important;
    font-size: 9pt !important;
  }

  .ficha-card.tema-arton .ficha-atributos-row {
    display: flex !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    gap: 8px !important;
    border-top: 1pt solid #5a0a0a !important;
    border-bottom: 1pt solid #5a0a0a !important;
    padding: 3px 0 !important;
    margin: 6px 0 !important;
    width: 100% !important;
    font-family: 'Spectral', Georgia, serif !important;
    font-size: 9pt !important;
    color: #1a0f0f !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .ficha-card.tema-arton .ficha-atributos-row b {
    font-weight: bold !important;
    color: #1a0f0f !important;
    font-size: 9pt !important;
  }

  /* === PERICIAS E EQUIPAMENTOS (rodapé) === */
  .ficha-card.tema-arton .ficha-txt-inline-container:last-child {
    font-size: 9pt !important;
    line-height: 1.35 !important;
    color: #1a0f0f !important;
  }

  /* === REMOVE ESTILOS DE INTERATIVIDADE === */
  .ficha-card.tema-arton [data-action],
  .ficha-card.tema-arton [onmouseover] {
    cursor: default !important;
    outline: none !important;
  }

}

/* ============================================================
   BESTIÁRIO — FILA DE IMPRESSÃO
   ============================================================ */

/* Modal do Diagramador com layout responsivo de duas colunas */
.bestiario-modal {
  max-width: 1200px;
  width: 95%;
}

/* Sistema de Abas */
.bestiario-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0;
  background: rgba(0, 0, 0, 0.15);
}

.bestiario-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-mid);
  padding: 10px 4px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.bestiario-tab:hover {
  color: var(--gold-light);
  background: rgba(255, 255, 255, 0.02);
}

.bestiario-tab.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
  background: rgba(200, 150, 60, 0.05);
}

.bestiario-tab i {
  font-size: 15px;
  color: var(--gold);
}

.bestiario-tab-content {
  display: none;
  padding: 1.5rem;
  background: var(--bg-card);
}

.bestiario-tab-content.active {
  display: block;
}

/* Badge da Fila */
.fila-badge {
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Painel de Conteúdo do Bestiário */
.bestiario-add-panel {
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}

@media (max-width: 600px) {
  .f-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Layout do Diagramador de Aventuras - Workspace */
.diagramador-workspace {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 20px;
  padding: 1.5rem;
  overflow: hidden;
  max-height: 80vh;
}

@media (max-width: 992px) {
  .bestiario-modal {
    max-width: 650px;
  }
  .diagramador-workspace {
    grid-template-columns: 1fr;
    max-height: none;
    overflow-y: auto;
  }
}

.diagramador-controles {
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  max-height: 75vh;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) var(--bg-card);
}

.diagramador-controles::-webkit-scrollbar {
  width: 6px;
}

.diagramador-controles::-webkit-scrollbar-track {
  background: var(--bg-card);
}

.diagramador-controles::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 3px;
}

.diagramador-fila-secao {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  min-height: 200px;
}

.diagramador-fila-secao .codice-body {
  padding: 10px;
  overflow-y: auto;
  flex-grow: 1;
  max-height: 350px;
}

.diagramador-fila-titulo {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: bold;
  color: var(--gold-light);
  padding: 10px 15px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.diagramador-preview-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 75vh;
  overflow-y: auto;
}

.diagramador-preview-titulo {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: bold;
  color: var(--gold-light);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* TOOLBAR DA VISUALIZAÇÃO (colunas / moldura A4) */
.diagramador-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.dtb-group { display: flex; align-items: center; gap: 4px; }
.dtb-label {
  font-family: var(--font-ui); font-size: 11px; font-weight: 600;
  color: var(--text-mid); text-transform: uppercase; letter-spacing: 0.04em;
  display: inline-flex; align-items: center; gap: 4px; margin-right: 2px;
}
.dtb-label i { color: var(--gold); font-size: 13px; }
.dtb-btn {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-mid);
  font-family: var(--font-ui); font-size: 12px; font-weight: 700;
  width: 26px; height: 24px; border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition);
}
.dtb-btn:hover { border-color: var(--gold-dim); color: var(--text-hi); }
.dtb-btn.active { background: var(--gold-dim); border-color: var(--gold); color: var(--text-hi); }
.dtb-toggle {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none;
  font-family: var(--font-ui); font-size: 11.5px; color: var(--text-mid); margin: 0;
}
.dtb-toggle i { color: var(--gold); font-size: 13px; }
.dtb-toggle input[type="checkbox"] { accent-color: var(--gold); }
.dtb-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-hi);
  font-family: var(--font-ui);
  font-size: 11.5px;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  width: 140px;
}
.dtb-input:focus { outline: none; border-color: var(--gold); }

/* SUMÁRIO (OUTLINE) DE TÍTULOS */
.diagramador-toc {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px dashed rgba(200, 150, 60, 0.25);
  border-radius: var(--radius-sm);
}
.diagramador-toc[hidden] { display: none; }
.toc-chip {
  background: rgba(200, 150, 60, 0.1); border: 1px solid rgba(200, 150, 60, 0.25);
  color: var(--gold-light); font-family: var(--font-ui); font-size: 11px;
  padding: 3px 8px; border-radius: 999px; cursor: pointer; transition: var(--transition);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toc-chip:hover { background: rgba(200, 150, 60, 0.25); border-color: var(--gold); }
.toc-chip.toc-nivel-h3 { font-size: 10px; opacity: 0.8; }

/* DICA DE ARRASTAR PARA REORDENAR */
.diagramador-drag-hint {
  font-family: var(--font-ui); font-size: 10.5px; color: var(--text-dim);
  display: flex; align-items: center; gap: 5px; padding: 0 2px;
}
.diagramador-drag-hint[hidden] { display: none; }
.diagramador-drag-hint i { color: var(--gold-dim); }

/* MODO MOLDURA A4 — folha de página com guias de quebra */
#diagramador-live-preview.modo-pagina {
  position: relative;
  width: var(--pagina-w, 680px);
  max-width: none;
  margin: 0 auto;
  padding: 1.5cm 1.8cm;
}
.marcador-pagina {
  position: absolute;
  left: 0; right: 0;
  border-top: 2px dashed rgba(122, 16, 16, 0.45);
  pointer-events: none;
  z-index: 5;
}
.marcador-pagina::after {
  content: attr(data-label);
  position: absolute;
  right: 6px; top: 3px;
  font-family: var(--font-ui); font-size: 9px; font-weight: 700;
  color: #7a1010; background: #f6efe8; padding: 0 5px; border-radius: 3px;
}

/* CTA DO ESTADO VAZIO */
.diagramador-empty-cta {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  background: var(--gold-dim); border: 1px solid var(--gold); color: var(--text-hi);
  font-family: var(--font-ui); font-weight: 700; font-size: 12px;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
}
.diagramador-empty-cta:hover { background: var(--gold); transform: translateY(-1px); }

/* Div do Live Preview Simulação A4 */
#diagramador-live-preview {
  background: #f6efe8;
  color: #1a1510;
  padding: 2.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  column-count: 2;
  column-gap: 2rem;
  height: auto;
  border-radius: var(--radius-md);
  text-align: left;
  font-family: 'Spectral', Georgia, serif;
  font-size: 9.5pt;
  line-height: 1.5;
}

/* Scoped styles inside diagramador-live-preview for realistic rendering */
#diagramador-live-preview .bestiario-titulo-bloco {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #7a1010;
}
#diagramador-live-preview .bestiario-titulo-bloco.bestiario-titulo-h1 {
  column-span: all;
  -webkit-column-span: all;
}
#diagramador-live-preview .bestiario-titulo-h1 h1 { font-family: 'Tormenta', 'Cinzel', Georgia, serif; color: #7a1010; font-size: 24pt; margin: 0; letter-spacing: 0.04em; text-transform: lowercase; }
#diagramador-live-preview .bestiario-titulo-h2 h2 { font-family: 'Tormenta', 'Cinzel', Georgia, serif; color: #7a1010; font-size: 16pt; margin: 0; text-transform: lowercase; }
#diagramador-live-preview .bestiario-titulo-h3 h3 { font-family: 'Tormenta', 'Cinzel', Georgia, serif; color: #7a1010; font-size: 12pt; margin: 0; text-transform: lowercase; }

#diagramador-live-preview .bestiario-imagem-container {
  margin: 1.2rem 0;
  page-break-inside: avoid;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  text-align: center;
}
#diagramador-live-preview .bestiario-img-full {
  column-span: all;
  -webkit-column-span: all;
  width: 100%;
}
#diagramador-live-preview .bestiario-img-col {
  width: 100%;
}
/* Ilustração de página (preview aproxima o sangramento do export) */
#diagramador-live-preview .bestiario-img-pagina {
  position: relative;
  margin: 0.6rem 0 1rem;
  text-align: center;
}
#diagramador-live-preview .bestiario-img-pagina img {
  width: 100%;
  height: auto;
  display: block;
  filter: none;
}
#diagramador-live-preview .bestiario-legenda-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-size: 9px;
  color: #f6efe8;
  background: rgba(122, 16, 16, 0.82);
  padding: 2px 9px;
  border-radius: 3px;
}
#diagramador-live-preview .bestiario-imagem-container img {
  max-width: 100%;
  height: auto;
}
#diagramador-live-preview .bestiario-legenda {
  font-family: 'Spectral', Georgia, serif;
  font-style: italic;
  font-size: 8pt;
  color: #555;
  margin-top: 4px;
}

/* Lore justificado + capitular no primeiro paragrafo (espelha o export) */
#diagramador-live-preview .bestiario-lore {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
#diagramador-live-preview .bestiario-lore.lead::first-letter {
  float: left;
  font-family: 'Tormenta', 'Cinzel', Georgia, serif;
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  font-size: 3em;
  line-height: 0.82;
  padding: 2px 6px 0 0;
  color: #7a1010;
}

#diagramador-live-preview .bestiario-ficha-bloco {
  margin-bottom: 1.2rem;
  page-break-inside: auto !important;
  break-inside: auto !important;
  -webkit-column-break-inside: auto !important;
}

#diagramador-live-preview .ficha-card.tema-arton {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  break-inside: auto !important;
  page-break-inside: auto !important;
}

/* Badge de ND/XP no preview: texto creme sobre pílula vinho (vence a regra global
   .ficha-card.tema-arton .ficha-nd que pintava o texto de vinho — invisível no badge). */
#diagramador-live-preview .ficha-card.tema-arton .ficha-nd {
  color: #f6efe8 !important;
  background: #7a1010 !important;
  padding: 1px 11px 2px !important;
  border-radius: 11px !important;
  align-self: center !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

#diagramador-live-preview .bestiario-nota-bloco {
  page-break-inside: avoid;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

/* Caixa de destaque vermelha (preview) */
#diagramador-live-preview .bestiario-box-vermelho {
  font-family: 'Spectral', Georgia, serif;
  background-color: #7a1010;
  color: #f6efe8;
  padding: 0.9rem 1rem;
  margin: 1.2rem 0;
  border-radius: 4px;
  font-size: 9.5pt;
  line-height: 1.5;
  break-inside: avoid;
  page-break-inside: avoid;
}
#diagramador-live-preview .bestiario-box-vermelho-titulo {
  font-family: 'Tormenta', 'Cinzel', Georgia, serif;
  text-transform: lowercase; /* fonte Tormenta só tem glifos minúsculos corretos */
  color: #e8c060;
  font-weight: bold;
  font-size: 12pt;
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}
#diagramador-live-preview .bestiario-box-vermelho b { color: #ffffff; }

/* EDITOR DE TEXTO RICO (Caixa de Texto do Diagramador) */
.rico-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 5px 6px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.rico-btn {
  min-width: 26px;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-hi);
  cursor: pointer;
  border-radius: 3px;
  font-family: var(--font-b);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rico-btn:hover { border-color: var(--gold-dim); color: var(--gold-light); }
.rico-btn i { font-size: 14px; }
.rico-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }
.rico-cor {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
}
.rico-cor:hover { transform: scale(1.15); }
.rico-editor {
  min-height: 90px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-hi);
  font-family: var(--font-b);
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
}
.rico-editor:focus { border-color: var(--gold-dim); }
.rico-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-dim);
  font-style: italic;
}

/* Botão de importação rápida no Códice */
.btn-icon-mini {
  background: rgba(200, 150, 60, 0.08);
  border: 1px solid rgba(200, 150, 60, 0.2);
  color: var(--gold);
  cursor: pointer;
  padding: 2px 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  margin-left: auto;
}
.btn-icon-mini:hover {
  color: var(--gold-light);
  background: rgba(200, 150, 60, 0.25);
  border-color: var(--gold-light);
  box-shadow: 0 0 6px rgba(200, 150, 60, 0.15);
}

/* Custom styles for interactive Drag and Drop and Resizing in Live Preview */
#diagramador-live-preview img {
    position: relative;
    cursor: grab;
    transition: width 0.1s ease; /* Feedback visual suave no resize */
    filter: none;
    max-width: 100%;
    height: auto;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
#diagramador-live-preview img.resizing { cursor: ew-resize; opacity: 0.8; }
#diagramador-live-preview img.preview-dragging { opacity: 0.4; cursor: grabbing; }

/* Limpeza de Estilos Antigos e Molduras para Imagens Flutuadas */
#diagramador-live-preview .bestiario-imagem-flutuada-right,
#diagramador-live-preview .bestiario-imagem-flutuada-left {
    display: contents;
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Implementação do Contorno Profissional (shape-outside) */
#diagramador-live-preview .bestiario-imagem-flutuada-right img {
    float: right; /* Obrigatório para o shape-outside */
    width: auto;
    max-width: 100%; /* permite ampliar/zoom; o usuário controla a largura ao redimensionar */
    height: auto;
    margin-left: 2rem;
    margin-bottom: 1rem;
    
    /* MÁGICA EDITORIAL AQUI */
    shape-outside: margin-box; /* Diz ao navegador para usar a silhueta da imagem */
    shape-margin: 1.5rem; /* Margem de respiro entre o texto e a pirata */
    
    /* Tratamento visual */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    /* Sombra que segue a silhueta, não a caixa */
    filter: none;
}

#diagramador-live-preview .bestiario-imagem-flutuada-left img {
    float: left; /* Obrigatório para o shape-outside */
    width: auto;
    max-width: 100%; /* permite ampliar/zoom; o usuário controla a largura ao redimensionar */
    height: auto;
    margin-right: 2rem;
    margin-bottom: 1rem;
    
    /* MÁGICA EDITORIAL AQUI */
    shape-outside: margin-box; /* Diz ao navegador para usar a silhueta da imagem */
    shape-margin: 1.5rem; /* Margem de respiro entre o texto e a pirata */
    
    /* Tratamento visual */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    /* Sombra que segue a silhueta, não a caixa */
    filter: none;
}

/* Contêiner da imagem selecionada para resize */
.preview-img-container {
    display: contents;
}
#diagramador-live-preview .preview-img-container.selected {
    display: block;
    position: relative;
    float: right;
    /* sem moldura: a imagem aparece limpa; a alça de redimensionar indica a seleção */
}
#diagramador-live-preview .bestiario-imagem-flutuada-left .preview-img-container.selected {
    float: left;
}

/* Alça de redimensionamento (canto inferior direito) */
.resize-handle, .resize-handler {
    position: absolute;
    width: 10px; height: 10px;
    background: var(--gold);
    border: 2px solid #fff;
    border-radius: 50%;
    bottom: -5px; right: -5px;
    cursor: se-resize;
    z-index: 10;
    display: none; /* Escondido por padrão */
}
.preview-img-container.selected .resize-handle,
.preview-img-container.selected .resize-handler {
    display: block;
}

/* Feedback for elements being dragged in the Live Preview */
.preview-item-wrapper {
    position: relative;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: grab;
}
.preview-item-wrapper.preview-dragging {
    opacity: 0.4;
    border: 1px dashed var(--gold);
    transform: scale(0.98);
}

/* Editorial Text Hierarchy (Lore vs Highlight Box) */
.bestiario-lore {
    font-family: 'Spectral', Georgia, serif; /* Alterado de var(--font-t) para Spectral */
    text-align: justify;
    hyphens: auto;
    margin-bottom: 1rem;
    color: #1a1510;
    font-size: 9.5pt;
    line-height: 1.5;
}

.bestiario-box-destaque {
    font-family: 'Spectral', Georgia, serif;
    background-color: #f1e5d5;
    border-left: 4px solid var(--gold);
    padding: 1rem;
    margin: 1.5rem 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
    color: #3a2010;
    font-size: 9.5pt;
    line-height: 1.5;
    page-break-inside: avoid;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

/* =========================================================
   MODAL COMO USAR / WALKTHROUGH
   ========================================================= */

.como-usar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 5, 2, 0.80);
  backdrop-filter: blur(5px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.como-usar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.como-usar-modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  width: 94vw;
  max-width: 900px;
  height: 88vh;
  max-height: 720px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.85), inset 0 0 20px rgba(200,150,60,0.05);
  display: flex;
  flex-direction: column;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.como-usar-overlay.active .como-usar-modal {
  transform: scale(1);
}

/* Header */
.como-usar-header {
  background: linear-gradient(180deg, #1d130c 0%, #120a06 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.como-usar-titulo {
  font-family: var(--font-t);
  text-transform: lowercase;
  font-size: 1.25rem;
  color: var(--gold-light);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.como-usar-titulo i { color: var(--gold); }

.como-usar-close {
  background: transparent;
  border: none;
  color: var(--text-mid);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.como-usar-close:hover { color: var(--red-light); }

/* Body: sidebar + content */
.como-usar-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.como-usar-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-page);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.75rem 0;
}

.como-usar-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-mid);
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  position: relative;
}

.como-usar-sidebar-item:hover {
  background: var(--bg-card-hi);
  color: var(--text-hi);
}

.como-usar-sidebar-item.ativo {
  background: var(--bg-card-hi);
  color: var(--gold-light);
  border-left-color: var(--gold);
}

.como-usar-sidebar-item i {
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--gold-dim);
}

.como-usar-sidebar-item.ativo i { color: var(--gold); }

.badge-novo {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-ui);
}

/* Content area */
.como-usar-conteudo {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 2rem;
  scrollbar-color: var(--gold-dim) var(--bg-card);
}

.como-usar-modulo-titulo {
  font-family: var(--font-t);
  text-transform: lowercase;
  font-size: 1.4rem;
  color: var(--gold-light);
  margin: 0 0 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.como-usar-modulo-titulo i { color: var(--gold); }

.como-usar-modulo-subtitulo {
  font-family: var(--font-b);
  font-size: 0.92rem;
  color: var(--text-mid);
  margin: 0 0 1.5rem;
  font-style: italic;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

.como-usar-secao {
  margin-bottom: 1.5rem;
}

.como-usar-secao h4 {
  font-family: var(--font-t);
  text-transform: lowercase;
  font-size: 0.95rem;
  color: var(--gold);
  margin: 0 0 0.6rem;
  letter-spacing: 0.04em;
}

.como-usar-secao p,
.como-usar-secao li {
  font-family: var(--font-b);
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
  margin: 0 0 0.5rem;
}

.como-usar-secao ul {
  padding-left: 1.25rem;
  margin: 0 0 0.75rem;
}

.como-usar-secao strong { color: var(--text-hi); }

/* Termo T20 tooltip */
.termo-t20 {
  color: var(--gold-light);
  border-bottom: 1px dashed var(--gold-dim);
  cursor: help;
  font-style: normal;
}

/* Dica de mestre */
.dica-mestre {
  background: var(--bg-card-hi);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-family: var(--font-b);
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.55;
}

/* Ênfase inline dentro do corpo da dica */
.dica-mestre strong {
  color: var(--text-hi);
}

/* Rótulo "Dica de Mestre" — apenas o primeiro strong vira cabeçalho de bloco */
.dica-mestre > strong:first-child {
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.25rem;
}

/* Botão de tour */
.btn-iniciar-tour {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding: 0.6rem 1.25rem;
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-iniciar-tour:hover {
  background: var(--gold);
  color: var(--bg-page);
}

/* Driver.js theme overrides */
.driver-popover {
  background: var(--bg-card) !important;
  border: 1px solid var(--gold) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7) !important;
  font-family: var(--font-b) !important;
  color: var(--text-mid) !important;
}

.driver-popover-title {
  font-family: var(--font-t) !important;
  font-size: 1rem !important;
  color: var(--gold-light) !important;
  text-transform: lowercase !important;
}

.driver-popover-description {
  font-size: 0.85rem !important;
  color: var(--text-mid) !important;
  line-height: 1.55 !important;
}

.driver-popover-prev-btn,
.driver-popover-next-btn {
  background: var(--bg-input) !important;
  border: 1px solid var(--border-hi) !important;
  color: var(--gold) !important;
  font-family: var(--font-ui) !important;
}

.driver-popover-next-btn:hover {
  background: var(--gold) !important;
  color: var(--bg-page) !important;
}

.driver-popover-progress-text {
  color: var(--text-dim) !important;
  font-family: var(--font-ui) !important;
  font-size: 0.75rem !important;
}

@media (max-width: 600px) {
  .como-usar-sidebar { display: none; }
  .como-usar-conteudo { padding: 1rem; }
}

