:root {
  --user-body-size: 22px;
  --user-heading-size: 30px;
  --main-button-height: 72px;
  --bg: #f7f8f5;
  --panel: #ffffff;
  --text: #24312b;
  --muted: #5b6860;
  --line: #d9dfd6;
  --green: #2f6f55;
  --green-soft: #e8f2ec;
  --yellow: #f2c15c;
  --blue-soft: #e8f0f5;
  --pink-soft: #f6ecec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--user-body-size);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.user-voice-meter {
  position: fixed;
  top: max(2px, env(safe-area-inset-top));
  left: 50%;
  z-index: 60;
  width: min(calc(100vw - 24px), 496px);
  min-height: 28px;
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid rgba(31, 83, 62, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(24, 36, 48, 0.08);
  transform: translateX(-50%);
  pointer-events: none;
}

.user-voice-meter[hidden] {
  display: none;
}

.user-voice-label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 15px;
  line-height: 1;
  color: #2f6f55;
  white-space: nowrap;
}

.user-voice-level {
  display: grid;
  grid-template-columns: repeat(12, minmax(12px, 1fr));
  gap: 3px;
  height: 14px;
  align-items: center;
  justify-content: center;
}

[data-user-voice-bar] {
  display: block;
  height: 14px;
  border-radius: 3px;
  background: #d5ded8;
  box-shadow: inset 0 -1px 0 rgba(24, 36, 48, 0.08);
}

[data-user-voice-state="listening"] [data-user-voice-bar].active,
[data-user-voice-state="speaking"] [data-user-voice-bar].active {
  background: #1faa59;
}

[data-user-voice-state="idle"] {
  border-color: rgba(83, 95, 110, 0.22);
}

