* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  overscroll-behavior-y: contain;
  overscroll-behavior: none;
  height: 100%;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

body {
  background-color: var(--paper-bg);
  color: var(--ink-primary);
  font-family: var(--active-font);
  font-size: 17px;
  line-height: 1.55;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  background-image: 
    radial-gradient(var(--paper-subtle) 15%, transparent 16%),
    radial-gradient(var(--paper-subtle) 15%, transparent 16%);
  background-size: 60px 60px;
  background-position: 0 0, 30px 30px;
  animation: bodyPatternBreath 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  padding-bottom: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.demo-mode-on {
  padding-bottom: 0;
}

/* Ambient Breathing Background (Calm Zen Rhythm: ~12s cycle) */
.ambient-breathing-aura {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Primary Center Light Halo */
.ambient-breathing-aura::before {
  content: '';
  position: absolute;
  top: -25%;
  left: -25%;
  width: 150%;
  height: 150%;
  background: radial-gradient(
    ellipse at 50% 42%,
    rgba(255, 252, 245, 0.95) 0%,
    rgba(247, 238, 222, 0.7) 35%,
    rgba(236, 222, 202, 0.35) 65%,
    transparent 100%
  );
  animation: ambientBreathPrimary 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: transform, opacity;
}

/* Soft Outer Vignette & Secondary Atmosphere Pulse */
.ambient-breathing-aura::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(
      circle at 20% 25%,
      rgba(255, 245, 228, 0.65) 0%,
      rgba(245, 232, 212, 0.3) 45%,
      transparent 75%
    ),
    radial-gradient(
      circle at 80% 75%,
      rgba(238, 218, 195, 0.55) 0%,
      rgba(228, 206, 180, 0.2) 40%,
      transparent 70%
    ),
    radial-gradient(
      circle at 50% 50%,
      transparent 45%,
      rgba(205, 190, 170, 0.2) 100%
    );
  animation: ambientBreathSecondary 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: transform, opacity;
}

/* Floating Organic Orbs for Organic Depth */
.aura-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  will-change: transform, opacity;
}

.aura-orb-1 {
  top: -5%;
  left: 10%;
  width: 50vw;
  height: 50vw;
  max-width: 600px;
  max-height: 600px;
  background: radial-gradient(circle, rgba(255, 248, 236, 0.85) 0%, rgba(246, 233, 212, 0.35) 60%, transparent 100%);
  animation: orbBreath1 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.aura-orb-2 {
  bottom: -5%;
  right: 5%;
  width: 55vw;
  height: 55vw;
  max-width: 650px;
  max-height: 650px;
  background: radial-gradient(circle, rgba(242, 222, 198, 0.75) 0%, rgba(230, 206, 180, 0.25) 60%, transparent 100%);
  animation: orbBreath2 12s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Meditative Breathing Keyframes (12s Cycle: Inhale ~4.5s, Hold ~1.5s, Exhale ~4.5s, Rest ~1.5s) */
@keyframes ambientBreathPrimary {
  0% {
    transform: scale(0.92) translate3d(0, 0, 0);
    opacity: 0.35;
  }
  38% {
    transform: scale(1.12) translate3d(0, -12px, 0);
    opacity: 0.95;
  }
  50% {
    transform: scale(1.12) translate3d(0, -12px, 0);
    opacity: 0.95;
  }
  88% {
    transform: scale(0.92) translate3d(0, 0, 0);
    opacity: 0.35;
  }
  100% {
    transform: scale(0.92) translate3d(0, 0, 0);
    opacity: 0.35;
  }
}

@keyframes ambientBreathSecondary {
  0% {
    transform: scale(0.95) rotate(0deg);
    opacity: 0.3;
  }
  40% {
    transform: scale(1.10) rotate(2deg);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.10) rotate(2deg);
    opacity: 0.85;
  }
  90% {
    transform: scale(0.95) rotate(0deg);
    opacity: 0.3;
  }
  100% {
    transform: scale(0.95) rotate(0deg);
    opacity: 0.3;
  }
}

@keyframes orbBreath1 {
  0%, 100% {
    transform: scale(0.85) translate3d(0, 0, 0);
    opacity: 0.25;
  }
  42%, 52% {
    transform: scale(1.18) translate3d(25px, -18px, 0);
    opacity: 0.9;
  }
}

@keyframes orbBreath2 {
  0%, 100% {
    transform: scale(1.15) translate3d(0, 0, 0);
    opacity: 0.8;
  }
  42%, 52% {
    transform: scale(0.88) translate3d(-20px, 12px, 0);
    opacity: 0.3;
  }
}

@keyframes bodyPatternBreath {
  0%, 100% {
    background-position: 0 0, 30px 30px;
    opacity: 0.85;
  }
  42%, 52% {
    background-position: 3px 3px, 33px 33px;
    opacity: 1;
  }
}
