@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #29263b;
  --ink-soft: #625d70;
  --paper: #fffdfb;
  --canvas: #fff8f4;
  --white: #ffffff;
  --line: #eadfe1;
  --rose: #f8e5e8;
  --coral: #da6672;
  --coral-deep: #af4454;
  --teal: #358b86;
  --teal-soft: #d9efec;
  --gold: #f2c45a;
  --gold-soft: #fff2c8;
  --sky: #dceef2;
  --blue: #5c81ae;
  --danger: #b73942;
  --shadow: 0 18px 50px rgba(58, 38, 55, 0.12);
  --header-height: 76px;
  --nav-height: 78px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: 'Poppins', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--white);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(53, 139, 134, 0.15);
}

textarea {
  resize: vertical;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.14;
}

h1 {
  margin-bottom: 12px;
  font-size: 32px;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

p {
  line-height: 1.65;
}

.is-hidden {
  display: none !important;
}

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

.ambient-pattern {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(circle at 1px 1px, rgba(53, 139, 134, 0.12) 1px, transparent 0);
  background-size: 26px 26px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--coral-deep);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 0 10px 26px rgba(41, 38, 59, 0.18);
}

.brand-eye {
  position: absolute;
  top: 11px;
  left: 9px;
  width: 25px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper);
  transform: rotate(-8deg);
}

.brand-eye::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: inset 3px 0 0 var(--ink);
}

.brand-spark {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}

.brand-mark--large {
  width: 68px;
  height: 68px;
  margin-bottom: 28px;
}

.brand-mark--large .brand-eye {
  top: 17px;
  left: 14px;
  width: 39px;
  height: 28px;
}

.brand-mark--large .brand-eye::after {
  top: 6px;
  left: 15px;
  width: 14px;
  height: 14px;
}

.brand-mark--large .brand-spark {
  width: 14px;
  height: 14px;
  right: 7px;
  bottom: 7px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
}

.auth-view {
  display: grid;
  min-height: 100vh;
  background: var(--paper);
}

.auth-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  padding: 48px 24px 36px;
}

.auth-panel h1 {
  max-width: 540px;
  margin-bottom: 14px;
  font-size: 42px;
}

.auth-copy {
  max-width: 520px;
  margin-bottom: 34px;
  color: var(--ink-soft);
  font-size: 16px;
}

.pin-form,
.entry-form {
  max-width: 390px;
}

.auth-enter-button {
  width: 100%;
  min-height: 52px;
  font-size: 15px;
}

.pin-form label,
.field-label,
.memory-form > label,
.profile-card form > label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.pin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 10px;
}

.pin-row input {
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  font-size: 21px;
}

.form-error {
  min-height: 21px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.auth-signature {
  margin: 60px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.auth-visual {
  display: none;
  position: relative;
  overflow: hidden;
  background: var(--teal);
}

.auth-moon {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--gold-soft);
  box-shadow: 0 0 0 28px rgba(255, 242, 200, 0.1), 0 0 80px rgba(255, 242, 200, 0.4);
}

.auth-moon::after {
  content: '';
  position: absolute;
  top: -20px;
  left: 76px;
  width: 205px;
  height: 205px;
  border-radius: 50%;
  background: var(--teal);
}

.auth-cloud {
  position: absolute;
  width: 260px;
  height: 58px;
  border-radius: 40px;
  background: rgba(255, 255, 255, 0.82);
}

.auth-cloud::before,
.auth-cloud::after {
  content: '';
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
}

.auth-cloud::before { left: 42px; width: 105px; height: 105px; }
.auth-cloud::after { right: 34px; width: 78px; height: 78px; }
.auth-cloud--one { right: -20px; bottom: 20%; }
.auth-cloud--two { left: 8%; bottom: 9%; transform: scale(0.7); opacity: 0.7; }

.auth-star {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--gold);
  transform: rotate(45deg);
  animation: twinkle 2.4s ease-in-out infinite;
}

.auth-star--one { top: 20%; left: 18%; }
.auth-star--two { top: 12%; right: 16%; animation-delay: 700ms; }
.auth-star--three { top: 48%; left: 28%; animation-delay: 1.2s; }

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  transition: transform 150ms ease, background 150ms ease;
}

