:root {
  --ink: #1f2421;
  --muted: #6f776f;
  --moss: #28584c;
  --moss-2: #3e7a69;
  --cream: #fff8ee;
  --paper: rgba(255, 253, 248, 0.86);
  --sage: #dfeadf;
  --sand: #eadfce;
  --coral: #ef6f53;
  --sun: #f5b65a;
  --sky: #d6edf0;
  --line: rgba(31, 36, 33, 0.12);
  --shadow: 0 24px 80px rgba(45, 60, 50, 0.14);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  background:
    radial-gradient(circle at 8% 4%, rgba(245, 182, 90, 0.28), transparent 30rem),
    radial-gradient(circle at 88% 18%, rgba(62, 122, 105, 0.26), transparent 28rem),
    linear-gradient(135deg, #fff8ee 0%, #edf5ee 52%, #f9efe6 100%);
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
.ambient { position: fixed; border-radius: 999px; filter: blur(18px); opacity: 0.55; pointer-events: none; z-index: 0; }
.ambient-one { width: 18rem; height: 18rem; background: var(--coral); right: -5rem; top: 12rem; }
.ambient-two { width: 22rem; height: 22rem; background: var(--sky); left: -8rem; bottom: 6rem; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  backdrop-filter: blur(20px);
  background: rgba(255, 248, 238, 0.76);
  border-bottom: 1px solid rgba(255, 255, 255, 0.65);
}
.brand { display: flex; align-items: center; gap: 0.8rem; color: inherit; text-decoration: none; min-width: 220px; }
.brand-mark { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 1.1rem; background: var(--moss); color: #fff; font-size: 1.6rem; font-weight: 900; box-shadow: 0 12px 30px rgba(40, 88, 76, 0.24); }
.brand strong { display: block; font-size: 1rem; letter-spacing: 0.02em; }
.brand small { color: var(--muted); }
.nav { display: flex; gap: 0.35rem; padding: 0.35rem; border-radius: 999px; background: rgba(255, 255, 255, 0.58); border: 1px solid var(--line); }
.nav-item { padding: 0.7rem 0.9rem; border-radius: 999px; color: var(--muted); background: transparent; white-space: nowrap; }
.nav-item.active { color: #fff; background: var(--moss); }
.account-pill { display: flex; gap: 0.5rem; align-items: center; justify-content: flex-end; min-width: 180px; }

main { position: relative; z-index: 1; padding: 2rem clamp(1rem, 4vw, 3rem) 5rem; max-width: 1280px; margin: 0 auto; }
.view { display: none; animation: fadeUp 0.36s ease both; }
.active-view { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr); gap: 1.4rem; align-items: stretch; }
.hero-copy, .pet-card, .panel, .feature-card, .timeline-panel, .chat-panel, .dialog-shell {
  border: 1px solid rgba(255,255,255,0.7);
  background: var(--paper);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.hero-copy { padding: clamp(2rem, 6vw, 5rem); position: relative; overflow: hidden; }
.hero-copy::after { content: ""; position: absolute; right: -7rem; top: -7rem; width: 18rem; height: 18rem; background: rgba(40, 88, 76, 0.11); border-radius: 50%; }
.eyebrow { margin: 0 0 0.8rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--moss-2); font-size: 0.78rem; font-weight: 800; }
h1 { max-width: 760px; margin: 0; font-size: clamp(2.8rem, 8vw, 6.2rem); line-height: 0.95; letter-spacing: -0.07em; }
h2 { margin: 0; font-size: clamp(1.8rem, 3vw, 3rem); letter-spacing: -0.04em; }
h3 { margin: 0 0 0.9rem; font-size: 1.25rem; }
.hero-lead { max-width: 720px; font-size: 1.22rem; line-height: 1.9; color: #465149; }
.hero-actions, .trust-row { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 1.5rem; }
.trust-row span { padding: 0.45rem 0.7rem; color: var(--muted); background: rgba(255,255,255,0.62); border: 1px solid var(--line); border-radius: 999px; font-size: 0.9rem; }
.primary, .secondary, .ghost { min-height: 2.9rem; padding: 0.75rem 1rem; border-radius: 999px; font-weight: 800; }
.primary { color: #fff; background: linear-gradient(135deg, var(--moss), var(--moss-2)); box-shadow: 0 12px 28px rgba(40, 88, 76, 0.24); }
.secondary { color: var(--ink); background: var(--sage); }
.ghost { color: var(--moss); background: rgba(255,255,255,0.7); border: 1px solid var(--line); }

.pet-card { padding: 2rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: linear-gradient(160deg, rgba(255,255,255,0.82), rgba(223,234,223,0.78)); }
.pet-orbit { height: 14rem; display: grid; place-items: center; border-radius: 2rem; background: radial-gradient(circle, #fff 0 25%, var(--sky) 26% 48%, transparent 49%); }
.pet-orbit span { font-size: 5rem; transform: rotate(-8deg); }
.pet-card h2 { margin-top: 0.4rem; }
.pet-card p { color: var(--muted); line-height: 1.6; }
.vital-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.7rem; margin-top: 1.2rem; }
.vital-grid div { padding: 0.9rem; border-radius: 1.2rem; background: rgba(255,255,255,0.65); border: 1px solid var(--line); }
.vital-grid strong { display: block; font-size: 1.1rem; }
.vital-grid small { color: var(--muted); }

.section-head { margin: 3rem 0 1rem; }
.section-head.split { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.section-head.compact { margin-top: 2rem; }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }
.feature-card { padding: 1.5rem; min-height: 13rem; }
.feature-card span { display: inline-flex; color: var(--coral); font-weight: 900; margin-bottom: 1.4rem; }
.feature-card p, .panel p { color: var(--muted); line-height: 1.7; }

.workspace-grid { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.panel { padding: 1.4rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.9rem; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 0.35rem; color: #3b453d; font-weight: 800; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,0.72); color: var(--ink);
  border-radius: 1rem; padding: 0.85rem 0.9rem; outline: none;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--moss-2); box-shadow: 0 0 0 4px rgba(62,122,105,0.12); }
.list-stack { display: grid; gap: 0.7rem; }
.item { padding: 1rem; border-radius: 1.2rem; background: rgba(255,255,255,0.62); border: 1px solid var(--line); }
.item.active { border-color: var(--moss-2); box-shadow: inset 0 0 0 1px var(--moss-2); }
.item-row { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.item-title { font-weight: 900; }
.item-meta { color: var(--muted); line-height: 1.6; margin-top: 0.35rem; }
.chip { display: inline-flex; padding: 0.25rem 0.55rem; border-radius: 999px; background: var(--sage); color: var(--moss); font-size: 0.82rem; font-weight: 800; }

.timeline-panel { padding: 1.4rem; display: grid; gap: 1rem; background: rgba(255,255,255,0.62); }
.timeline-item { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: start; }
.timeline-date { color: var(--moss); font-weight: 900; }
.timeline-body { padding: 1rem; border-radius: 1.3rem; background: rgba(255,255,255,0.72); border: 1px solid var(--line); }
.timeline-body img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 1rem; margin-top: 0.75rem; }
.advice-card { padding: 1.1rem; border-radius: 1.2rem; background: linear-gradient(135deg, rgba(214,237,240,0.8), rgba(255,248,238,0.9)); line-height: 1.8; margin-bottom: 1rem; white-space: pre-wrap; }

.consult-layout { display: grid; grid-template-rows: minmax(420px, 58vh) auto; gap: 1rem; }
.chat-panel { padding: 1.2rem; overflow: auto; display: grid; align-content: start; gap: 1rem; }
.message { max-width: 78%; padding: 1rem 1.1rem; border-radius: 1.3rem; line-height: 1.8; white-space: pre-wrap; }
.message.user { justify-self: end; background: var(--moss); color: #fff; border-bottom-right-radius: 0.3rem; }
.message.ai { justify-self: start; background: rgba(255,255,255,0.78); border: 1px solid var(--line); border-bottom-left-radius: 0.3rem; }
.consult-box { display: grid; grid-template-columns: 1fr auto; gap: 0.8rem; align-items: end; padding: 1rem; border-radius: 1.6rem; background: rgba(255,255,255,0.72); box-shadow: var(--shadow); }
.consult-box textarea { min-height: 5rem; }
.mode-badge { align-self: center; padding: 0.55rem 0.8rem; border-radius: 999px; background: var(--sage); color: var(--moss); font-weight: 900; }

.auth-dialog { border: 0; background: transparent; width: min(94vw, 520px); }
.auth-dialog::backdrop { background: rgba(25, 31, 28, 0.38); backdrop-filter: blur(10px); }
.dialog-shell { position: relative; padding: 1.6rem; display: grid; gap: 0.9rem; }
.icon-close { position: absolute; right: 1rem; top: 1rem; width: 2.4rem; height: 2.4rem; border-radius: 999px; background: var(--sage); font-size: 1.5rem; }
.auth-tabs { display: flex; gap: 0.4rem; padding: 0.3rem; background: var(--sage); border-radius: 999px; }
.auth-tabs button { flex: 1; padding: 0.7rem; border-radius: 999px; background: transparent; }
.auth-tabs .active { background: #fff; color: var(--moss); font-weight: 900; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%) translateY(140%); z-index: 50; padding: 0.9rem 1.1rem; background: var(--ink); color: #fff; border-radius: 999px; transition: transform .25s ease; max-width: min(92vw, 720px); }
.toast.show { transform: translateX(-50%) translateY(0); }
.empty { color: var(--muted); padding: 1rem; border: 1px dashed var(--line); border-radius: 1rem; text-align: center; }

@media (max-width: 920px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .brand, .account-pill { min-width: 0; }
  .nav { overflow-x: auto; justify-content: flex-start; }
  .hero-grid, .workspace-grid, .feature-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  main { padding-inline: 0.8rem; }
  .hero-copy, .pet-card, .panel, .feature-card { border-radius: 1.4rem; }
  h1 { font-size: 3.2rem; }
  .feature-grid, .form-grid, .consult-box { grid-template-columns: 1fr; }
  .message { max-width: 92%; }
  .timeline-item { grid-template-columns: 1fr; }
}