.startup-permission-panel {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 55;
  width: min(calc(100vw - 28px), 492px);
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(45, 106, 82, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 30px rgba(24, 36, 48, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
}

.startup-permission-panel[hidden] {
  display: none;
}

.startup-permission-panel strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.startup-permission-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.permission-panel-message {
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff8dc;
  color: #6e5420;
  pointer-events: auto;
}

.permission-status-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.permission-status-list span {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 2px solid rgba(83, 95, 110, 0.18);
  border-radius: 8px;
  background: #f5f7fa;
  color: #4a5565;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

[data-permission-state="granted"] {
  border-color: rgba(31, 170, 89, 0.38);
  background: #eafff1;
  color: #17673a;
}

[data-permission-state="denied"] {
  border-color: rgba(196, 64, 64, 0.34);
  background: #fff0f0;
  color: #8a2b2b;
}

.permission-request-again {
  min-height: 48px;
  font-size: 18px;
  font-weight: 900;
  pointer-events: auto;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.proactive-greeting-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin: 0 8px 8px;
}

[data-proactive-greeting-toggle] {
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid rgba(24, 36, 48, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 6px 14px rgba(24, 36, 48, 0.1);
}

[data-proactive-greeting-toggle][aria-pressed="false"] {
  border-color: rgba(83, 95, 110, 0.28);
  background: #f5f7fa;
  color: #4a5565;
}

.proactive-greeting-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.proactive-greeting-boundary {
  color: #695b35;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.profile-onboarding-panel {
  display: grid;
  gap: 10px;
  margin: 0 8px 12px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.profile-onboarding-panel[hidden] {
  display: none;
}

.profile-onboarding-copy {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}

.profile-onboarding-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-onboarding-actions .primary-button,
.profile-onboarding-actions .secondary-button {
  min-height: 64px;
}

.basic-profile-panel[hidden] {
  display: none;
}

.basic-profile-panel {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 2px solid var(--line);
}

.basic-profile-grid {
  display: grid;
  grid-template-columns: minmax(72px, 0.32fr) minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}

.basic-profile-voice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.screen.role-module-screen.active {
  display: grid;
}

.role-module-screen {
  position: relative;
  height: calc(100svh - 36px);
  min-height: calc(100svh - 36px);
  grid-template-rows: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.role-module-screen > .text-button {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  width: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 16px rgba(24, 36, 48, 0.16);
}

.role-module-scene {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: transparent;
}

.role-module-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.role-module-scene[data-module-bg="anan"] {
  background: transparent;
}

.role-module-scene[data-module-bg="kangkang"] {
  background: transparent;
}

.role-module-character,
.role-module-puppet {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: min(72vw, 330px);
  height: min(58svh, 520px);
  display: grid;
  place-items: end center;
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 22px rgba(24, 36, 48, 0.24));
  z-index: 2;
  pointer-events: auto;
}

.role-module-character {
  object-fit: contain;
  object-position: center bottom;
}

[data-local-listening-state="listening"] .role-module-character,
[data-local-listening-state="listening"] .role-stage {
  position: relative;
}

[data-local-listening-state="listening"] .role-module-character::after,
[data-local-listening-state="listening"] .role-stage::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 2px solid rgba(88, 166, 255, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.16);
  pointer-events: none;
  animation: roleListeningHalo 2.4s ease-in-out infinite;
}

.listening-status-indicator {
  display: none;
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 5;
  min-width: 112px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px solid rgba(24, 36, 48, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  box-shadow: 0 8px 18px rgba(24, 36, 48, 0.14);
  pointer-events: none;
}

[data-listening-status-note]::after {
  content: attr(data-listening-status-note);
  display: block;
  min-height: 0;
  margin-top: 3px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

[data-listening-status-note=""]::after {
  content: none;
}

.listening-dot {
  display: inline-block;
  opacity: 0.25;
  animation: listeningDotBlink 1.1s ease-in-out infinite;
}

.listening-dot.dot-two {
  animation-delay: 0.18s;
}

.listening-dot.dot-three {
  animation-delay: 0.36s;
}

[data-local-listening-state="off"] [data-listening-status],
[data-listening-status][hidden] {
  display: none;
}

[data-listening-status-state="listening"] {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-color: rgba(34, 139, 96, 0.32);
  background: rgba(238, 255, 247, 0.94);
}

[data-local-listening-state="sleeping"] [data-listening-status] {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-color: rgba(83, 95, 110, 0.28);
  background: rgba(245, 247, 250, 0.94);
}

[data-local-listening-state="wake-word-armed"] [data-listening-status] {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-color: rgba(64, 117, 204, 0.34);
  background: rgba(239, 246, 255, 0.95);
}

[data-listening-status-state="sleeping"] {
  color: #4a5565;
}

[data-listening-status-state="wake-word-armed"] {
  color: #244f93;
}

.voice-wake-control {
  display: grid;
  gap: 5px;
  margin: 8px 18px 0;
  padding: 0;
}

.voice-wake-toggle {
  min-height: 44px;
  border: 2px solid rgba(35, 83, 151, 0.22);
  border-radius: 8px;
  background: #f5f9ff;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.voice-wake-toggle[aria-pressed="true"] {
  border-color: rgba(34, 139, 96, 0.34);
  background: #effff7;
}

.voice-wake-status,
.voice-wake-boundary {
  display: block;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.role-module-puppet canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: contain;
  object-position: center bottom;
  background: transparent;
}

.role-module-puppet[data-loading-state="loading"] canvas {
  opacity: 0;
  transition: opacity 220ms ease;
}

.role-module-puppet[data-loading-state="ready"] canvas {
  opacity: 1;
  transition: opacity 220ms ease;
}

.role-module-title {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 3;
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 28px;
  line-height: 1.1;
}

.role-module-controls {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px 0 0;
  overflow-y: auto;
}

.role-module-document {
  display: none;
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.94);
}

.role-module-document:not([hidden]) {
  display: grid;
  align-content: start;
  gap: 12px;
}

.role-module-doc-card {
  padding: 14px;
  border: 2px solid rgba(45, 106, 82, 0.24);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(24, 36, 48, 0.08);
}

.role-module-doc-card h2 {
  margin-top: 0;
}

.role-module-doc-table {
  display: grid;
  gap: 8px;
}

.role-module-doc-table p {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid rgba(45, 106, 82, 0.14);
}

.role-module-doc-table p:last-child {
  border-bottom: 0;
}

.role-module-doc-table span {
  color: var(--muted);
}

.role-module-view-button {
  grid-column: 1 / -1;
  width: min(100%, 320px);
  min-height: 54px;
  justify-self: center;
  padding: 8px 12px;
  border: 2px solid #2d6a52;
  border-bottom-width: 5px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #edf7f1 100%);
  color: #225642;
  font-weight: 900;
  cursor: pointer;
}

.role-module-screen[data-view-mode="document"] {
  grid-template-rows: minmax(86px, 15svh) minmax(0, 1fr);
}

.role-module-screen[data-view-mode="document"] .role-module-scene {
  border-radius: 8px 8px 0 0;
}

.role-module-screen[data-view-mode="document"] .role-module-bg {
  filter: saturate(0.95) brightness(1.04);
}

.role-module-screen[data-view-mode="document"] .role-module-puppet {
  left: auto;
  right: 10px;
  bottom: 0;
  width: min(26vw, 104px);
  height: min(14svh, 110px);
  transform: none;
  filter: drop-shadow(0 8px 12px rgba(24, 36, 48, 0.2));
}

.role-module-screen[data-view-mode="document"] .role-module-title {
  left: 12px;
  bottom: 10px;
  max-width: calc(100% - 132px);
  font-size: 22px;
}

.role-module-screen[data-view-mode="document"] .role-module-document {
  display: grid;
}

.role-module-screen[data-view-mode="document"] .role-module-controls {
  display: none;
}

.role-module-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 58px repeat(2, 86px);
  align-content: center;
  gap: 12px 10px;
  padding: 14px 14px 10px;
}

.role-module-nav-button {
  width: min(100%, 152px);
  min-height: 0;
  height: 86px;
  margin: 0;
  justify-self: center;
  padding: 8px 6px 10px;
  border: 2px solid #2d6a52;
  border-bottom-width: 5px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 249, 244, 0.96) 48%, rgba(212, 235, 222, 0.98) 100%);
  color: #225642;
  font-weight: 900;
  font-size: 19px;
  line-height: 1.12;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.96),
    inset 0 -2px 0 rgba(49, 112, 86, 0.12),
    0 8px 0 rgba(31, 86, 62, 0.18),
    0 14px 20px rgba(24, 36, 48, 0.14);
  transform: translateY(0);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.role-module-nav-button:focus-visible,
.role-module-nav-button:hover {
  outline: 4px solid var(--green-soft);
}

.role-module-nav-button:active {
  border-bottom-width: 3px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(49, 112, 86, 0.18),
    0 3px 0 rgba(31, 86, 62, 0.2),
    0 8px 14px rgba(24, 36, 48, 0.12);
  transform: translateY(5px);
}

.memoir-starter-row,
.memoir-followup-row,
.health-consult-starter-row,
.health-consult-followup-row,
.document-reading-flow-grid,
.health-history-filter-row,
.health-trend-filter-row,
.record-history-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 14px 0;
}

.memoir-starter-row button,
.memoir-followup-row button,
.health-consult-starter-row button,
.health-consult-followup-row button,
.document-reading-flow-grid button,
.health-history-filter-row button,
.health-trend-filter-row button,
.record-history-choice-row button {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 7px 8px;
  border: 2px solid rgba(45, 106, 82, 0.26);
  border-radius: 8px;
  background: #fff;
  color: #225642;
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.health-history-filter-row,
.health-trend-filter-row,
.record-history-choice-row {
  padding: 0;
  margin: 14px 0;
}

.health-history-filter-row button,
.health-trend-filter-row button {
  min-height: 56px;
  font-size: 22px;
}

.health-history-filter-row button[aria-pressed="true"],
.health-trend-filter-row button[aria-pressed="true"] {
  border-color: #2f6fed;
  background: #eaf2ff;
  color: #143b7d;
}

.role-module-talk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 14px 0;
}

.role-module-talk input {
  min-width: 0;
  min-height: 58px;
  padding: 10px 12px;
  border: 2px solid rgba(45, 106, 82, 0.34);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 20px;
  line-height: 1.2;
}

.role-module-talk-submit,
.role-module-stt-button {
  min-height: 58px;
  padding: 8px 12px;
  border: 2px solid #2d6a52;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.12;
}

.role-module-stt-button {
  grid-column: 1 / 3;
  background: #fff;
  color: #225642;
}

.role-module-talk-status {
  grid-column: 1 / 3;
  min-height: 24px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}

.auth-scene {
  min-height: clamp(390px, 62svh, 540px);
  border-radius: 8px 8px 0 0;
}

.auth-character {
  bottom: -14px;
  width: min(82vw, 380px);
  height: min(48svh, 390px);
}

.kangkang-module-character {
  width: min(78vw, 360px);
}

.auth-controls {
  padding-top: 10px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.auth-speech-bubble {
  position: absolute;
  left: 50%;
  min-height: 42px;
  padding: 9px 13px;
  border: 2px solid rgba(207, 130, 54, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  box-shadow: 0 8px 24px rgba(77, 67, 48, 0.12);
  pointer-events: none;
  animation: role-bubble-in 0.28s ease forwards;
}

.auth-speech-bubble {
  top: clamp(16px, 5svh, 44px);
  width: min(84vw, 330px);
  max-width: min(84vw, 330px);
  transform: translate(-50%, -4px);
  z-index: 8;
}

.auth-speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 16px;
  height: 16px;
  border-right: 2px solid rgba(207, 130, 54, 0.52);
  border-bottom: 2px solid rgba(207, 130, 54, 0.52);
  background: rgba(255, 255, 255, 0.92);
  transform: translateX(-50%) rotate(45deg);
}

.auth-speech-bubble.hiding {
  animation: role-bubble-out 0.46s ease forwards;
}

.role-module-speech-bubble {
  position: absolute;
  left: 50%;
  top: clamp(18px, 5svh, 48px);
  z-index: 8;
  width: min(84vw, 330px);
  max-width: min(84vw, 330px);
  min-height: 42px;
  padding: 9px 13px;
  border: 2px solid rgba(45, 106, 82, 0.5);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  box-shadow: 0 8px 24px rgba(77, 67, 48, 0.12);
  pointer-events: none;
  transform: translate(-50%, -4px);
  animation: role-bubble-in 0.28s ease forwards;
}

.role-module-speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 16px;
  height: 16px;
  border-right: 2px solid rgba(45, 106, 82, 0.5);
  border-bottom: 2px solid rgba(45, 106, 82, 0.5);
  background: rgba(255, 255, 255, 0.94);
  transform: translateX(-50%) rotate(45deg);
}

.role-module-speech-bubble.hiding {
  animation: role-bubble-out 0.46s ease forwards;
}

h1 {
  margin: 8px 0 14px;
  font-size: var(--user-heading-size);
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin: 18px 0 8px;
  font-size: 24px;
  letter-spacing: 0;
}

p {
  margin: 0 0 12px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 18px;
  font-weight: 700;
}

.helper,
.note {
  color: var(--muted);
}

.large-line {
  font-size: 26px;
  color: var(--text);
}

.benefit-list {
  display: grid;
  gap: 6px;
  margin: 4px 0 10px;
  padding: 0;
  list-style: none;
}

.benefit-list li {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--text);
  font-size: 19px;
  line-height: 1.3;
}