.icon-button:hover { transform: translateY(-1px); }
.icon-button svg { width: 20px; height: 20px; }
.icon-button--primary { color: white; border-color: var(--coral); background: var(--coral); }
.icon-button--light { color: var(--ink); border-color: transparent; background: rgba(255, 255, 255, 0.85); }

.primary-button,
.quiet-button,
.small-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  padding: 0 20px;
  color: white;
  background: var(--coral);
  box-shadow: 0 10px 24px rgba(218, 102, 114, 0.22);
}

.primary-button svg,
.quiet-button svg,
.small-action svg { width: 17px; height: 17px; }
.primary-button--teal { background: var(--teal); box-shadow: 0 10px 24px rgba(53, 139, 134, 0.2); }
.primary-button--gold { color: var(--ink); background: var(--gold); box-shadow: 0 10px 24px rgba(242, 196, 90, 0.22); }

.quiet-button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: var(--white);
}

.quiet-button--full { width: 100%; margin-top: 14px; }

.small-action {
  min-height: 38px;
  padding: 0 13px;
  color: var(--teal);
  background: var(--white);
  white-space: nowrap;
}

.care-cta-short { display: none; }

.onboarding-view {
  min-height: 100vh;
  padding: 28px 18px 50px;
  background: var(--canvas);
}

.onboarding-shell {
  width: min(1020px, 100%);
  margin: 0 auto;
}

.onboarding-heading {
  max-width: 720px;
  margin: 56px 0 30px;
}

.onboarding-heading h1 { font-size: 36px; }
.onboarding-heading > p:last-child { color: var(--ink-soft); }
.onboarding-view fieldset { padding: 0; border: 0; }

.pet-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.pet-choice {
  position: relative;
  min-width: 0;
}

.pet-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pet-choice label {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  cursor: pointer;
}

.pet-choice label:hover { transform: translateY(-2px); }
.pet-choice input:checked + label { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(53, 139, 134, 0.14); }
.pet-choice input:focus-visible + label { outline: 3px solid rgba(53, 139, 134, 0.24); }
.pet-choice__art { width: 90px; height: 78px; }
.pet-choice__art .pet-svg { width: 100%; height: 100%; }
.pet-choice strong { font-size: 14px; }
.pet-choice small { color: var(--ink-soft); font-size: 11px; }

.onboarding-submit {
  display: grid;
  gap: 10px;
}

.onboarding-submit input { height: 52px; padding: 0 16px; }

.app-view { min-height: 100vh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  border-bottom: 1px solid rgba(234, 223, 225, 0.8);
  background: rgba(255, 253, 251, 0.94);
  backdrop-filter: blur(16px);
}

.app-header__inner {
  display: flex;
  width: min(1120px, 100%);
  height: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: auto;
  padding: 0 16px;
}

.pet-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 0;
  text-align: left;
  background: transparent;
}

