:root {
  --ink: #0a0f14;
  --mist: #1a2535;
  --presence: #2e4a5f;
  --text: #e8eef4;
  --line: #2c3e50;
  --quiet: #4a6080;
  --entry-duration: 4s;
  --serif-cn: "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --sans-cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overflow-x: hidden;
  background: var(--ink);
}

body {
  color: var(--text);
  font-family: var(--sans-cn);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app {
  position: relative;
  width: 100%;
  max-width: 100vw;
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #000;
}

.world {
  position: absolute;
  inset: -10%;
  z-index: 0;
  opacity: 0;
  overflow: hidden;
  transform: scale(calc(1 + var(--approach-progress, 0) * 0.055));
  transform-origin: 50% 58%;
  transition: opacity var(--entry-duration) ease-out, transform 0.18s linear;
  will-change: opacity, transform;
}

.is-world .world {
  opacity: 1;
}

.world__motion {
  position: absolute;
  inset: 0;
  transform: scale(1);
  transform-origin: 50% 58%;
  transition: transform 3.2s cubic-bezier(0.42, 0, 0.58, 1);
  will-change: transform;
}

.is-haba-inhale .world__motion {
  transform: scale(0.97);
  transition-duration: 4.2s;
  transition-timing-function: cubic-bezier(0.3, 0, 0.35, 1);
}

.is-haba-hold .world__motion {
  transform: scale(0.97);
  transition-duration: 0.7s;
  transition-timing-function: cubic-bezier(0.3, 0, 0.35, 1);
}

.is-haba-exhale .world__motion {
  animation: haba-exhale-world 4s cubic-bezier(0.35, 0, 0.3, 1) both;
}

.world__motion::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle at 50% 57%, transparent 0%, transparent 9%, rgba(2, 5, 8, 0.28) 27%, rgba(1, 3, 5, 0.96) 61%, #000 100%);
  opacity: 1;
  transition: opacity 5s ease;
  pointer-events: none;
}

.is-world .world__motion::after {
  opacity: 0.18;
}

.world__sky,
.world__glow,
.world__ground,
.world__grain,
.world__fog {
  position: absolute;
}

.world__sky {
  inset: 0;
  background:
    radial-gradient(ellipse 74% 56% at 52% 62%, rgba(67, 92, 111, 0.31) 0%, rgba(30, 46, 59, 0.18) 37%, transparent 72%),
    radial-gradient(ellipse 110% 52% at 50% 111%, rgba(51, 72, 86, 0.22) 0%, transparent 64%),
    linear-gradient(180deg, #060a0e 0%, #0a0f14 48%, #0e1720 76%, #090e13 100%);
}

.world__glow {
  top: 30%;
  left: 50%;
  width: min(72vw, 980px);
  aspect-ratio: 1.7;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(153, 181, 198, 0.13) 0%, rgba(95, 126, 147, 0.058) 40%, transparent 72%);
  filter: blur(36px);
  opacity: 0.72;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 4s ease, transform 4.2s cubic-bezier(0.3, 0, 0.35, 1);
}

.is-haba-inhale .world__glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.14);
}

.is-haba-hold .world__glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.14);
}

.is-haba-exhale .world__glow {
  opacity: 0.76;
  transform: translate(-50%, -50%) scale(1);
}

.world__fog {
  left: -18%;
  width: 136%;
  height: 35%;
  border-radius: 50%;
  filter: blur(52px);
  mix-blend-mode: screen;
  will-change: transform;
}

.world__fog--far {
  top: 39%;
  opacity: 0.3;
  background: linear-gradient(90deg, transparent 2%, rgba(26, 37, 53, 0.3) 28%, rgba(52, 70, 84, 0.34) 52%, rgba(26, 37, 53, 0.24) 76%, transparent 100%);
  animation: fog-drift-far 34s ease-in-out infinite alternate;
}

.world__fog--middle {
  top: 49%;
  height: 40%;
  opacity: 0.34;
  background: linear-gradient(90deg, transparent 0%, rgba(31, 48, 64, 0.38) 22%, rgba(55, 72, 85, 0.28) 48%, rgba(30, 43, 57, 0.4) 78%, transparent 100%);
  animation: fog-drift-middle 26s ease-in-out infinite alternate;
}