.brand-row,
.home-header,
.companion-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.auth-hero {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 18px 0 24px;
}

.brand-mark,
.companion,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  color: var(--text);
  font-weight: 800;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
}

.auth-avatar {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #ffe0ec;
  color: var(--text);
  font-weight: 800;
  position: relative;
  overflow: hidden;
}

.companion {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--yellow);
  position: relative;
  overflow: hidden;
}

.companion-img {
  width: 94%;
  height: 94%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  filter: drop-shadow(0 6px 10px rgba(26, 32, 44, 0.14));
}

.anan-record-companion {
  position: relative;
  left: auto;
  bottom: auto;
  width: 104px;
  height: 122px;
  display: block;
  flex: 0 0 104px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff8e6 0%, #eaf7f0 100%);
  transform: none;
  filter: drop-shadow(0 8px 14px rgba(24, 36, 48, 0.16));
}

.anan-record-companion canvas {
  transform: scale(2.25) translateY(0%);
  transform-origin: center top;
}

.image-companion {
  padding: 4px;
}

.main-companion {
  background: #f2c15c;
}

.memoir-companion,
.avatar.memoir {
  background: #f4d48a;
}

.consult-companion,
.avatar.consult {
  background: #dcebe4;
}

.chef-companion,
.avatar.chef {
  background: #ffe0bd;
}

