/* Sample app: a live HTML phone (Home, Progress, Routine) in the app's own light and dark tokens. */

.time { max-width: 1240px; margin: clamp(72px, 12vw, 160px) auto 0; padding: 0 var(--gutter); display: grid; gap: 40px; align-items: center; }
.time__copy h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 5.2vw, 64px); line-height: 1.05; color: var(--ink); margin: 12px 0 0; text-wrap: balance; }
.time__copy p:not(.eyebrow) { margin: 18px 0 0; max-width: 44ch; font-size: clamp(16px, 1.5vw, 18px); line-height: 1.75; color: var(--text); }
.time__copy .time__note { font-size: 14px; color: var(--muted); }
.time__demo { display: grid; justify-items: stretch; gap: 24px; width: min(100%, 340px); justify-self: center; }
@media (min-width: 860px) { .time { grid-template-columns: 1fr 1fr; gap: 96px; } .time__demo { justify-self: end; } }

/* ---------- Phone ---------- */
.ph {
  --bg: #F3F0EA; --surface: #FFFFFF; --alt: #ECE8E0; --hair: rgba(23,21,27,.09); --tx: #17151B; --soft: #4B4853; --mu: #6F6C76; --ink: #17151B; --on-ink: #FFFFFF; --good: #2E9E6B; --bad: #E5604D; --sh: 0 6px 18px rgba(23,21,27,.08);
  position: relative; width: 100%; height: 640px; border: 9px solid #17140f; border-radius: 48px; overflow: hidden;
  background: var(--bg); color: var(--tx); font-family: var(--sans); box-shadow: var(--shadow-card-hover); transition: background-color .35s ease-out, color .35s ease-out;
}
.ph[data-theme="dark"] { --bg: #000; --surface: #111114; --alt: #1B1B20; --hair: rgba(255,255,255,.12); --tx: #fff; --soft: rgba(255,255,255,.86); --mu: rgba(255,255,255,.6); --ink: #fff; --on-ink: #000; --good: #4ADE80; --bad: #FB7185; --sh: none; }
html[data-theme="dark"] .ph { border-color: #2d2820; }
.ph button { font-family: inherit; }
.ph button:focus-visible, .ph__scroll:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ph__bar { position: absolute; left: 50%; top: 9px; z-index: 3; width: 84px; height: 22px; transform: translateX(-50%); border-radius: 12px; background: #17140f; }
.ph__scroll { position: absolute; inset: 0 0 62px 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 40px 16px 24px; }
.ph__scroll::-webkit-scrollbar { display: none; }
.ph__title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.ph h3 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1; letter-spacing: -.01em; color: var(--tx); }
.ph__sample { flex: none; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); border: 1px solid var(--hair); border-radius: 8px; padding: 3px 7px; }
.ph__sec { margin: 20px 0 10px; font-size: 15px; font-weight: 800; letter-spacing: -.2px; }

/* tab bar */
.ph__tabs { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 62px; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--hair); }
.ph__tab { display: grid; place-items: center; align-content: center; gap: 3px; border: 0; background: none; color: var(--mu); font-size: 10.5px; font-weight: 700; cursor: pointer; transition: color .2s ease-out; }
.ph__tab svg { width: 22px; height: 22px; }
.ph__tab:hover { color: var(--tx); }
.ph__tab[aria-current="page"] { color: var(--tx); }