.pet-identity > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.pet-identity strong { overflow: hidden; max-width: 170px; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.pet-identity small { color: var(--ink-soft); font-size: 11px; }
.mini-pet { display: block; width: 46px; height: 46px; overflow: hidden; border-radius: 50%; background: var(--teal-soft); }
.mini-pet .pet-svg { width: 100%; height: 100%; transform: scale(1.35); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.streak-chip { display: flex; min-width: 54px; height: 38px; align-items: center; justify-content: center; gap: 6px; border-radius: 8px; color: var(--coral-deep); background: var(--rose); font-weight: 700; }
.streak-chip svg { width: 17px; }

.app-layout { width: min(1200px, 100%); margin: 0 auto; }
.desktop-nav { display: none; }

.content-area {
  width: 100%;
  min-width: 0;
  padding: 24px 16px calc(var(--nav-height) + 32px + env(safe-area-inset-bottom));
}

.app-section { display: none; animation: reveal 240ms ease both; }
.app-section.is-active { display: block; }

.welcome-row,
.section-heading,
.compact-heading {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.welcome-row h1,
.section-heading h1 { margin-bottom: 0; }
.section-heading > p { max-width: 620px; margin-bottom: 0; color: var(--ink-soft); }
.compact-heading { flex-direction: row; align-items: flex-end; justify-content: space-between; }
.compact-heading h2 { margin: 0; }

.pet-stage {
  position: relative;
  height: 415px;
  overflow: hidden;
  border: 1px solid #cbe1e4;
  border-radius: 8px;
  background: var(--sky);
  box-shadow: var(--shadow);
}

.stage-sky { position: absolute; inset: 0; }
.stage-sky::before { content: ''; position: absolute; top: 26px; right: 28px; width: 86px; height: 86px; border-radius: 50%; background: var(--gold-soft); }
.stage-star { position: absolute; width: 8px; height: 8px; background: var(--gold); transform: rotate(45deg); animation: twinkle 2.6s ease-in-out infinite; }
.stage-star--one { top: 42px; left: 12%; }
.stage-star--two { top: 102px; right: 15%; animation-delay: 800ms; }
.stage-star--three { top: 152px; left: 18%; animation-delay: 1.5s; }

.stage-ground {
  position: absolute;
  right: -10%;
  bottom: 53px;
  left: -10%;
  height: 105px;
  border-radius: 50% 50% 0 0;
  background: #c6e2d2;
}

.stage-ground::before,
.stage-ground::after { content: ''; position: absolute; bottom: 30px; width: 56px; height: 70px; border-radius: 50% 50% 10px 10px; background: #82b49b; }
.stage-ground::before { left: 18%; transform: rotate(-9deg); }
.stage-ground::after { right: 14%; transform: rotate(11deg); }

.pet-speech {
  position: absolute;
  top: 24px;
  left: 50%;
  z-index: 4;
  width: min(270px, calc(100% - 40px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(41, 38, 59, 0.1);
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
}

.pet-speech::after { content: ''; position: absolute; bottom: -7px; left: 50%; width: 14px; height: 14px; background: inherit; transform: translateX(-50%) rotate(45deg); }

.pet-art {
  position: absolute;
  z-index: 3;
  top: 100px;
  left: 50%;
  width: 270px;
  height: 230px;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 16px rgba(41, 38, 59, 0.15));
}

.pet-svg { width: 100%; height: 100%; overflow: visible; }
.pet-bob { transform-origin: 150px 170px; animation: petBob 3.4s ease-in-out infinite; }
.pet-eye { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
.pet-wing { transform-box: fill-box; transform-origin: center; animation: wing 2.8s ease-in-out infinite; }
.pet-tail { transform-box: fill-box; transform-origin: left center; animation: tail 2.2s ease-in-out infinite; }
.pet-stage.is-reacting .pet-bob,
.care-stage.is-reacting .pet-bob { animation: petCelebrate 700ms ease-in-out 2; }
.pet-stage.is-sleeping .pet-eye,
.care-stage.is-sleeping .pet-eye { transform: scaleY(0.12); animation: none; }

.pet-stage__footer {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mood-chip {
  display: inline-flex;
  min-width: 0;
  height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  overflow: hidden;
  border-radius: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  font-weight: 600;
}
.mood-chip svg { width: 16px; flex: 0 0 auto; }

.needs-section { padding-top: 30px; }
.bond-label { color: var(--teal); font-size: 12px; font-weight: 700; }

.needs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.need-item { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.need-item__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.need-item__top span { display: flex; min-width: 0; align-items: center; gap: 7px; font-weight: 600; }
.need-item__top svg { width: 16px; color: var(--teal); }
.need-item__top strong { font-size: 11px; }
.need-track,
.xp-track { height: 7px; overflow: hidden; border-radius: 6px; background: #eee7e7; }
.need-track span,
.xp-track span { display: block; height: 100%; border-radius: inherit; background: var(--teal); transition: width 500ms ease; }
.need-item[data-low='true'] .need-track span { background: var(--coral); }

.daily-band {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 18px 14px;
  border-radius: 8px;
  background: var(--gold-soft);
}
.daily-band h2 { margin-bottom: 4px; font-size: 17px; }
.daily-band p { margin-bottom: 0; font-size: 12px; }
.daily-band__icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: var(--ink); background: var(--gold); }
.daily-band__icon svg { width: 22px; }

.care-layout { display: grid; gap: 14px; }
.care-stage { position: relative; height: 310px; overflow: hidden; border-radius: 8px; background: var(--teal-soft); }
.care-stage::before { content: ''; position: absolute; right: 0; bottom: 0; left: 0; height: 80px; background: #c5dfd4; }
.pet-art--care { top: 34px; width: 250px; height: 215px; }
.care-reaction { position: absolute; right: 18px; bottom: 16px; left: 18px; z-index: 5; min-height: 44px; padding: 11px 14px; border-radius: 8px; text-align: center; background: rgba(255,255,255,.9); font-size: 13px; font-weight: 600; }

.care-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.care-button { display: grid; min-height: 145px; min-width: 0; place-items: center; align-content: center; gap: 3px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); transition: transform 160ms ease, box-shadow 160ms ease; }
.care-button:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(58,38,55,.1); }
.care-button > span { display: grid; width: 48px; height: 48px; margin-bottom: 7px; place-items: center; border-radius: 50%; }
.care-button svg { width: 22px; }
.care-button strong { font-size: 15px; }
.care-button small { color: var(--ink-soft); font-size: 11px; }
.care-button--food > span { color: var(--coral-deep); background: var(--rose); }
.care-button--rest > span { color: var(--blue); background: var(--sky); }
.care-button--play > span { color: #8c6811; background: var(--gold-soft); }
.care-button--hug > span { color: var(--teal); background: var(--teal-soft); }

.progress-panel { margin-top: 22px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.progress-panel h2 { margin-bottom: 14px; }
.progress-panel .xp-track { height: 9px; }
.progress-panel .xp-track span { background: var(--coral); }
.progress-panel > p { margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; }

.day-heading { margin-bottom: 24px; }
.day-layout { display: grid; gap: 14px; }
.habit-panel,
.emotion-panel,
.week-panel,
.emotion-history-panel { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.week-panel,
.emotion-history-panel { margin-top: 14px; }
.tracker-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tracker-header h2 { margin: 0; font-size: 20px; }
.habit-score { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; }
.habit-score strong { color: var(--teal); font-size: 20px; }
.habit-score span { color: var(--ink-soft); font-size: 9px; }
.habit-progress { height: 8px; margin-bottom: 16px; overflow: hidden; border-radius: 8px; background: #eee7e7; }
.habit-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--teal); transition: width 300ms ease; }
.habit-list { display: grid; gap: 8px; }
.habit-row { display: grid; min-height: 50px; grid-template-columns: minmax(0, 1fr) 36px; align-items: center; gap: 8px; padding: 7px 7px 7px 10px; border: 1px solid var(--line); border-radius: 8px; transition: background 150ms ease, border-color 150ms ease; }
.habit-row.is-complete { border-color: #bcded8; background: #eff9f7; }
.habit-check { display: grid; min-width: 0; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 9px; cursor: pointer; }
.habit-check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.habit-checkbox { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: transparent; background: var(--canvas); }
.habit-checkbox svg { width: 16px; height: 16px; }
.habit-check input:focus-visible + .habit-checkbox { outline: 3px solid rgba(53,139,134,.2); }
.habit-check input:checked + .habit-checkbox { color: white; border-color: var(--teal); background: var(--teal); }
.habit-name { overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.habit-row.is-complete .habit-name { color: var(--ink-soft); text-decoration: line-through; }
.habit-delete { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; color: var(--ink-soft); background: transparent; }
.habit-delete:hover { color: var(--danger); background: var(--rose); }
.habit-delete svg { width: 15px; height: 15px; }
.habit-spacer { width: 34px; }
.habit-form { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 8px; margin-top: 12px; }
.habit-form input { height: 44px; padding: 0 12px; font-size: 12px; }

.emotion-today { flex: 0 0 auto; padding: 6px 9px; border-radius: 8px; color: var(--coral-deep); background: var(--rose); font-size: 10px; font-weight: 700; }
.emotion-panel fieldset { padding: 0; border: 0; }
.emotion-picker { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 5px; }
.emotion-picker button { display: flex; min-width: 0; min-height: 72px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 7px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); transition: transform 150ms ease, border-color 150ms ease, background 150ms ease; }
.emotion-picker button:hover { transform: translateY(-1px); }
.emotion-picker button svg { width: 20px; height: 20px; }
.emotion-picker button span { font-size: 9px; font-weight: 600; }
.emotion-picker button[data-emotion-score='1'] { color: #65728d; }
.emotion-picker button[data-emotion-score='2'] { color: var(--blue); }
.emotion-picker button[data-emotion-score='3'] { color: var(--ink-soft); }
.emotion-picker button[data-emotion-score='4'] { color: var(--teal); }
.emotion-picker button[data-emotion-score='5'] { color: #9b7115; }
.emotion-picker button.is-selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 2px rgba(53,139,134,.12); }
.emotion-note-label { display: block; margin: 18px 0 7px; font-size: 12px; font-weight: 600; }
.emotion-panel textarea { padding: 11px; font-size: 12px; }
.emotion-tags-fieldset { margin-top: 15px; }
.emotion-tags-fieldset legend { margin-bottom: 8px; font-size: 11px; font-weight: 600; }
.emotion-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.emotion-tags label { position: relative; cursor: pointer; }
.emotion-tags input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.emotion-tags span { display: inline-flex; min-height: 32px; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); font-size: 10px; font-weight: 600; }
.emotion-tags input:checked + span { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); }
.emotion-tags input:focus-visible + span { outline: 3px solid rgba(53,139,134,.18); }
.emotion-submit { width: 100%; margin-top: 16px; }

.week-panel .compact-heading,
.emotion-history-panel .compact-heading { margin-bottom: 18px; }
.week-legend { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 9px; }
.week-legend svg { width: 14px; }
.week-chart { display: grid; height: 170px; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 7px; }
.week-day { display: grid; min-width: 0; grid-template-rows: 28px minmax(0,1fr) 18px; place-items: center; gap: 4px; }
.mood-dot { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--ink-soft); background: #eee8e7; }
.mood-dot svg { width: 13px; height: 13px; }
.mood-dot[data-score='1'] { color: white; background: #65728d; }
.mood-dot[data-score='2'] { color: white; background: var(--blue); }
.mood-dot[data-score='3'] { color: white; background: var(--ink-soft); }
.mood-dot[data-score='4'] { color: white; background: var(--teal); }
.mood-dot[data-score='5'] { color: var(--ink); background: var(--gold); }
.week-bar { position: relative; width: min(22px,100%); height: 100%; overflow: hidden; border-radius: 6px 6px 2px 2px; background: var(--rose); }
.week-bar span { position: absolute; right: 0; bottom: 0; left: 0; min-height: 3px; border-radius: inherit; background: var(--coral); }
.week-day.is-today .week-bar span { background: var(--teal); }
.week-day small { overflow: hidden; width: 100%; color: var(--ink-soft); text-align: center; text-overflow: ellipsis; font-size: 9px; }

.emotion-history { display: grid; gap: 8px; }
.emotion-entry { display: grid; grid-template-columns: 36px minmax(0,1fr) 34px; align-items: start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.emotion-entry__icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: white; background: var(--teal); }
.emotion-entry__icon svg { width: 16px; height: 16px; }
.emotion-entry__content { min-width: 0; }
.emotion-entry__content header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }
.emotion-entry__content strong { font-size: 12px; }
.emotion-entry__content time { color: var(--ink-soft); font-size: 9px; }
.emotion-entry__content p { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.emotion-entry__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.emotion-entry__tags span { padding: 3px 6px; border-radius: 5px; color: var(--teal); background: var(--teal-soft); font-size: 8px; font-weight: 600; }
.emotion-delete { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 8px; color: var(--ink-soft); background: transparent; }
.emotion-delete svg { width: 14px; }

.pause-grid { display: grid; gap: 12px; }
.pause-card { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.pause-card h2 { font-size: 21px; }
.pause-card > p:not(.eyebrow) { min-height: 52px; color: var(--ink-soft); font-size: 13px; }
.pause-card .primary-button { width: 100%; }
.pause-icon { display: grid; width: 50px; height: 50px; margin-bottom: 20px; place-items: center; border-radius: 8px; }
.pause-icon svg { width: 24px; }
.pause-card--breath .pause-icon { color: var(--teal); background: var(--teal-soft); }
.pause-card--stars .pause-icon { color: #8c6811; background: var(--gold-soft); }
.pause-card--reset .pause-icon { color: var(--coral-deep); background: var(--rose); }
.reset-list { display: grid; gap: 8px; margin-top: 16px; }
.reset-list label { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.reset-list input { width: 18px; height: 18px; accent-color: var(--teal); }

.chat-shell { display: flex; min-height: calc(100vh - var(--header-height) - var(--nav-height) - 48px); flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow); }
.chat-header { display: grid; grid-template-columns: 48px minmax(0, 1fr) 44px; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.chat-header h1 { margin: 0; font-size: 18px; }
.chat-header .eyebrow { margin-bottom: 2px; }
.chat-avatar { width: 46px; height: 46px; overflow: hidden; border-radius: 50%; background: var(--teal-soft); }
.chat-avatar .pet-svg { width: 100%; height: 100%; transform: scale(1.3); }
.online-status { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 10px; }
.online-status > span { width: 7px; height: 7px; border-radius: 50%; background: #4ea36f; }
.chat-messages { display: flex; min-height: 260px; flex: 1; flex-direction: column; gap: 10px; overflow-y: auto; padding: 16px; }
.chat-empty { margin: auto; max-width: 300px; text-align: center; color: var(--ink-soft); font-size: 13px; }
.chat-empty .pause-icon { margin: 0 auto 14px; }
.chat-message { display: flex; max-width: 86%; flex-direction: column; gap: 4px; }
.chat-message p { margin: 0; padding: 10px 13px; border-radius: 8px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.chat-message time { color: var(--ink-soft); font-size: 9px; }
.chat-message--assistant { align-self: flex-start; }
.chat-message--assistant p { background: var(--rose); }
.chat-message--user { align-self: flex-end; align-items: flex-end; }
.chat-message--user p { color: white; background: var(--teal); }
.typing-indicator { display: flex; width: 56px; gap: 4px; margin: 0 16px 8px; padding: 10px 13px; border-radius: 8px; background: var(--rose); }
.typing-indicator span { width: 6px; height: 6px; border-radius: 50%; background: var(--coral-deep); animation: typing 1s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: 120ms; }
.typing-indicator span:nth-child(3) { animation-delay: 240ms; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: end; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form textarea { max-height: 120px; min-height: 44px; padding: 10px 12px; resize: none; }
.chat-note { margin: 0; padding: 0 14px 12px; color: var(--ink-soft); font-size: 9px; line-height: 1.45; }

.memory-form { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.memory-entry { display: grid; gap: 10px; }
.memory-entry textarea { padding: 12px; }
.memory-summary { display: flex; align-items: center; gap: 16px; margin: 20px 0; padding: 18px; border-radius: 8px; background: var(--gold-soft); }
.memory-summary > div:last-child { display: flex; flex-direction: column; }
.memory-summary strong { font-size: 28px; }
.memory-summary span { color: var(--ink-soft); font-size: 12px; }
.memory-jar { position: relative; width: 54px; height: 54px; border: 3px solid rgba(41,38,59,.7); border-top: 8px solid var(--ink); border-radius: 5px 5px 14px 14px; background: rgba(255,255,255,.45); }
.memory-jar span { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); }
.memory-jar span:nth-child(1) { left: 10px; bottom: 9px; }
.memory-jar span:nth-child(2) { right: 9px; bottom: 14px; background: var(--teal); }
.memory-jar span:nth-child(3) { left: 22px; bottom: 23px; background: var(--gold); }
.memory-jar span:nth-child(4) { left: 8px; bottom: 31px; background: var(--blue); }
.memories-list { display: grid; gap: 10px; }
.memory-item { display: grid; grid-template-columns: minmax(0,1fr) 40px; gap: 10px; align-items: start; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.memory-item p { margin-bottom: 7px; font-size: 13px; }
.memory-item time { color: var(--ink-soft); font-size: 10px; }
.memory-item button { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 8px; color: var(--ink-soft); background: var(--canvas); }
.memory-item button svg { width: 16px; }
.empty-state { padding: 36px 18px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; color: var(--ink-soft); font-size: 13px; }

.mobile-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 35;
  display: grid;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 6px 4px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.97);
  backdrop-filter: blur(16px);
}

.nav-button { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 9px; color: var(--ink-soft); background: transparent; font-size: 12px; font-weight: 600; }
.mobile-nav .nav-button { flex-direction: column; gap: 3px; font-size: 9px; }
.nav-button svg { width: 20px; height: 20px; }
.nav-button.is-active { color: var(--coral-deep); }
.mobile-nav .nav-button.is-active svg { fill: var(--rose); }

.modal,
.encouragement-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: end center; padding: 14px; }
.modal-backdrop,
.encouragement-backdrop { position: absolute; inset: 0; background: rgba(22, 20, 31, 0.58); backdrop-filter: blur(5px); }
.modal-card,
.encouragement-card { position: relative; z-index: 1; width: min(520px, 100%); max-height: calc(100vh - 28px); overflow-y: auto; border-radius: 8px; background: var(--paper); box-shadow: 0 28px 80px rgba(22,20,31,.28); animation: modalUp 220ms ease both; }
.profile-card { padding: 22px; }
.profile-card > header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.profile-card h2 { margin: 0; }
.profile-card form { display: grid; gap: 8px; }
.profile-card form input,
.profile-card form select { height: 46px; padding: 0 12px; margin-bottom: 8px; }
.profile-card .primary-button { margin-top: 8px; }
.profile-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 20px 0; }
.profile-stats > div { display: flex; min-width: 0; flex-direction: column; padding: 12px; border-radius: 8px; text-align: center; background: var(--rose); }
.profile-stats span { color: var(--ink-soft); font-size: 9px; }
.profile-stats strong { font-size: 20px; }
.danger-link { display: flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--danger); background: transparent; font-size: 12px; font-weight: 600; }
.danger-link svg { width: 17px; }

.activity-card { min-height: 520px; overflow: hidden; padding: 24px; background: var(--ink); color: white; }
.activity-close { position: absolute; top: 14px; right: 14px; z-index: 4; color: white; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); }
.activity-view { height: 100%; min-height: 470px; }
.activity-view .eyebrow { color: var(--gold); }
.activity-view > h2 { font-size: 28px; }
.breathing-orbit { display: grid; height: 310px; place-items: center; }
#breathing-circle { display: grid; width: 128px; height: 128px; place-items: center; border: 2px solid rgba(255,255,255,.5); border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 24px rgba(53,139,134,.12); transition: transform 4s ease-in-out, background 800ms ease; }
#breathing-circle.is-inhaling { transform: scale(1.42); }
#breathing-circle.is-holding { transform: scale(1.42); background: var(--blue); }
#breathing-circle.is-exhaling { transform: scale(.82); background: var(--coral); transition-duration: 6s; }
#breathing-label { font-weight: 700; }
#breathing-time { margin-bottom: 4px; text-align: center; font-size: 28px; font-weight: 700; }
#breathing-guide { color: rgba(255,255,255,.7); text-align: center; font-size: 12px; }
.game-header { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; margin-bottom: 18px; }
.game-header h2 { margin: 0; font-size: 21px; }
.game-header > div:nth-child(2) { display: flex; flex-direction: column; align-items: center; }
.game-header > div:nth-child(2) strong { font-size: 22px; }
.game-header > div:nth-child(2) span { color: rgba(255,255,255,.6); font-size: 9px; }
.game-header time { font-weight: 700; }
.star-board { position: relative; height: 400px; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 8px; background-color: #35344f; background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.14) 1px, transparent 0); background-size: 20px 20px; }
#moving-star { position: absolute; top: 45%; left: 45%; display: grid; width: 52px; height: 52px; place-items: center; border-radius: 50%; color: var(--ink); background: var(--gold); box-shadow: 0 0 0 10px rgba(242,196,90,.13); transition: top 110ms ease, left 110ms ease; }
#moving-star svg { width: 25px; fill: var(--gold-soft); }

.encouragement-modal { place-items: center; }
.encouragement-card { padding: 32px 24px 24px; text-align: center; }
.message-spark { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 50%; color: white; background: var(--coral); box-shadow: 0 0 0 10px var(--rose); }
.message-spark svg { width: 26px; fill: rgba(255,255,255,.35); }
.encouragement-card h2 { font-size: 24px; }
.encouragement-card > p:not(.eyebrow) { color: var(--ink-soft); font-size: 14px; }
.encouragement-card .primary-button { width: 100%; margin-top: 8px; }

.toast { position: fixed; right: 16px; bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom)); z-index: 100; max-width: min(360px, calc(100% - 32px)); padding: 12px 14px; border-radius: 8px; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 180ms ease, transform 180ms ease; font-size: 12px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: var(--danger); }

@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes petBob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(1deg); } }
@keyframes petCelebrate { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-18px) rotate(4deg); } }
@keyframes blink { 0%,45%,49%,100% { transform: scaleY(1); } 47% { transform: scaleY(.08); } }
@keyframes wing { 0%,100% { transform: rotate(0); } 50% { transform: rotate(8deg); } }
@keyframes tail { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(5deg); } }
@keyframes twinkle { 0%,100% { opacity: .35; transform: rotate(45deg) scale(.75); } 50% { opacity: 1; transform: rotate(45deg) scale(1.2); } }
@keyframes typing { 0%,80%,100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }

@media (min-width: 540px) {
  .content-area { padding-right: 24px; padding-left: 24px; }
  .pet-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .onboarding-submit { grid-template-columns: minmax(0, 1fr) auto; }
  .welcome-row { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .care-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pause-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-layout { grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; }
  .pause-card--reset { grid-column: 1 / -1; }
  .memory-entry { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .modal { place-items: center; }
}

@media (max-width: 380px) {
  .pet-stage__footer { gap: 6px; }
  .mood-chip { padding: 0 9px; font-size: 11px; }
  .small-action { padding: 0 10px; }
  .care-cta-long { display: none; }
  .care-cta-short { display: inline; }
}

@media (min-width: 840px) {
  .auth-view { grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr); }
  .auth-panel { padding: 64px max(7vw, 56px); }
  .auth-visual { display: block; }
  .onboarding-view { padding: 44px 32px 70px; }
  .onboarding-heading h1 { font-size: 44px; }
  .pet-picker { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .pet-choice label { min-height: 168px; }
  .app-header { display: none; }
  .app-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
  .desktop-nav { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 30px 18px; border-right: 1px solid var(--line); background: rgba(255,253,251,.9); }
  .brand-lockup--nav { margin: 0 10px 34px; }
  .nav-list { display: grid; gap: 5px; }
  .desktop-nav .nav-button { min-height: 46px; justify-content: flex-start; padding: 0 12px; border-radius: 8px; }
  .desktop-nav .nav-button.is-active { background: var(--rose); }
  .desktop-nav__note { margin: auto 10px 0; color: var(--ink-soft); font-size: 11px; }
  .content-area { max-width: 980px; padding: 48px 40px 64px; }
  .mobile-nav { display: none; }
  .toast { bottom: 22px; }
  .pet-stage { height: 470px; }
  .pet-art { top: 110px; width: 310px; height: 270px; }
  .needs-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .care-layout { grid-template-columns: minmax(320px, .9fr) minmax(360px, 1.1fr); align-items: stretch; }
  .care-stage { height: auto; min-height: 350px; }
  .care-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pause-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .habit-panel,
  .emotion-panel,
  .week-panel,
  .emotion-history-panel { padding: 22px; }
  .pause-card--reset { grid-column: auto; }
  .chat-shell { min-height: calc(100vh - 96px); }
}

@media (min-width: 1120px) {
  .app-layout { grid-template-columns: 245px minmax(0,1fr); }
  .content-area { padding-right: 56px; padding-left: 56px; }
  .pet-stage { height: 500px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