.wellness-companion,
.avatar.wellness {
  background: #edf1d4;
}

.record-companion,
.avatar.record {
  background: #dfeaf7;
}

.capsule-companion,
.avatar.capsule {
  background: #f6d9dc;
}

.symptom-companion,
.avatar.symptom {
  background: #eee4f2;
}

.forum-companion,
.avatar.forum {
  background: #f1e2d0;
}

.city-companion,
.avatar.city {
  background: #d8ece8;
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 700;
}

.text-field {
  width: 100%;
  min-height: 62px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 10px;
  align-items: stretch;
}

.auth-phone-row,
.auth-action-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.auth-action-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
}

.auth-prefix {
  padding-right: 8px;
  appearance: auto;
}

.auth-controls .primary-button,
.auth-controls .secondary-button {
  margin: 0;
}

.auth-choice-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.auth-choice-button {
  min-height: 72px;
  font-size: 24px;
  font-weight: 900;
}

.auth-register-panel[hidden] {
  display: none;
}

.auth-register-panel {
  margin-top: 12px;
}

.about-feature-list {
  display: grid;
  gap: 12px;
  margin: 14px 0 16px;
}

.about-card-stage {
  position: relative;
  min-height: 184px;
  margin: 16px 0;
}

.about-card {
  display: none;
  min-height: 184px;
  padding: 18px;
  border: 2px solid var(--line);
  border-left: 8px solid var(--green);
  border-radius: 8px;
  background: var(--panel);
}

.about-card.is-active {
  display: grid;
  align-content: center;
  gap: 10px;
}

.about-card strong {
  font-size: 27px;
  line-height: 1.25;
  color: var(--green);
}

.about-card span {
  font-size: 20px;
  line-height: 1.45;
  color: var(--text);
}

.about-feature-list article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.about-feature-list strong {
  font-size: 24px;
  color: var(--green);
}

.about-feature-list span {
  font-size: 19px;
  line-height: 1.35;
  color: var(--text);
}