/* shared cards */
.ph__d1 { background: var(--ink); color: var(--on-ink); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.ph__d1 small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #b8923e; }
.ph[data-theme="dark"] .ph__d1 small { color: #8a6a22; }
.ph__row { display: flex; gap: 8px; margin-top: 10px; }
.ph__cell { flex: 1; min-width: 0; }
.ph__cell b { color: inherit; display: block; font-size: 20px; font-weight: 800; letter-spacing: -.4px; white-space: nowrap; }
.ph__cell b.up { color: #5fd39a; } .ph__cell b.dn { color: #ff8a78; }
.ph[data-theme="dark"] .ph__cell b.up { color: #168a4a; } .ph[data-theme="dark"] .ph__cell b.dn { color: #c8392f; }
.ph__cell span { display: block; font-size: 10.5px; font-weight: 600; margin-top: 2px; opacity: .72; }
.ph__card { background: var(--surface); border-radius: 24px; padding: 16px; box-shadow: var(--sh); border: 1px solid transparent; margin-bottom: 12px; }
.ph[data-theme="dark"] .ph__card, .ph[data-theme="dark"] .ph__tile { border-color: var(--hair); }

/* progress: trend */
.ph__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ph__head strong { font-size: 16px; font-weight: 800; letter-spacing: -.3px; margin-top: 3px; }
.ph__val { text-align: right; }
.ph__val b { display: block; font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -1.2px; }
.ph__val small { font-size: 10.5px; font-weight: 600; color: var(--mu); }
.ph svg.ph__chart { display: block; width: 100%; height: auto; overflow: visible; margin-top: 6px; }
.ph__ax { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 600; color: var(--mu); margin-top: 2px; }
.ph__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ph__chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--hair); background: var(--bg); color: var(--tx); font-size: 11.5px; font-weight: 700; cursor: pointer; transition: background-color .2s ease-out, color .2s ease-out; }
.ph__chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.ph__chip:hover { background: var(--alt); }
.ph__chip[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: var(--cc); }
.ph__chip[aria-pressed="true"] i { background: var(--cc); }
.ph__chip:disabled { opacity: .4; cursor: not-allowed; }
.ph__chip:disabled:hover { background: var(--bg); }
.ph__chip--ms[aria-pressed="true"] { --c: var(--tx); --cc: var(--bg); }
.ph__chip--ms i { background: var(--mu); }
.ph__msnote { margin: 10px 2px 0; min-height: 34px; font-size: 12px; line-height: 1.45; color: var(--soft); }

/* progress: insight card with a flip side */
.ph__flip { display: grid; perspective: 1000px; margin-bottom: 12px; }
.ph__face { grid-area: 1 / 1; margin: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .55s var(--ease), visibility 0s .27s; }
.ph__face--back { transform: rotateY(180deg); }
.ph__flip[data-flipped="true"] .ph__face--front { transform: rotateY(-180deg); visibility: hidden; }
.ph__flip[data-flipped="true"] .ph__face--back { transform: rotateY(0); }
.ph__flip:not([data-flipped="true"]) .ph__face--back { visibility: hidden; }
.ph__top { display: flex; align-items: center; gap: 12px; }
.ph__badge { display: inline-flex; align-items: center; gap: 2px; flex: none; border-radius: 12px; padding: 5px 10px; font-size: 16px; font-weight: 800; letter-spacing: -.4px; color: var(--bg); }
.ph__hl { font-size: 15px; font-weight: 700; letter-spacing: -.2px; line-height: 1.3; margin: 0; }
.ph__body { margin: 10px 0 4px; font-size: 12.5px; line-height: 1.5; color: var(--soft); }
.ph__pile { margin-top: 10px; }
.ph__pile div { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; }
.ph__pile b { font-size: 14px; font-weight: 800; color: inherit; }
.ph__pile i { display: block; height: 10px; border-radius: 5px; background: var(--alt); overflow: hidden; }
.ph__pile i s { display: block; height: 100%; border-radius: 5px; background: var(--c); }
.ph__pile small { display: block; margin-top: 4px; font-size: 10.5px; color: var(--mu); }
.ph__meter { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); }
.ph__meter span { display: flex; gap: 3px; }
.ph__meter u { width: 18px; height: 4px; border-radius: 2px; background: var(--alt); }
.ph__meter u.on { background: var(--c); }
.ph__fine { margin: 10px 0 0; font-size: 11px; line-height: 1.45; color: var(--mu); }
.ph__lnk { display: inline-block; min-height: 32px; margin-top: 8px; padding: 0; border: 0; background: none; color: var(--tx); font-size: 12px; font-weight: 700; text-decoration: underline; text-decoration-color: var(--hair); text-underline-offset: 3px; cursor: pointer; }
.ph__lnk:hover { text-decoration-color: var(--tx); }
.ph__track { height: 10px; margin-top: 14px; border-radius: 5px; background: var(--alt); overflow: hidden; }
.ph__track s { display: block; height: 100%; border-radius: 5px; background: #b8923e; }
.ph__hows { list-style: none; margin: 12px 0 0; padding: 0; }
.ph__how { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px; padding: 10px 0; }
.ph__how + .ph__how { border-top: 1px solid var(--hair); }
.ph__how svg { width: 64px; height: 36px; padding: 0; border-radius: 12px; background: var(--alt); }
.ph__how div b { display: block; font-size: 13px; font-weight: 700; color: var(--tx); }
.ph__how div span { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.45; color: var(--soft); }
.ph__steps { margin: 8px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.5; color: var(--soft); }
.ph__steps li + li { margin-top: 4px; }

/* home */
.ph__brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.ph__brand svg { width: 24px; height: 24px; color: var(--tx); }
.ph__lead { margin: 0 0 4px; font-size: 13px; line-height: 1.45; color: var(--soft); }
.ph__day { margin: 0 0 12px; font-size: 11px; font-weight: 600; color: var(--mu); }
.ph__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ph__tile { display: grid; gap: 3px; text-align: left; padding: 12px; border-radius: 20px; border: 1px solid transparent; background: var(--surface); box-shadow: var(--sh); color: var(--tx); cursor: pointer; transition: transform .2s ease-out; }
.ph__tile:hover { transform: translateY(-1px); }
.ph__tile b { color: inherit; font-size: 22px; font-weight: 800; letter-spacing: -.6px; line-height: 1.1; }
.ph__tile span { font-size: 11.5px; font-weight: 600; color: var(--mu); }
.ph__tile small { font-size: 10px; color: var(--mu); }
.ph__tile svg { justify-self: center; width: 56px; height: 56px; margin-top: 4px; }
.ph__skin { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 10px; text-align: left; padding: 14px; border-radius: 20px; border: 1px solid transparent; background: var(--surface); box-shadow: var(--sh); color: var(--tx); cursor: pointer; }
.ph[data-theme="dark"] .ph__skin { border-color: var(--hair); }
.ph__skin b { display: block; color: inherit; font-size: 13px; font-weight: 800; }
.ph__skin small { font-size: 10.5px; color: var(--mu); }
.ph__skin em { font-style: normal; font-size: 17px; font-weight: 800; color: #b8923e; }

/* routine */
.ph__big { display: block; margin-top: 6px; font-size: 26px; font-weight: 800; letter-spacing: -.6px; color: inherit; }
.ph__stepper { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.ph__stepper + .ph__stepper { border-top: 1px solid var(--hair); }
.ph__stepper strong { font-size: 13px; font-weight: 800; }
.ph__stepper span { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 800; min-width: 0; }
.ph__stepper output { min-width: 78px; text-align: center; }
.ph__pm { width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--alt); color: var(--tx); font-size: 20px; line-height: 1; cursor: pointer; transition: background-color .2s ease-out; }
.ph__pm:hover { background: var(--hair); }
.ph__left { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--mu); }
.ph__hab { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; border: 0; border-top: 1px solid var(--hair); background: none; color: var(--tx); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.ph__hab:first-of-type { border-top: 0; }
.ph__ck { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--mu); color: transparent; transition: background-color .2s ease-out, border-color .2s ease-out; }
.ph__ck svg { width: 12px; height: 12px; }
.ph__hab[aria-pressed="true"] { color: var(--mu); }
.ph__hab[aria-pressed="true"] .ph__ck { background: var(--tx); border-color: var(--tx); color: var(--bg); }

/* ---------- Controls under the phone ---------- */
.ctl { width: 100%; display: grid; gap: 14px; }
.ctl__week { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.ctl__week b { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1; letter-spacing: 0; color: var(--ink); text-transform: none; font-variant-numeric: lining-nums tabular-nums; }
.ctl__week small { font-size: 14px; letter-spacing: 0; text-transform: none; }
.ctl input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.ctl input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--ink) var(--p, 100%), var(--rule) var(--p, 100%)); }
.ctl input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--rule); }
.ctl input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
.ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 2px 8px rgba(30,26,22,.3); transition: transform .2s ease-out; }
.ctl input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 2px 8px rgba(30,26,22,.3); }
.ctl input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.08); }
.ctl input[type=range]:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 12px; }
.ctl__tag { margin: -6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .ph, .ph__chip, .ph__tab, .ph__tile, .ph__pm, .ph__ck, .ctl input::-webkit-slider-thumb { transition: none; }
  .ph__face { transition: none; }
  .ph__face--back, .ph__flip[data-flipped="true"] .ph__face--front { transform: none; }
}
