/* Dadolopos — tema escuro grafite, layout sidebar + dado 3D.
   Para trocar a identidade visual, mexa apenas nas variaveis do :root. */

:root {
  /* Paleta base — grafite */
  --bg: #0b0c10;
  --panel: #14161c;
  --panel-2: #1b1e26;
  --border: #262a34;
  --border-hi: #3b4150;
  --text: #eef1f6;
  --text-dim: #a3abba;
  --text-faint: #737d8e;

  /* Acentos: ambar como principal, esmeralda como funcional */
  --accent: #f5a524;
  --accent-hot: #f97316;
  --accent-2: #10b981;
  --gold: #fcd34d;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --accent-line: rgba(245, 165, 36, 0.34);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.1);
  --danger: #f87171;

  /* Dado: marfim sobre grafite (usado nos ladrilhos de resultado) */
  --die-face: #f6f3e9;
  --die-face-2: #e6e1d1;
  --die-face-3: #d3ccb8;
  --die-edge: #bdb59d;
  --die-ink: #16181e;
  --die-glow: rgba(245, 165, 36, 0.4);

  /* Uma cor por face do cubo. A face 1 e sempre a de cima, onde o resultado
     para: por isso ela leva a cor da marca. Todas sao claras o suficiente para
     o texto escuro (--die-ink) manter contraste alto. */
  --face-1: #f5a524;
  --face-2: #34d399;
  --face-3: #60a5fa;
  --face-4: #fb7185;
  --face-5: #c4b5fd;
  --face-6: #a3e635;

  /* Metricas */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 44px rgba(0, 0, 0, 0.5);
  --maxw: 1180px;
  --card-pad: 20px;
  --gap: 18px;
  --sidebar-w: 264px;

  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

body[data-density="compact"] {
  --card-pad: 13px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1100px 560px at 78% -14%, rgba(245, 165, 36, 0.17), transparent 62%),
    radial-gradient(900px 500px at -8% 10%, rgba(16, 185, 129, 0.10), transparent 58%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
body[data-sidebar="hidden"] .layout { grid-template-columns: 0 1fr; }
body[data-sidebar="hidden"] .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 18px;
  border-right: 1px solid var(--border);
  background: rgba(10, 8, 18, 0.66);
  backdrop-filter: blur(10px);
  transition: transform .25s ease, opacity .25s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.brand .logo { display: block; width: 28px; height: 28px; flex: 0 0 28px; }
.brand small {
  display: block;
  font-weight: 500;
  font-size: .71rem;
  color: var(--text-faint);
  letter-spacing: 0;
}
.nav { margin-top: 22px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: .91rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active {
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-label {
  margin: 18px 0 6px;
  padding-left: 12px;
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
}

.tweaks { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.tweaks h4 {
  margin: 0 0 10px;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.toggle-row > span:first-child { font-size: .81rem; color: var(--text-dim); }
.seg {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: .71rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}
.seg button.on { background: var(--accent); color: #05221b; }

/* ---------- Main / topbar ---------- */
.main { min-width: 0; }
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 8, 18, 0.88);
  backdrop-filter: blur(8px);
  z-index: 20;
}
.icon-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
}
.sidebar-reveal {
  position: fixed;
  top: 14px; left: 14px;
  z-index: 45;
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.sidebar-reveal:hover { border-color: var(--border-hi); }
body[data-sidebar="hidden"] .sidebar-reveal { display: flex; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- Hero ---------- */
.hero { padding: 34px 0 26px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .77rem;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  font-weight: 800;
}
.grad {
  background: linear-gradient(90deg, var(--gold), var(--accent-hot));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.sub {
  font-size: 1.07rem;
  color: var(--text-dim);
  max-width: 660px;
  margin: 0 0 22px;
}
.stats { display: flex; flex-wrap: wrap; gap: 26px; }
.stat .num { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }
.stat .lbl { font-size: .76rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Ferramenta: dado ---------- */
.tool {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin: 8px 0 40px;
}
.tool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tool-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.01em; }
.tool-head .hint { font-size: .8rem; color: var(--text-faint); }

.dice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.dice-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; }

/* A cena carrega a perspectiva; o brilho de baixo separa o dado do fundo. */
.dice-scene {
  /* Menor que a cena de proposito: o espaco em volta e o que deixa o halo e a
     sombra aparecerem, em vez de ficarem escondidos atras do proprio cubo. */
  --cube-size: clamp(140px, 38vw, 206px);
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1100px;
  perspective-origin: 50% 42%;
}
/* Halo quente atras do dado: e ele que separa o objeto do fundo grafite
   e o que da a sombra de contato algo para escurecer. */
.dice-scene::before {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  /* Chega ate a borda: se o halo terminasse antes, o proprio cubo cobriria
     a parte iluminada e o efeito nao apareceria. */
  background: radial-gradient(closest-side,
    var(--die-glow) 0%,
    rgba(245, 165, 36, .22) 58%,
    rgba(245, 165, 36, .07) 80%,
    transparent 100%);
  filter: blur(12px);
  pointer-events: none;
}

/* Sombra de contato: encolhe quando o dado "sobe" no arremesso. */
.dice-shadow {
  position: absolute;
  bottom: 6%;
  width: 58%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .85), rgba(0, 0, 0, .3) 62%, transparent 78%);
  filter: blur(3px);
  transition: transform .5s ease, opacity .5s ease;
}
.dice-scene.rolling .dice-shadow { transform: scale(.6); opacity: .45; }

/* Dois niveis: o wrapper cuida do pulo vertical, o cubo cuida da rotacao.
   Separado porque animar as duas coisas no mesmo transform brigaria. */
.cube-lift { transform-style: preserve-3d; }
.cube-lift.tossing { animation: toss 1.7s cubic-bezier(.3, .1, .34, 1); }
@keyframes toss {
  0%   { transform: translateY(0); }
  38%  { transform: translateY(-15%); }
  70%  { transform: translateY(2%); }
  86%  { transform: translateY(-4%); }
  100% { transform: translateY(0); }
}

.cube {
  --half: calc(var(--cube-size) / 2);
  position: relative;
  width: var(--cube-size);
  height: var(--cube-size);
  transform-style: preserve-3d;
  /* Repouso: camera acima e um pouco a esquerda. O angulo e mais aberto no
     eixo X para a face de cima (a do resultado) ficar grande e legivel. */
  transform: rotateX(-30deg) rotateY(-25deg);
  transition: transform 1.7s cubic-bezier(.16, .74, .16, 1);
  /* Sem filter aqui: filter e propriedade de agrupamento e achataria
     o preserve-3d, colapsando o cubo. O volume vem das faces + .dice-shadow. */
}

.cube .face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12%;
  text-align: center;
  /* Canto pequeno + faces 2% maiores: cantos arredondados abrem fenda entre
     dois paineis planos, e o leve transbordo fecha essa fenda. */
  border-radius: 5%;
  /* Cor plana da face + uma camada de luz e sombra por cima. Assim cada face
     precisa de uma variavel so, em vez de tres tons por cor. */
  background-color: var(--fc, var(--die-face));
  background-image: linear-gradient(150deg,
    rgba(255, 255, 255, .34),
    rgba(255, 255, 255, 0) 44%,
    rgba(0, 0, 0, .24));
  border: 1px solid rgba(0, 0, 0, .26);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), inset 0 -16px 30px rgba(0, 0, 0, .12);
  color: var(--die-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .38);
  font-weight: 800;
  /* --fs e ajustado pelo app.js conforme o tamanho do texto da face. */
  font-size: calc(var(--cube-size) * .115 * var(--fs, 1));
  letter-spacing: -0.02em;
  line-height: 1.14;
  overflow: hidden;
  word-break: break-word;
  backface-visibility: hidden;
}
/* Escurece as faces que nao sao a de cima, para dar volume. */
.cube .face.f-top    { --fc: var(--face-1); transform: rotateX(90deg) translateZ(var(--half)) scale(1.02); }
.cube .face.f-front  { --fc: var(--face-2); transform: translateZ(var(--half)) scale(1.02); }
.cube .face.f-right  { --fc: var(--face-3); transform: rotateY(90deg) translateZ(var(--half)) scale(1.02); }
.cube .face.f-back   { --fc: var(--face-4); transform: rotateY(180deg) translateZ(var(--half)) scale(1.02); }
.cube .face.f-left   { --fc: var(--face-5); transform: rotateY(-90deg) translateZ(var(--half)) scale(1.02); }
.cube .face.f-bottom { --fc: var(--face-6); transform: rotateX(-90deg) translateZ(var(--half)) scale(1.02); }
.cube .face.f-front::after,
.cube .face.f-right::after,
.cube .face.f-left::after,
.cube .face.f-back::after,
.cube .face.f-bottom::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(12, 13, 17, .16);
  pointer-events: none;
}
.cube .face.f-right::after, .cube .face.f-left::after { background: rgba(12, 13, 17, .26); }
.cube .face.f-bottom::after { background: rgba(12, 13, 17, .34); }

/* Pips do dado classico: grade 3x3 com pontos posicionados por classe. */
.pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; padding: 6%; }
.pips i {
  align-self: center;
  justify-self: center;
  width: 62%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #4a4d57, var(--die-ink) 68%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .25);
}
.pips i.p1 { grid-area: 1 / 1; } .pips i.p2 { grid-area: 1 / 3; }
.pips i.p3 { grid-area: 2 / 1; } .pips i.p4 { grid-area: 2 / 2; }
.pips i.p5 { grid-area: 2 / 3; } .pips i.p6 { grid-area: 3 / 1; }
.pips i.p7 { grid-area: 3 / 3; }

