/* Forme: one-hand phone app. Dark navy ground, orange for effort, blue for rest and done. */
:root {
  --bg: #121a2b; --panel: #1b2640; --panel2: #243252; --line: #3a4a74;
  --text: #eef1f8; --muted: #a9b4cf; --org: #f26b21; --rest: #4cc3d9; --ink: #0e1626; --warn: #ffb27a;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.4; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--rest); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; }
h1 { font-size: 36px; }
h2 { font-size: 24px; text-transform: uppercase; letter-spacing: .5px; }
p { color: var(--muted); }

#app { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
#view { flex: 1; padding: calc(16px + env(safe-area-inset-top)) 16px 96px; display: flex; flex-direction: column; gap: 14px; }
#tabs { position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; display: flex; background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 5; }
.tab { flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 500; }
.tab[aria-current="page"] { color: var(--org); font-weight: 600; }
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.card.pad0 { padding: 0; overflow: hidden; }
.logo { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: 3px; color: var(--org); line-height: 1; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--text); flex: none; }
.btn { min-height: 56px; border-radius: 14px; background: var(--org); color: var(--ink); font-weight: 600; font-size: 18px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 0 16px; }
.btn.rest { background: var(--rest); }
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); font-weight: 500; font-size: 16px; min-height: 48px; }
.btn.small { min-height: 44px; font-size: 14px; width: auto; border-radius: 10px; padding: 0 14px; }
.btn[disabled] { opacity: .5; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--panel); color: var(--text); border: 1px solid var(--line); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; }
.chip.on { background: var(--org); color: var(--ink); border-color: var(--org); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line); font-size: 12px; color: var(--text); }
.eyebrow { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; color: var(--rest); }
.msg { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.1; }

