/* index2 — Visual Novel Mobile-First (TabaIA) */

:root {
  --vn-azul-900: #1e3a8a;
  --vn-azul-700: #1d4ed8;
  --vn-azul-600: #2563eb;
  --vn-azul-500: #3b82f6;
  --vn-google: #0b57d0;
  --vn-ink: #1f2937;
  --vn-muted: #5f6368;
  --vn-bg-0: #e8eef8;
  --vn-bg-1: #f4f7fc;
  --vn-card: #ffffff;
  --vn-border: #e2e8f0;
  --vn-shadow: 0 12px 40px rgba(30, 58, 138, 0.12);
  --vn-radius: 1.25rem;
  --vn-safe-top: env(safe-area-inset-top, 0px);
  --vn-safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body.vn-home {
  margin: 0;
  min-height: 100%;
  font-family: "Plus Jakarta Sans", "Roboto", system-ui, sans-serif;
  color: var(--vn-ink);
  background:
    radial-gradient(ellipse 90% 60% at 10% 0%, rgba(59, 130, 246, 0.22), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 10%, rgba(30, 58, 138, 0.16), transparent 50%),
    linear-gradient(180deg, var(--vn-bg-0) 0%, var(--vn-bg-1) 45%, #ffffff 100%);
  padding:
    max(0.5rem, var(--vn-safe-top))
    max(0.75rem, env(safe-area-inset-right, 0px))
    max(0.5rem, var(--vn-safe-bottom))
    max(0.75rem, env(safe-area-inset-left, 0px));
}

.vn-shell {
  max-width: 28rem;
  margin: 0 auto;
  min-height: calc(100svh - 1rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Header */
.vn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.15rem;
  position: relative;
  z-index: 20;
}

.vn-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.vn-brand__mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

.vn-brand__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.vn-brand__name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--vn-azul-900);
}

.vn-brand__sub {
  font-size: 0.72rem;
  color: var(--vn-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vn-header__right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  position: relative;
}

.vn-avatar {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  border: 2px solid #fff;
  background: linear-gradient(135deg, var(--vn-azul-900), var(--vn-azul-500));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.18);
}

.vn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vn-hidden {
  display: none !important;
}

.vn-menu-btn {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.7rem;
  border: 1px solid var(--vn-border);
  background: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  cursor: pointer;
  padding: 0;
}

.vn-menu-btn__line {
  display: block;
  width: 1rem;
  height: 2px;
  border-radius: 2px;
  background: var(--vn-azul-900);
}

.vn-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 15.5rem;
  background: #fff;
  border: 1px solid var(--vn-border);
  border-radius: 0.9rem;
  box-shadow: var(--vn-shadow);
  padding: 0.4rem;
  display: none;
  z-index: 30;
}

.vn-menu.is-open {
  display: block;
  animation: vn-fade-in 0.18s ease;
}

.vn-menu__link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.7rem 0.75rem;
  border-radius: 0.65rem;
  color: var(--vn-ink);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.vn-menu__link:hover,
.vn-menu__link:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.vn-menu__link .bi {
  color: var(--vn-google);
  font-size: 1.05rem;
}

/* Stage / card */
.vn-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.vn-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--vn-card);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: calc(var(--vn-radius) + 0.35rem);
  box-shadow: var(--vn-shadow);
  overflow: hidden;
  min-height: 22rem;
}

.vn-scene {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 1rem;
  padding: 1.1rem 1rem 1rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(211, 227, 253, 0.55), transparent 55%),
    linear-gradient(180deg, #fbfdff 0%, #ffffff 60%);
}

.vn-speech {
  width: 100%;
  max-width: none;
  background: #fff;
  border: 1px solid var(--vn-border);
  border-radius: 1.1rem;
  padding: 0.95rem 1rem;
  position: relative;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.vn-speech__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--vn-google);
  margin-bottom: 0.35rem;
}

