/* ===== Reset & base ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0b0e;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

/* ===== Touch canvas (golden particle trail) ===== */
#touchCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  touch-action: none;
  cursor: crosshair;
}

/* ===== Initial guide ===== */
.guide {
  position: fixed;
  top: calc(12% + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 15;
  text-align: center;
  pointer-events: none;
  transition: opacity .8s ease;
}
.guide.hidden { opacity: 0; }
.guide h1 {
  font-weight: 300;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  letter-spacing: .03em;
  text-shadow: 0 0 16px rgba(255,255,255,.35);
  margin-bottom: 8px;
}
.guide p {
  font-weight: 300;
  font-size: clamp(.75rem, 3vw, .9rem);
  color: rgba(255,255,255,.55);
}

/* ===== Language switcher ===== */
.lang-switch {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 50;
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  padding: 4px;
}
.lang-switch button {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .72rem;
  letter-spacing: .05em;
  color: rgba(255,255,255,.6);
  transition: background .25s ease, color .25s ease;
}
.lang-switch button.active {
  background: rgba(255,255,255,.22);
  color: #fff;
}

/* ===== Mood layer (warm scene + headline + scattered pills) ===== */
.mood-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
  background: linear-gradient(160deg, #d6d1c8 0%, #c7c1b6 55%, #b7b0a4 100%);
  overflow: hidden;
}
.mood-layer.visible { opacity: 1; pointer-events: auto; }

.mood-headline {
  font-weight: 500;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  letter-spacing: .01em;
  color: #2e2a24;
  margin: calc(10vh + env(safe-area-inset-top, 0px)) 0 0;
  text-align: center;
  padding: 0 24px;
  z-index: 2;
}

.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Caveat', cursive;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  color: rgba(60, 50, 40, .18);
  z-index: 1;
  pointer-events: none;
}

.tagline {
  position: absolute;
  bottom: calc(8vh + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  color: #a85c26;
  z-index: 2;
  padding: 0 20px;
}

.pill-field {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.pill {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: #5b4a37;
  background: rgba(250, 244, 234, .8);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 0 20px rgba(255, 178, 102, .45), 0 6px 18px rgba(0, 0, 0, .12);
  transform: translate(-50%, -50%);
  animation: floatPill var(--duration) ease-in-out var(--delay) infinite;
  transition: background .25s ease, box-shadow .25s ease;
  white-space: nowrap;
}
.pill:hover, .pill:focus-visible {
  background: rgba(255, 250, 242, .95);
  box-shadow: 0 0 30px rgba(255, 178, 102, .7), 0 6px 18px rgba(0, 0, 0, .16);
}
@keyframes floatPill {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -10px; }
}

/* ===== Warp / portal flare ===== */
.warp-flare {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}
.warp-flare::before {
  content: '';
  position: absolute;
  left: var(--wx, 50%);
  top: var(--wy, 50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,228,170,1) 0%, rgba(255,180,90,.85) 40%, transparent 72%);
  filter: blur(2px);
  transform: translate(-50%,-50%) scale(0);
  opacity: 0;
}
.warp-flare.active::before {
  animation: warpPulse .7s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes warpPulse {
  0%   { transform: translate(-50%,-50%) scale(0); opacity: 1; }
  55%  { opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(70); opacity: 0; }
}

/* ===== Full-bleed video layer ===== */
.video-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
}
.video-layer.visible { opacity: 1; pointer-events: auto; }
.video-layer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== End prompt (soft mist) ===== */
.prompt-layer {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: calc(14vh + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 45%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.prompt-layer.visible { opacity: 1; pointer-events: auto; }
.prompt-layer p {
  font-weight: 300;
  font-size: clamp(1.05rem, 4vw, 1.4rem);
  text-shadow: 0 2px 14px rgba(0,0,0,.6);
  margin-bottom: 18px;
}
.farewell {
  font-family: 'Caveat', cursive;
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  color: #ffd9a8;
}
.prompt-actions { display: flex; gap: 14px; }
.prompt-actions button {
  padding: 9px 26px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: .9rem;
}
.prompt-actions button:hover { background: rgba(255,255,255,.26); }

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .pill { animation: none; }
  .warp-flare.active::before { animation-duration: .01ms; }
  .guide, .mood-layer, .video-layer, .prompt-layer { transition: none; }
}