/* week strip and calendar marks */
.week { display: flex; gap: 4px; }
.day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 56px; }
.day small { font-size: 11px; color: var(--muted); }
.mk { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 19px; font-weight: 700; box-sizing: border-box; }
.mk.done { background: var(--rest); color: var(--ink); }
.mk.today { background: var(--org); color: var(--ink); }
.mk.missed { border: 2px dashed var(--org); color: var(--org); }
.mk.plan { border: 2px solid var(--line); color: var(--muted); }
.mk.skipped { border: 2px dotted var(--line); color: var(--muted); }
.mk.none { border: 1px solid transparent; }
button.day { background: none; }
.todaycard img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--panel2); }
.stat { flex: 1; }
.stat b { font-family: var(--display); font-size: 32px; font-weight: 700; line-height: 1; display: block; white-space: nowrap; }
.ringwrap { position: relative; width: 68px; height: 68px; flex: none; }
.ringwrap svg { width: 68px; height: 68px; transform: rotate(-90deg); }
.ringwrap div { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; font-weight: 700; }
.badges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 11px; color: var(--muted); }
.badge i { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.badge.on i { background: var(--org); border-color: var(--org); color: var(--ink); }
.badge.on { color: var(--text); }
.badge svg.i { width: 22px; height: 22px; }

/* lists */
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 52px; }
.item:first-child { border-top: 0; }
.item .mk { flex: none; }
.dots { display: flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: block; }
.dots i.on { background: var(--org); }
.sw { width: 46px; height: 26px; border-radius: 13px; background: var(--line); position: relative; flex: none; display: block; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.sw.on { background: var(--org); }
.sw.on::after { transform: translateX(20px); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; width: 100%; text-align: left; border-top: 1px solid var(--line); font-size: 15px; }
.toggle:first-child { border-top: 0; }
.toggle small { display: block; color: var(--muted); font-size: 13px; }
input[type="range"] { width: 100%; accent-color: var(--org); min-height: 32px; }
input[type="number"], input[type="time"], select, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; width: 100%; }
textarea { resize: vertical; min-height: 84px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

/* photos */
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pthumb { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); padding: 0; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(14,22,38,.82); font-size: 11px; padding: 3px 6px; text-align: left; }
.cmp { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cmp .lbl { position: absolute; top: 8px; padding: 3px 10px; border-radius: 10px; background: rgba(14,22,38,.85); font-size: 12px; font-weight: 600; }
.cmp .bar { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--text); box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.empty { border: 2px dashed var(--line); border-radius: 14px; padding: 22px 14px; text-align: center; color: var(--muted); }

/* overlays */
.ov { position: fixed; inset: 0; background: var(--bg); z-index: 20; overflow-y: auto; }
.ov .in { max-width: 520px; margin: 0 auto; min-height: 100%; padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet { position: fixed; inset: 0; background: rgba(6,10,20,.66); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { width: 100%; max-width: 520px; max-height: 88%; overflow-y: auto; background: var(--panel); border-radius: 20px 20px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); max-width: 488px; margin: 0 auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; z-index: 40; text-align: center; font-size: 14px; }

/* session */
.s-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.s-top .w { flex: 1; text-align: center; color: var(--muted); font-size: 14px; }
.s-clock { font-family: var(--display); font-size: 22px; font-weight: 600; min-width: 60px; text-align: right; font-variant-numeric: tabular-nums; }
.s-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.s-bar i { display: block; height: 100%; width: 0; background: var(--org); }
.rest-mode .s-bar i { background: var(--rest); }
.mode { font-family: var(--display); font-weight: 700; letter-spacing: 3px; text-align: center; font-size: 17px; color: var(--org); }
.rest-mode .mode { color: var(--rest); }
.media { position: relative; height: clamp(150px, 29vh, 260px); border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); flex: none; }
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s; }
.media img.contain { object-fit: contain; background: #f4f6fb; }
.media img.on { opacity: 1; }
.media .pos { position: absolute; left: 10px; top: 10px; padding: 3px 12px; border-radius: 12px; background: var(--ink); font-size: 13px; font-weight: 600; z-index: 2; }
.s-title { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.05; }
.s-sub { color: var(--muted); font-size: 15px; }
.tempo { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.tempo .big { min-width: 118px; }
.lbl { font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--org); }
.num { font-family: var(--display); font-size: 72px; font-weight: 700; line-height: .92; font-variant-numeric: tabular-nums; }
.pchips { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pc { padding: 7px 12px; border-radius: 12px; font-size: 14px; background: var(--panel); color: var(--muted); border: 1px solid var(--line); }
.pc.on { background: var(--org); color: var(--ink); border-color: var(--org); font-weight: 600; }
.dial { position: relative; width: min(60vw, 230px); aspect-ratio: 1; margin: 0 auto; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial circle { fill: none; stroke-width: 12; }
.dial .bg { stroke: var(--line); }
.dial .fg { stroke: var(--org); stroke-linecap: round; }
.rest-mode .dial .fg { stroke: var(--rest); }
.dial .t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dial .num { font-size: 92px; }
.rest-mode .lbl { color: var(--rest); }
.s-cue { text-align: center; color: var(--muted); font-size: 14px; }
.s-ctl { margin-top: auto; display: flex; gap: 10px; padding-top: 6px; }
.s-ctl .icon-btn { width: 56px; height: 56px; border-radius: 14px; }
.next { display: flex; align-items: center; gap: 12px; }
.next img, .next .ph { width: 96px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--panel2); }
.next .ph { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); color: var(--muted); font-size: 11px; }
.adj { display: flex; align-items: center; gap: 10px; justify-content: center; }
.adj button { width: 48px; height: 48px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); font-size: 22px; font-weight: 600; }
.adj b { font-family: var(--display); font-size: 28px; min-width: 40px; text-align: center; }
.rep-in { width: 56px; text-align: center; padding: 6px; font-family: var(--display); font-size: 22px; font-weight: 700; }
.setrow { display: flex; flex-wrap: wrap; gap: 8px; }
.setrow label { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.big-time { font-family: var(--display); font-size: 72px; font-weight: 700; color: var(--org); line-height: 1; }
.celebrate { border: 2px solid var(--org); background: var(--panel); }
@media (max-height: 700px) { .num { font-size: 60px; } .dial .num { font-size: 72px; } .media { height: 130px; } }
@media (prefers-reduced-motion: reduce) { .sw::after, .media img { transition: none; } }

.pitem { align-items: flex-start; }
.pth { width: 72px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; background: var(--panel2); display: block; }
.pth.contain, .todaycard img.contain { object-fit: contain; background: #f4f6fb; }
.nm { font-weight: 500; }
.why { color: var(--text); margin-top: 4px; opacity: .9; }
.pitem .icon-btn { width: 44px; height: 44px; align-self: center; }

.pbar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--org); border-radius: 4px; }
.pbar i.ok { background: var(--rest); }
