/* ═══════════════════════════════════════════════════════
   TRIAKORVO — css/mecanicas.css
   Estilos das mecânicas centrais: Descanso, Fundamentos,
   Catarse, Desequilíbrio e Habilidades.
   Compartilhado entre o criador (index.html) e a ficha de
   sessão (ficha.html). Depende de css/tokens.css.
═══════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════
   DESCANSO (botões na seção de Recursos)
════════════════════════════════════════════════════ */
.descanso-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.descanso-btn {
  flex: 1;
  font-family: var(--font-ui);
  font-size: .62rem;
  letter-spacing: .08em;
  padding: 9px 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color .15s, color .15s, background .15s;
}
.descanso-btn:hover { background: var(--surface-3); }
.descanso-btn--curto:hover { border-color: var(--blue);  color: var(--blue); }
.descanso-btn--longo:hover { border-color: var(--green); color: var(--green); }
.descanso-resumo {
  font-family: var(--font-ui);
  font-size: .74rem;
  color: var(--text);
  line-height: 1.6;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

/* ════════════════════════════════════════════════════
   FUNDAMENTOS · CATARSE · DESEQUILÍBRIO
════════════════════════════════════════════════════ */
.fund-band { margin-bottom: 16px; }
.fund-band-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
}
.fund-band-col--list { min-width: 0; }
.fund-col-label,
.danomods-title {
  font-family: var(--font-ui);
  font-size: .56rem;
  letter-spacing: .14em;
  color: var(--text-mute);
  margin-bottom: 8px;
}

/* ── Linha de um fundamento ─────────────────────────── */
.fund-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 6px;
}
.fund-row:last-child { margin-bottom: 0; }
.fund-row--dom {
  border-color: var(--gold-dim);
  background: var(--gold-deep);
}
.fund-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.fund-nome {
  font-family: var(--font-ui);
  font-size: .76rem;
  letter-spacing: .04em;
  font-weight: 600;
}
.fund-nome--dom { text-shadow: 0 0 12px currentColor; }
.fund-dom-tag {
  font-family: var(--font-ui);
  font-size: .5rem;
  letter-spacing: .1em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}