.long-content-choice-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.document-reading-flow-panel {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.long-content-choice-panel p {
  margin: 0;
  font-size: 19px;
  line-height: 1.4;
  color: var(--text);
}

.document-reading-flow-panel p {
  margin: 0;
  font-size: 19px;
  line-height: 1.4;
  color: var(--text);
}

.document-reading-capture-preview {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 2px dashed rgba(26, 126, 95, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.document-reading-capture-frame {
  display: grid;
  place-items: center;
  min-height: 86px;
  border-radius: 8px;
  border: 2px solid rgba(26, 126, 95, 0.28);
  background:
    linear-gradient(90deg, transparent 47%, rgba(26, 126, 95, 0.2) 47%, rgba(26, 126, 95, 0.2) 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(26, 126, 95, 0.2) 47%, rgba(26, 126, 95, 0.2) 53%, transparent 53%),
    rgba(250, 255, 252, 0.92);
}

.document-reading-capture-frame span {
  width: 52px;
  height: 38px;
  border-radius: 6px;
  border: 3px solid var(--green);
  background: rgba(26, 126, 95, 0.12);
}

.document-reading-capture-preview strong {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
  color: var(--green);
}

.document-reading-capture-tips {
  font-size: 18px;
}

.long-content-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.long-content-choice-row button,
.health-consult-starter-row button,
.health-consult-followup-row button,
.document-reading-flow-grid button {
  min-height: 64px;
}

.medicine-instruction-help,
.report-interpretation-help {
  border-left: 6px solid var(--green);
}

.paste-button {
  min-height: 62px;
  margin: 0;
  padding: 10px 12px;
  font-size: 18px;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: var(--main-button-height);
  margin: 10px 0;
  padding: 14px 16px;
  border-radius: 8px;
  border: 2px solid var(--green);
  border-bottom-width: 5px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.7),
    0 7px 0 rgba(31, 86, 62, 0.22),
    0 12px 18px rgba(24, 36, 48, 0.14);
  transform: translateY(0);
  transition: transform 120ms ease, box-shadow 120ms ease, border-bottom-width 120ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #3c8768 0%, var(--green) 100%);
  color: #ffffff;
}

.secondary-button {
  background: linear-gradient(180deg, #ffffff 0%, #eef7f1 100%);
  color: var(--green);
}

.primary-button:active,
.secondary-button:active {
  border-bottom-width: 3px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.62),
    0 3px 0 rgba(31, 86, 62, 0.2),
    0 8px 12px rgba(24, 36, 48, 0.12);
  transform: translateY(4px);
}

.text-button {
  min-height: 48px;
  margin: 0 0 14px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.module-grid,
.consult-actions {
  display: grid;
  gap: 10px;
}

.v2-home {
  min-height: calc(100svh - 36px);
  display: grid;
  grid-template-rows: 32px auto auto auto;
  align-content: start;
  gap: 8px;
}

.anan-stage {
  position: relative;
  display: grid;
  place-items: center;
  align-content: end;
  min-height: 398px;
  padding: 6px 0 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: transparent;
}

.role-stage-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: transparent;
}

.role-stage-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.role-stage-button {
  position: relative;
  z-index: 1;
  width: min(88vw, 350px);
  min-height: 390px;
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 0;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  cursor: pointer;
  --role-idle-x: 0px;
  --role-idle-y: 0px;
}

.role-stage-button:focus-visible,
.role-stage-button:hover {
  border-color: var(--green);
  outline: 4px solid var(--green-soft);
}

.role-motion-layer {
  position: relative;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  display: block;
  transform: translate(0, 0);
  animation: none;
  will-change: transform;
}

.role-pixi-stage {
  position: relative;
  width: min(78vw, 330px);
  aspect-ratio: 376 / 430;
  display: none;
  overflow: hidden;
  border-radius: 8px;
  background: transparent;
  transform: translateY(30px);
}

.role-pixi-stage canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.role-pixi-stage[data-loading-state="loading"] canvas {
  opacity: 0;
  transition: opacity 220ms ease;
}

.role-pixi-stage[data-loading-state="ready"] canvas {
  opacity: 1;
  transition: opacity 220ms ease;
}

.role-stage-button[data-rig-mode="pixi-gsap"] .role-pixi-stage {
  display: block;
}

.role-stage-button[data-rig-mode="pixi-gsap"] .role-motion-layer {
  display: none;
}

.role-stage-button[data-rig-mode="dom-fallback"] .role-pixi-stage {
  display: none;
}

.role-stage-button[data-rig-mode="dom-fallback"] .role-motion-layer {
  display: block;
}

.role-motion-body,
.role-motion-head,
.role-motion-foot,
.role-motion-hair {
  pointer-events: none;
}

.role-motion-body {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: 50% 88%;
  animation: none;
}

.role-character-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
  transform-origin: 50% 90%;
  will-change: transform, filter, opacity;
}

.role-motion-head {
  position: absolute;
  left: 24%;
  top: 11%;
  width: 52%;
  height: 45%;
  border-radius: 48%;
  transform-origin: 50% 72%;
  animation: role-idle-head 3.6s ease-in-out infinite;
}

.role-motion-hair {
  position: absolute;
  left: 31%;
  top: 6%;
  width: 38%;
  height: 16%;
  border-radius: 50%;
  border-top: 3px solid rgba(36, 49, 43, 0.28);
  transform-origin: 50% 100%;
  animation: role-idle-hair 3.8s ease-in-out infinite;
}

.role-motion-foot {
  position: absolute;
  bottom: 3%;
  width: 18%;
  height: 8%;
  border-radius: 50%;
  background: rgba(47, 111, 85, 0.1);
  display: none;
  animation: none;
}

.role-motion-foot.left {
  left: 29%;
}

.role-motion-foot.right {
  right: 29%;
  animation-delay: 0.35s;
}

.role-speech-bubble {
  position: absolute;
  left: 50%;
  top: 16px;
  width: min(80vw, 300px);
  max-width: min(80vw, 300px);
  min-height: 42px;
  padding: 9px 13px;
  border: 2px solid rgba(207, 130, 54, 0.52);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  transform: translate(-50%, -4px);
  opacity: 0;
  box-shadow: 0 8px 24px rgba(77, 67, 48, 0.12);
  pointer-events: none;
  animation: role-bubble-in 0.28s ease forwards;
}

.role-speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 16px;
  height: 16px;
  border-right: 2px solid rgba(207, 130, 54, 0.52);
  border-bottom: 2px solid rgba(207, 130, 54, 0.52);
  background: rgba(255, 255, 255, 0.92);
  transform: translateX(-50%) rotate(45deg);
}

.role-speech-bubble.hiding {
  animation: role-bubble-out 0.46s ease forwards;
}

.intent-button-panel {
  position: absolute;
  left: 50%;
  top: 78px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(90vw, 420px);
  padding: 8px;
  border: 2px solid rgba(207, 130, 54, 0.4);
  border-radius: 8px;
  background: rgba(255, 249, 239, 0.96);
  box-shadow: 0 14px 34px rgba(77, 67, 48, 0.16);
  transform: translateX(-50%);
  animation: intent-panel-in 0.22s ease forwards;
}

.intent-button-panel.hiding {
  animation: intent-panel-out 0.28s ease forwards;
  pointer-events: none;
}