.dice-hint { font-size: .8rem; color: var(--text-faint); text-align: center; }

.winner {
  width: 100%;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.winner .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); }
.winner .v { font-size: clamp(1.2rem, 3.4vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; word-break: break-word; }
.winner.idle { background: var(--panel); border-color: var(--border); color: var(--text-faint); }
.winner.idle .v { font-size: .95rem; font-weight: 500; color: var(--text-faint); }
.winner.pop { animation: pop .45s ease; }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.035); } 100% { transform: scale(1); } }

.dice-side label, .tool-controls label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); margin-bottom: 7px; }
.dice-side textarea, .tool-controls textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  background: rgba(7, 8, 11, .58);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
  font-size: .92rem;
  line-height: 1.55;
}
.dice-side textarea:focus, .tool-controls textarea:focus { outline: 2px solid var(--accent-line); outline-offset: -1px; }
.entry-count { font-size: .78rem; color: var(--text-faint); margin-top: 7px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(95deg, var(--accent), var(--accent-hot));
  color: #2a1806;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: .93rem;
  font-family: inherit;
  border: 0;
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel); border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover:not(:disabled) { border-color: var(--border-hi); }
.btn.small { padding: 8px 14px; font-size: .82rem; }
.btn.block { width: 100%; justify-content: center; }

