* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #000;
  overflow: hidden;
  font-family: 'Courier New', monospace;
}

html, body { width: 100%; height: 100%; }

#canvas3d {
  display: block;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* respeita a barra dinâmica do mobile */
}

/* ── Vignette: moldura escura sutil pra focar a árvore ───────── */
#vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  /* bem leve — a vignette principal é no shader; aqui só um toque */
  background: radial-gradient(
    ellipse at 50% 46%,
    transparent 62%,
    rgba(0, 0, 0, 0.12) 88%,
    rgba(0, 0, 0, 0.22) 100%
  );
}

/* ── Legenda delicada ───────────────────────────────────────── */
#caption {
  position: fixed;
  top: max(4vh, env(safe-area-inset-top));
  left: max(3.2vw, env(safe-area-inset-left));
  z-index: 3;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  animation: captionIn 3.5s cubic-bezier(0.22, 1, 0.36, 1) 3.4s forwards;
}

#caption .kanji {
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;
  font-weight: 300;
  font-size: 30px;
  line-height: 1;
  color: rgba(255, 228, 235, 0.82);
  text-shadow: 0 0 18px rgba(255, 150, 180, 0.35);
}

#caption .latin {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: 7px;
  text-indent: 7px; /* compensa o letter-spacing do último glifo */
  color: rgba(255, 228, 235, 0.42);
}

/* ── Fade-in do preto ───────────────────────────────────────── */
#fade {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: #000;
  animation: fadeOut 2.6s ease forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes captionIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  #caption .kanji { font-size: 24px; }
  #caption .latin { font-size: 9px; letter-spacing: 5px; text-indent: 5px; }
}

/* ── Fallback (sem WebGL2) ───────────────────────────────────── */
#fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none; /* mostrado via JS */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: #000;
  color: rgba(255, 228, 235, 0.7);
}

#fallback .kanji {
  font-family: 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;
  font-size: 44px;
  color: rgba(255, 228, 235, 0.85);
  text-shadow: 0 0 24px rgba(255, 150, 180, 0.4);
}

#fallback p {
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 1px;
  max-width: 30ch;
}