.intent-action-button {
  min-height: 54px;
  padding: 9px 10px;
  border: 2px solid rgba(207, 130, 54, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff7e8 0%, #ffe7bf 100%);
  color: #5f3518;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.18;
  box-shadow: 0 8px 18px rgba(130, 77, 28, 0.12);
}

.intent-action-button:focus-visible,
.intent-action-button:hover {
  border-color: rgba(190, 93, 31, 0.82);
  background: #fff2d6;
}

.intent-action-button:active {
  transform: translateY(1px);
}

.role-speech-bubble {
  top: 16px;
  width: min(80vw, 300px);
  max-width: min(80vw, 300px);
  transform: translate(-50%, -4px);
}

.role-stage-button[data-expression="idle"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-expression="talking"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-expression="listening"] .role-motion-body {
  animation: role-listen 1.8s ease-in-out infinite;
}

.role-stage-button[data-expression="happy"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-expression="pout"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-expression="blink"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-expression="wave"] .role-motion-body {
  animation: role-wave 1.2s ease-in-out infinite;
}

.role-stage-button[data-expression="jump"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-gesture="welcome"] .role-motion-layer,
.role-stage-button[data-gesture="beckon"] .role-motion-layer {
  animation: role-gesture-welcome 1.1s ease-in-out 1, role-idle-breathe 3.4s ease-in-out infinite 1.1s;
}

.role-stage-button[data-gesture="wave"] .role-motion-head {
  animation: role-gesture-wave 0.9s ease-in-out 2;
}

.role-stage-button[data-gesture="heart"] .role-motion-body {
  filter: saturate(1.08) contrast(1.02);
}

.role-stage-button[data-gesture="thumbsup"] .role-motion-body {
  filter: saturate(1.1) contrast(1.03);
}

.role-stage-button[data-gesture="jump"] .role-motion-body {
  animation: none;
}

.role-stage-button[data-gesture="bow"] .role-motion-head {
  animation: role-gesture-bow 0.86s ease-in-out 1;
}

.role-stage-button[data-gesture="akimbo"] .role-motion-body {
  filter: saturate(1.12) contrast(1.03);
}

.role-stage-button[data-gesture="thinking"] .role-motion-head {
  animation: role-gesture-thinking 1.2s ease-in-out infinite;
}

.role-stage-button[data-gesture="decline"] .role-motion-head {
  animation: role-gesture-decline 0.42s ease-in-out 3;
}

.v2-core-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.v2-module-button {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 0;
  padding: 10px;
  border: 2px solid #2d6a52;
  border-bottom-width: 5px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #edf7f1 100%);
  color: var(--text);
  text-align: left;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.88),
    0 6px 0 rgba(31, 86, 62, 0.18),
    0 12px 18px rgba(24, 36, 48, 0.12);
  cursor: pointer;
  transform: translateY(0);
  transition: transform 120ms ease, box-shadow 120ms ease, border-bottom-width 120ms ease;
}

.v2-module-button:active {
  border-bottom-width: 3px;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.8),
    0 3px 0 rgba(31, 86, 62, 0.18),
    0 8px 12px rgba(24, 36, 48, 0.1);
  transform: translateY(4px);
}

.v2-module-button.health {
  grid-column: 1 / -1;
}

.v2-module-button strong {
  font-size: 22px;
  line-height: 1.1;
}

.v2-module-button em {
  color: var(--muted);
  font-size: 15px;
  font-style: normal;
  line-height: 1.25;
}

.v2-footnote {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  text-align: center;
}

