/* /assets/app.css */
:root{
  --bg:#0b1220;
  --card:#0f1a33;
  --card2:rgba(15,26,51,.55);
  --text:#e8eefc;
  --muted:#a7b3d1;
  --line:rgba(255,255,255,.08);
  --btn:#2d6cdf;
  --btn2:rgba(255,255,255,.08);

  /* viewport real (JS vai sobrescrever) */
  --appvh: 1vh;
}

@supports (height: 100svh){
  :root{ --appvh: 1svh; }
}
@supports (height: 100dvh){
  :root{ --appvh: 1dvh; }
}

*{ box-sizing:border-box; }

/* body NÃO rola — só o chat */
html, body{
  height:100%;
  overflow:hidden;
}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background: radial-gradient(1200px 800px at 20% 10%, #14214a 0%, var(--bg) 55%);
  color:var(--text);
}

/* =========================================================
   LAYOUT PRINCIPAL
   ========================================================= */
.wrap{
  max-width:980px;
  margin:0 auto;

  height: calc(var(--appvh) * 100);
  min-height:0;

  display:flex;
  flex-direction:column;

  padding:14px;
  padding-top: calc(14px + env(safe-area-inset-top));
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

/* Topo */
.top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(15,26,51,.55);
  backdrop-filter: blur(6px);
}
.title{font-weight:800;font-size:17px}
.subtitle{color:var(--muted);font-size:12px;margin-top:2px}
.top-left{display:flex;flex-direction:column}

.top-actions{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.btn{
  border:0;
  border-radius:12px;
  padding:10px 12px;
  background:var(--btn);
  color:white;
  font-weight:800;
  cursor:pointer;

  /* ✅ mobile antigo: clique mais confiável */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn.ghost{
  background:var(--btn2);
  border:1px solid var(--line);
  color:var(--text);
}
.btn:disabled{opacity:.6;cursor:not-allowed}

.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.14);
}
.toggle input{width:38px;height:20px}

/* =========================================================
   GRID
   ========================================================= */
.grid{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
  margin-top:12px;

  flex:1;
  min-height:0;
}

/* card vira flex para o chat calcular altura */
.card{
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(15,26,51,.45);
  backdrop-filter: blur(6px);
  min-height:0;

  display:flex;
  flex-direction:column;
}

/* CHAT */
.chat{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;

  flex:1;
  min-height:0;

  overflow-y:auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  /* 🔒 espaço para NÃO ficar atrás do input */
  padding-bottom: 150px;
  scroll-padding-bottom: 150px;
}

.bubble{
  max-width:88%;
  padding:12px;
  border-radius:16px;
  border:1px solid var(--line);
  background:rgba(15,26,51,.55);
  line-height:1.35;
  white-space:pre-wrap;
  word-break:break-word;
}
.bubble.user{align-self:flex-end;background:rgba(45,108,223,.18)}
.bubble.assistant{align-self:flex-start}

.bubble-actions{margin-top:10px}
.play{
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--text);
  padding:8px 10px;
  border-radius:999px;
  cursor:pointer;

  /* ✅ mobile antigo */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* INPUT */
.bottom{
  margin-top:12px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:16px;
  background:rgba(15,26,51,.55);
  backdrop-filter: blur(6px);

  flex:0 0 auto;   /* não sobrepõe */
}

.form{display:flex;gap:10px;align-items:center}
.input{
  flex:1;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--text);
  padding:12px;

  /* ✅ evita zoom/bug de teclado em Android */
  font-size:16px;
}
.input::placeholder{color:rgba(231,238,252,.55)}
.hint{color:var(--muted);font-size:12px;margin-top:8px}

.mic{
  width:44px;height:44px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--text);
  font-size:18px;

  /* ✅ mobile antigo */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mic.rec{outline:2px solid rgba(45,108,223,.6)}

/* =========================================================
   PAINEL
   ========================================================= */
.panel{
  padding:14px;
  overflow:auto;
  min-height:0;
  position:relative;
}

.panel h3{margin:0 0 4px;font-size:16px}
.panel .sub{margin:0 0 12px;color:var(--muted);font-size:12px}

.panel-box{
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  background:rgba(0,0,0,.12);
}

.label{color:var(--muted);font-size:12px;font-weight:700}
.value{font-size:14px;margin-bottom:10px}

.pill{
  display:inline-block;
  margin:4px 6px 0 0;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  font-size:12px;
}

.panel-close{
  position:absolute;
  top:10px;right:10px;
  width:38px;height:38px;
  border-radius:12px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);

  /* ✅ mobile antigo */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* BACKDROP */
.backdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:40;
}

/* MOBILE DRAWER */
@media (max-width:900px){
  .panel{
    position:fixed;
    inset:12px;
    z-index:50;
    transform:translateY(110%);
    transition:transform .25s ease;
  }
  .panel.open{transform:translateY(0)}
}

/* DESKTOP */
@media (min-width:901px){
  .grid{grid-template-columns:1fr 360px}
  .bubble{max-width:74%}
  .panel-close,.backdrop{display:none}
}
