/* Design system mínimo: app claro e legível no celular, palco escuro e
   reverente. Sem CDN — o modo offline depende de tudo ser local. */

:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e6e9ee;
  --bg: #f6f7f9;
  --accent: #1e3a5f;
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --live: #047857;
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* pilhas para o palco: só fontes que costumam existir no PC da igreja
     (Windows/Linux/Android); nada de CDN */
  --serif-elegant: Didot, "Bodoni 72", "Bodoni MT", "Palatino Linotype", Palatino, Georgia, serif;
  --serif-news: Georgia, Cambria, "Noto Serif", "Times New Roman", serif;
  --sans-condensed: "Bahnschrift SemiCondensed", "Bahnschrift", "Roboto Condensed", "Arial Narrow", "Liberation Sans Narrow", sans-serif;
  --sans-geometric: "Century Gothic", "Avenir Next", Futura, "Trebuchet MS", "Noto Sans", sans-serif;
  --sans-heavy: Inter, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2 { margin: 0 0 .4rem; line-height: 1.15; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
a { color: var(--accent); }

.narrow { max-width: 26rem; margin: 0 auto; padding: 2rem 1rem; }
main { padding: 1rem; max-width: 60rem; margin: 0 auto; }
.muted { color: var(--muted); font-size: .9rem; margin: .25rem 0; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--muted); margin: 0 0 .3rem; }
.error { color: var(--danger); background: #fef2f2; border: 1px solid #fecaca; padding: .6rem .8rem; border-radius: var(--radius); }
.live { color: var(--live); font-weight: 600; }

/* ---------- formulários ---------- */
form { display: grid; gap: .85rem; }
form.inline { display: inline; }
label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }
input, textarea, button, select {
  font: inherit;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
input:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: .7rem 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  width: auto;
}
button.ghost, .ghost {
  background: transparent; color: var(--ink); border-color: var(--line);
  font-weight: 500;
}
button.ghost:hover { background: #eef0f3; }
button.wide, .wide { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- topo ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .9rem 1rem; max-width: 64rem; margin: 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar nav { display: flex; align-items: center; gap: .5rem; }
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  color: var(--ink); text-decoration: none;
  font-weight: 600; letter-spacing: -.01em;
}
.brand-mark {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- página ---------- */
.page { max-width: 64rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.page-head h1 { font-size: 1.75rem; letter-spacing: -.02em; margin: 0 0 .2rem; }
.page-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.sep { color: var(--line); margin: 0 .1rem; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--live); margin-right: .35rem; vertical-align: 1px;
}

/* ---------- grade do acervo ---------- */
.grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .9rem;
  grid-template-columns: 1fr;
}
@media (min-width: 40rem) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .grid { grid-template-columns: repeat(3, 1fr); } }