.world__fog--near {
  top: 62%;
  height: 42%;
  opacity: 0.36;
  background: linear-gradient(90deg, transparent 0%, rgba(20, 31, 43, 0.62) 24%, rgba(41, 55, 68, 0.28) 55%, rgba(18, 29, 41, 0.7) 82%, transparent 100%);
  animation: fog-drift-near 21s ease-in-out infinite alternate;
}

.world__ground {
  right: -8%;
  bottom: -8%;
  left: -8%;
  height: 43%;
  opacity: 0.8;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(69, 83, 87, 0.23) 0%, rgba(29, 43, 50, 0.3) 38%, rgba(9, 15, 19, 0.95) 83%),
    repeating-linear-gradient(101deg, rgba(111, 129, 129, 0.028) 0 1px, transparent 1px 8px);
  filter: blur(7px);
  transform: perspective(440px) rotateX(62deg) scale(1.14);
  transform-origin: 50% 0%;
}

.world__grain {
  inset: -35%;
  background-image: url("./assets/grain.svg");
  background-size: 180px 180px;
  opacity: 0.2;
  mix-blend-mode: soft-light;
  animation: grain-shift 7s steps(2, end) infinite;
  pointer-events: none;
}

.presence {
  --presence-scale: 0.98;
  --presence-x: 0px;
  --presence-breath-y: 0px;
  --presence-breath-scale: 1;
  --presence-rotate: 0deg;
  position: absolute;
  top: 49%;
  left: 50%;
  z-index: 3;
  width: clamp(190px, 24vw, 310px);
  opacity: 0;
  filter: blur(8px) saturate(0.78);
  transform: translate(calc(-50% + var(--presence-x)), calc(-48% + var(--presence-breath-y))) rotate(var(--presence-rotate)) scale(calc(var(--presence-scale) * var(--presence-breath-scale)));
  transform-origin: 50% 78%;
  transition: opacity 3s ease-out, filter 8s ease, transform 0.18s linear;
  pointer-events: none;
  will-change: opacity, transform;
}

.is-presence .presence {
  --presence-scale: calc(1 + var(--approach-progress, 0) * 0.44);
  opacity: 0.75;
}

.is-looking .presence {
  filter: blur(7.5px) saturate(0.82) drop-shadow(0 0 34px rgba(190, 216, 230, 0.08));
}

.is-listening .presence {
  --presence-x: 8px;
  --presence-rotate: 1.2deg;
  opacity: 0.8;
}

.is-haba-inhale .presence {
  --presence-breath-y: -14px;
  --presence-breath-scale: 1.026;
  filter: blur(7.4px) saturate(0.88) drop-shadow(0 0 36px rgba(196, 221, 234, 0.12));
  transition: opacity 3s ease-out, filter 4s ease, transform 4.2s cubic-bezier(0.3, 0, 0.35, 1);
}

.is-haba-hold .presence {
  --presence-breath-y: -14px;
  --presence-breath-scale: 1.026;
  filter: blur(7.4px) saturate(0.88) drop-shadow(0 0 36px rgba(196, 221, 234, 0.12));
  transition: opacity 3s ease-out, filter 1.2s ease, transform 0.7s cubic-bezier(0.3, 0, 0.35, 1);
}

.is-haba-exhale .presence {
  --presence-breath-y: 0px;
  --presence-breath-scale: 1;
  filter: blur(8px) saturate(0.8) drop-shadow(0 0 18px rgba(175, 204, 220, 0.05));
  transition: opacity 3s ease-out, filter 4s ease, transform 4s cubic-bezier(0.35, 0, 0.3, 1);
}

.presence__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 20px 56px rgba(4, 10, 15, 0.72));
}

.presence__halo {
  opacity: 0.68;
  transition: opacity 3s ease;
}

.is-looking .presence__halo {
  opacity: 0.94;
}

.is-haba-inhale .presence__halo {
  opacity: 0.98;
  transition-duration: 4.2s;
}