.fund-tag-nexo {
  font-family: var(--font-ui);
  font-size: .58rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  white-space: nowrap;
}
.fund-catarse-mini {
  font-family: var(--font-ui);
  font-size: .58rem;
  color: var(--text-dim);
  margin-left: auto;
}
.fund-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 0;
}
.fund-btn {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  width: 52px;
  height: 52px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  cursor: pointer;
  border-radius: 50%;
  transition: border-color .2s, color .2s, background .15s, transform .12s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.fund-btn:active { transform: scale(.92); }
.fund-btn--plus  { color: var(--green); }
.fund-btn--minus { color: var(--red); }
.fund-btn--plus:hover  { border-color: var(--green); background: rgba(60, 160, 90, .08); }
.fund-btn--minus:hover { border-color: var(--red);   background: rgba(180, 50, 50, .08); }
.fund-nivel-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 60px;
  text-align: center;
  cursor: text;
  outline: none;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  line-height: 1;
  user-select: text;
}
.fund-nivel-num:focus,
.fund-nivel-num:hover {
  background: rgba(212, 165, 84, .08);
}
.fund-nivel-num:empty::before {
  content: '0';
  color: var(--text-mute);
}
.fund-bar {
  height: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.fund-bar-fill {
  height: 100%;
  transition: width .25s ease;
}

/* ── Medidores (Catarse / Desequilíbrio) ────────────── */
.fund-band-col--meters {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.meter-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.meter-block--catarse { border-color: #5a4a8a; }
.meter-block--deseq   { border-color: #6a3a3a; }
.meter-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.meter-label {
  font-family: var(--font-ui);
  font-size: .66rem;
  letter-spacing: .12em;
  color: var(--text-dim);
}
.meter-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--gold);
  line-height: 1;
}
.meter-bar {
  height: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}
.meter-fill {
  height: 100%;
  transition: width .3s ease;
}
.meter-fill--catarse {
  background: linear-gradient(90deg, #3a2a6a, #8a6acc);
}
.meter-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.catarse-seg {
  font-family: var(--font-ui);
  font-size: .56rem;
  padding: 2px 6px;
  border: 1px solid;
  border-radius: var(--radius-sm);
}

/* ── Estados de Desequilíbrio ───────────────────────── */
.deseq-estado {
  font-family: var(--font-ui);
  font-size: .6rem;
  letter-spacing: .1em;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: var(--radius-sm);
  margin-left: auto;
}
.deseq-estado--estavel  { color: var(--green);  border-color: var(--green); }
.deseq-estado--leve     { color: var(--gold);   border-color: var(--gold); }
.deseq-estado--instavel { color: var(--orange); border-color: var(--orange); }
.deseq-estado--critico  { color: var(--red);    border-color: var(--red); }
.deseq-estado--colapso  {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  animation: deseq-pulse 1.2s ease-in-out infinite;
}
@keyframes deseq-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}
.deseq-fill--estavel  { background: linear-gradient(90deg, #1a4a2a, var(--green)); }
.deseq-fill--leve     { background: linear-gradient(90deg, #4a3a10, var(--gold)); }
.deseq-fill--instavel { background: linear-gradient(90deg, #5a3010, var(--orange)); }
.deseq-fill--critico  { background: linear-gradient(90deg, #5a1010, var(--red)); }
.deseq-fill--colapso  { background: linear-gradient(90deg, var(--red), #ff6666); }

/* Temperatura sobrescreve o gradiente do estado. Tons quentes
   quando a CARGA do dominante sobra (poder bruto concentrado);
   tons frios quando a DESCARGA sobra (reações ao redor demais).
   O estado neutro (valor 0) usa o gradiente estável padrão. */
.deseq-fill--dir-quente { background: linear-gradient(90deg, #5a2010, #ff8844); }
.deseq-fill--dir-frio   { background: linear-gradient(90deg, #1a2a5a, #5a8aff); }
/* Quanto mais grave o estado, mais saturada a temperatura. */
.deseq-fill--colapso.deseq-fill--dir-quente { background: linear-gradient(90deg, #ff3300, #ffaa00); }
.deseq-fill--colapso.deseq-fill--dir-frio   { background: linear-gradient(90deg, #3344ff, #88ccff); }
.deseq-desc {
  font-family: var(--font-body);
  font-size: .8rem;
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.deseq-dominante-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--border-2);
  border-bottom: 1px solid var(--border-2);
  margin-bottom: 8px;
}
.deseq-dom-label {
  font-family: var(--font-ui);
  font-size: .58rem;
  letter-spacing: .1em;
  color: var(--text-mute);
}
.deseq-dom-val {
  font-family: var(--font-ui);
  font-size: .82rem;
  color: var(--gold);
}
.deseq-contrib {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.deseq-contrib-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: .72rem;
  padding: 3px 6px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--border);
}
.deseq-contrib-row--forte        { border-left-color: var(--red); }
.deseq-contrib-row--fraco        { border-left-color: var(--green); }
.deseq-contrib-row--neutro       { border-left-color: var(--text-mute); }
.deseq-contrib-row--estabilizador{ border-left-color: var(--blue); }
.deseq-contrib-nome {
  font-family: var(--font-ui);
  font-size: .68rem;
}
.deseq-contrib-rel {
  font-family: var(--font-ui);
  font-size: .56rem;
  color: var(--text-mute);
}
.deseq-contrib-val {
  font-family: var(--font-ui);
  font-size: .78rem;
  color: var(--text);
  min-width: 32px;
  text-align: right;
}

/* ════════════════════════════════════════════════════
   HABILIDADES — modificadores + cards
════════════════════════════════════════════════════ */
.hab-band { margin-top: 16px; }
.danomods {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}
.danomods-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.danomod-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.danomod-label {
  font-family: var(--font-ui);
  font-size: .58rem;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.danomod-input {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: .9rem;
  padding: 6px;
  text-align: center;
  border-radius: var(--radius);
}
.danomod-input:focus { outline: none; border-color: var(--gold); }

.danomod-value {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: .95rem;
  font-weight: 600;
  padding: 6px;
  text-align: center;
  border-radius: var(--radius);
  cursor: help;
  user-select: none;
}

.hab-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.hab-add-btn {
  font-family: var(--font-ui);
  font-size: .6rem;
  letter-spacing: .04em;
  padding: 6px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: border-color .15s, color .15s;
}
.hab-add-btn:hover { border-color: var(--blue); color: var(--blue); }

.hab-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.hab-empty {
  grid-column: 1 / -1;
  font-family: var(--font-body);
  font-size: .82rem;
  font-style: italic;
  color: var(--text-mute);
  text-align: center;
  padding: 20px;
}

/* ── Card de habilidade ─────────────────────────────── */
.hab-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.hab-card--open { grid-column: 1 / -1; }
.hab-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border-left: 3px solid var(--gold);
  transition: background .15s;
}
.hab-card-head:hover { background: var(--surface-3); }
.hab-card-head--truque    { border-left-color: var(--purple); }
.hab-card-head--mana      { border-left-color: var(--blue); }
.hab-card-head--energia   { border-left-color: var(--green); }
.hab-card-head--corpo     { border-left-color: var(--red); }
.hab-card-head--distancia { border-left-color: var(--orange); }
.hab-head-main { min-width: 0; }
.hab-head-tipo {
  display: block;
  font-family: var(--font-ui);
  font-size: .52rem;
  letter-spacing: .1em;
  color: var(--text-mute);
}
.hab-head-nome {
  font-family: var(--font-ui);
  font-size: .82rem;
  color: var(--text);
}
.hab-head-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.hab-head-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.hab-dano-num, .hab-custo-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.hab-head-stat--dano  .hab-dano-num  { color: var(--red); }
.hab-head-stat--custo .hab-custo-num { color: var(--blue); }
.hab-stat-lbl {
  font-family: var(--font-ui);
  font-size: .48rem;
  letter-spacing: .06em;
  color: var(--text-mute);
}
.hab-head-caret {
  color: var(--text-dim);
  font-size: .8rem;
}

/* ── Corpo do card (expandido) ──────────────────────── */
.hab-card-body {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.hab-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.hab-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hab-field-label {
  font-family: var(--font-ui);
  font-size: .56rem;
  letter-spacing: .08em;
  color: var(--text-dim);
}
.hab-input, .hab-select, .hab-textarea {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: .76rem;
  padding: 6px 8px;
  border-radius: var(--radius);
  width: 100%;
}
.hab-input:focus, .hab-select:focus, .hab-textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.hab-input--num { text-align: center; color: var(--gold); }
.hab-textarea {
  resize: vertical;
  min-height: 52px;
  font-family: var(--font-body);
  font-size: .84rem;
  line-height: 1.5;
}

/* ── Multi-dano ─────────────────────────────────────────── */
.hab-dano-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.hab-dano-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.hab-dano-row .hab-input--num {
  width: 64px;
  flex-shrink: 0;
}
.hab-dano-row .hab-select--mod {
  flex: 1;
  min-width: 120px;
}
.hab-dano-subtotal {
  font-family: var(--font-ui);
  font-size: .72rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.hab-dano-add-btn {
  align-self: flex-start;
  margin-top: 2px;
  padding: 3px 10px;
  font-size: .72rem;
  font-family: var(--font-ui);
  letter-spacing: .06em;
  color: var(--gold);
  background: transparent;
  border: 1px dashed var(--gold);
  border-radius: var(--radius);
  cursor: pointer;
  opacity: .8;
  transition: opacity .15s;
}
.hab-dano-add-btn:hover { opacity: 1; }
.hab-dano-rem-btn {
  padding: 2px 7px;
  font-size: .78rem;
  font-family: var(--font-ui);
  color: var(--red);
  background: transparent;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s;
  flex-shrink: 0;
}
.hab-dano-rem-btn:hover { opacity: 1; }
/* ─────────────────────────────────────────────────────────── */
.hab-dano-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 10px;
}
.hab-dano-line-lbl {
  font-family: var(--font-ui);
  font-size: .58rem;
  letter-spacing: .1em;
  color: var(--text-dim);
}
.hab-dano-line-val {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--red);
}
.hab-dano-line-break {
  font-family: var(--font-ui);
  font-size: .62rem;
  color: var(--text-dim);
}
.hab-del-btn {
  font-family: var(--font-ui);
  font-size: .62rem;
  letter-spacing: .06em;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #4a2a2a;
  color: var(--red);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.hab-del-btn:hover { background: var(--red-dim); }

/* Botão de usar habilidade (consome recurso e mostra dano). */
.hab-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.hab-usar-btn {
  font-family: var(--font-ui);
  font-size: .72rem;
  letter-spacing: .08em;
  padding: 8px 16px;
  background: linear-gradient(180deg, #2a1f10, #1a1408);
  border: 1px solid var(--gold);
  color: var(--gold);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all .15s;
  flex: 1;
}
.hab-usar-btn:hover {
  background: linear-gradient(180deg, #3a2a18, #2a1f10);
  box-shadow: 0 0 8px rgba(212, 165, 84, 0.3);
}
.hab-usar-btn:active { transform: translateY(1px); }

.empty-dim {
  font-family: var(--font-body);
  font-size: .78rem;
  font-style: italic;
  color: var(--text-mute);
}


/* ════════════════════════════════════════════════════
   RODA DOS FUNDAMENTOS — visualização SVG
   Pentágono com Morte no topo, ciclo no sentido horário,
   Energia no centro como nó estabilizador. Cada nó é
   clicável; o nó selecionado fica em destaque branco e
   o dominante recebe halo dourado.
════════════════════════════════════════════════════ */
.fund-wheel-host {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 0 14px;
}
.fund-wheel {
  width: 100%;
  max-width: 560px;
  height: auto;
  display: block;
  overflow: visible;
}

/* Aro externo decorativo — duplo anel dourado tracejado. */
.fund-wheel-aro {
  fill: none;
  stroke: var(--gold-dim);
}
.fund-wheel-aro--outer {
  stroke-width: 1;
  opacity: .45;
  stroke-dasharray: 2 5;
}
.fund-wheel-aro--inner {
  stroke-width: .5;
  opacity: .3;
  stroke-dasharray: 1 3;
}

/* Pentagrama interno — estrela conectando os 5 fundamentos
   no padrão clássico (pulando vértices). Dourado sutil
   com glow leve, transmite o "selo oculto" da mecânica. */
.fund-wheel-pentagrama {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1;
  opacity: .28;
  filter: url(#fundGoldGlow);
}

/* Linhas radiais Energia → fundamentos do ciclo. Bem discretas. */
.fund-wheel-radial {
  stroke: var(--gold-dim);
  stroke-width: .5;
  opacity: .2;
  stroke-dasharray: 1 4;
}

/* Linhas do ciclo (pentágono): vizinhança forte/fraca/neutra. */
.fund-wheel-link-line {
  stroke: var(--gold-dim);
  stroke-width: 1.5;
  opacity: .55;
}
.fund-wheel-link-arrow {
  fill: var(--gold);
  opacity: .9;
}

/* Nó de fundamento — grupo agrupador. */
.fund-wheel-no {
  cursor: pointer;
  outline: none;
  transition: opacity .15s ease;
}
.fund-wheel-no:hover { opacity: .85; }
.fund-wheel-no:focus { outline: none; }

/* Anel de fundo do nó (cinza fraco, decorativo). */
.fund-wheel-anel-bg {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 3;
  opacity: .4;
}

/* Anel preenchido (cor do fundamento, proporção do nível). */
.fund-wheel-anel {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray .25s ease;
  filter: drop-shadow(0 0 4px currentColor);
}

/* Corpo do círculo do nó — preenchimento inline define a cor;
   só damos uma borda discreta para destacar do fundo escuro. */
.fund-wheel-corpo {
  stroke-width: 2;
  transition: filter .15s ease;
}

/* Halo dourado para o nó dominante — gradient radial pulsante.
   transform-box: fill-box garante que scale rotacione em torno
   do próprio círculo no Chrome 74 / Tabletop Simulator. */
.fund-wheel-halo {
  pointer-events: none;
  animation: fund-halo-pulse 2.8s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes fund-halo-pulse {
  0%, 100% { transform: scale(1);    opacity: .85; }
  50%      { transform: scale(1.08); opacity: 1; }
}

/* Anel duplo dourado em volta de cada nó — estética arcana. */
.fund-wheel-anel-aro-outer {
  fill: none;
  stroke: var(--gold);
  stroke-width: .8;
  opacity: .65;
}
.fund-wheel-anel-aro-inner {
  fill: none;
  stroke: var(--gold-dim);
  stroke-width: .5;
  opacity: .4;
}

/* Nó selecionado (foco da edição): contorno branco luminoso. */
.fund-wheel-no--sel .fund-wheel-corpo {
  stroke: var(--text);
  stroke-width: 3;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.4));
}

/* Número do nível dentro do nó — fonte de display grande. */
.fund-wheel-nivel {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  pointer-events: none;
}
.fund-wheel-no--nexo .fund-wheel-nivel { font-size: 40px; }

/* Rótulo do fundamento — fonte serif gótica do tema, com
   sombra escura forte para legibilidade em qualquer cor. */
.fund-wheel-rotulo {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: .14em;
  font-weight: 600;
  pointer-events: none;
  text-transform: uppercase;
  paint-order: stroke;
  stroke: rgba(8, 8, 14, .9);
  stroke-width: 5;
  stroke-linejoin: round;
}
.fund-wheel-rotulo--nexo {
  font-size: 15px;
  letter-spacing: .2em;
  stroke: none;
}

/* Tag DOMINANTE flutuante. */
.fund-wheel-tag-dom {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .22em;
  font-weight: 700;
  fill: var(--gold);
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(8, 8, 14, .9);
  stroke-width: 5;
  stroke-linejoin: round;
}

/* ════════════════════════════════════════════════════
   PAINEL DE CONTROLE — fundamento selecionado
   Fica abaixo da roda; mostra o nome do fundamento em foco
   e os botões +/− e o número editável para ajustar o nível.
════════════════════════════════════════════════════ */
.fund-control {
  position: relative;
  background:
    radial-gradient(circle at top, rgba(212, 165, 84, .04), transparent 70%),
    var(--surface-2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  /* Borda dupla decorativa interna. */
  box-shadow: inset 0 0 0 1px rgba(212, 165, 84, .08);
}
.fund-control::before,
.fund-control::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: .5;
}
.fund-control::before { left: 0; }
.fund-control::after  { right: 0; }
.fund-control-nome {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.fund-control-titulo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: .12em;
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 0 0 18px currentColor;
}



   Empilha as duas colunas dos Fundamentos e ajusta os
   controles para não vazarem em telas estreitas.
════════════════════════════════════════════════════ */
/* ════════════════════════════════════════════════════
   RESPONSIVO — celular em retrato
   Empilha as duas colunas dos Fundamentos e ajusta os
   controles para não vazarem em telas estreitas.
════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .fund-band-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  /* Catarse/Desequilíbrio ficam acima da roda no celular —
     leitura rápida vem primeiro, edição vem em seguida. */
  .fund-band-col--meters { order: -1; }
  .fund-wheel { max-width: 360px; }
}

@media (max-width: 600px) {
  .fund-band-col--list,
  .fund-band-col--meters { min-width: 0; }

  /* Linha de um fundamento: nome em cima, controles embaixo. */
  .fund-head {
    flex-wrap: wrap;
    gap: 6px;
  }
  .fund-nome { font-size: .82rem; }
  .fund-catarse-mini,
  .fund-tag-nexo,
  .fund-dom-tag { margin-left: 0; }

  .fund-controls { gap: 10px; }
  .fund-btn { width: 32px; height: 32px; font-size: 1rem; }
  .fund-nivel-num { font-size: 1.4rem; min-width: 44px; }

  /* Medidores: estado vai para baixo se não couber. */
  .meter-head { gap: 8px; }
  .meter-value { font-size: 1.5rem; }

  /* Habilidades: cards passam a ocupar a linha inteira. */
  .hab-list { grid-template-columns: 1fr; }
  .hab-card--open { grid-column: auto; }
  .hab-grid { grid-template-columns: 1fr; }

  /* Modificadores: 1 coluna em telas estreitas. */
  .danomods-row { grid-template-columns: 1fr; }

  /* Botões de adicionar habilidade quebram em mais linhas. */
  .hab-add-btn { flex: 1 1 calc(50% - 6px); }
}

/* ── PAINEL DO MESTRE ─────────────────────────────────── */
.topbar-btn--mestre {
  background: transparent;
  border: 1px solid var(--c-gold);
  color: var(--c-gold);
}
.topbar-btn--mestre:hover { background: rgba(212,175,55,.15); }

.modal--mestre {
  background: var(--c-surface);
  border: 1px solid var(--c-gold);
  border-radius: 8px;
  width: min(780px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-mestre-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-border);
}
.modal-mestre-title {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--c-gold);
}
.modal-mestre-close {
  background: none;
  border: none;
  color: var(--c-text-muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.modal-mestre-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.modal-mestre-footer {
  padding: .75rem 1rem;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}

.mestre-sec { display: flex; flex-direction: column; gap: .5rem; }
.mestre-sec-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--c-gold);
  text-transform: uppercase;
  border-bottom: 1px solid var(--c-border);
  padding-bottom: .25rem;
}
.mestre-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.mestre-label {
  font-size: .75rem;
  color: var(--c-text-muted);
  min-width: 7rem;
}
.mestre-input {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  color: var(--c-text);
  padding: .25rem .5rem;
  width: 5rem;
  font-size: .85rem;
}
.mestre-input:focus { border-color: var(--c-gold); outline: none; }

.mestre-attr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .4rem; }
.mestre-hint { font-size: .8rem; color: var(--c-text-muted); }

/* Bloco de erros de validação do Mestre */
.mestre-erros {
  background: #2a0808;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.mestre-erros-titulo {
  font-family: var(--font-ui);
  font-size: .78rem;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 8px;
}
.mestre-erro-item {
  font-size: .78rem;
  color: #cc7777;
  padding: 3px 0 3px 10px;
  border-left: 2px solid var(--red);
  margin-bottom: 4px;
  font-family: var(--font-ui);
}

.mestre-readonly {
  font-family: var(--font-ui);
  font-size: .95rem;
  color: var(--gold);
  padding: 6px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-left: 2px solid var(--gold);
  border-radius: var(--radius-sm);
  display: inline-block;
  cursor: help;
  user-select: none;
}

.mestre-pericias-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .4rem; }
.mestre-pericia-row { display: flex; align-items: center; gap: .4rem; }
.mestre-pericia-nome { font-size: .8rem; flex: 1; }
.mestre-pericia-bonus { font-size: .7rem; color: var(--c-gold); }

.mestre-resist-wrap { display: flex; flex-direction: column; gap: .75rem; }
.mestre-resist-barra { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.mestre-resist-pts { font-size: .8rem; color: var(--c-gold); font-weight: 700; white-space: nowrap; }
.mestre-mode-btns { display: flex; gap: .35rem; flex-wrap: wrap; }
.mestre-mode-btn {
  padding: .25rem .6rem;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-muted);
  font-size: .7rem;
  cursor: pointer;
  letter-spacing: .05em;
}
.mestre-mode-btn--active {
  border-color: var(--c-gold);
  color: var(--c-gold);
  background: rgba(212,175,55,.1);
}
.mestre-resist-group { display: flex; flex-direction: column; gap: .35rem; }

/* ── RESISTÊNCIAS — grupos e chips novos ─────────────── */
.resist-group { display: flex; flex-direction: column; gap: .35rem; }
.resist-group-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--c-text-muted);
  text-transform: uppercase;
}
.resist-chip-row { display: flex; flex-wrap: wrap; gap: .3rem; }
.resist-chip--dim { opacity: .35; }
.resist-chip--icl { border-color: var(--c-gold);   color: var(--c-gold);  background: rgba(212,175,55,.12); }
.resist-chip--ics { border-color: #e06060;          color: #e06060;        background: rgba(224, 96, 96,.12); }

/* ── ESPECIALIZAÇÃO DE PERÍCIA ──────────────────────── */
.pool-chip--espec {
  border-color: var(--gold) !important;
}

.espec-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 0 3px;
  background: none;
  border: none;
  color: var(--text-mute);
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.espec-toggle:hover { opacity: 0.8; color: var(--gold); }
.espec-toggle--on   { opacity: 1;   color: var(--gold); }

/* ── Resistências raciais no criador ── */
.resist-racial-block {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: rgba(200,169,110,.04);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
}
.resist-racial-label {
  font-family: var(--font-ui);
  font-size: .55rem;
  letter-spacing: .14em;
  color: var(--gold-dim);
  margin-bottom: 6px;
}
.resist-racial-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.resist-chip--racial {
  border-color: var(--gold-dim) !important;
  color: var(--gold) !important;
  background: rgba(200,169,110,.08) !important;
  cursor: default;
}