.reception-card,
.voice-intro,
.voice-guide-card,
.active-guide-panel,
.completion-card,
.sos-card {
  margin: 0 0 12px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.reception-card h2,
.voice-intro h2,
.voice-guide-card h2,
.active-guide-panel h2,
.completion-card h2,
.sos-card h2 {
  margin-top: 6px;
}

.reception-card p,
.voice-intro p,
.voice-guide-card p,
.active-guide-panel p,
.completion-card p,
.sos-card p {
  margin-bottom: 8px;
}

.active-guide-panel,
.completion-card {
  background: var(--green-soft);
}

.sos-card {
  border-color: #c94a3a;
  background: #fff3f0;
}

.intent-confirmation {
  margin-top: 14px;
  padding: 14px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
}

.two-buttons {
  grid-template-columns: 1fr 1fr;
}

.three-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-card {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 86px;
  padding: 12px;
  gap: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.module-card strong {
  display: block;
  font-size: 23px;
}

.module-card em {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 18px;
  font-style: normal;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  font-size: 24px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.reception-card .action-row {
  grid-template-columns: 1fr 1fr;
}

.plain-section,
.summary-list,
.chart-card,
.timeline-item,
.summary-tile {
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.quick-form {
  margin-bottom: 12px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.record-choice-open {
  width: 100%;
  margin: 0 0 12px;
  padding: 16px;
  border: 2px solid #2f6fed;
  border-radius: 8px;
  background: #eaf2ff;
  color: #143b7d;
  font-size: 24px;
  font-weight: 800;
}

.record-choice-tray,
.companion-choice-tray {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 60;
  padding: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  max-height: min(72svh, 620px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(23, 33, 54, 0.22);
}

.growth-share-card-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 70;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.growth-share-card-panel[hidden] {
  display: none;
}

.growth-share-card {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px;
  border: 2px solid #d6e2d3;
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(23, 33, 54, 0.22);
}

.growth-share-card-eyebrow {
  margin: 0 0 6px;
  color: #4f6b50;
  font-size: 16px;
  font-weight: 800;
}

.growth-share-card h2 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.25;
}

.growth-share-card p {
  overflow-wrap: anywhere;
}

.growth-share-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.growth-share-card-actions button {
  min-height: 56px;
  border: 2px solid #d9e1ef;
  border-radius: 8px;
  background: #f7fbff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.record-choice-title,
.companion-choice-title {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.45;
  font-weight: 700;
}

.record-choice-grid,
.companion-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.record-choice-grid button,
.record-choice-close,
.companion-choice-grid button,
.companion-choice-close {
  min-height: 64px;
  border: 2px solid #d9e1ef;
  border-radius: 8px;
  background: #f7fbff;
  color: var(--ink);
  font-size: 28px;
  font-weight: 850;
}

.record-choice-grid.secondary button {
  font-size: 24px;
}

.record-choice-close,
.companion-choice-close {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  background: #f7f7f7;
  color: var(--muted);
  font-size: 20px;
}

.summary-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.summary-tile strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
}

.summary-tile span {
  color: var(--muted);
  font-size: 18px;
}

.timeline-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.timeline-item {
  border-left: 6px solid var(--green);
}

.timeline-item strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 22px;
}

.timeline-item p {
  color: var(--muted);
  font-size: 18px;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 16px;
  font-weight: 800;
}

.medication-row {
  border-left-color: #b85b5b;
  background: #fffafa;
}

.chart-card {
  margin-bottom: 12px;
}

.chart-card h2 {
  margin-top: 0;
}

.line-chart,
.bar-chart {
  display: flex;
  align-items: end;
  gap: 12px;
  height: 118px;
  margin: 8px 0 12px;
  padding: 14px;
  border-radius: 8px;
  background: var(--blue-soft);
}

.line-chart span,
.bar-chart span {
  flex: 1;
  min-height: 18px;
  border-radius: 8px 8px 0 0;
  background: var(--green);
}

.bp-chart span:nth-child(1) {
  height: 86%;
}

.bp-chart span:nth-child(2) {
  height: 66%;
}

.bp-chart span:nth-child(3) {
  height: 76%;
}

.heart-chart span {
  background: #b85b5b;
}

.activity-chart span {
  background: #4a78a8;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 800;
}

.mini-tag {
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 17px;
  font-weight: 800;
}

.wave {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  height: 76px;
  margin: 18px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--green-soft);
}

.wave span {
  width: 12px;
  border-radius: 8px;
  background: var(--green);
}

.wave span:nth-child(1) {
  height: 28px;
}

.wave span:nth-child(2) {
  height: 48px;
}

.wave span:nth-child(3) {
  height: 62px;
}

.wave span:nth-child(4) {
  height: 38px;
}

.listening-pulse {
  outline: 6px solid var(--green-soft);
}

.toast {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 16px;
  max-width: 484px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  font-size: 18px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

@keyframes anan-breathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1);
  }
}

@keyframes anan-wave {
  0%,
  100% {
    transform: rotate(-18deg);
  }

  50% {
    transform: rotate(-42deg);
  }
}

@keyframes roleListeningHalo {
  0%,
  100% {
    opacity: 0.28;
    transform: scale(0.985);
  }

  50% {
    opacity: 0.58;
    transform: scale(1.015);
  }
}

@keyframes listeningDotBlink {
  0%,
  100% {
    opacity: 0.18;
    transform: translateY(0);
  }
  45% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes role-breathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.006);
  }
}

@keyframes role-talk {
  0%,
  100% {
    transform: scale(1);
    filter: saturate(1);
  }

  50% {
    transform: scale(1);
    filter: saturate(1.12);
  }
}

@keyframes role-listen {
  0%,
  100% {
    transform: rotate(-1deg);
    filter: drop-shadow(0 0 0 rgba(47, 111, 85, 0));
  }

  50% {
    transform: rotate(2deg);
    filter: drop-shadow(0 6px 8px rgba(47, 111, 85, 0.24));
  }
}

@keyframes role-happy {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1);
  }
}

@keyframes role-pout {
  0%,
  100% {
    transform: scale(1);
    filter: saturate(0.95);
  }

  50% {
    transform: scale(1);
    filter: saturate(0.85);
  }
}

@keyframes role-blink {
  0%,
  88%,
  100% {
    transform: scaleY(1);
    opacity: 1;
  }

  92% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes role-wave {
  0%,
  100% {
    transform: rotate(-4deg) translateX(0);
  }

  50% {
    transform: rotate(5deg) translateX(4px);
  }
}

@keyframes role-jump {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1);
  }
}

@keyframes role-idle-breathe {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(0, 0) scale(1.004);
  }
}

@keyframes role-idle-head {
  0%,
  100% {
    transform: rotate(-1deg);
  }

  50% {
    transform: rotate(1.5deg);
  }
}

@keyframes role-idle-body {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.004);
  }
}

@keyframes role-idle-foot {
  0%,
  100% {
    transform: translateY(0) scaleX(1);
  }

  50% {
    transform: translateY(1px) scaleX(1.14);
  }
}