.is-haba-hold .presence__halo {
  opacity: 0.98;
  transition-duration: 0.7s;
}

.is-haba-exhale .presence__halo {
  opacity: 0.68;
  transition-duration: 4s;
}

.presence__figure {
  transform-box: fill-box;
  transform-origin: 50% 94%;
  animation: presence-breathe 9s ease-in-out infinite;
}

.is-haba .presence__figure {
  animation: none;
}

.presence__leg,
.presence__arm {
  transform-box: fill-box;
}

.presence__leg {
  transform-origin: 50% 0%;
}

.presence__arm {
  transform-origin: 50% 5%;
}

.is-walking .presence__figure {
  animation: walk-body 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.is-walking .presence__leg--left {
  animation: walk-leg-left 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.is-walking .presence__leg--right {
  animation: walk-leg-right 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.is-walking .presence__arm--left {
  animation: walk-arm-left 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.is-walking .presence__arm--right {
  animation: walk-arm-right 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.presence__head {
  transform: translateY(4px) rotate(1.5deg);
  transform-box: view-box;
  transform-origin: 130px 140px;
  transition: transform 3s cubic-bezier(0.42, 0, 0.58, 1);
}

.is-looking .presence__head {
  transform: translateY(-4px) rotate(-7deg);
}

.is-listening.is-looking .presence__head {
  transform: translate(4px, -4px) rotate(-5deg);
}

.presence__inner-light {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 4s ease;
}

.is-haba-inhale .presence__inner-light {
  opacity: 0.042;
}

.is-haba-hold .presence__inner-light {
  opacity: 0.042;
  transition-duration: 1.2s;
}

.is-haba-exhale .presence__inner-light {
  opacity: 0;
  transition-duration: 4s;
}

.is-light .presence__inner-light {
  animation: inner-light 1s ease-in-out both;
}

.presence__face {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.is-face .presence__face {
  animation: face-flash 0.8s ease-in-out both;
}

.sound-toggle {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 10px;
  border: 1px solid rgba(139, 166, 184, 0.42);
  border-radius: 999px;
  outline: none;
  background: rgba(10, 15, 20, 0.42);
  color: #b9cbd8;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 10px rgba(2, 6, 10, 0.8);
  box-shadow: inset 0 0 18px rgba(118, 151, 173, 0.05), 0 4px 22px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transition: opacity 1.2s ease, color 0.5s ease, border-color 0.5s ease, background-color 0.5s ease;
}

.is-world .sound-toggle:not(.is-dismissed) {
  opacity: 0.86;
  pointer-events: auto;
}

.is-world .sound-toggle:hover,
.is-world .sound-toggle:focus-visible {
  color: #e2edf4;
  border-color: rgba(176, 202, 218, 0.7);
  background: rgba(28, 42, 54, 0.58);
  opacity: 1;
}

.sound-toggle:focus-visible {
  outline: 1px solid rgba(125, 149, 173, 0.42);
  outline-offset: 4px;
}

.sound-toggle.is-on {
  color: rgba(191, 214, 227, 0.82);
  opacity: 0.78 !important;
  pointer-events: none;
}

.sound-toggle.has-error {
  color: #e2c3a8;
  border-color: rgba(226, 195, 168, 0.56);
  background: rgba(42, 30, 24, 0.62);
  opacity: 0.94 !important;
}

.sound-toggle.is-dismissed {
  opacity: 0 !important;
  pointer-events: none;
}

.sound-toggle__mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #91adc0;
  box-shadow: 0 0 0 0 rgba(156, 181, 200, 0);
  transition: background-color 0.5s ease, box-shadow 0.8s ease, transform 0.8s ease;
}

.sound-toggle.is-on .sound-toggle__mark {
  background: #d6e5ed;
  box-shadow: 0 0 16px rgba(190, 217, 231, 0.48);
  transform: scale(1.08);
}

.approach-button {
  position: absolute;
  bottom: clamp(30px, 7vh, 68px);
  left: 50%;
  z-index: 19;
  min-width: 142px;
  padding: 12px 22px;
  border: 1px solid rgba(139, 166, 184, 0.48);
  border-radius: 999px;
  outline: none;
  background: rgba(10, 15, 20, 0.54);
  color: #d8e4eb;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transform: translateX(-50%) scale(1);
  box-shadow: inset 0 0 22px rgba(123, 156, 178, 0.07), 0 8px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  touch-action: none;
  transition: opacity 0.8s ease, color 0.35s ease, border-color 0.35s ease, background-color 0.35s ease, transform 0.16s ease;
}

.is-approach-ready .approach-button {
  opacity: 0.92;
  pointer-events: auto;
}

.is-approach-ready .approach-button:hover,
.is-approach-ready .approach-button:focus-visible {
  color: #f1f7fa;
  border-color: rgba(194, 216, 229, 0.76);
  background: rgba(30, 46, 58, 0.72);
}

.approach-button:focus-visible {
  outline: 1px solid rgba(194, 216, 229, 0.54);
  outline-offset: 5px;
}

.approach-button.is-pressed {
  background: rgba(45, 65, 79, 0.78);
  border-color: rgba(204, 224, 235, 0.84);
  transform: translateX(-50%) scale(0.975);
}

.approach-button.is-complete {
  color: rgba(199, 219, 230, 0.68);
  border-color: rgba(139, 166, 184, 0.26);
  opacity: 0.54;
  pointer-events: none;
}

.approach-button.is-dismissed {
  opacity: 0 !important;
  pointer-events: none;
}

.skip {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 20;
  padding: 8px 5px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transition: opacity 1.6s ease, color 0.5s ease;
}

.can-skip .skip {
  opacity: 0.3;
  pointer-events: auto;
}

.can-skip .skip:hover,
.can-skip .skip:focus-visible {
  color: #7d95ad;
  opacity: 0.72;
}

.can-skip .skip:focus-visible {
  outline: 1px solid rgba(125, 149, 173, 0.42);
  outline-offset: 5px;
}

.entry-copy {
  position: absolute;
  bottom: 28%;
  left: 50%;
  z-index: 6;
  width: min(92vw, 840px);
  opacity: 0;
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 0.8s ease;
  pointer-events: none;
}

.entry-copy__phrase {
  margin: 0;
  color: var(--text);
  font-family: var(--serif-cn);
  font-size: clamp(21px, 2.05vw, 32px);
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.55;
  opacity: 0;
  transform: translateY(8px);
  text-shadow: 0 2px 28px rgba(3, 8, 12, 0.8);
  will-change: opacity, transform;
}

.entry-copy__phrase.haba-float-in {
  opacity: 1;
  transform: translateY(0);
}

.is-haba .entry-copy {
  opacity: 1;
}

.composer {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 12;
  width: min(86vw, 620px);
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 1s ease, bottom 1s ease;
  pointer-events: none;
}

.can-speak .composer {
  opacity: 1;
  pointer-events: auto;
}

.composer__form {
  display: grid;
  min-width: 0;
  grid-template-columns: 46px minmax(0, 1fr);
  grid-template-areas:
    "voice input"
    "status status";
  gap: 8px 10px;
  width: 100%;
  align-items: center;
}

.voice-button {
  position: relative;
  grid-area: voice;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(134, 164, 184, 0.58);
  border-radius: 50%;
  outline: none;
  background: rgba(18, 30, 40, 0.72);
  color: #c4d7e3;
  cursor: pointer;
  box-shadow: inset 0 0 18px rgba(101, 139, 163, 0.08), 0 5px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 0.35s ease, border-color 0.35s ease, background-color 0.35s ease, transform 0.2s ease;
}

.voice-button svg {
  width: 19px;
  height: 19px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-button:hover,
.voice-button:focus-visible {
  color: #eef6fa;
  border-color: rgba(188, 213, 227, 0.86);
  background: rgba(31, 49, 63, 0.82);
}

.voice-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.voice-button.is-recording {
  color: #f5e9e5;
  border-color: rgba(195, 104, 91, 0.8);
  background: rgba(91, 38, 34, 0.82);
}

.voice-button.is-speaking {
  color: #eaf5f1;
  border-color: rgba(129, 184, 159, 0.82);
  background: rgba(26, 66, 53, 0.82);
}

.voice-button__pulse {
  position: absolute;
  inset: -5px;
  border: 1px solid transparent;
  border-radius: 50%;
  pointer-events: none;
}

.voice-button.is-recording .voice-button__pulse {
  border-color: rgba(205, 116, 101, 0.45);
  animation: voice-pulse 1.45s ease-out infinite;
}

.voice-button.is-speaking .voice-button__pulse {
  border-color: rgba(129, 184, 159, 0.42);
  animation: voice-pulse 1.8s ease-out infinite;
}

.voice-status {
  grid-area: status;
  min-height: 18px;
  margin: 0;
  padding-left: 3px;
  color: rgba(155, 181, 198, 0.76);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.05em;
}

.voice-status.is-error {
  color: #dca894;
}

.composer__input {
  grid-area: input;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  max-height: 148px;
  padding: 14px 19px 13px;
  resize: none;
  overflow-y: auto;
  border: 1px solid rgba(44, 62, 80, 0.82);
  border-radius: 2px;
  outline: none;
  background: rgba(10, 15, 20, 0.34);
  color: rgba(232, 238, 244, 0.94);
  caret-color: #9cb2c4;
  font-family: var(--serif-cn);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 16px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.8s ease, background-color 0.8s ease, box-shadow 0.8s ease;
}

.composer__input::placeholder {
  color: var(--quiet);
  opacity: 0.92;
}

.composer__input:focus {
  border-color: rgba(74, 96, 128, 0.96);
  background: rgba(10, 15, 20, 0.44);
  box-shadow: inset 0 1px 20px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(56, 76, 97, 0.12);
}

.composer.is-submitting {
  opacity: 0.58;
}

.permission-guide {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 11, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.permission-guide__card {
  width: min(100%, 390px);
  padding: 24px 22px 20px;
  border: 1px solid rgba(126, 156, 177, 0.54);
  border-radius: 6px;
  background: rgba(12, 20, 28, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  color: var(--text);
}

.permission-guide__eyebrow {
  margin: 0 0 10px;
  color: rgba(131, 165, 187, 0.76);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.permission-guide h2 {
  margin: 0;
  font-family: var(--serif-cn);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.permission-guide__body {
  margin: 14px 0 20px;
  color: rgba(218, 229, 237, 0.78);
  font-size: 14px;
  line-height: 1.8;
}

.permission-guide__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.permission-guide button {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 3px;
  cursor: pointer;
}

.permission-guide__retry {
  border: 1px solid rgba(147, 180, 201, 0.62);
  background: rgba(39, 62, 78, 0.86);
  color: #edf5f9;
}

.permission-guide__later {
  border: 1px solid transparent;
  background: transparent;
  color: rgba(154, 179, 195, 0.78);
}

.conversation {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}

.conversation__messages {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(84vw, 690px);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(70px, 9vh, 96px) 0 150px;
}

.message {
  max-width: 88%;
  margin: 0;
  color: rgba(232, 238, 244, 0.82);
  font-family: var(--serif-cn);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.8;
  letter-spacing: 0.055em;
  overflow-wrap: anywhere;
  word-break: break-word;
  opacity: 0;
  transform: translateY(8px);
  animation: message-in 0.9s ease forwards;
  text-shadow: 0 2px 22px rgba(2, 7, 11, 0.72);
}

.message--user {
  align-self: flex-end;
  color: rgba(218, 228, 235, 0.68);
  text-align: right;
}

.message--coach {
  align-self: flex-start;
}

.message--pending {
  color: rgba(164, 182, 195, 0.6);
}

.understanding-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin-top: 4px;
  padding: 20px;
  border: 1px solid rgba(85, 111, 131, 0.48);
  border-radius: 4px;
  background: rgba(8, 14, 20, 0.66);
  box-shadow: inset 0 1px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

.understanding-panel__intro {
  margin: 0 0 2px;
  color: rgba(221, 232, 239, 0.86);
  font-family: var(--serif-cn);
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: 0.04em;
}

.understanding-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 15px 15px;
  border: 1px solid rgba(63, 84, 101, 0.52);
  border-radius: 3px;
  background: rgba(13, 21, 29, 0.64);
  transition: border-color 0.6s ease, background-color 0.6s ease;
}

.understanding-card.is-confirmed {
  border-color: rgba(119, 157, 146, 0.58);
  background: rgba(13, 27, 29, 0.62);
}

.understanding-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.understanding-card h3 {
  margin: 0;
  color: rgba(206, 220, 229, 0.82);
  font-family: var(--sans-cn);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.understanding-card button {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: rgba(139, 170, 190, 0.82);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.understanding-card button:hover,
.understanding-card button:focus-visible {
  color: #e0edf4;
}

.understanding-card button:disabled {
  color: rgba(137, 181, 164, 0.84);
  cursor: default;
}

.understanding-card textarea {
  width: 100%;
  min-width: 0;
  min-height: 76px;
  padding: 0;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: rgba(237, 243, 247, 0.9);
  font-family: var(--serif-cn);
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: 0.035em;
}

.understanding-panel__done {
  max-height: 0;
  margin: 0;
  overflow: hidden;
  color: rgba(171, 207, 191, 0.86);
  font-family: var(--serif-cn);
  font-size: 14px;
  line-height: 1.65;
  opacity: 0;
  transition: max-height 0.8s ease, opacity 0.8s ease, margin 0.8s ease;
}

.understanding-panel__done.is-visible {
  max-height: 80px;
  margin-top: 4px;
  opacity: 1;
}

.is-conversing .conversation {
  opacity: 1;
  pointer-events: auto;
}

.is-conversing .entry-copy {
  opacity: 0;
}

.is-conversing .world {
  opacity: 0.56;
  transform: scale(1.07);
}

.is-conversing .world__motion {
  animation: none;
  transform: scale(1);
}

.is-conversing .presence {
  opacity: 0.42;
  filter: blur(10px) saturate(0.66);
}

.is-conversing .composer {
  bottom: max(22px, env(safe-area-inset-bottom));
}

@keyframes fog-drift-far {
  from { transform: translate3d(-2%, 0.5%, 0) scale(1.01); }
  to { transform: translate3d(3%, -1.2%, 0) scale(1.07); }
}

@keyframes fog-drift-middle {
  from { transform: translate3d(2%, -0.6%, 0) scale(1.05); }
  to { transform: translate3d(-3%, 1%, 0) scale(1); }
}

@keyframes fog-drift-near {
  from { transform: translate3d(-3%, 1%, 0) scale(1.02); }
  to { transform: translate3d(3%, -0.4%, 0) scale(1.08); }
}

@keyframes grain-shift {
  0% { transform: translate3d(-1.5%, -1%, 0); }
  25% { transform: translate3d(1%, -0.5%, 0); }
  50% { transform: translate3d(-0.5%, 1%, 0); }
  75% { transform: translate3d(1.5%, 0.5%, 0); }
  100% { transform: translate3d(-1.5%, -1%, 0); }
}

@keyframes presence-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-0.55%) scale(1.012); }
}

@keyframes inner-light {
  0% { opacity: 0; }
  48% { opacity: 0.15; }
  100% { opacity: 0; }
}

@keyframes face-flash {
  0% { opacity: 0; transform: scale(0.985); }
  35% { opacity: 0.08; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.012); }
}

@keyframes walk-body {
  0%, 50%, 100% { transform: translateY(0) scale(1); }
  25%, 75% { transform: translateY(-1.2%) scale(1.008); }
}

@keyframes walk-leg-left {
  0%, 50%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-16px) rotate(-4.5deg); }
  75% { transform: translateY(0) rotate(1.8deg); }
}

@keyframes walk-leg-right {
  0%, 50%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(0) rotate(-1.8deg); }
  75% { transform: translateY(-16px) rotate(4.5deg); }
}

@keyframes walk-arm-left {
  0%, 50%, 100% { transform: rotate(0deg); }
  25% { transform: translateY(-1px) rotate(-8deg); }
  75% { transform: translateY(1px) rotate(8deg); }
}

@keyframes walk-arm-right {
  0%, 50%, 100% { transform: rotate(0deg); }
  25% { transform: translateY(-1px) rotate(-8deg); }
  75% { transform: translateY(1px) rotate(8deg); }
}

@keyframes haba-exhale-world {
  0% { transform: scale(1.018); }
  62% { transform: scale(1.002); }
  100% { transform: scale(1); }
}

@keyframes voice-pulse {
  0% { transform: scale(0.92); opacity: 0.7; }
  70%, 100% { transform: scale(1.18); opacity: 0; }
}

@keyframes message-in {
  to { opacity: 1; transform: translateY(0); }
}

.is-skipping .world,
.is-skipping .world__motion,
.is-skipping .presence,
.is-skipping .entry-copy,
.is-skipping .composer,
.is-skipping .sound-toggle,
.is-skipping .approach-button,
.is-skipping .skip {
  transition-duration: 0.7s !important;
}

.is-skipping .world__motion {
  animation-duration: 0.7s !important;
}

.motion-reduced .world__fog,
.motion-reduced .world__grain,
.motion-reduced .presence__figure {
  animation: none !important;
}

@media (max-width: 720px) {
  .permission-guide {
    padding: 18px;
  }

  .permission-guide__card {
    padding: 21px 18px 17px;
  }

  .permission-guide h2 {
    font-size: 20px;
  }

  .permission-guide__actions {
    flex-direction: column-reverse;
  }

  .permission-guide button {
    width: 100%;
  }

  .world {
    inset: -22%;
  }

  .presence {
    top: 48%;
    width: clamp(190px, 53vw, 265px);
  }

  .world__fog {
    height: 31%;
    filter: blur(44px);
  }

  .entry-copy {
    bottom: 31%;
    width: calc(100% - 32px);
  }

  .entry-copy__phrase {
    font-size: clamp(20px, 5.6vw, 25px);
    letter-spacing: 0.1em;
  }

  .composer {
    right: 14px;
    left: 14px;
    width: auto;
    max-width: none;
    bottom: max(20px, env(safe-area-inset-bottom));
    transform: none;
  }

  .composer__form {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 7px 8px;
  }

  .voice-button {
    width: 42px;
    height: 42px;
  }

  .composer__input {
    min-height: 46px;
    padding: 12px 14px 11px;
    font-size: 15px;
  }

  .voice-status {
    font-size: 10px;
  }

  .sound-toggle {
    top: max(14px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
  }

  .approach-button {
    bottom: max(24px, env(safe-area-inset-bottom));
    min-width: 132px;
    padding: 11px 19px;
    font-size: 12px;
  }

  .skip {
    top: max(14px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }

  .conversation__messages {
    width: calc(100% - 28px);
    max-width: none;
    padding-top: 88px;
    padding-bottom: 128px;
  }

  .understanding-panel {
    gap: 11px;
    padding: 14px;
  }

  .understanding-card {
    padding: 12px;
  }

  .understanding-card h3 {
    font-size: 11px;
  }

  .understanding-card textarea {
    min-height: 86px;
    font-size: 14px;
  }
}

@media (max-height: 690px) {
  .presence {
    top: 46%;
    width: clamp(170px, 20vw, 245px);
  }

  .entry-copy {
    bottom: 27%;
  }

  .conversation__messages {
    padding-bottom: 105px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .presence {
    top: 48%;
    width: clamp(150px, 23vw, 220px);
  }

  .entry-copy {
    bottom: 27%;
  }

  .entry-copy__phrase {
    font-size: clamp(18px, 3vw, 23px);
  }

  .composer {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(72vw, 540px);
  }

  .conversation__messages {
    width: min(72vw, 620px);
    padding-bottom: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .world__motion,
  .world__fog,
  .world__grain,
  .presence__figure {
    animation: none !important;
  }

  .motion-reduced .world__motion {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .is-walking .presence__figure,
  .is-walking .presence__leg,
  .is-walking .presence__arm {
    animation-duration: 0.01ms !important;
  }
}
