:root {
  --ameixa: #2e1228;
  --ameixa-2: #4a2040;
  --rose: #9b4f6a;
  --rose-claro: #d4879f;
  --creme: #fdf6f0;
  --papel: #ffffff;
  --tinta: #2b2320;
  --tinta-2: #5c4d52;
  --linha: #ead9d6;
  --erro: #a3243b;
  --fundo: var(--creme);
  --cartao: var(--papel);
  --bolha-aluna: var(--ameixa-2);
  --bolha-aluna-texto: #fff7f3;
  --bolha-ia: var(--papel);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #1a0b17;
    --cartao: #26121f;
    --papel: #26121f;
    --tinta: #f6ebe7;
    --tinta-2: #cdb8bf;
    --linha: #3d2236;
    --bolha-aluna: #6b2f55;
    --bolha-ia: #26121f;
    --rose: #e0a3b8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--tinta);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--rose); }
.invisivel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- telas em cartão (entrar, código, sem acesso) */
.tela-cartao { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.cartao {
  width: 100%; max-width: 420px; background: var(--cartao); border: 1px solid var(--linha);
  border-radius: 18px; padding: 32px 24px 24px;
}
.selo { margin: 0 0 10px; font: italic 600 22px/1 var(--serif); color: var(--rose); }
.cartao h1 { margin: 0 0 10px; font: 600 30px/1.12 var(--serif); color: var(--tinta); }
.apoio { margin: 0 0 22px; color: var(--tinta-2); }
.apoio.pequeno { font-size: 14px; margin: 18px 0 6px; }
label { display: block; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
input {
  width: 100%; padding: 13px 14px; border: 1px solid var(--linha); border-radius: 12px;
  background: var(--fundo); font-size: 17px;
}
#codigo { letter-spacing: .3em; font-size: 22px; text-align: center; }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--rose); outline-offset: 1px; }
.botao {
  display: block; width: 100%; margin-top: 14px; padding: 14px; border: 0; border-radius: 12px;
  background: var(--ameixa-2); color: #fff7f3; font-weight: 600; font-size: 16px; text-align: center;
  text-decoration: none; cursor: pointer;
}
.botao:hover { background: var(--ameixa); }
.botao:focus-visible, .link:focus-visible, .icone:focus-visible, .chip:focus-visible, .enviar:focus-visible {
  outline: 2px solid var(--rose); outline-offset: 2px;
}
.botao:disabled { opacity: .6; cursor: default; }
.erro { min-height: 1.3em; margin: 10px 0 0; color: var(--erro); font-size: 14px; }
.link { background: none; border: 0; padding: 8px 0; color: var(--rose); text-decoration: underline; cursor: pointer; }

/* ---------- chat */
#tela-chat { height: 100%; height: 100dvh; display: flex; flex-direction: column; }
.topo {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--ameixa); color: #fff7f3;
}
.marca { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.marca .nome { font: italic 600 24px/1 var(--serif); }
.marca .sub { font-size: 12px; opacity: .8; margin-top: 3px; }
.icone {
  width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 12px;
  background: transparent; color: inherit; cursor: pointer;
}
.icone svg, .enviar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icone:hover { background: rgba(255,255,255,.1); }

#mensagens { flex: 1; overflow-y: auto; padding: 18px 14px 8px; scroll-behavior: smooth; }
#mensagens > * { max-width: 720px; margin-left: auto; margin-right: auto; }
#boas-vindas { padding: 8px 4px 4px; color: var(--tinta-2); }
#boas-vindas .ola { font: 600 28px/1.15 var(--serif); color: var(--tinta); margin: 4px 0 8px; }
.sugestoes { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.chip {
  text-align: left; padding: 11px 14px; border: 1px solid var(--linha); border-radius: 12px;
  background: var(--cartao); color: var(--tinta); cursor: pointer; font-size: 15px;
}
.chip:hover { border-color: var(--rose-claro); }

.msg { display: flex; margin: 12px auto; }
.msg.aluna { justify-content: flex-end; }
.bolha { max-width: 86%; padding: 11px 14px; border-radius: 16px; overflow-wrap: anywhere; }
.aluna .bolha { background: var(--bolha-aluna); color: var(--bolha-aluna-texto); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.ia .bolha { background: var(--bolha-ia); border: 1px solid var(--linha); border-bottom-left-radius: 6px; max-width: 94%; }
.ia .bolha p { margin: 0 0 10px; }
.ia .bolha p:last-child, .ia .bolha ul:last-child, .ia .bolha ol:last-child { margin-bottom: 0; }
.ia .bolha ul, .ia .bolha ol { margin: 0 0 10px; padding-left: 20px; }
.ia .bolha li { margin-bottom: 4px; }
.ia .bolha strong { font-weight: 600; }
.status { color: var(--tinta-2); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pontos { display: inline-flex; gap: 4px; }
.pontos i { width: 6px; height: 6px; border-radius: 50%; background: var(--rose-claro); animation: pulsar 1.2s infinite ease-in-out; }
.pontos i:nth-child(2) { animation-delay: .15s; }
.pontos i:nth-child(3) { animation-delay: .3s; }
@keyframes pulsar { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .pontos i { animation: none; opacity: .7; } #mensagens { scroll-behavior: auto; } }

.aulas { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--linha); display: flex; flex-direction: column; gap: 6px; }
.aulas .rotulo { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--tinta-2); }
.aula { font-size: 14px; color: var(--tinta-2); }
.aula a { font-weight: 500; }
.acoes { display: flex; gap: 6px; margin-top: 8px; }
.acoes button {
  border: 1px solid var(--linha); background: transparent; border-radius: 999px; padding: 5px 12px;
  font-size: 13px; color: var(--tinta-2); cursor: pointer;
}
.acoes button[aria-pressed="true"] { background: var(--ameixa-2); color: #fff7f3; border-color: var(--ameixa-2); }
.msg-erro .bolha { border-color: var(--erro); color: var(--erro); }

.compositor {
  display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px;
  max-width: 744px; width: 100%; margin: 0 auto;
}
.compositor textarea {
  flex: 1; resize: none; max-height: 140px; padding: 12px 14px; border: 1px solid var(--linha);
  border-radius: 14px; background: var(--cartao); font-size: 16px; line-height: 1.4;
}
.enviar {
  width: 46px; height: 46px; flex: none; border: 0; border-radius: 14px; display: grid; place-items: center;
  background: var(--ameixa-2); color: #fff7f3; cursor: pointer;
}
.enviar:disabled { opacity: .45; cursor: default; }
.aviso-ia { margin: 0; padding: 0 16px max(10px, env(safe-area-inset-bottom)); text-align: center; font-size: 12px; color: var(--tinta-2); }

/* ---------- gaveta */
.gaveta { position: fixed; inset: 0; z-index: 10; }
.gaveta-fundo { position: absolute; inset: 0; background: rgba(20, 6, 16, .45); }
.gaveta-painel {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(340px, 88vw); background: var(--cartao);
  display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
}
.gaveta-topo { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--linha); }
#lista-conversas { list-style: none; margin: 0; padding: 6px 8px; flex: 1; overflow-y: auto; }
#lista-conversas li { display: flex; align-items: center; gap: 4px; }
#lista-conversas .abrir {
  flex: 1; text-align: left; padding: 11px 10px; border: 0; border-radius: 10px; background: none; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#lista-conversas .abrir:hover, #lista-conversas .abrir[aria-current="true"] { background: var(--fundo); }
#lista-conversas .apagar { border: 0; background: none; color: var(--tinta-2); cursor: pointer; padding: 8px; border-radius: 8px; font-size: 13px; }
.gaveta-pe { padding: 12px 18px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--linha); font-size: 14px; color: var(--tinta-2); }
.gaveta-pe p { margin: 0 0 4px; }
.vazio { padding: 14px 10px; color: var(--tinta-2); font-size: 14px; }