.history { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.history h4 { margin: 0 0 9px; font-size: .69rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); }
.history ol { margin: 0; padding-left: 20px; font-size: .87rem; color: var(--text-dim); }
.history li { margin-bottom: 4px; }
.history .empty { font-size: .85rem; color: var(--text-faint); }

.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 14px);
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .88rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Secoes e cards ---------- */
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 1.25rem; margin: 0; letter-spacing: -0.01em; }
.section-head .count { font-size: .79rem; color: var(--text-faint); }
.section > p.lead { color: var(--text-dim); max-width: 720px; margin: -6px 0 18px; }

/* Subtitulo que agrupa cards dentro de uma secao (ex.: guias por tema) */
.section h3.group {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-faint);
  margin: 26px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section h3.group:first-of-type { margin-top: 4px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: var(--gap); }

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-pad);
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity .16s;
}
.card:hover { transform: translateY(-3px); border-color: var(--border-hi); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }
.card .ico { font-size: 1.55rem; line-height: 1; }
.card h3 { margin: 0; font-size: 1.1rem; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: .89rem; color: var(--text-dim); }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag {
  font-size: .71rem;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(10, 8, 18, .5);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.tag.hot { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- Paginas de conteudo ---------- */
.breadcrumb { font-size: .81rem; color: var(--text-faint); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--text-dim); }

.page, .prose { max-width: 780px; }
.page h1, .prose h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -0.02em; margin: 0 0 10px; }
.page .updated, .prose .updated { color: var(--text-faint); font-size: .81rem; margin: 0 0 26px; }
.page h2, .prose h2 { font-size: 1.3rem; margin: 30px 0 10px; letter-spacing: -0.01em; }
.page h3, .prose h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.page p, .prose p { margin: 0 0 14px; }
.page ul, .page ol, .prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.page li, .prose li { margin-bottom: 6px; }
.page a:not(.btn), .prose a:not(.btn) { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.callout {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 18px 0;
  font-size: .94rem;
}
.callout.warn { background: var(--warn-soft); border-color: rgba(255,176,32,.3); border-left-color: var(--warn); }

.factbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 28px; }
.fact { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.fact .k { font-size: .71rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.fact .v { font-size: 1.02rem; font-weight: 700; margin-top: 4px; }

.data-table { width: 100%; border-collapse: collapse; margin: 8px 0 20px; font-size: .91rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-faint); font-weight: 600; font-size: .77rem; text-transform: uppercase; letter-spacing: .06em; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table code { font-size: .88em; }
/* Cartao de regras: paragrafos densos dentro de um .fact largo */
.factbar .fact p { font-size: .91rem; line-height: 1.62; }

/* ---------- Formulario ---------- */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: .84rem; color: var(--text-dim); margin-bottom: 6px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 13px;
  font: inherit;
}
.form-field textarea { min-height: 140px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { outline: 2px solid var(--accent-line); outline-offset: -1px; }
.form-note { font-size: .8rem; color: var(--text-faint); margin-top: -6px; }
.form-status { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .9rem; display: none; }
.form-status.ok { display: block; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.form-status.err { display: block; background: rgba(255,93,122,.1); border: 1px solid rgba(255,93,122,.32); }

/* ---------- CTA ---------- */
.cta {
  margin: 44px 0 0;
  background: linear-gradient(120deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
}
.cta h3 { margin: 0 0 8px; }
.cta p { color: var(--text-dim); max-width: 560px; margin: 0 auto 16px; font-size: .94rem; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 60px;
  padding: 30px 0 10px;
  color: var(--text-faint);
  font-size: .84rem;
}
.footer .cols { display: flex; flex-wrap: wrap; gap: 44px; margin-bottom: 22px; }
.footer h5 { color: var(--text-dim); margin: 0 0 10px; font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; }
.footer a { display: block; color: var(--text-faint); margin-bottom: 6px; }
.footer a:hover { color: var(--text); }
.footer .bottom { padding-top: 16px; border-top: 1px solid var(--border); line-height: 1.7; }
.footer .disclaimer { color: var(--text-dim); }

/* ---------- 404 ---------- */
.notfound { max-width: 560px; margin: 8vh auto; text-align: center; }
.notfound .code { font-size: clamp(3.4rem, 12vw, 6rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.notfound p { color: var(--text-dim); }

/* ---------- Ferramentas das paginas tools/ ---------- */
.tool-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.tool-controls textarea { min-height: 190px; }
.tool-controls .form-field { margin-bottom: 14px; }
.inline-fields { display: flex; gap: 10px; }
.inline-fields .form-field { flex: 1; margin-bottom: 14px; }
.check-row { display: flex; align-items: center; gap: 9px; font-size: .87rem; color: var(--text-dim); margin-bottom: 14px; }
.check-row input { width: auto; accent-color: var(--accent); }

.tool-result {
  background: rgba(7, 8, 11, .5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  min-height: 240px;
}
.tool-result .placeholder { color: var(--text-faint); font-size: .9rem; margin: 0; }
.tool-result h4 {
  margin: 0 0 12px;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-faint);
}

.big-result {
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  padding: 14px 0 6px;
  word-break: break-word;
}
.tally { display: flex; gap: 22px; justify-content: center; margin-top: 10px; }
.tally .n { font-size: 1.35rem; font-weight: 800; text-align: center; }
.tally .l { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); text-align: center; }

.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .94rem; }
.result-list li:last-child { border-bottom: 0; }
.result-list .i { color: var(--text-faint); min-width: 26px; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px; font-size: .86rem; }
.chip.big { font-size: 1.05rem; font-weight: 700; padding: 9px 17px; font-variant-numeric: tabular-nums; }

.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(186px, 1fr)); gap: 12px; }
.team { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; }
.team h5 { margin: 0 0 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.team ul { margin: 0; padding-left: 18px; font-size: .9rem; }
.team li { margin-bottom: 3px; }

.matchups, .pairs { list-style: none; margin: 0; padding: 0; }
.matchups li, .pairs li { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .94rem; }
.matchups li:last-child, .pairs li:last-child { border-bottom: 0; }
.matchups .vs { color: var(--text-faint); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 9px; }
.matchups .bye { color: var(--text-faint); font-style: italic; }
.pairs .arrow { color: var(--accent); margin: 0 9px; }

.dice-faces { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 16px; }
.die {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Responsivo ---------- */
@media (max-width: 980px) {
  .dice-layout, .tool-grid { grid-template-columns: 1fr; }
  .dice-side textarea, .tool-controls textarea { min-height: 150px; }
  .tool-result { min-height: 0; }
  /* No mobile o dado continua sendo o objeto principal, so encolhe. */
  .dice-scene { --cube-size: clamp(132px, 38vw, 190px); max-width: 320px; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 82%; max-width: 320px; box-shadow: var(--shadow); }
  body:not([data-sidebar="open"]) .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }
  body[data-sidebar="open"] .sidebar { transform: none; opacity: 1; pointer-events: auto; }
  .topbar { display: flex; }
  .sidebar-reveal { display: none !important; }
  .container { padding: 20px 16px 60px; }
  .backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35; }
  body[data-sidebar="open"] .backdrop { display: block; }
  .tool { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .winner.pop { transition: none; animation: none; }
  /* Sem tombo: o dado apenas troca de face. O app.js encurta o tempo. */
  .cube { transition-duration: .28s; }
  .cube-lift.tossing { animation: none; }
}

/* ---------- Blocos extra das ferramentas de dado ---------- */

/* Seletor de tipo de dado (d4 a d100) */
.die-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.die-picker button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 9px 15px;
  font: inherit;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.die-picker button:hover { border-color: var(--border-hi); transform: translateY(-1px); }
.die-picker button.on { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

/* Resultado de varios dados: cada face em um quadradinho de marfim */
.roll-tray { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-bottom: 14px; }
.roll-tray .rd {
  min-width: 50px;
  padding: 11px 8px;
  border-radius: 12px;
  /* Cicla as mesmas seis cores das faces, para o resultado de varios dados
     parecer um punhado do mesmo conjunto. */
  background-color: var(--fc, var(--face-1));
  background-image: linear-gradient(155deg, rgba(255, 255, 255, .3), rgba(0, 0, 0, .2));
  border: 1px solid rgba(0, 0, 0, .26);
  color: var(--die-ink);
  font-weight: 800;
  font-size: 1.15rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45);
}
.roll-tray .rd:nth-child(6n + 1) { --fc: var(--face-1); }
.roll-tray .rd:nth-child(6n + 2) { --fc: var(--face-2); }
.roll-tray .rd:nth-child(6n + 3) { --fc: var(--face-3); }
.roll-tray .rd:nth-child(6n + 4) { --fc: var(--face-4); }
.roll-tray .rd:nth-child(6n + 5) { --fc: var(--face-5); }
.roll-tray .rd:nth-child(6n + 6) { --fc: var(--face-6); }
.roll-tray .rd.max { outline: 2px solid var(--text); outline-offset: 2px; }
.roll-tray .rd.min { opacity: .55; }

.roll-sum { display: flex; align-items: baseline; justify-content: center; gap: 10px; flex-wrap: wrap; }
.roll-sum .eq { font-size: .78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .1em; }

/* Faces escritas pelo usuario no dado de decisao */
.face-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.face-fields .form-field { margin-bottom: 0; }
.face-fields input {
  width: 100%;
  background: rgba(7, 8, 11, .58);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: .9rem;
}
.face-fields input:focus { outline: 2px solid var(--accent-line); outline-offset: -1px; }

/* Placar sim/nao */
.verdict { font-size: clamp(2.1rem, 8vw, 3.6rem); font-weight: 800; text-align: center; letter-spacing: -0.03em; }
.verdict.sim { color: var(--accent-2); }
.verdict.nao { color: var(--danger); }