.vn-speech__text {
  margin: 0;
  min-height: 2.9em;
  font-size: clamp(0.98rem, 3.6vw, 1.08rem);
  line-height: 1.45;
  color: var(--vn-ink);
  font-weight: 500;
  white-space: pre-line;
}

.vn-speech__text.is-typing::after {
  content: "▍
  display: inline-block;
  width: 0.55ch;
  margin-left: 1px;
  animation: vn-caret 0.85s steps(1) infinite;
  color: var(--vn-google);
  font-weight: 700;
}

.vn-actions {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.15rem;
}

.vn-actions.is-waiting {
  opacity: 0.45;
  pointer-events: none;
}

.vn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.vn-chip:active {
  transform: scale(0.98);
}

.vn-chip--primary {
  background: var(--vn-google);
  color: #fff;
  box-shadow: 0 8px 20px rgba(11, 87, 208, 0.28);
}

.vn-chip--primary:hover {
  background: #0842a0;
}

.vn-chip--ghost {
  background: #fff;
  color: var(--vn-azul-900);
  border-color: var(--vn-border);
}

.vn-chip--ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.vn-chip .bi {
  font-size: 1.05rem;
}

/* Sumário de dúvidas frequentes (estilo chat-sumario) */
.vn-sumario {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: 100%;
  margin: 0 0 0.35rem;
}

.vn-sumario__hint {
  flex: 1 0 100%;
  margin: 0 0 0.1rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--vn-muted);
}

.vn-sumario__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: auto;
  max-width: 100%;
  text-align: left;
  min-height: 2.25rem;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--vn-border);
  background: #fff;
  color: var(--vn-azul-900);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.vn-sumario__item:hover,
.vn-sumario__item:focus-visible {
  background: #d3e3fd;
  border-color: #aecbfa;
  color: #0c3b7a;
  outline: none;
}

.vn-sumario__item:active {
  transform: scale(0.98);
}

.vn-sumario__num {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d3e3fd;
  color: #0b57d0;
  font-size: 0.7rem;
  font-weight: 700;
}

.vn-sumario__label {
  flex: 1;
  min-width: 0;
}

/* Composer */
.vn-composer {
  border-top: 1px solid var(--vn-border);
  background: #f8fafc;
  padding: 0.75rem 0.85rem 0.9rem;
}

.vn-composer__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #fff;
  border: 1px solid var(--vn-border);
  border-radius: 999px;
  padding: 0.35rem 0.4rem 0.35rem 0.85rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.vn-composer__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--vn-ink);
  padding: 0.55rem 0.25rem;
}

.vn-composer__input::placeholder {
  color: #94a3b8;
}

.vn-composer__btn {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: transparent;
  color: var(--vn-muted);
  flex-shrink: 0;
}

.vn-composer__btn--send {
  background: var(--vn-google);
  color: #fff;
}

.vn-composer__hint {
  margin: 0.45rem 0.35rem 0;
  font-size: 0.72rem;
  color: var(--vn-muted);
  text-align: center;
}

.vn-file-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.vn-footer-mini {
  text-align: center;
  font-size: 0.72rem;
  color: var(--vn-muted);
  padding: 0.15rem 0 0.35rem;
}

.vn-footer-mini a {
  color: var(--vn-google);
  text-decoration: none;
}

.vn-footer-mini a:hover {
  text-decoration: underline;
}

@keyframes vn-caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes vn-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .vn-speech__text.is-typing::after {
    animation: none;
    opacity: 0;
  }
}

