/* Cherry Blossom Voxel Diorama — styles */
:root {
  --paper: rgba(252, 249, 245, 0.86);
  --ink: #4a3f43;
  --ink-soft: rgba(74, 63, 67, 0.62);
  --accent: #c2708b;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1c1723; /* dusk-ish base so canvas never flashes empty */
  font-family: "Hiragino Mincho ProN", "Songti SC", Georgia, "Times New Roman", serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- title overlay ---------- */
#title {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  left: 24px;
  z-index: 10;
  pointer-events: none;
  padding: 10px 18px 12px;
  background: var(--paper);
  border: 1px solid rgba(74, 63, 67, 0.12);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(30, 20, 40, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 1.6s ease, transform 1.6s ease;
}

#title.visible { opacity: 1; transform: translateY(0); }

#title .jp {
  font-size: 22px;
  letter-spacing: 0.42em;
  color: var(--accent);
  line-height: 1.2;
}

#title .en {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ---------- footer hint ---------- */
#hint {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 250, 246, 0.78);
  text-shadow: 0 1px 6px rgba(20, 12, 28, 0.55);
  background: rgba(28, 20, 36, 0.28);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 2s ease;
  white-space: nowrap;
}

#hint.visible { opacity: 1; }

/* ---------- error fallback (never a broken state) ---------- */
#fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: linear-gradient(180deg, #f7cdd6 0%, #cfe0ee 55%, #9db98c 100%);
}

#fallback.visible { display: flex; }

#fallback .card {
  max-width: 420px;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: 0 12px 40px rgba(60, 40, 60, 0.18);
}

#fallback h1 {
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

#fallback p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #title, #hint { transition: none; }
}

@media (max-width: 560px) {
  #title { left: 14px; top: max(14px, env(safe-area-inset-top)); padding: 8px 14px 10px; }
  #title .jp { font-size: 18px; letter-spacing: 0.32em; }
  #hint { font-size: 10px; max-width: 92vw; white-space: normal; text-align: center; }
}