@keyframes role-idle-look {
  0%,
  78%,
  100% {
    transform: translateX(0) scaleY(1);
  }

  84% {
    transform: translateX(2px) scaleY(0.24);
  }

  90% {
    transform: translateX(-2px) scaleY(1);
  }
}

@keyframes role-idle-hair {
  0%,
  100% {
    transform: rotate(-1deg);
  }

  50% {
    transform: rotate(2deg);
  }
}

@keyframes role-gesture-welcome {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  45% {
    transform: translateX(3px) scale(1.015);
  }
}

@keyframes role-gesture-wave {
  0%,
  100% {
    transform: rotate(-3deg);
  }

  50% {
    transform: rotate(6deg);
  }
}

@keyframes role-gesture-point {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(5px);
  }
}

@keyframes role-gesture-bow {
  0%,
  100% {
    transform: rotate(0) translateY(0);
  }

  50% {
    transform: rotate(8deg) translateY(6px);
  }
}

@keyframes role-gesture-thinking {
  0%,
  100% {
    transform: rotate(-2deg) translateY(0);
  }

  50% {
    transform: rotate(3deg) translateY(-2px);
  }
}

@keyframes role-gesture-decline {
  0%,
  100% {
    transform: translateX(0);
  }

  35% {
    transform: translateX(-5px);
  }

  70% {
    transform: translateX(5px);
  }
}

@keyframes role-bubble-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes role-bubble-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -6px) scale(0.98);
  }
}

@keyframes intent-panel-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes intent-panel-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.98);
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 10px;
  }

  .role-module-screen {
    height: calc(100svh - 20px);
    min-height: calc(100svh - 20px);
    grid-template-rows: minmax(320px, 52svh) minmax(0, 1fr);
  }

  .role-module-screen[data-screen="auth"] {
    grid-template-rows: minmax(430px, 66svh) minmax(0, 1fr);
  }

  .role-module-scene {
    min-height: 0;
  }

  .auth-scene {
    min-height: clamp(430px, 66svh, 560px);
  }

  .role-module-controls {
    min-height: 0;
    gap: 8px;
    padding-top: 8px;
  }

  .auth-controls {
    gap: 6px;
    padding-top: 8px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .auth-controls .field-label {
    margin: 4px 0 4px;
    font-size: 16px;
  }

  .auth-controls .text-field,
  .auth-controls .primary-button,
  .auth-controls .secondary-button {
    min-height: 40px;
    padding: 6px 8px;
    font-size: 16px;
  }

  .auth-controls .note {
    min-height: 15px;
    margin: 0;
    font-size: 14px;
  }

  .auth-phone-row {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 8px;
  }

  .auth-action-row,
  .code-row {
    gap: 8px;
  }

  .code-row {
    grid-template-columns: minmax(0, 1fr) 106px;
  }

  .paste-button {
    font-size: 16px;
  }

  .role-module-screen[data-screen="auth"].keyboard-active {
    overflow-y: auto;
    grid-template-rows: minmax(250px, 40svh) minmax(330px, auto);
    align-content: start;
    scroll-padding-bottom: max(96px, env(safe-area-inset-bottom));
  }

  .role-module-screen[data-screen="auth"].keyboard-active .auth-scene {
    min-height: clamp(250px, 40svh, 330px);
  }

  .role-module-screen[data-screen="auth"].keyboard-active .auth-character {
    bottom: -18px;
    width: min(68vw, 300px);
    height: min(34svh, 280px);
  }

  .role-module-screen[data-screen="auth"].keyboard-active .auth-speech-bubble {
    top: 12px;
    width: min(78vw, 300px);
  }

  .role-module-screen[data-screen="auth"].keyboard-active .auth-controls {
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .role-module-character {
    width: min(82vw, 340px);
    height: min(58svh, 500px);
  }

  .role-module-title {
    font-size: 24px;
  }

  .brand-row,
  .home-header,
  .companion-panel {
    align-items: flex-start;
    gap: 12px;
  }

  .companion {
    width: 82px;
    height: 82px;
  }

  .module-card {
    min-height: 82px;
  }

  .module-card strong {
    font-size: 22px;
  }

  .module-card em {
    font-size: 17px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .reception-card .action-row {
    grid-template-columns: 1fr 1fr;
  }

  .two-buttons {
    grid-template-columns: 1fr;
  }

  .reception-card .primary-button,
  .reception-card .secondary-button {
    min-height: 64px;
    padding: 10px 8px;
  }

  .v2-home {
    min-height: calc(100svh - 20px);
    grid-template-rows: 32px auto auto auto;
    gap: 8px;
  }

  .anan-stage {
    min-height: 368px;
  }

  .role-stage-button {
    width: min(92vw, 330px);
    min-height: 358px;
  }

  .role-character-image {
    width: min(54vw, 162px);
  }

  .role-pixi-stage,
  .role-motion-layer {
    width: min(78vw, 300px);
  }

  .anan-character {
    width: min(86vw, 300px);
  }

  .v2-core-actions {
    gap: 8px;
  }

  .v2-module-button {
    min-height: 76px;
    padding: 8px;
  }

  .v2-module-button strong {
    font-size: 20px;
  }

  .v2-module-button em {
    display: none;
  }

}
