/* Phone screen styles — shared across Home / Tracker / Pulse */

.phone-screen { color: #fff; font-family: var(--font-sans); font-size: 13px; }
.phone-screen * { box-sizing: border-box; }

.phs-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px 2px;
  font-family: var(--font-sans);
  font-size: 15px; font-weight: 600;
  position: relative;
  z-index: 10;
}
.phs-status .phs-icons { display: flex; gap: 5px; align-items: center; color: #fff; }
.phs-status .phs-icons svg { display: block; }

.phs-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 20px 22px 10px;
}
.phs-hello { font-size: 13px; color: var(--text-2); font-weight: 500; }
.phs-name { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.phs-subtle { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.phs-header-actions { display: flex; gap: 10px; align-items: center; }
.phs-iconbtn {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1C1C1E; display: grid; place-items: center;
  color: #AAA;
}
.phs-pro {
  background: linear-gradient(135deg, #0A84FF, #5AC8FA);
  color: #001530; font-weight: 800; font-size: 10px;
  padding: 4px 10px; border-radius: 999px; letter-spacing: 0.05em;
}
.phs-expenses {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
  font-size: 11px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Week */
.phs-week { display: flex; justify-content: space-between; padding: 14px 18px 8px; }
.phs-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.phs-dow { font-size: 9px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-2); }
.phs-day.active .phs-dow { color: #0A84FF; }
.phs-day .phs-date {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid #0A84FF; color: #fff; font-weight: 600; font-size: 13px;
}
.phs-day.active .phs-date { background: #0A84FF; color: #fff; }
.phs-day.dim .phs-date { border-color: #3A3A3C; color: #8E8E93; }
.phs-day.dim .phs-dow { color: #636366; }

/* Stack */
.phs-stack-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px 8px;
}
.phs-stack-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.phs-stack-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(52, 199, 89, 0.15); color: #34C759;
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px;
}
.phs-stack-badge .check { font-size: 11px; }

.phs-meds { padding: 0 14px; }
.phs-med {
  background: #151518;
  border: 1px solid #232325;
  border-radius: 14px;
  padding: 11px 12px 11px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  position: relative;
}
.phs-med.simple { margin: 0 8px 10px; }
.phs-med .stripe {
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 2px 2px 0;
}
.phs-med .stripe.teal { background: #5AC8FA; }
.phs-med .stripe.purple { background: #BF5AF2; }
.phs-med-main { flex: 1; min-width: 0; overflow: hidden; }
.phs-med-name { font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.phs-med-name .dose { color: #8E8E93; font-weight: 500; }
.phs-med-name .blend {
  background: rgba(191, 90, 242, 0.15);
  color: #BF5AF2;
  font-size: 8px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 5px; border-radius: 3px;
}
.phs-med-meta { font-size: 10.5px; color: #8E8E93; margin-top: 3px; }
.phs-med-meta.tiny { font-size: 9.5px; color: #636366; margin-top: 2px; }
.phs-med-meta .ok { color: #34C759; font-weight: 500; }
.phs-med-meta .sep { color: #3A3A3C; margin: 0 3px; }
.phs-add {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2C2C2E; display: grid; place-items: center;
  color: #fff; font-size: 17px; flex-shrink: 0;
  font-weight: 400;
}

.num-chip {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: rgba(90, 200, 250, 0.15);
  color: #5AC8FA;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  margin-right: 2px;
}
.num-chip.purple { background: rgba(191, 90, 242, 0.15); color: #BF5AF2; }

.phs-med-right { text-align: right; }
.pct-good { font-size: 11px; color: #34C759; font-weight: 600; }
.pct-good .info { color: #636366; margin-left: 2px; }
.since { font-size: 9.5px; color: #636366; margin-top: 2px; font-family: var(--font-mono); }

/* Section heads inside phone */
.phs-sec-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 22px 8px;
  font-size: 16px; font-weight: 700; letter-spacing: -0.02em;
}
.phs-sec-head .count { color: #636366; font-weight: 500; font-size: 13px; margin-left: 2px; }
.phs-sec-head a { color: #0A84FF; font-size: 12px; font-weight: 500; text-decoration: none; }

.phs-tabs-inline { display: flex; gap: 6px; padding: 0 14px; }
.phs-tabs-inline .t {
  flex: 1; text-align: center;
  padding: 9px 0;
  background: #1C1C1E;
  border-radius: 10px;
  font-size: 11.5px; font-weight: 600;
  color: #8E8E93;
}
.phs-tabs-inline .t.active { background: rgba(10, 132, 255, 0.2); color: #0A84FF; }

/* Tracker score card */
.phs-score-card {
  margin: 12px 14px 0;
  background: #151518;
  border: 1px solid #232325;
  border-radius: 18px;
  padding: 16px;
}
.phs-score-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.phs-score-sub { font-size: 10.5px; color: #8E8E93; margin-top: 2px; }
.phs-score-body { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; margin-top: 14px; align-items: center; }
.phs-score-metrics { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.phs-score-metric { display: grid; grid-template-columns: 8px 1fr; column-gap: 6px; row-gap: 2px; font-size: 10.5px; color: #8E8E93; align-items: center; }
.phs-score-metric .dot { width: 6px; height: 6px; border-radius: 50%; grid-row: span 2; align-self: center; }
.phs-score-metric .dot.green { background: #34C759; }
.phs-score-metric .dot.orange { background: #FF9F0A; }
.phs-score-metric .dot.purple { background: #BF5AF2; }
.phs-score-metric .dot.blue { background: #0A84FF; }
.phs-score-metric .k { font-size: 10px; color: #8E8E93; grid-column: 2; }
.phs-score-metric .v { grid-column: 2; font-family: var(--font-mono); font-weight: 600; font-size: 12px; }
.phs-score-metric .v.green { color: #34C759; }
.phs-score-metric .v.orange { color: #FF9F0A; }
.phs-score-metric .v.purple { color: #BF5AF2; }
.phs-score-metric .v.blue { color: #0A84FF; }

.phs-score-ring { position: relative; width: 110px; height: 110px; justify-self: center; }
.phs-score-ring svg { width: 100%; height: 100%; display: block; }
.phs-score-num {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
  color: #fff;
}
.phs-score-num .n { font-size: 30px; line-height: 1; }
.phs-score-num .pct { font-size: 13px; color: #8E8E93; line-height: 1; }

/* Tab bar */
.phs-tabbar {
  position: absolute;
  bottom: 14px; left: 12px; right: 12px;
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 32px;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.phs-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0;
  color: #8E8E93; font-size: 9px; font-weight: 500;
}
.phs-tab.active { color: #0A84FF; }
.phs-tab svg { stroke-width: 1.7; }
.phs-grid-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #0A84FF, #2D7DD2);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 132, 255, 0.4);
}

/* Pulse / dial-in */
.phs-med-pills { display: flex; gap: 6px; padding: 8px 14px; overflow-x: auto; scrollbar-width: none; }
.phs-med-pills::-webkit-scrollbar { display: none; }
.phs-med-pills .pill {
  padding: 7px 16px;
  border: 1.5px solid #3A3A3C;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  color: #8E8E93;
  white-space: nowrap;
}
.phs-med-pills .pill.active {
  border-color: #0A84FF; color: #0A84FF;
  background: rgba(10, 132, 255, 0.08);
}

.phs-pk-card {
  margin: 10px 14px;
  background: #151518;
  border: 1px solid #232325;
  border-radius: 16px;
  overflow: hidden;
}
.phs-pk-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 8px;
}
.phs-pk-title { font-size: 14px; font-weight: 600; color: #0A84FF; }
.phs-pk-meta { font-size: 10px; color: #8E8E93; font-family: var(--font-mono); margin-top: 2px; }
.phs-pk-edit {
  background: rgba(10, 132, 255, 0.1);
  border: 1px solid rgba(10, 132, 255, 0.25);
  color: #0A84FF;
  padding: 5px 12px; border-radius: 8px;
  font-size: 10.5px; font-weight: 600;
}
.phs-pk-chart { position: relative; padding: 0 16px 12px; }
.phs-pk-chart svg { width: 100%; height: 130px; display: block; }
.phs-pk-ylabels {
  position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 2px 0 14px 6px;
  height: 130px;
  font-family: var(--font-mono);
  font-size: 8px; color: #636366;
}

.phs-compare {
  margin: 10px 14px;
  background: #151518;
  border: 1px solid #232325;
  border-radius: 16px;
  padding: 14px;
}
.phs-compare-head { margin-bottom: 10px; }
.phs-compare-head > div:first-child { font-size: 14px; font-weight: 600; }
.phs-compare-head .sub { font-size: 10px; color: #8E8E93; margin-top: 2px; }
.phs-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phs-compare-grid .c-cell {
  background: #0A0A0C;
  border: 1px solid #232325;
  border-radius: 10px;
  padding: 10px 12px;
}
.phs-compare-grid .k { font-size: 10px; color: #8E8E93; }
.phs-compare-grid .v { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: #0A84FF; letter-spacing: -0.03em; margin-top: 2px; }
.phs-compare-grid .v.dim { color: #8E8E93; }

.phs-compare-breakdown { margin-top: 10px; padding-top: 8px; border-top: 1px solid #232325; }
.phs-compare-breakdown .b-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 11px; }
.phs-compare-breakdown .b-row .arrow { font-size: 14px; }
.phs-compare-breakdown .b-row .arrow.down { color: #FF9F0A; }
.phs-compare-breakdown .b-row .arrow.up { color: #0A84FF; }
.phs-compare-breakdown .b-row .k { flex: 1; color: #8E8E93; }
.phs-compare-breakdown .b-row .v { font-family: var(--font-mono); font-weight: 600; }
.phs-compare-breakdown .b-row .v.orange { color: #FF9F0A; }
.phs-compare-breakdown .b-row .v.blue { color: #0A84FF; }

/* ========== PHONE UI ANIMATIONS ========== */
.screen.active .phs-week .phs-day {
  animation: day-in 0.5s cubic-bezier(.2,.8,.2,1) both;
}
.screen.active .phs-week .phs-day:nth-child(1) { animation-delay: 0.05s; }
.screen.active .phs-week .phs-day:nth-child(2) { animation-delay: 0.10s; }
.screen.active .phs-week .phs-day:nth-child(3) { animation-delay: 0.15s; }
.screen.active .phs-week .phs-day:nth-child(4) { animation-delay: 0.20s; }
.screen.active .phs-week .phs-day:nth-child(5) { animation-delay: 0.25s; }
.screen.active .phs-week .phs-day:nth-child(6) { animation-delay: 0.30s; }
.screen.active .phs-week .phs-day:nth-child(7) { animation-delay: 0.35s; }
@keyframes day-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.screen.active .phs-day.active .phs-date {
  animation: date-pulse 2.4s ease-in-out 0.6s infinite;
}
@keyframes date-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(10,132,255,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(10,132,255,0); }
}

.screen.active .phs-med {
  animation: med-in 0.5s cubic-bezier(.2,.8,.2,1) both;
}
.screen.active .phs-med:nth-of-type(1) { animation-delay: 0.3s; }
.screen.active .phs-med:nth-of-type(2) { animation-delay: 0.4s; }
.screen.active .phs-med:nth-of-type(3) { animation-delay: 0.5s; }
.screen.active .phs-med:nth-of-type(4) { animation-delay: 0.6s; }
@keyframes med-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

/* Protocol score ring reveal */
.screen.active .phs-score-ring circle:nth-child(n+2) {
  stroke-dashoffset: 0;
  animation: ring-reveal 1.2s cubic-bezier(.2,.8,.2,1) 0.4s both;
}
@keyframes ring-reveal {
  from { stroke-dasharray: 0 392; }
}
.screen.active .phs-score-num {
  animation: num-count 0.8s ease 0.8s both;
}
@keyframes num-count {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* PK chart draw-in */
.screen.active .phs-pk-chart path[fill="none"] {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: draw-wave 2s cubic-bezier(.3,.7,.3,1) 0.3s forwards;
}
.screen.active .phs-pk-chart path[fill="url(#pkFill)"] {
  animation: fill-fade 1.2s ease 1.5s both;
}
@keyframes draw-wave {
  to { stroke-dashoffset: 0; }
}
@keyframes fill-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Pill cascade */
.screen.active .phs-med-pills .pill {
  animation: pill-in 0.4s cubic-bezier(.2,.8,.2,1) both;
}
.screen.active .phs-med-pills .pill:nth-child(1) { animation-delay: 0.1s; }
.screen.active .phs-med-pills .pill:nth-child(2) { animation-delay: 0.2s; }
.screen.active .phs-med-pills .pill:nth-child(3) { animation-delay: 0.3s; }
@keyframes pill-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}

/* Live dot on PK title */
.screen.active .phs-pk-title::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: #34C759;
  margin-right: 6px;
  box-shadow: 0 0 8px #34C759;
  animation: live-pulse 1.5s ease-in-out infinite;
  vertical-align: middle;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Compare values tick up */
.screen.active .phs-compare-grid .v {
  animation: num-tick 0.6s cubic-bezier(.2,.8,.2,1) 0.8s both;
}
@keyframes num-tick {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Tab bar lift */
.screen.active .phs-tabbar {
  animation: tab-lift 0.6s cubic-bezier(.2,.8,.2,1) 0.2s both;
}
@keyframes tab-lift {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* Bento cards reveal on scroll — handled by styles.css */

/* Hero big chart stroke draw — only starts once card is in view */
.mini-chart svg path[fill="none"] {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
}
.card.in-view .mini-chart svg path[fill="none"] {
  animation: draw-big 3s cubic-bezier(.3,.7,.3,1) forwards;
}
@keyframes draw-big { to { stroke-dashoffset: 0; } }

/* Stack badge pulse */
.phs-stack-badge {
  animation: badge-bounce 0.6s cubic-bezier(.3,1.5,.5,1) 0.5s both;
}
@keyframes badge-bounce {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active .phs-week .phs-day,
  .screen.active .phs-med,
  .screen.active .phs-score-num,
  .screen.active .phs-compare-grid .v,
  .screen.active .phs-tabbar,
  .screen.active .phs-med-pills .pill,
  .screen.active .phs-pk-chart path[fill="none"],
  .screen.active .phs-pk-chart path[fill="url(#pkFill)"],
  .phs-stack-badge,
  .card.in-view .mini-chart svg path[fill="none"] {
    animation: none;
  }
  .screen.active .phs-score-ring circle:nth-child(n+2) {
    animation: none;
    stroke-dashoffset: 0;
  }
  .screen.active .phs-day.active .phs-date {
    animation: none;
  }
  .screen.active .phs-pk-title::before {
    animation: none;
  }
  .mini-chart svg path[fill="none"] {
    stroke-dashoffset: 0;
  }
}