/* Tablet */
@media (min-width: 768px) {
  body.vn-home {
    padding:
      max(1.25rem, var(--vn-safe-top))
      max(1.5rem, env(safe-area-inset-right, 0px))
      max(1.25rem, var(--vn-safe-bottom))
      max(1.5rem, env(safe-area-inset-left, 0px));
  }

  .vn-shell {
    max-width: 36rem;
    min-height: calc(100svh - 2.5rem);
    gap: 1rem;
    justify-content: center;
  }

  .vn-header {
    padding: 0.5rem 0.25rem;
  }

  .vn-brand__mark {
    width: 2.35rem;
    height: 2.35rem;
  }

  .vn-brand__name {
    font-size: 1.12rem;
  }

  .vn-brand__sub {
    font-size: 0.8rem;
  }

  .vn-card {
    min-height: min(38rem, calc(100svh - 8rem));
    border-radius: calc(var(--vn-radius) + 0.5rem);
  }

  .vn-scene {
    gap: 1.25rem;
    padding: 1.5rem 1.5rem 1.25rem;
  }

  .vn-speech {
    padding: 1.15rem 1.25rem;
    border-radius: 1.25rem;
  }

  .vn-speech__text {
    font-size: 1.12rem;
    line-height: 1.5;
    min-height: 3.2em;
  }

  .vn-actions {
    gap: 0.65rem;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
  }

  .vn-sumario {
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
  }

  .vn-sumario__item {
    font-size: 0.9rem;
    min-height: 2.4rem;
  }

  .vn-chip {
    min-height: 3.15rem;
    font-size: 1rem;
    padding: 0.8rem 1.15rem;
  }

  .vn-chip:hover {
    transform: translateY(-1px);
  }

  .vn-chip:active {
    transform: scale(0.99);
  }

  .vn-composer {
    padding: 0.9rem 1.15rem 1.05rem;
  }

  .vn-composer__input {
    font-size: 1rem;
  }

  .vn-composer__btn {
    width: 2.6rem;
    height: 2.6rem;
  }

  .vn-footer-mini {
    font-size: 0.78rem;
    padding-bottom: 0.5rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  body.vn-home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding:
      max(2rem, var(--vn-safe-top))
      max(2rem, env(safe-area-inset-right, 0px))
      max(2rem, var(--vn-safe-bottom))
      max(2rem, env(safe-area-inset-left, 0px));
    background:
      radial-gradient(ellipse 55% 50% at 18% 15%, rgba(59, 130, 246, 0.2), transparent 55%),
      radial-gradient(ellipse 45% 45% at 88% 8%, rgba(30, 58, 138, 0.14), transparent 50%),
      radial-gradient(ellipse 40% 35% at 70% 90%, rgba(37, 99, 235, 0.08), transparent 55%),
      linear-gradient(180deg, var(--vn-bg-0) 0%, var(--vn-bg-1) 40%, #ffffff 100%);
  }

  .vn-shell {
    width: 100%;
    max-width: 42rem;
    min-height: auto;
    max-height: min(52rem, calc(100svh - 4rem));
  }

  .vn-stage {
    min-height: 0;
  }

  .vn-card {
    min-height: min(40rem, calc(100svh - 10rem));
    max-height: min(46rem, calc(100svh - 9rem));
    box-shadow:
      0 20px 50px rgba(30, 58, 138, 0.14),
      0 4px 16px rgba(15, 23, 42, 0.06);
  }

  .vn-scene {
    padding: 1.75rem 1.75rem 1.35rem;
    overflow-y: auto;
  }

  .vn-speech__label {
    font-size: 0.78rem;
  }

  .vn-speech__text {
    font-size: 1.18rem;
  }

  .vn-actions {
    max-width: 30rem;
  }

  .vn-sumario {
    max-width: 30rem;
  }

  .vn-chip {
    min-height: 3.25rem;
  }

  .vn-menu {
    min-width: 17rem;
  }
}

@media (min-width: 1280px) {
  .vn-shell {
    max-width: 44rem;
  }

  .vn-speech__text {
    font-size: 1.22rem;
  }
}

/* Banner de cookies acima do composer (cliques) */
body.apen-cookie-banner-open.vn-home {
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}
body.apen-cookie-banner-open.vn-home .vn-composer {
  pointer-events: none;
}
body.apen-cookie-banner-open.vn-home .apen-cookie-banner,
body.apen-cookie-banner-open.vn-home .apen-cookie-banner * {
  pointer-events: auto;
}
