/* 7 Days with Cortisol — Lingzhi AI companion demo
   Tokens match anti-inflamitore / chinjaneking lesson demos. */

:root {
  --bg: #FDFBF7;
  --surface: #FFFFFF;
  --ink: #3D2C29;
  --ink-soft: #8A7A72;
  --primary: #E86FA4;
  --primary-deep: #D9538E;
  --accent: #F08C5A;
  --violet: #8B5FBF;
  --violet-soft: #EDE4F7;
  --leaf: #8BA84E;
  --sky: #7EC8E3;
  --flame: #E05A4E;
  --line: #EFE9E2;
  --grad-main: linear-gradient(135deg, #F08C5A 0%, #E86FA4 100%);
  --grad-badge: linear-gradient(160deg, #A98BE0, #E86FA4);
  --r-card: 24px;
  --r-photo: 20px;
  --shadow: 0 2px 12px rgba(61, 44, 41, .06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Noto Serif SC", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--sans);
  background: #EFE9E2;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; border: none; cursor: pointer; background: none; color: inherit; }

.stage {
  --phone-w: 406px;
  --phone-h: 860px;
  --fit: min(1, (100vw - 32px) / 406px, (100dvh - 56px) / 860px);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  padding: 8px 16px;
}
.phone-fit {
  width: calc(var(--phone-w) * var(--fit));
  height: calc(var(--phone-h) * var(--fit));
  overflow: hidden;
}
.phone {
  width: var(--phone-w);
  height: var(--phone-h);
  background: var(--ink);
  border-radius: 55px;
  padding: 8px;
  box-shadow: 0 24px 64px rgba(61, 44, 41, .28), inset 0 0 0 2px #5a4642;
  position: relative;
  transform: scale(var(--fit));
  transform-origin: top left;
}
.phone-island {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 34px;
  background: #1a1210;
  border-radius: 20px;
  z-index: 100;
  pointer-events: none;
}
.phone-screen {
  width: 390px;
  height: 844px;
  background: var(--bg);
  border-radius: 47px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.stage-hint {
  flex-shrink: 0;
  font-size: 12px;
  color: #B8AC9F;
  letter-spacing: .12em;
}

@media (max-width: 500px) {
  html, body { overflow: hidden; }
  .stage { --fit: 1; padding: 0; gap: 0; }
  .phone-fit { width: 100vw; height: 100dvh; }
  .phone {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    transform: none;
  }
  .phone-island { display: none; }
  .phone-screen { width: 100%; height: 100%; border-radius: 0; }
  .stage-hint { display: none; }
}

@keyframes rise {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.serif-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.3;
  margin: 6px 0 10px;
}
.day-serif {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--violet);
}
.lede { font-size: 15px; line-height: 1.65; margin: 4px 0 14px; color: var(--ink); }
.nav-back { font-size: 28px; color: var(--ink-soft); line-height: 1; cursor: pointer; margin-bottom: 8px; }
.page { padding: 64px 20px 24px; animation: rise .4s ease-out; }

.btn-primary {
  display: block;
  width: 100%;
  height: 48px;
  border-radius: 24px;
  background: var(--grad-main);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  margin-top: 18px;
}
.btn-primary:disabled { background: var(--line); color: var(--ink-soft); cursor: not-allowed; }
.btn-ghost {
  display: block;
  width: 100%;
  min-height: 44px;
  border-radius: 22px;
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 14px;
  padding: 10px;
}

.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt {
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.55;
}
.opt.sel { background: var(--violet-soft); border-color: var(--violet); }
.opt.correct { background: #eef5e6; border-color: var(--leaf); }
.opt.wrong { background: #fbeceb; border-color: var(--flame); }
.opt .opt-sub { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.screen {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen[hidden] { display: none !important; }

.screen-welcome { padding: 0; display: flex; flex-direction: column; }
.welcome-hero img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  object-position: center 62%;
  border-radius: 0 0 28px 28px;
}
.welcome-body { padding: 20px 22px 30px; }
.welcome-body .serif-title { font-size: 30px; }
.welcome-sub { font-size: 15px; margin: 8px 0 6px; line-height: 1.55; }
.welcome-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.welcome-note { font-size: 12px; color: var(--ink-soft); margin-top: 12px; text-align: center; }

.safety-dots { display: flex; gap: 6px; align-items: center; margin: 8px 0 16px; }
.safety-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); display: block; }
.safety-dots i.on { background: var(--violet); transform: scale(1.25); }
.safety-dots i.done { background: var(--leaf); }

.letter {
  background: #fff;
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-top: 4px;
}
.letter-copy { font-family: var(--serif); font-size: 17px; line-height: 1.65; margin-top: 10px; }
.guide-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.guide-list .g {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.count-row { margin: 10px 0 2px; }
.dots { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
}
.dot.done { background: var(--leaf); border-color: var(--leaf); }
.dot.now { border-color: var(--violet); background: var(--violet-soft); }
.count-label { font-size: 12px; color: var(--ink-soft); }
.today-hero {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--r-photo);
  margin: 10px 0 14px;
}
.today-hero.hero-wake { object-position: center 12%; }

.kp {
  background: var(--violet-soft);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.know-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.action-card {
  background: #fff;
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 18px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}
.action-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.action-card h3 { font-family: var(--serif); font-size: 17px; margin-bottom: 8px; }
.action-card p { font-size: 14px; margin-bottom: 8px; line-height: 1.6; }
.hint-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chip {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}
.chip.sel { background: var(--violet-soft); border-color: var(--violet); }
.explain {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.list-thumb { width: 100%; height: 80px; object-fit: cover; border-radius: 16px; margin: 10px 0 14px; }
.day-row {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
}
.day-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 14px; flex-shrink: 0; }
.day-row .t1 { font-family: var(--serif); font-size: 13px; color: var(--violet); font-weight: 700; }
.day-row .t2 { font-size: 14px; font-weight: 600; line-height: 1.45; }
.day-row .st { font-size: 12px; color: var(--ink-soft); }
.day-row.today { border: 1.5px solid var(--violet); }

.bean-card {
  background: #fff;
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 4px 0 12px;
}
.bean-num { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--accent); }
.bean-sub { font-size: 12px; color: var(--ink-soft); }
.traj { background: #fff; border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; font-size: 13px; line-height: 1.6; }
.kit-item {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.kit-item strong { display: block; font-size: 14px; margin-bottom: 2px; }
.kit-item span { font-size: 12px; color: var(--ink-soft); }
.demo-fold { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.demo-fold summary { cursor: pointer; padding: 8px 0; }
.demo-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.demo-btns button {
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
}

.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar[hidden] { display: none; }
.tab {
  flex: 1;
  padding: 10px 0 12px;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tab span { font-size: 18px; }
.tab.active { color: var(--violet); box-shadow: inset 0 2px 0 var(--violet); }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(61,44,41,.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.overlay[hidden] { display: none; }
.fb-modal {
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 88%;
  overflow-y: auto;
  animation: rise .3s ease-out;
}
.fb-band { width: 100%; height: 80px; object-fit: cover; }
.fb-body { padding: 16px 20px 28px; }
.fb-user { background: var(--violet-soft); border-radius: 14px; padding: 10px 14px; font-size: 14px; margin-bottom: 10px; }
.fb-ai { background: #fff; border: 1px solid var(--violet); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.badge-pop { text-align: center; margin: 16px 0; }
.badge-pop .badge-circle {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--grad-badge);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff; margin: 0 auto 8px;
}
.badge-name { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.badge-copy { font-size: 13px; color: var(--ink-soft); }

.toast {
  position: absolute;
  left: 20px; right: 20px; bottom: 90px;
  z-index: 80;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  text-align: center;
  border-radius: 16px;
  padding: 12px 16px;
  animation: rise .22s ease-out;
}
.toast[hidden] { display: none; }

.chart {
  width: 100%;
  height: 168px;
  display: block;
}
.chart-wrap { position: relative; }
.chart-caption {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.chart-note {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}
.hit {
  cursor: pointer;
}
.footer-note { font-size: 12px; color: var(--ink-soft); margin: 12px 0; line-height: 1.55; }
