/* ============================================================
   PepTalk Health — Senior-First Design System
   Shared tokens + components for all redesigned screens.
   ============================================================ */

:root {
  /* Brand */
  --brand:       #0E6E7E;
  --brand-deep:  #0A5664;
  --brand-soft:  #2A8CAD;
  --accent:      #DCEAEC;

  /* Semantic status */
  --ok:   #1E6E3A;
  --warn: #8B4A00;
  --bad:  #9B2214;

  /* Ink / neutrals */
  --ink:  #22241F;
  --ink2: #55564E;
  --ink3: #7A7B72;
  --line: #E8E2D4;

  /* Warm surfaces */
  --bg:            #FBF6EC;
  --surface:       #FFFDF6;
  --surface-sage:  #EEF2E8;
  --surface-peach: #FBEFE3;
  --surface-teal:  #E4EFF1;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Arial, sans-serif;

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 36px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-card: 0 1px 2px rgba(60,40,10,.04), 0 14px 30px -18px rgba(60,40,10,.14);
  --shadow-btn:  0 8px 20px -8px rgba(14,110,126,.5);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font);
}

/* ------- Stage / showcase wrapper for a single screen ------- */
.stage-single {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(14,110,126,.12), transparent 60%),
    radial-gradient(600px 400px at 80% 90%, rgba(200,140,80,.10), transparent 60%),
    #0b1120;
}
.stage-single .label {
  position: fixed;
  top: 20px; left: 24px;
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
}
.stage-single .label b { color: #fff; font-weight: 800; text-transform: none; letter-spacing: 0; margin-left: 8px; }
.stage-single .back {
  position: fixed;
  top: 20px; right: 24px;
  color: #cbd5e1; text-decoration: none;
  background: #1e293b;
  padding: 8px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

/* ------- iPhone-ish frame ------- */
.phone {
  width: 380px;
  max-width: 100%;
  background: linear-gradient(180deg,#1a2540,#0b1220);
  border-radius: 48px;
  padding: 14px;
  box-shadow:
    0 60px 100px -30px rgba(0,0,0,.7),
    inset 0 0 0 2px #1e293b,
    inset 0 0 0 6px #0b1220;
}
.screen {
  color: var(--ink);
  border-radius: var(--r-xl);
  overflow: hidden;
  height: 740px;
  position: relative;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  font-size: 17px;
  line-height: 1.5;
  background:
    radial-gradient(420px 260px at -10% -5%, rgba(14,110,126,.12), transparent 65%),
    radial-gradient(520px 320px at 115% 105%, rgba(200,140,80,.14), transparent 65%),
    radial-gradient(260px 200px at 90% 10%, rgba(120,150,110,.10), transparent 70%),
    var(--bg);
}
/* ambient floating shapes */
.bgshape { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(4px); opacity: .6; z-index: 0; }
.bgshape.a { top: -40px; right: -40px; width: 180px; height: 180px; background: radial-gradient(closest-side, rgba(14,110,126,.14), transparent 70%); animation: floatA 9s ease-in-out infinite; }
.bgshape.b { bottom: 80px; left: -50px; width: 220px; height: 220px; background: radial-gradient(closest-side, rgba(200,140,80,.14), transparent 70%); animation: floatB 11s ease-in-out infinite; }
.bgshape.c { top: 40%; right: -30px; width: 120px; height: 120px; background: radial-gradient(closest-side, rgba(120,150,110,.18), transparent 70%); animation: floatA 13s ease-in-out infinite reverse; }
@keyframes floatA { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-10px,14px) scale(1.05); } }
@keyframes floatB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(16px,-10px) scale(1.06); } }

