:root {
  /* Identidade da marca: grafite, cinza e laranja-queimado (do logotipo) */
  --bg: #16181a;
  --surface: #1e2124;
  --surface-2: #282c30;
  --line: rgba(255, 255, 255, .1);
  --text: #f2efe9;
  --muted: #9a9ea3;
  --accent: #e07a3c;
  --accent-2: #f09a62;
  --on-accent: #1a0d05;
  --ok: #5ccf9a;
  --warn: #e8b04a;
  --danger: #ff7a6b;
  --radius: 8px;
  font-family: 'Helvetica Neue', Arial, Inter, system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.wrap { width: min(1080px, 100% - 32px); margin-inline: auto; }

/* Botões e campos */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; letter-spacing: .01em; padding: 10px 18px; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #32373c; border-color: rgba(255, 255, 255, .2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: .875rem; }
.btn.lg { padding: 14px 26px; font-size: 1.05rem; border-radius: 6px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 11px 14px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

/* Rótulo editorial: pequeno, em caixa alta, espaçado */
.eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text); }
.eyebrow.gold { color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
.field { margin-bottom: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.btn.google { width: 100%; background: #fff; border-color: #fff; color: #1f1f1f; font-weight: 600; padding: 12px 18px; }
.btn.google:hover { background: #f1f1f1; border-color: #f1f1f1; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.error { color: var(--danger); font-size: .9rem; min-height: 1.3em; margin: 8px 0 0; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface-2);
  border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; z-index: 100; max-width: 90vw;
}

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; color: var(--text); font-size: 1.2rem; }

.topbar { border-bottom: 1px solid var(--line); background: rgba(22,24,26,.88); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.topbar nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.badge { font-size: .68rem; padding: 3px 10px; border-radius: 99px; background: transparent; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

/* Login */
.auth-box { width: min(420px, 100% - 32px); margin: 56px auto; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 6px; margin-bottom: 22px; border: 1px solid var(--line); }
.tabs button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 9px; border-radius: 4px; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--surface-2); color: var(--accent); }

/* Dashboard */
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; padding: 36px 0 20px; flex-wrap: wrap; }
.connect { display: flex; gap: 8px; align-items: center; }
.connect input { width: 150px; text-align: center; letter-spacing: .25em; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; padding-bottom: 64px; }
.deck { display: flex; flex-direction: column; gap: 14px; }
.deck h3 { font-size: 1.05rem; word-break: break-word; }
.deck .meta { font-size: .85rem; color: var(--muted); }
.deck .row { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s; }
.drop.over, .drop:hover { border-color: var(--accent); background: rgba(224, 122, 60, .08); }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(560px, 100% - 24px); max-height: 88vh; overflow: auto; }
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog h2 { margin-bottom: 16px; }
.qr-box { display: inline-block; background: #fff; padding: 12px; border-radius: 16px; }
.qr-box img { display: block; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.notes-list label { margin-top: 12px; }

/* Galeria de modelos */
.start-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
dialog.wide { width: min(980px, 100% - 24px); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.tpl { display: flex; flex-direction: column; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tpl h3 { font-size: 1rem; margin-top: 4px; }
.tpl p { margin: 0; font-size: .85rem; flex: 1; }
.tpl-thumb { aspect-ratio: 16 / 9; width: 100%; border-radius: 8px; }

/* Editor de apresentações */
.editor-page .topbar { position: static; }
.ed-bar { display: flex; align-items: center; gap: 14px; }
.ed-bar .title-input { flex: 1; max-width: 380px; font-weight: 700; }
.ed-bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.ed-bar-right select { width: auto; padding: 7px 12px; }
.ed-bar-right label.inline { margin: 0; }
.editor { display: grid; grid-template-columns: 220px minmax(0, 1fr) 340px; height: calc(100vh - 65px); }
.ed-list { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.ed-slides { display: flex; flex-direction: column; gap: 8px; }
.slide-item { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: start; background: none; border: 2px solid transparent; border-radius: 10px; padding: 6px; cursor: pointer; color: var(--muted); font: inherit; font-size: .8rem; text-align: left; }
.slide-item.active { border-color: var(--accent); background: var(--surface); }
.slide-item .thumb { aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.ed-main { padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; overflow: auto; }
#preview { aspect-ratio: 16 / 9; width: 100%; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-props { border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
.ed-props textarea { min-height: 90px; }
@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .ed-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .ed-slides { flex-direction: row; overflow-x: auto; }
  .slide-item { min-width: 150px; }
  .ed-props { border-left: 0; border-top: 1px solid var(--line); }
  .ed-bar { flex-wrap: wrap; padding-block: 8px; height: auto; }
  .ed-bar .title-input { order: 3; max-width: none; flex-basis: 100%; }
}

/* Slides (projetor e apresentador) */
.slide-stage { position: relative; display: grid; place-items: center; overflow: hidden; background: #000; }
.slide-stage > img, .slide-stage > canvas { display: block; }

/* Projetor */
body.projector { background: #000; overflow: hidden; height: 100vh; cursor: default; }
body.projector.idle { cursor: none; }
.screen { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; }
.wait { display: grid; grid-template-columns: auto 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; width: min(1100px, 100%); text-align: left; }
.wait .qr { background: #fff; padding: 16px; border-radius: 24px; width: clamp(220px, 34vw, 420px); }
.wait .qr img { display: block; width: 100%; height: auto; }
.wait h1 { font-size: clamp(1.6rem, 3.4vw, 2.8rem); letter-spacing: -.02em; margin-bottom: 14px; }
.wait .pin { font-size: clamp(3rem, 9vw, 7rem); font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; color: var(--accent-2); line-height: 1; margin: 18px 0; }
.wait .hint { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.3rem); }
.wait code { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; color: var(--text); word-break: break-all; }
.wait .share { display: flex; gap: 8px; flex-wrap: wrap; }
.wait #join-link code { font-size: clamp(1rem, 1.8vw, 1.4rem); }
@media (max-width: 760px) { .wait .share { justify-content: center; } .wait { grid-template-columns: 1fr; text-align: center; } .wait .qr { margin-inline: auto; } }
.status-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 8px; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
#live-screen { padding: 0; }
#live-screen .slide-stage { position: absolute; inset: 0; }
.blackout { position: absolute; inset: 0; background: #000; z-index: 5; }
.laser { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: radial-gradient(circle, #ff3b3b 0 35%, rgba(255,59,59,.45) 36% 60%, transparent 62%); box-shadow: 0 0 18px 6px rgba(255,59,59,.55); pointer-events: none; z-index: 6; }
.overlay-ui { position: fixed; top: 16px; right: 16px; z-index: 20; display: flex; gap: 8px; align-items: center; transition: opacity .3s; }
body.projector.idle .overlay-ui { opacity: 0; pointer-events: none; }
.pill { background: rgba(21,25,34,.85); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-size: .85rem; backdrop-filter: blur(6px); }
.pill.warn { color: var(--warn); border-color: var(--warn); }

/* Controle do apresentador */
.control { width: min(560px, 100% - 24px); margin: 0 auto; padding: 16px 0 32px; }
.control.console { width: min(1100px, 100% - 24px); }
.pin-input { font-size: 2.2rem !important; text-align: center; letter-spacing: .3em; font-weight: 800; }
.deck-pick { display: grid; gap: 10px; margin-top: 16px; }
.deck-pick button { text-align: left; justify-content: flex-start; font-weight: 400; padding: 14px 16px; }
.console-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.console-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.console-grid > * { min-width: 0; }
@media (max-width: 820px) { .console-grid { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.panel h4 { margin: 0 0 8px; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#cur { aspect-ratio: 16 / 9; width: 100%; border-radius: 10px; touch-action: pan-y; user-select: none; }
#cur.laser-mode { touch-action: none; cursor: crosshair; outline: 2px solid #ff3b3b; }
#nxt { aspect-ratio: 16 / 9; width: 100%; border-radius: 8px; }
.notes { white-space: pre-wrap; font-size: 1.05rem; max-height: 34vh; overflow: auto; }
.nav-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.nav-row .btn { padding: 22px; font-size: 1.2rem; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.counter { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Tema claro e verde (login, painel de apresentações e editor). Projetor e controle continuam escuros. */
html:has(body.light) { background: #f7f4ef; color-scheme: light; }
body.light {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-2: #ece8e1;
  --line: rgba(43, 47, 51, .14);
  --text: #2b2f33;
  --muted: #686d72;
  --accent: #b8541f;
  --accent-2: #9a4417;
  --on-accent: #ffffff;
  --ok: #1d7a4b;
  --warn: #9a5b00;
  --danger: #b3261e;
  color-scheme: light;
}
body.light .btn:hover { background: #e4dfd6; border-color: rgba(43, 47, 51, .28); }
body.light .btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
body.light .btn.google { border-color: var(--line); }
body.light .topbar { background: rgba(247, 244, 239, .92); }
body.light .badge { color: var(--accent); border-color: var(--accent); }
body.light .card, body.light .panel, body.light dialog { box-shadow: 0 1px 2px rgba(43, 47, 51, .06); }
body.light dialog::backdrop { background: rgba(43, 47, 51, .5); }
body.light .toast { box-shadow: 0 8px 28px rgba(43, 47, 51, .2); }
body.light .drop.over, body.light .drop:hover { background: rgba(184, 84, 31, .06); }
body.light .slide-item.active { background: #fff; }
body.light #preview { box-shadow: 0 18px 50px -16px rgba(43, 47, 51, .35); }
body.light input:focus, body.light textarea:focus, body.light select:focus { border-color: var(--accent); }

/* Logotipo (marca + nome). O nome é grafite; em telas escuras vira branco. */
.brand { gap: 9px; }
.brand .mark { height: 28px; width: auto; display: block; }
.brand .word { height: 15px; width: auto; display: block; }
body:not(.light) .brand .word { filter: brightness(0) invert(1); }
/* Em fundo escuro as peças cinza do logotipo precisam de mais luz para aparecer */
body:not(.light) .brand .mark { filter: brightness(1.75) saturate(.95); }
