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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: #13241f;
  color: #f3ead8;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
}

#scene {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(to bottom, #1d3a33 0%, #2b4f45 42%, #2b4f45 58%, #1d3a33 100%);
  background-size: cover;
  background-position: center;
}

#scene.custom-river #river {
  display: none;
}

#river {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#mist {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 38% 55% at var(--vp-x, 4%) var(--vp-y, 46%),
    rgba(225, 236, 238, 0.85) 0%,
    rgba(225, 236, 238, 0.35) 45%,
    rgba(225, 236, 238, 0) 100%
  );
}

#ripples,
#icons,
#bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ripple {
  position: absolute;
  left: 0;
  top: 0;
  width: 3.2em;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.45);
  opacity: 0;
}

.icon {
  position: absolute;
  width: var(--icon-size, 48px);
  height: var(--icon-size, 48px);
  object-fit: contain;
}

.icon.me {
  filter: drop-shadow(0 0 0.35em rgba(255, 236, 170, 0.95));
  animation: me-glow 3.5s ease-in-out infinite;
}

@keyframes me-glow {
  50% { filter: drop-shadow(0 0 0.7em rgba(255, 236, 170, 0.75)); }
}

.bubble {
  position: absolute;
  left: 0;
  top: 0;
  max-width: min(16em, 60vw);
  padding: 0.6em 0.9em;
  border-radius: 1.2em;
  background: rgba(255, 255, 255, 0.9);
  color: #1d3a33;
  font-size: clamp(13px, 1.1vmin + 8px, 18px);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 0.3em 1.2em rgba(0, 0, 0, 0.25);
  will-change: transform, opacity;
  opacity: 0;
}

.bubble::after {
  content: "";
  position: absolute;
  right: 0.6em;
  bottom: -0.55em;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: inherit;
}

#status {
  position: absolute;
  top: 0.8em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3em 0.9em;
  border-radius: 1em;
  background: rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
}

#release-form {
  display: flex;
  gap: 0.5em;
  padding: 0.75em max(1em, env(safe-area-inset-left)) calc(0.75em + env(safe-area-inset-bottom));
  background: #13241f;
}

#thought {
  flex: 1;
  min-width: 0;
  padding: 0.7em 1em;
  border: 1px solid #3f6b5e;
  border-radius: 999px;
  background: #1d3a33;
  color: inherit;
  font: inherit;
  font-size: 16px;
}

#thought::placeholder {
  color: #9bb5ab;
}

#release-form button {
  padding: 0.7em 1.3em;
  border: 0;
  border-radius: 999px;
  background: #6ea3bd;
  color: #13241f;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

#thought:disabled,
#release-form button:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  #ripples {
    display: none;
  }
  .icon.me {
    animation: none;
  }
}