/* ------- Status bar + content + tab bar ------- */
.statusbar {
  height: 42px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 24px;
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  position: relative;
  z-index: 3;
}
.island {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 28px; background: #0b1220; border-radius: 20px;
  z-index: 5;
}
.content {
  flex: 1; overflow: auto;
  padding: 14px 18px 28px;
  position: relative; z-index: 1;
  scroll-behavior: smooth;
}
.content::-webkit-scrollbar { display: none; }
.content > * { animation: slideUp .5s ease both; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .08s; }
.content > *:nth-child(3) { animation-delay: .14s; }
.content > *:nth-child(4) { animation-delay: .20s; }
.content > *:nth-child(5) { animation-delay: .26s; }
.content > *:nth-child(6) { animation-delay: .32s; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tabbar {
  display: flex;
  justify-content: space-around;
  padding: 10px 8px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  z-index: 2;
}
.tab {
  flex: 1; text-align: center;
  color: #7A7B72;
  font-weight: 700; font-size: 13px;
  padding: 6px 0;
  border-radius: 12px;
  cursor: pointer;
}
.tab.active { color: var(--brand); background: var(--surface-teal); }
.tab .i { display: block; font-size: 22px; margin-bottom: 3px; line-height: 1; }

/* ------- Typography ------- */
.greet {
  font-size: 12px;
  color: var(--ink2);
  margin-bottom: 2px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.title {
  font-size: 30px;
  font-weight: 800;
  margin: 6px 0 14px;
  letter-spacing: -.015em;
  line-height: 1.15;
  color: var(--ink);
}
.sub {
  font-size: 16px;
  color: var(--ink2);
  margin: 0 0 18px;
  font-weight: 500;
  line-height: 1.45;
}
.eyebrow-center { text-align: center; }

/* Big hero readings */
.big-reading {
  font-size: 68px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  margin: 18px 0 8px;
  text-align: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.big-reading .sep { color: var(--ink3); font-size: 42px; font-weight: 700; margin: 0 4px; }
.big-reading .unit { display: block; font-size: 16px; font-weight: 600; color: var(--ink2); letter-spacing: 0; margin-top: 6px; text-transform: uppercase; }
.reading-label {
  text-align: center;
  color: var(--ink2);
  font-size: 17px;
  margin-bottom: 14px;
  font-weight: 600;
}

/* ------- Cards ------- */
.today-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid #EFE8D6;
  position: relative;
  overflow: hidden;
}
.today-card.sage  { background: var(--surface-sage);  border-color: #D9E0CF; }
.today-card.peach { background: var(--surface-peach); border-color: #F1DFC8; }
.today-card.teal  { background: var(--surface-teal);  border-color: #CFE0E4; }
.today-card h3 { margin: 0 0 6px; font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.today-card p  { margin: 0 0 14px; color: var(--ink2); font-size: 16px; line-height: 1.45; }
.today-card .illus-top {
  height: 130px;
  margin: -20px -20px 14px;
  border-bottom: 1px solid rgba(0,0,0,.04);
}

/* Simple row card used on list screens */
.row-card {
  background: var(--surface);
  border: 1px solid #EFE8D6;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .15s;
}
.row-card:hover { transform: translateY(-1px); }
.row-card .thumb {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--surface-teal);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  border: 1px solid #CFE0E4;
  overflow: hidden;
}
.row-card .thumb svg { width: 100%; height: 100%; }
.row-card .meta { flex: 1; min-width: 0; }
.row-card .meta .name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.row-card .meta .sub2 { font-size: 14px; color: var(--ink2); margin-top: 2px; font-weight: 500; }
.row-card .chev { color: var(--ink3); font-size: 22px; flex: 0 0 auto; }

/* ------- Buttons ------- */
.bigbtn {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 16px;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  padding: 14px 16px;
  box-shadow: var(--shadow-btn);
  transition: transform .15s, box-shadow .15s;
  font-family: var(--font);
}
.bigbtn:hover  { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(14,110,126,.6); }
.bigbtn:active { transform: translateY(0); }
.bigbtn.secondary { background: var(--surface); color: var(--brand); border: 2px solid var(--brand); box-shadow: none; }
.bigbtn.ghost     { background: var(--surface); color: var(--ink);   border: 1px solid var(--line); box-shadow: none; }
.bigbtn.danger    { background: var(--surface); color: var(--bad);   border: 2px solid #E3B2A7; box-shadow: none; }
.bigbtn.apple     { background: #22241F; color: #fff; box-shadow: none; }
.bigbtn[disabled] { opacity: .5; cursor: not-allowed; }

/* small inline text link */
.linkbtn {
  background: transparent; border: 0;
  color: var(--brand);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  padding: 10px 8px;
  font-family: var(--font);
}

/* Icon-only circle button (back, close) */
.iconbtn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink);
  font-size: 18px;
}

/* Header row with back + title + action */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 18px;
}
.topbar .t { flex: 1; font-size: 17px; font-weight: 700; text-align: center; }
.topbar .spacer { width: 44px; }

/* ------- Status pills ------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 15px;
  border: 2px solid transparent;
}
.pill.warn { background: #F6E2CA; color: var(--warn); border-color: #E3C59D; }
.pill.ok   { background: #DDE9D4; color: var(--ok);   border-color: #BFD2B1; }
.pill.bad  { background: #F3D6CF; color: var(--bad);  border-color: #E3B2A7; }
.pill.info { background: var(--surface-teal); color: var(--brand); border-color: #B8D0D5; }

/* ------- Step list (numbered) ------- */
.step { display: flex; gap: 14px; margin-bottom: 14px; align-items: flex-start; }
.step .n {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; flex: 0 0 auto;
  font-size: 15px;
  box-shadow: 0 4px 10px -4px rgba(14,110,126,.5);
}
.step .n.off  { background: #E5DFCE; color: #9A9583; box-shadow: none; }
.step .n.done { background: var(--ok); box-shadow: 0 4px 10px -4px rgba(30,110,58,.5); }
.step h4 { margin: 4px 0 2px; font-size: 18px; font-weight: 700; color: var(--ink); }
.step p  { margin: 0; color: var(--ink2); font-size: 15px; line-height: 1.4; }

/* ------- Progress bar ------- */
.progress {
  height: 12px;
  background: #E8E0CC;
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 8px 0 4px;
  position: relative;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-soft));
  border-radius: var(--r-pill);
  transition: width .4s;
  position: relative;
}
.progress > span::after {
  content: ""; position: absolute; top: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { left: -40px; } to { left: 100%; } }

/* ------- Live status strip ------- */
.live-status {
  display: flex; align-items: center; gap: 12px;
  background: #DDE9D4;
  color: var(--ok);
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  margin: 12px 0;
  border: 2px solid #BFD2B1;
}
.live-status.warn { background: #F6E2CA; color: var(--warn); border-color: #E3C59D; }
.live-status.info { background: var(--surface-teal); color: var(--brand); border-color: #B8D0D5; }
.pulse-dot {
  width: 14px; height: 14px;
  background: currentColor; border-radius: 50%;
  position: relative; flex: 0 0 auto;
}
.pulse-dot::before {
  content: ""; position: absolute; inset: -6px;
  border-radius: 50%; background: currentColor; opacity: .3;
  animation: pulseRing 1.4s ease-out infinite;
}
@keyframes pulseRing { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(2); opacity: 0; } }

/* ------- Scene / illustration container ------- */
.scene {
  height: 190px;
  border-radius: 20px;
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  background:
    radial-gradient(240px 140px at 30% 30%, rgba(14,110,126,.14), transparent 70%),
    radial-gradient(240px 180px at 80% 80%, rgba(200,140,80,.18), transparent 70%),
    linear-gradient(135deg, #EAE1CE, #DCEAEC);
}
.scene svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ------- Form inputs (senior-sized) ------- */
.field {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  font-family: var(--font);
  margin-bottom: 12px;
  transition: border-color .2s;
}
.field:focus { outline: none; border-color: var(--brand); }
.field::placeholder { color: var(--ink3); font-weight: 500; }
.label-above {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink2);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 4px 4px 8px;
}

/* Toggle switch */
.toggle-sw {
  position: relative;
  width: 56px; height: 32px;
  background: #D9D3C1;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s;
  flex: 0 0 auto;
}
.toggle-sw::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  transition: left .2s;
}
.toggle-sw.on { background: var(--brand); }
.toggle-sw.on::after { left: 27px; }

.setting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid #EFE8D6;
  border-radius: 14px;
  margin-bottom: 10px;
}
.setting-row .icon { font-size: 22px; width: 36px; text-align: center; }
.setting-row .meta { flex: 1; }
.setting-row .meta .name { font-size: 17px; font-weight: 700; }
.setting-row .meta .sub2 { font-size: 14px; color: var(--ink2); margin-top: 2px; font-weight: 500; }
.setting-row .v { font-size: 15px; color: var(--ink2); font-weight: 600; }
.setting-row .chev { color: var(--ink3); font-size: 22px; }

/* ------- Reusable animations ------- */
.heart { animation: heartbeat 1.2s ease-in-out infinite; transform-origin: center; display: inline-block; }
@keyframes heartbeat { 0%,60%,100% { transform: scale(1); } 30% { transform: scale(1.2); } 45% { transform: scale(.95); } }
.breathe { animation: breathe 4s ease-in-out infinite; transform-origin: center; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.02); } }
.btwave { animation: btwave 1.8s ease-out infinite; transform-origin: center; }
@keyframes btwave { 0% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
.cuff { animation: inflate 3.2s ease-in-out infinite; }
@keyframes inflate { 0%,100% { transform: scaleX(1); transform-origin: center; } 45%,55% { transform: scaleX(1.05); } }
.sparkle { animation: sparkle 1.6s ease infinite; transform-origin: center; }
@keyframes sparkle { 0%,100% { opacity: .4; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }
.ecg-line { stroke-dasharray: 500; stroke-dashoffset: 500; animation: draw 2s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.spin-slow { animation: spinSlow 2.2s linear infinite; transform-origin: center; }
@keyframes spinSlow { to { transform: rotate(360deg); } }