.sermon {
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.sermon:hover { border-color: #cdd4dd; }
.sermon.is-live { border-left: 3px solid var(--live); }

.sermon-body {
  display: block; padding: 1rem 1rem .75rem;
  text-decoration: none; color: inherit;
}
.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .55rem; }
.chip {
  font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); background: #f1f3f6;
  border-radius: 999px; padding: .2rem .5rem;
}
.chip-live { color: var(--live); background: #ecfdf5; }

.sermon-title {
  font-family: var(--serif);
  font-size: 1.25rem; line-height: 1.25; margin: 0 0 .45rem;
  letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sermon-meta {
  margin: 0; font-size: .82rem; color: var(--muted);
  display: flex; flex-wrap: wrap; align-items: center; gap: .15rem;
}

.sermon-actions {
  display: flex; gap: .4rem; flex-wrap: wrap;
  padding: .75rem 1rem 1rem; border-top: 1px solid var(--line);
}
.button.small, .ghost.small { padding: .45rem .7rem; font-size: .82rem; }

/* ---------- estado vazio ---------- */
.empty {
  text-align: center; padding: 3.5rem 1.5rem;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-mark {
  width: 44px; height: 44px; margin: 0 auto .9rem;
  fill: none; stroke: #c2c9d4; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.empty h2 { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 .35rem; }
.empty p { color: var(--muted); margin: 0 auto 1.2rem; max-width: 32ch; font-size: .92rem; }
.empty .button { display: inline-flex; }

/* ---------- controle ---------- */
.control { display: grid; gap: 1rem; }
@media (min-width: 46rem) { .control { grid-template-columns: 1fr 1fr; align-items: start; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: grid; gap: .8rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.pill { font-size: .75rem; padding: .15rem .6rem; border-radius: 999px; background: #eef0f3; color: var(--muted); }
.pill.on { background: #ecfdf5; color: var(--live); }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.counter { align-self: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.slide-now { font-family: var(--serif); font-size: 1.05rem; min-height: 1.6em; margin: 0; }
.notes { font-size: .85rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: .6rem; margin: 0; }

.code-box { border: 2px dashed var(--accent); border-radius: var(--radius); padding: 1rem; text-align: center; }
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 2.4rem; letter-spacing: .18em; font-weight: 700;
  margin: .2rem 0 .6rem; color: var(--accent);
  user-select: all;
}
.sessions summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.sessions ul { list-style: none; padding: 0; display: grid; gap: .4rem; font-size: .85rem; }
.sessions li { display: flex; align-items: center; gap: .6rem; justify-content: space-between; border-top: 1px solid var(--line); padding-top: .4rem; }

/* ---------- estúdio ---------- */
.studio { display: grid; gap: 1rem; }
/* o estúdio usa a largura toda da tela: o slide é o protagonista */
main.studio { max-width: 112rem; }
/* tela larga: chat à esquerda (como uma conversa), edição grande à direita */
@media (min-width: 62rem) {
  .studio { grid-template-columns: minmax(300px, 27%) 1fr; align-items: start; }
  .studio .chat-col {
    position: sticky; top: .8rem; height: calc(100vh - 6.5rem);
    display: flex; flex-direction: column;
  }
  .studio .chat-col .chat { flex: 1; max-height: none; }
}

.chat { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem;
        align-content: start; max-height: 22rem; overflow-y: auto; }
.chat li { padding: .6rem .8rem; border-radius: var(--radius); max-width: 92%; font-size: .92rem; }
.chat li p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat li.user { background: #eef2f7; justify-self: end; }
.chat li.assistant { background: #f7f5ef; border: 1px solid var(--line); justify-self: start; }
.chat li.progresso { font-style: italic; color: var(--muted); }
.chat li.progresso p::before {
  content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .5em;
  border-radius: 50%; background: var(--accent); animation: pulsa 1s ease-in-out infinite;
}
@keyframes pulsa { 50% { opacity: .25; transform: scale(.7); } }
.chat-form { grid-template-columns: 1fr auto; align-items: end; }
.chat-form textarea { resize: vertical; }
.chat-form button { height: 100%; }

.preview {
  position: relative; width: 100%; overflow: hidden; border-radius: 6px;
  background: #000; aspect-ratio: 16 / 9;
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
}
.preview .stage-canvas { position: absolute; left: 50%; top: 50%; }

/* edição direto no slide */
.stage-canvas[data-editable="1"] [data-campo] {
  outline: none; cursor: text; border-radius: 6px;
  transition: box-shadow .12s, background .12s;
}
.stage-canvas[data-editable="1"] [data-campo]:hover {
  box-shadow: 0 0 0 2px rgba(147, 197, 253, .55);
}
.stage-canvas[data-editable="1"] [data-campo]:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .95);
  background: rgba(15, 23, 42, .18);
}
.stage-canvas[data-editable="1"] [data-vazio="1"]::before {
  content: attr(data-placeholder);
  opacity: .45; font-style: italic;
}
.stage-canvas[data-editable="1"] .points-list li {
  min-height: 1.2em;
}
.editor-nav { align-items: center; }
.editor-nav .spacer { flex: 1; }
.editor-tools { gap: .35rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.ghost.danger { color: var(--danger); border-color: #f3d6d6; }
.pill.ok { background: #ecfdf5; color: var(--live); }

/* ---------- palco: entrada do código ---------- */
body.stage-enter { background: #0b0f16; color: #e5e7eb; }
body.stage-enter .muted { color: #9ca3af; }
body.stage-enter input { background: #111827; border-color: #374151; color: #f9fafb; }
body.stage-enter .error { background: #3b0d0d; border-color: #7f1d1d; color: #fecaca; }
body.stage-enter .narrow { display: grid; align-content: center; min-height: 100vh; }
.code-input {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 2rem; letter-spacing: .3em; text-align: center; text-transform: uppercase;
}

/* ---------- palco: superfície de projeção ----------
   Uma única classe para telão, simulador e prévia. O JS monta o interior. */
.stage-canvas {
  position: absolute; left: 50%; top: 50%;
  transform-origin: center center;
  overflow: hidden; background: #000;
  border-radius: inherit;
}
body.stage { background: #000; overflow: hidden; height: 100vh; width: 100vw; cursor: none; }
body.stage .stage-canvas { position: fixed; }

.stage-layer, .stage-bg, .stage-scrim, .stage-safe,
.stage-curtain, .stage-waiting, .stage-ended { position: absolute; inset: 0; }

/* ---------- temas ----------
   Tema é do sermão. A cor do texto vem dele (garante contraste);
   o fundo pode vir do slide. */
.stage-canvas[data-theme] {
  --font-display: var(--serif);
  --font-body: var(--sans);
  --veu-rgb: 0, 0, 0;                 /* temas claros usam véu branco */
}
.stage-canvas[data-theme="sanctuary_dark"] {
  --stage-fallback-bg: radial-gradient(circle at 30% 20%, #1e3a5f 0%, #090d16 75%);
  --stage-bg-solid: #0b1220;
  --stage-bg-rgb: 11, 18, 32;
  --stage-ink: #f8fafc;
  --stage-ink-soft: #cbd5e1;
  --stage-kicker: #c7d2fe;
  --stage-accent: #93c5fd;
  --stage-shadow: 0 4px 24px rgba(0,0,0,.55);
}
.stage-canvas[data-theme="gold_night"] {
  --stage-fallback-bg: radial-gradient(circle at 50% 30%, #231c0e 0%, #070605 72%);
  --stage-bg-solid: #0a0806;
  --stage-bg-rgb: 10, 8, 6;
  --stage-ink: #fbf6ea;
  --stage-ink-soft: #dccfb4;
  --stage-kicker: #d4af37;
  --stage-accent: #e3bb4f;
  --stage-shadow: 0 4px 24px rgba(0,0,0,.6);
  --font-display: var(--serif-elegant);
}
.stage-canvas[data-theme="ember"] {
  --stage-fallback-bg: radial-gradient(circle at 35% 25%, #3d2516 0%, #120a06 75%);
  --stage-bg-solid: #170d07;
  --stage-bg-rgb: 23, 13, 7;
  --stage-ink: #fff4e6;
  --stage-ink-soft: #ead2b6;
  --stage-kicker: #f2a65a;
  --stage-accent: #ec8f3e;
  --stage-shadow: 0 4px 24px rgba(0,0,0,.6);
}
.stage-canvas[data-theme="olive"] {
  --stage-fallback-bg: radial-gradient(circle at 30% 25%, #34402a 0%, #10140c 75%);
  --stage-bg-solid: #13180f;
  --stage-bg-rgb: 19, 24, 15;
  --stage-ink: #f7f4e8;
  --stage-ink-soft: #d8dcc4;
  --stage-kicker: #cbd8a4;
  --stage-accent: #aec982;
  --stage-shadow: 0 4px 24px rgba(0,0,0,.55);
}
.stage-canvas[data-theme="modern"] {
  --stage-fallback-bg: linear-gradient(160deg, #111827 0%, #070a0f 70%);
  --stage-bg-solid: #0a0e14;
  --stage-bg-rgb: 10, 14, 20;
  --stage-ink: #ffffff;
  --stage-ink-soft: #cbd5e1;
  --stage-kicker: #2dd4bf;
  --stage-accent: #2dd4bf;
  --stage-shadow: 0 4px 24px rgba(0,0,0,.5);
  --font-display: var(--sans-condensed);
}
.stage-canvas[data-theme="monochrome"] {
  --stage-fallback-bg: radial-gradient(circle at 50% 40%, #1a1a1a 0%, #050505 100%);
  --stage-bg-solid: #0a0a0a;
  --stage-bg-rgb: 10, 10, 10;
  --stage-ink: #ffffff;
  --stage-ink-soft: #d4d4d4;
  --stage-kicker: #9ca3af;
  --stage-accent: #9ca3af;
  --stage-shadow: none;
}
.stage-canvas[data-theme="parchment_light"] {
  --stage-fallback-bg: radial-gradient(circle at 30% 20%, #fbf5e9 0%, #eadfc9 100%);
  --stage-bg-solid: #f3ead8;
  --stage-bg-rgb: 243, 234, 216;
  --stage-ink: #2a2318;
  --stage-ink-soft: #4b4030;
  --stage-kicker: #8a6d3b;
  --stage-accent: #8a6d3b;
  --stage-shadow: none;
  --veu-rgb: 251, 245, 233;
}
.stage-canvas[data-theme="editorial"] {
  --stage-fallback-bg: linear-gradient(180deg, #f8f6f1 0%, #ece8df 100%);
  --stage-bg-solid: #f7f5f0;
  --stage-bg-rgb: 247, 245, 240;
  --stage-ink: #111111;
  --stage-ink-soft: #3f3f46;
  --stage-kicker: #b91c1c;
  --stage-accent: #b91c1c;
  --stage-shadow: none;
  --font-display: var(--serif-news);
  --veu-rgb: 248, 246, 241;
}
.stage-canvas[data-theme="cream_navy"] {
  /* inspirado no que o pregador aprovou no Canva: creme, marinho, dourado,
     título sem serifa bem pesado */
  --stage-fallback-bg: linear-gradient(160deg, #f7efe3 0%, #efe3d0 100%);
  --stage-bg-solid: #f6ede0;
  --stage-bg-rgb: 246, 237, 224;
  --stage-ink: #1b2f4b;
  --stage-ink-soft: #33465f;
  --stage-kicker: #b0843a;
  --stage-accent: #c4964a;
  --stage-shadow: none;
  --font-display: var(--sans-heavy);
  --font-body: var(--sans-heavy);
  --peso-forte: 800;
  --veu-rgb: 246, 237, 224;
}
.stage-canvas[data-theme="dawn"] {
  --stage-fallback-bg: linear-gradient(160deg, #e0f2fe 0%, #fdf2f8 100%);
  --stage-bg-solid: #eef6fc;
  --stage-bg-rgb: 238, 246, 252;
  --stage-ink: #0f2a44;
  --stage-ink-soft: #33506e;
  --stage-kicker: #d9573c;
  --stage-accent: #e46a4e;
  --stage-shadow: none;
  --font-display: var(--sans-geometric);
  --font-body: var(--sans-geometric);
  --veu-rgb: 240, 247, 253;
}

.stage-bg {
  background-color: #090d16;
  background-image: var(--stage-fallback-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.stage-scrim {
  /* `--veu` é medido pela engine a partir do brilho da imagem: foto clara
     recebe véu forte, foto escura quase nada. O vinhete vem por cima. */
  background:
    radial-gradient(ellipse at center, rgba(var(--veu-rgb),.12) 0%, rgba(var(--veu-rgb),.45) 100%),
    linear-gradient(rgba(var(--veu-rgb),var(--veu, .35)), rgba(var(--veu-rgb),var(--veu, .35)));
  opacity: 0; transition: opacity .4s;
}
.stage-bg.has-image + .stage-scrim { opacity: 1; }

.stage-safe {
  /* projetor não corta borda (TV antiga cortava ~8%): só um respiro de 3%,
     para o texto usar o slide inteiro. Espelho de app/design.py:GRID_INICIO */
  inset: 3%;
  display: flex; align-items: center; justify-content: center;
  padding: 0; transition: opacity .25s;
}
.stage-safe.hidden-text { opacity: 0; }

.stage-content {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  visibility: hidden;
}
.layout-cover, .layout-verse, .layout-points, .layout-quote {
  display: flex; flex-direction: column; gap: 1.6rem; text-align: center;
  align-items: center; justify-content: center; height: 100%;
}
.layout-points { align-items: flex-start; text-align: left; }

.stage-content .kicker {
  font-family: var(--font-body, var(--sans)); color: var(--stage-kicker, #c7d2fe);
  text-transform: uppercase; letter-spacing: .28em;
  font-size: 26px; margin: 0; font-weight: 600;
}
.stage-content .main-title {
  font-family: var(--font-display, var(--serif)); color: var(--stage-ink, #f8fafc); font-weight: 700;
  margin: 0; line-height: 1.1; max-width: 100%; text-wrap: balance;
  overflow-wrap: anywhere; text-shadow: var(--stage-shadow, none);
}
.stage-content .subtitle {
  font-family: var(--font-body, var(--sans)); color: var(--stage-ink-soft, #e2e8f0);
  margin: 0; max-width: 80%; text-wrap: pretty;
}
.stage-content .scripture {
  font-family: var(--font-display, var(--serif)); font-style: italic;
  color: var(--stage-ink-soft, #cbd5e1); margin: 0; letter-spacing: .02em;
}
.stage-content .points-list {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; width: 100%;
}
.stage-content .points-list li {
  font-family: var(--font-body, var(--sans)); color: var(--stage-ink, #f1f5f9);
  padding-left: 1.4em; position: relative;
  text-shadow: var(--stage-shadow, none); max-width: 100%;
}
.stage-content .points-list li::before {
  content: ""; position: absolute; left: .2em; top: .55em;
  width: .35em; height: .35em; border-radius: 50%;
  background: var(--stage-accent, #93c5fd);
}

/* ---------- grid: elementos posicionados ----------
   Caixas absolutas em % (área segura, ou canvas inteiro para `bleed`). */
.layout-grid { position: relative; width: 100%; height: 100%; }
.stage-content[data-layout="grid"] { display: block; }
.stage-bleed { position: absolute; inset: 0; pointer-events: none; }
.el { position: absolute; display: flex; flex-direction: column; overflow: hidden; }
.el[data-valign="top"] { justify-content: flex-start; }
.el[data-valign="middle"] { justify-content: center; }
.el[data-valign="bottom"] { justify-content: flex-end; }
.el[data-align="left"] { text-align: left; align-items: flex-start; }
.el[data-align="center"] { text-align: center; align-items: center; }
.el[data-align="right"] { text-align: right; align-items: flex-end; }

.el-inner {
  /* palavra NÃO quebra no meio: se não cabe, o telão diminui a letra; só
     quebra se nem a letra mínima couber (.apertado) */
  margin: 0; max-width: 100%; line-height: 1.15;
  overflow-wrap: normal; text-wrap: balance;
  text-shadow: var(--stage-shadow, none);
}
.el[data-font="display"] .el-inner { font-family: var(--font-display, var(--serif)); }
.el[data-font="body"] .el-inner { font-family: var(--font-body, var(--sans)); }
.el[data-weight="bold"] .el-inner { font-weight: var(--peso-forte, 700); }
.el-title[data-weight="bold"] .el-inner { letter-spacing: -.015em; }
.el[data-weight="regular"] .el-inner { font-weight: 400; }
.el[data-italic="1"] .el-inner { font-style: italic; }
.el[data-upper="1"] .el-inner { text-transform: uppercase; letter-spacing: .22em; }
.el-title .el-inner { line-height: 1.02; letter-spacing: -.01em; }
.el-text .el-inner, .el-subtitle .el-inner { text-wrap: pretty; line-height: 1.3; }
/* texto corrido e itens de lista usam a largura toda (balance quebrava as
   linhas no meio da caixa — tela 2 da versão 3 do "Família") */
.el-list .el-inner, .el-list li, .el-scripture .el-inner, .el-quote .el-inner { text-wrap: pretty; }
blockquote.el-inner { quotes: "“" "”"; }
blockquote.el-inner::before { content: open-quote; }
blockquote.el-inner::after { content: close-quote; }

.el[data-color="ink"] { color: var(--stage-ink, #f8fafc); }
.el[data-color="soft"] { color: var(--stage-ink-soft, #cbd5e1); }
.el[data-color="accent"] { color: var(--stage-accent, #93c5fd); }
.el[data-color="kicker"] { color: var(--stage-kicker, #c7d2fe); }
.el[data-color="bg"] { color: var(--stage-bg-solid, #0b1220); }

ul.el-inner { list-style: none; padding: 0; display: grid; gap: .45em; width: 100%; }
ul.el-inner li { position: relative; padding-left: 1.2em; line-height: 1.25; }
ul.el-inner li::before {
  content: ""; position: absolute; left: .15em; top: .5em;
  width: .36em; height: .36em; border-radius: 50%;
  background: var(--stage-accent, #93c5fd);
}

/* lista com numerais grandes (estilo cartaz) */
ul.el-inner[data-marker="number"] li { padding-left: 0; display: flex; gap: .55em; align-items: baseline; }
ul.el-inner[data-marker="number"] li::before { content: none; }
ul.el-inner[data-marker="number"] .num {
  font-family: var(--font-display, var(--serif)); font-weight: 800;
  font-size: 1.9em; line-height: .9; color: var(--stage-accent, #c4964a);
  min-width: 1.1em; flex: none;
}
ul.el-inner[data-marker="none"] li { padding-left: 0; }
ul.el-inner[data-marker="none"] li::before { content: none; }

/* pílulas: palavras-chave com fundo da cor de destaque */
.el-inner.tags { display: flex; flex-wrap: wrap; gap: .35em .45em; }
.el[data-align="center"] .el-inner.tags { justify-content: center; }
.el[data-align="right"] .el-inner.tags { justify-content: flex-end; }
.el-inner.tags .tag {
  display: inline-block; padding: .22em .75em; border-radius: 999px;
  background: currentColor; line-height: 1.15;
}
/* o texto da pílula usa a cor do fundo do tema (contraste com o destaque) */
.el-inner.tags .tag { color: var(--stage-bg-solid, #0b1220); }
.el[data-color] .el-inner.tags .tag { background: var(--cor-pilula, var(--stage-accent, #c4964a)); }
.el[data-color="ink"] .el-inner.tags { --cor-pilula: var(--stage-ink); }
.el[data-color="kicker"] .el-inner.tags { --cor-pilula: var(--stage-kicker); }
.el[data-color="soft"] .el-inner.tags { --cor-pilula: var(--stage-ink-soft); }

/* cartão: bloco com fundo suave; color "accent" pinta o cartão */
.el-inner.card {
  width: 100%; padding: .7em .9em; border-radius: .45em;
  background: rgba(var(--stage-bg-rgb, 11, 18, 32), .82);
  box-shadow: 0 .25em 1.2em rgba(0, 0, 0, .14);
  text-shadow: none; text-align: left;
}
.el-inner.card p { margin: 0; }
/* o cartão ocupa a caixa inteira: lado a lado, os fundos ficam da mesma
   altura mesmo com textos de tamanhos diferentes */
.el-card .el-inner.card { height: 100%; display: flex; flex-direction: column;
  justify-content: flex-start; }
/* cartões lado a lado não encostam: respiro entre as caixas */
.el-card { padding-inline: 12px; }
.el-inner.card .card-titulo {
  font-weight: var(--peso-forte, 700); font-size: .72em; letter-spacing: .12em;
  text-transform: uppercase; color: var(--stage-kicker); margin-bottom: .45em;
}
.el-inner.card .card-texto + .card-texto { margin-top: .4em; }
.el[data-color="accent"] .el-inner.card { background: var(--stage-ink); color: var(--stage-bg-solid); }
.el[data-color="accent"] .el-inner.card .card-titulo { color: var(--stage-accent); }

/* formas: a cor vem do token, como o texto */
.el-shape { opacity: var(--op, .6); }
.el-shape[data-shape="rect"] { background: currentColor; }
.el-shape[data-shape="line"] { justify-content: center; }
.el-shape[data-shape="line"]::after {
  content: ""; display: block; width: 100%; height: 6px; background: currentColor;
}

/* entrada por elemento (o atraso vem inline, do JSON) */
.enter .el[data-anim="fade-up"] { animation: fadeUp .6s ease both; }
.enter .el[data-anim="zoom-in"] { animation: zoomIn .7s cubic-bezier(.2,.7,.3,1) both; }
.enter .el[data-anim="slide-right"] { animation: slideRight .6s ease both; }
.enter .el[data-anim="fade"] { animation: layerFade .6s ease both; }
/* forma só esmaece: as outras animações levariam a opacidade a 1 */
.enter .el-shape:not([data-anim="none"]) { animation: fadeOpacity .6s ease both; }
@keyframes fadeOpacity { from { opacity: 0; } to { opacity: var(--op, .6); } }

/* passos: o que ainda não chegou fica invisível (sem mexer no layout);
   ao chegar, anima de novo com a animação do próprio elemento */
.oculto { visibility: hidden; }
.el.revela[data-anim="fade-up"], li.revela { animation: fadeUp .55s ease both; }
.el.revela[data-anim="zoom-in"] { animation: zoomIn .6s cubic-bezier(.2,.7,.3,1) both; }
.el.revela[data-anim="slide-right"] { animation: slideRight .55s ease both; }
.el.revela[data-anim="fade"] { animation: layerFade .55s ease both; }
.el-shape.revela:not([data-anim="none"]) { animation: fadeOpacity .55s ease both; }

/* contraste medido: texto sobre trecho da foto que não dá leitura ganha um
   fundo próprio (cor do fundo do tema), só do tamanho do texto */
.el.com-fundo .el-inner, .el.halo-fixo .el-inner {
  /* halo suave na cor do fundo do tema: dá leitura sem caixa por cima da
     foto (o retângulo antigo ficava pesado, nada parecido com o Canva) */
  text-shadow:
    0 0 .18em rgba(var(--stage-bg-rgb, 11, 18, 32), .95),
    0 0 .45em rgba(var(--stage-bg-rgb, 11, 18, 32), .9),
    0 0 1em rgba(var(--stage-bg-rgb, 11, 18, 32), .75);
}

/* edição no estúdio: mesmo realce dos layouts antigos */
.stage-canvas[data-editable="1"] .el-inner[data-campo],
.stage-canvas[data-editable="1"] li[data-campo] { outline: 2px dashed transparent; }
.stage-canvas[data-editable="1"] .el-inner[data-campo]:hover,
.stage-canvas[data-editable="1"] li[data-campo]:hover { outline-color: rgba(147,197,253,.6); }

/* transições entre telas */
.stage-layer.trans-fade { animation: layerFade .45s ease both; }
.stage-layer.trans-slide { animation: layerSlide .5s cubic-bezier(.2,.7,.3,1) both; }
@keyframes layerFade { from { opacity: .25; } to { opacity: 1; } }
@keyframes layerSlide { from { opacity: .35; transform: translateX(6%); } to { opacity: 1; transform: none; } }

/* animações de entrada do texto */
.stage-content.enter[data-animation="fade-up"] { animation: fadeUp .6s ease both; }
.stage-content.enter[data-animation="zoom-in"] { animation: zoomIn .7s cubic-bezier(.2,.7,.3,1) both; }
.stage-content.enter[data-animation="slide-right"] { animation: slideRight .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(36px); } to { opacity: 1; transform: none; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes slideRight { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }

.stage-curtain { background: #000; opacity: 0; pointer-events: none; transition: opacity .18s; }
.stage-curtain.active { opacity: 1; }

.stage-waiting, .stage-ended {
  display: grid; place-content: center; text-align: center; gap: .5rem;
  background: #080b11; color: #94a3b8; font-family: var(--sans);
}
.stage-waiting p, .stage-ended p {
  font-family: var(--serif); font-size: 52px; color: #e2e8f0; margin: 0;
}
.stage-waiting span, .stage-ended span { font-size: 22px; letter-spacing: .04em; }
.stage-waiting[hidden] { display: none; }

/* pré-carregamento: selo pequeno no canto, fora da área de leitura */
.stage-preload {
  position: absolute; right: 24px; bottom: 18px; z-index: 5;
  font: 600 18px/1 system-ui, sans-serif; letter-spacing: .03em;
  color: rgba(255, 255, 255, .78); background: rgba(0, 0, 0, .55);
  padding: 8px 14px; border-radius: 999px; pointer-events: none;
}
.stage-preload[hidden] { display: none; }
/* sucesso some sozinho; falha continua visível */
.stage-preload.done { animation: preload-some 1s ease 4s forwards; }
@keyframes preload-some { to { opacity: 0; visibility: hidden; } }
.stage-ended { opacity: 0; pointer-events: none; transition: opacity .3s; }
.stage-ended.active { opacity: 1; }

#leave { position: fixed; right: 1rem; bottom: 1rem; opacity: 0; }
#leave:hover, body.stage:hover #leave { opacity: .35; }

/* ---------- controle do pregador ---------- */
body.control-page { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

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

.remote-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
  padding: .55rem .9rem calc(.5rem + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.remote-back, .icon-btn {
  display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: none; color: var(--ink);
  text-decoration: none;
}
.remote-back svg, .icon-btn svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

.remote-title { min-width: 0; flex: 1; }
.remote-title h1 {
  font-family: var(--serif); font-size: 1rem; margin: 0; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.remote-title .kicker { margin: 0; font-size: .58rem; color: var(--muted); }

.head-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; width: 100%; order: 5;
}

.clock-block {
  display: flex; align-items: baseline; gap: .4rem;
  background: none; border: none; padding: .15rem .3rem;
  border-radius: 8px; color: var(--ink); width: auto;
}
.clock-block:hover { background: var(--surface-2); }
.clock-now {
  font-size: 1.15rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.clock-left {
  font-size: .74rem; font-weight: 600; line-height: 1;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.clock-left.warn { color: #b45309; }
.clock-left.over { color: var(--danger); }

.status-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--surface-2); border: 1px solid transparent;
  border-radius: 999px; padding: .35rem .7rem; width: auto;
  color: var(--muted); font-size: .78rem; font-weight: 600;
  min-height: 36px;
}
.status-chip.on { background: #ecfdf5; color: var(--live); }
.status-chip.warn { background: #fffbeb; color: #92400e; }

.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #cbd0d8; transition: background .2s, box-shadow .2s;
}
.status-dot.on { background: var(--live); box-shadow: 0 0 0 3px rgba(4,120,87,.16); }

.remote { max-width: 60rem; margin: 0 auto; padding: .9rem; display: grid; gap: 1rem; }
.remote-side { display: grid; gap: .8rem; align-content: start; }
.remote-side[hidden] { display: none; }

/* ---------- prévia ---------- */
.previews { display: grid; gap: .8rem; }
.shot { margin: 0; }
.shot figcaption {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .5rem; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .35rem;
}
.shot figcaption .pos {
  font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--ink); font-variant-numeric: tabular-nums;
  max-width: 64%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-frame {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9;
  border-radius: 12px; background: #070a10;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(16, 24, 40, .22);
}
.progress {
  height: 4px; border-radius: 999px; background: var(--surface-3);
  margin-top: .45rem; overflow: hidden;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: inherit;
  transition: width .25s ease;
}

/* ---------- esteira de miniaturas ---------- */
.strip {
  display: flex; gap: .5rem; overflow-x: auto;
  padding: .2rem .15rem .5rem; scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.thumb {
  flex: none; width: 132px; min-width: 132px; padding: 0; background: none; border: none;
  display: grid; gap: .25rem; scroll-snap-align: center;
  color: var(--muted); font: inherit; touch-action: manipulation;
}
.thumb-frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 7px; background: #070a10; min-height: 56px;
  border: 1px solid var(--line);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.thumb-num {
  font-size: .64rem; font-weight: 700; text-align: center;
  font-variant-numeric: tabular-nums;
}
.thumb.current .thumb-frame { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(30,58,95,.2); }
.thumb.current .thumb-num { color: var(--ink); font-weight: 700; }
.thumb.selected .thumb-frame {
  border-color: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,.32); transform: translateY(-1px);
}
.thumb.selected .thumb-num { color: #b45309; font-weight: 700; }

.select-bar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px;
  padding: .5rem .6rem .5rem .8rem;
}
.select-bar[hidden] { display: none; }
.select-label {
  font-size: .82rem; color: #92400e; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.select-bar .button { width: auto; flex: none; }

.notes-box { display: grid; gap: .35rem; }
.notes-card { align-content: start; }
.notes-card .notes { font-size: .95rem; line-height: 1.6; }
.notes {
  margin: 0; font-size: .88rem; color: var(--ink);
  border-left: 3px solid var(--line); padding-left: .65rem;
  line-height: 1.5; white-space: pre-wrap;
}

/* ---------- cartões ---------- */
.card {
  display: grid; gap: .8rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem;
}
.card[hidden] { display: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-head h2 { font-size: .95rem; margin: 0; }
.tiny { font-size: .74rem; }

/* ---------- folhas ---------- */
.sheet {
  border: none; padding: 0; width: 100%; max-width: 100%; max-height: 85vh;
  margin: auto 0 0; background: var(--surface); color: var(--ink);
  border-radius: 16px 16px 0 0;
}
.sheet::backdrop { background: rgba(8, 11, 17, .5); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem .55rem; position: sticky; top: 0; background: var(--surface);
  border-bottom: 1px solid var(--line); z-index: 1;
}
.sheet-head h2 { margin: 0; font-size: .95rem; }

.options-body { display: grid; gap: 1.1rem; padding: 1rem 1rem calc(1.2rem + env(safe-area-inset-bottom)); }

.sheet-list {
  list-style: none; margin: 0; padding: .4rem;
  display: grid; gap: .3rem; overflow-y: auto; max-height: 62vh;
}
.sheet-list li {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: 0 .2rem;
}
.sheet-list li.current .sheet-item { background: var(--surface-2); }
.sheet-list li.current .sheet-num { background: var(--accent); color: #fff; }
.sheet-item {
  display: flex; align-items: center; gap: .7rem; flex: 1;
  padding: .55rem .6rem; border-radius: 10px; text-align: left; min-height: 48px;
  background: transparent; border: none; color: inherit; width: 100%;
}
.sheet-item:hover { background: var(--surface-2); }
.sheet-num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
  background: var(--surface-3); color: var(--muted);
}
.sheet-txt { display: grid; gap: .1rem; min-width: 0; }
.sheet-txt strong {
  font-family: var(--serif); font-weight: 600; font-size: .92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-txt small { color: var(--muted); font-size: .7rem; }
.sheet-foot { padding: .6rem 1rem calc(.9rem + env(safe-area-inset-bottom)); }
.sheet-foot .ghost { width: 100%; min-height: 44px; }

/* ---------- opções ---------- */
.group { display: grid; gap: .45rem; }
.group-label {
  margin: 0; font-size: .64rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg-btn {
  display: inline-flex; align-items: center; gap: .4rem; width: auto;
  padding: .5rem .8rem; min-height: 46px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: .84rem; font-weight: 500;
}
.seg-btn:hover { background: var(--surface-2); }
.seg-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.seg-small .seg-btn { min-height: 42px; padding: .42rem .7rem; font-size: .8rem; }
.seg-btn.tema.on { background: var(--surface-2); border-color: var(--accent); color: var(--ink); }
.sw {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  border: 1px solid rgba(0,0,0,.18);
}
.sw-sanctuary_dark { background: linear-gradient(135deg, #1e3a5f, #090d16); }
.sw-gold_night { background: linear-gradient(135deg, #d4af37 0 35%, #070605 35%); }
.sw-ember { background: linear-gradient(135deg, #ec8f3e 0 35%, #2a170c 35%); }
.sw-olive { background: linear-gradient(135deg, #aec982 0 35%, #1d2416 35%); }
.sw-modern { background: linear-gradient(135deg, #2dd4bf 0 35%, #0b0f14 35%); }
.sw-monochrome { background: linear-gradient(135deg, #ffffff, #111111); }
.sw-parchment_light { background: linear-gradient(135deg, #fbf5e9, #eadfc9); }
.sw-editorial { background: linear-gradient(135deg, #b91c1c 0 35%, #f7f5f0 35%); }
.sw-dawn { background: linear-gradient(135deg, #e46a4e 0 35%, #e0f2fe 35%); }
.sw-cream_navy { background: linear-gradient(135deg, #1b2f4b 0 35%, #c4964a 35% 55%, #f6ede0 55%); }
.temas-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
.temas-grid .seg-btn { justify-content: flex-start; }

/* ---------- barra fixa ---------- */
.remote-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr 1.3fr 1fr 1fr 1fr; gap: .35rem;
  padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  touch-action: manipulation;
}
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  height: 52px; width: 100%; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid transparent;
  color: var(--ink); font-weight: 600; font-size: .8rem;
  touch-action: manipulation;
}
.bar-btn svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.bar-btn:disabled { opacity: .35; }
.bar-btn.on { background: var(--accent); color: #fff; }
.bar-list { background: var(--surface); border-color: var(--line); }
.bar-dark.on { background: #111827; }
.bar-dark svg { fill: currentColor; stroke: none; }

@supports not (aspect-ratio: 16 / 9) {
  .preview-frame { height: 0; padding-bottom: 56.25%; }
  .thumb-frame { height: 0; padding-bottom: 56.25%; }
}

/* ---------- offline ---------- */
body.is-offline .preview-frame { opacity: .5; }
body.is-offline .thumb-frame { opacity: .7; }

/* ---------- tablet e desktop ---------- */
@media (min-width: 40rem) {
  .thumb { width: 152px; }
}

@media (min-width: 52rem) {
  body.control-page { padding-bottom: 1.5rem; }
  .remote-head { flex-wrap: nowrap; padding: .6rem 1.2rem; }
  .head-bar { width: auto; order: 0; margin-left: auto; gap: .7rem; }
  .remote { grid-template-columns: 1.4fr 1fr; align-items: start; padding: 1.2rem; }
  .previews { position: sticky; top: 5rem; }
  .remote-side { position: sticky; top: 5rem; }
  .notes-card .notes { max-height: 52vh; overflow-y: auto; }
  .remote-bar {
    position: sticky; bottom: 1rem; margin: 0 auto; max-width: 34rem;
    grid-template-columns: 1fr 1.5fr 1fr 1fr 1fr;
    border: 1px solid var(--line); border-radius: 999px;
    padding: .4rem; box-shadow: 0 12px 30px rgba(16,24,40,.18);
  }
  .sheet { border-radius: 16px; margin: auto; max-width: 30rem; }
  .sheet-list { max-height: 60vh; }
}

@media (min-width: 64rem) {
  .remote { grid-template-columns: 1.5fr 1fr; gap: 1.4rem; }
}

/* ---------- modo noturno do controle ---------- */
body.dark {
  --ink: #e8edf5;
  --muted: #93a0b4;
  --line: #26303d;
  --surface: #131a24;
  --surface-2: #1b2431;
  --surface-3: #26303d;
  --bg: #0b1017;
  --accent: #37648f;
}
body.dark .status-chip.on { background: #0f2a22; color: #4ade80; }
body.dark .status-chip.warn { background: #3a2a08; color: #fcd34d; }
body.dark .select-bar { background: #3a2a08; border-color: #5b4410; }
body.dark .select-label { color: #fcd34d; }
body.dark .bar-list { background: var(--surface-2); border-color: var(--line); }
body.dark .preview-frame, body.dark .thumb-frame { border-color: #1e2836; }
body.dark .preview-frame { box-shadow: 0 10px 24px rgba(0,0,0,.5); }
body.dark .clock-left.warn { color: #fbbf24; }
body.dark .sheet::backdrop { background: rgba(0,0,0,.62); }
body.dark .notes { border-left-color: #2f3c4c; }

/* ---------- busca e filtros do acervo ---------- */
.search {
  position: relative; display: flex; align-items: center;
  margin-bottom: .7rem;
}
.search svg {
  position: absolute; left: .8rem; width: 18px; height: 18px;
  fill: none; stroke: var(--muted); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
.search input {
  width: 100%; padding: .7rem .8rem .7rem 2.4rem;
  border-radius: 10px; background: var(--surface);
}
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: .55rem; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 50%;
  color: var(--muted); text-decoration: none; font-size: 1.1rem;
}
.search-clear:hover { background: var(--surface-2); }

.series {
  display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.series .chip {
  text-decoration: none; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  padding: .3rem .65rem; font-size: .74rem;
}
.series .chip.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.series .chip:hover { border-color: #c2c9d4; }

a.icon-only {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
}
a.icon-only svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- zona de perigo ---------- */
.danger-zone {
  margin-top: 2rem; padding: 1rem;
  border: 1px solid #f3d6d6; border-radius: var(--radius);
  background: #fffafa;
}
.danger-zone h2 { font-size: .95rem; margin: 0 0 .3rem; color: var(--danger); }
.danger-zone p { margin: 0 0 .8rem; }
.danger-zone form { display: block; }

body.dark .search input { background: var(--surface-2); border-color: var(--line); }
body.dark .series .chip { background: var(--surface-2); border-color: var(--line); }
body.dark .series .chip.on { background: var(--accent); border-color: var(--accent); }
body.dark .danger-zone { background: #1a1214; border-color: #4a2020; }

/* ---------- imagem de fundo (estúdio) ---------- */
.image-box {
  display: grid; gap: .5rem;
  border-top: 1px solid var(--line); padding-top: .8rem;
}
.image-box h3 { font-size: .82rem; margin: 0; color: var(--muted); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; }
.image-box textarea { font-size: .84rem; resize: vertical; min-height: 60px; }
.image-box .row { align-items: center; }

/* ---------- laboratório de imagem (estúdio) ---------- */
.image-lab {
  display: grid; gap: .7rem;
  border-top: 1px solid var(--line); padding-top: .9rem;
}
.image-lab h3 {
  font-size: .78rem; margin: 0; color: var(--muted); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.image-lab textarea { font-size: .84rem; resize: vertical; min-height: 58px; }

.field { display: grid; gap: .3rem; }
.field-label {
  font-size: .78rem; font-weight: 600; color: var(--ink);
  letter-spacing: .02em;
}
.field-label b { color: var(--accent); font-variant-numeric: tabular-nums; }
.field input[type="range"] { padding: 0; border: 0; background: none; height: 28px; }
.field select, .field input[type="number"] { padding: .5rem .6rem; font-size: .88rem; }
.field input[type="number"] { width: 100%; }

.hint {
  font-size: .74rem; line-height: 1.45; color: var(--muted);
  margin: 0; text-wrap: pretty;
}
.hint strong { color: var(--ink); font-weight: 600; }
.hint code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .9em; background: #eef0f3; border-radius: 4px; padding: 0 .2em;
}
.hint-inline { font-weight: 400; opacity: .75; }

.params { display: grid; gap: .8rem; }
@media (min-width: 34rem) {
  .params { grid-template-columns: 1fr 1fr; }
  .params .field:first-child { grid-column: 1 / -1; }
}

.presets { display: flex; gap: .35rem; flex-wrap: wrap; }
.presets .chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: .35rem .7rem; font-size: .74rem; cursor: pointer;
  min-height: 34px;
}
.presets .chip.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.presets .chip:hover { border-color: #c2c9d4; }

.fold {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .55rem .7rem; background: #fbfcfd;
}
.fold > summary {
  cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--ink);
  list-style: none; display: flex; align-items: center; gap: .4rem;
  min-height: 28px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before {
  content: "+"; font-family: ui-monospace, monospace; color: var(--muted);
  font-size: .9rem; width: 1em;
}
.fold[open] > summary::before { content: "−"; }
.fold > *:not(summary) { margin-top: .5rem; }

.help-list {
  margin: .2rem 0 .6rem; display: grid; gap: .45rem;
  font-size: .8rem; line-height: 1.5; color: var(--muted);
}
.help-list dt { font-weight: 700; color: var(--ink); font-size: .78rem; }
.help-list dd { margin: 0; text-wrap: pretty; }
.help-list code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .9em; background: #eef0f3; border-radius: 4px; padding: 0 .2em;
}

.row.tight { gap: .35rem; align-items: center; }
button.small { padding: .45rem .7rem; font-size: .82rem; min-height: 38px; }

.img-result {
  margin: 0; display: grid; gap: .5rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .5rem; background: var(--surface);
}
.img-result img {
  width: 100%; border-radius: calc(var(--radius) - 4px);
  display: block; background: #0b0f16;
}
.img-result figcaption { display: grid; gap: .45rem; }
.img-result figcaption .row { justify-content: stretch; }
.img-result figcaption .row button { flex: 1 1 auto; }

body.dark .fold { background: var(--surface-2); }
body.dark .hint code, body.dark .help-list code { background: #22262e; }
body.dark .presets .chip { background: var(--surface-2); }
body.dark .presets .chip.on { background: var(--accent); }

.notice {
  font-size: .78rem; line-height: 1.45; margin: 0;
  border: 1px solid #f5e0b8; background: #fffaf0; color: #7a5312;
  border-radius: var(--radius); padding: .55rem .7rem;
}
.image-lab.so-leitura .params,
.image-lab.so-leitura .presets { opacity: .55; }
body.dark .notice { background: #1e1a10; border-color: #4a3a18; color: #e5c07b; }

/* ---------- seletor de backend (laboratório) ---------- */
.segmented {
  display: grid; grid-auto-flow: column; gap: 2px;
  background: #eef0f3; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 3px;
}
.segmented button {
  background: transparent; border: 0; color: var(--muted);
  font-size: .82rem; font-weight: 600; padding: .5rem .6rem;
  border-radius: calc(var(--radius) - 4px); min-height: 40px;
}
.segmented button:hover { color: var(--ink); background: #ffffff99; }
.segmented button[aria-pressed="true"] {
  background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 2px rgba(17, 24, 39, .08);
}
.segmented button[hidden] { display: none; }

.cfg { display: grid; gap: .8rem; }
.cfg[hidden] { display: none; }

body.dark .segmented { background: var(--surface-2); border-color: var(--line); }
body.dark .segmented button[aria-pressed="true"] { background: #2a2f3a; color: #dbeafe; }

/* ---------- lista de modelos por preço ---------- */
.wide-main { max-width: 62rem; }
.price-head { display: grid; gap: .3rem; margin-bottom: 1rem; }
.price-tools {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  margin-bottom: .8rem;
}
.price-tools input[type="search"] { flex: 1 1 14rem; padding: .55rem .7rem; font-size: .9rem; }
.check {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .82rem; color: var(--muted); white-space: nowrap;
}
.check input { width: auto; }

.price-row {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem;
  align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: .6rem .8rem; margin-bottom: .4rem;
}
.price-row h2 {
  font-size: .92rem; margin: 0; font-weight: 600; color: var(--ink);
  font-family: inherit; letter-spacing: 0;
}
.price-meta { margin: .12rem 0 0; font-size: .72rem; color: var(--muted); line-height: 1.45; }
.price-values { text-align: right; display: grid; gap: .1rem; }
.price-usd { font-size: .9rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.price-brl { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.price-row.is-free { border-color: #a7f3d0; background: #f0fdf9; }
.price-row.is-free .price-usd { color: var(--live); }

@media (max-width: 30rem) {
  .price-row { grid-template-columns: 1fr; }
  .price-values { text-align: left; }
}

body.dark .price-row { background: var(--surface-2); }
body.dark .price-row.is-free { background: #0d2019; border-color: #14532d; }

.price-tools .field.grow { flex: 1 1 100%; }
.price-tools .field.grow select { padding: .5rem .6rem; font-size: .88rem; }

/* ---------- modelos em uso ---------- */
.em-uso { border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 1rem 1.1rem; margin-bottom: 1.4rem; }
.em-uso h2 { font-family: var(--serif); font-size: 1.1rem; margin: 0 0 .6rem; }
.em-uso-lista { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 .8rem; }
.em-uso-lista dt { font-weight: 600; }
.em-uso-lista dd { margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.em-uso-lista dd .reserva { color: var(--muted); }
.politica { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin: 0 0 .6rem; }
.politica legend { font-weight: 600; padding: 0 .3rem; }
.politica .check { display: flex; gap: .5rem; align-items: baseline; margin: .3rem 0; }
.price-row.is-fixo { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }

.passo-ctl { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem;
  border: 1px solid var(--line); border-radius: 999px; padding: .1rem .2rem .1rem .7rem; }
.passo-ctl[hidden] { display: none; }
.passo-ctl b { min-width: 1.2em; text-align: center; }

/* superfície usada só para "fotografar" a tela (crítico visual): sem
   animação, para as palavras estarem no lugar final */
.sem-animacao, .sem-animacao * { animation: none !important; transition: none !important; }

/* modo bloco: textos empilhados numa área, crescendo juntos */
.pilha { position: absolute; display: flex; flex-direction: column; overflow: hidden; }
.pilha[data-valign="top"] { justify-content: flex-start; }
.pilha[data-valign="middle"] { justify-content: center; }
.pilha[data-valign="bottom"] { justify-content: flex-end; }
.pilha[data-valign="spread"] { justify-content: space-between; }
.el.na-pilha { position: relative; width: 100%; height: auto; overflow: visible; flex: none; }

/* edição à mão: texto que estourou a caixa (só aparece no estúdio, editando) */
.stage-canvas[data-editable="1"] .el.estoura { outline: 3px dashed #dc2626; outline-offset: 2px; }

/* ---------- editor livre ---------- */
.editor-camada { position: absolute; inset: 0; z-index: 30; cursor: default; touch-action: none; }
.editor-camada[hidden] { display: none; }
.editor-area { position: absolute; outline: 2px dashed rgba(148, 163, 184, .45); pointer-events: none; }
.editor-caixa { position: absolute; outline: 2px dashed rgba(59, 130, 246, .35); cursor: move; }
.editor-caixa:hover { outline-color: rgba(59, 130, 246, .8); }
.editor-caixa.sel { outline: 3px solid #3b82f6; }
.editor-caixa.estoura { outline: 3px dashed #dc2626; }
.editor-grupo { position: absolute; outline: 3px solid #2563eb; pointer-events: none; }
.editor-alca {
  position: absolute; width: 30px; height: 30px; background: #fff; border: 4px solid #2563eb;
  border-radius: 50%; pointer-events: auto; transform: translate(-50%, -50%);
}
.editor-alca.nw { left: 0; top: 0; cursor: nwse-resize; }
.editor-alca.ne { left: 100%; top: 0; cursor: nesw-resize; }
.editor-alca.sw { left: 0; top: 100%; cursor: nesw-resize; }
.editor-alca.se { left: 100%; top: 100%; cursor: nwse-resize; }
.editor-laco { position: absolute; background: rgba(59, 130, 246, .12); border: 2px solid #3b82f6; pointer-events: none; }

.barra-edicao {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
  padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.barra-edicao[hidden] { display: none; }
.barra-edicao .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 .2rem; }
.barra-edicao select { font-size: .8rem; padding: .25rem .3rem; width: auto; }
.barra-edicao input[type="number"] { width: 4.2rem; font-size: .85rem; padding: .25rem .35rem; }
.barra-edicao .cores { display: inline-flex; gap: .25rem; align-items: center; }
.barra-edicao .cor { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%;
  border: 2px solid var(--line); }
.barra-edicao input[type="color"] { width: 28px; height: 26px; padding: 0; border: none; background: none; }
.barra-edicao .dica { flex-basis: 100%; font-size: .72rem; color: var(--muted); }
.barra-edicao.sem-selecao button:not(#ed-novo):not(#ed-desfazer):not(#ed-refazer),
.barra-edicao.sem-selecao select, .barra-edicao.sem-selecao input { opacity: .45; pointer-events: none; }

/* faixa de miniaturas no estúdio */
.faixa-telas { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem .1rem .5rem; }
.faixa-telas .mini {
  position: relative; flex: none; width: 150px; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 6px; border: 2px solid transparent; background: #000; padding: 0; cursor: pointer;
}
.faixa-telas .mini.atual { border-color: var(--accent); }
.faixa-telas .mini .stage-canvas { position: absolute; left: 50%; top: 50%; }
.faixa-telas .mini .num {
  position: absolute; left: 4px; top: 3px; z-index: 5; font-size: .7rem; font-weight: 700;
  color: #fff; background: rgba(0,0,0,.55); padding: 0 5px; border-radius: 4px;
}

.topbar.topbar-larga { max-width: 112rem; }

.el.apertado .el-inner { overflow-wrap: anywhere; }

/* editando o texto (duplo clique): a camada do editor sai da frente */
.editor-camada.digitando, .editor-camada.digitando * { pointer-events: none !important; }
.editor-camada.digitando .editor-caixa:not(.sel) { outline-color: transparent; }

/* A7: opções de uma tela */
.opcoes { border: 1px solid var(--line); border-radius: 10px; padding: .6rem; background: var(--surface-2); }
.opcoes[hidden] { display: none; }
.opcoes-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.opcao { display: grid; gap: .35rem; align-content: start; }
.opcao .mini {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; padding: 0;
  border-radius: 6px; border: 2px solid transparent; background: #000; cursor: pointer;
}
.opcao .mini:hover { border-color: var(--accent); }
.opcao .mini .stage-canvas { position: absolute; left: 50%; top: 50%; }
.opcao p { margin: 0; }

/* biblioteca de imagens (estúdio) */
.biblioteca summary { cursor: pointer; font-weight: 600; }
.bib-filtros { flex-wrap: wrap; margin: .5rem 0; }
.bib-filtros input[type="search"] { flex: 1 1 14rem; }
.bib-filtros select { width: auto; }
.bib-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem;
             max-height: 30rem; overflow-y: auto; }
.bib-item { margin: 0; display: grid; gap: .3rem; align-content: start; }
.bib-item img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; }
.bib-item figcaption { display: grid; gap: .2rem; }
