/* TrueRep — dual theme. Dark is default; [data-theme="light"] overrides.
   Machine illustrations keep their dark cinematic artwork in both modes. */
:root {
  color-scheme: dark;
  --blue: #89CFF0;
  --blue-ink: #06222f;
  --blue-dim: rgba(137, 207, 240, 0.14);
  --blue-line: rgba(137, 207, 240, 0.35);
  --bg: #0B0E13;
  --surface: #151A21;
  --surface-2: #1C232D;
  --text: #F5F7FA;
  --muted: #8A94A3;
  --hairline: rgba(255, 255, 255, 0.06);
  --input-bg: #0B0E13;
  --input-border: #232c38;
  --bar-bg: rgba(11, 14, 19, 0.92);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}
[data-theme="light"] {
  color-scheme: light;
  --blue: #19698C;
  --blue-ink: #ffffff;
  --blue-dim: rgba(25, 105, 140, 0.10);
  --blue-line: rgba(25, 105, 140, 0.35);
  --bg: #F4F7FA;
  --surface: #FFFFFF;
  --surface-2: #E9EEF4;
  --text: #10202E;
  --muted: #5D6E7E;
  --hairline: rgba(16, 32, 46, 0.08);
  --input-bg: #FFFFFF;
  --input-border: #D5DDE6;
  --bar-bg: rgba(244, 247, 250, 0.92);
  --shadow: 0 8px 24px rgba(16, 32, 46, 0.10);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  padding-bottom: 110px;
  transition: background 0.2s ease, color 0.2s ease;
}
#app { max-width: 520px; margin: 0 auto; padding: 18px 16px 0; }

.header { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.header img#brand-logo { height: 40px; width: auto; display: block; }
.theme-toggle {
  margin-left: auto; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--hairline); background: var(--surface); color: var(--text);
  font-size: 20px; cursor: pointer; flex-shrink: 0;
}
.tagline { color: var(--muted); font-size: 13px; margin: 2px 0 18px; }

.greeting { font-size: 26px; font-weight: 800; margin: 18px 0 4px; letter-spacing: -0.3px; }
.sub { color: var(--muted); font-size: 15px; margin: 0 0 18px; }

.profile-row { display: flex; gap: 10px; margin-bottom: 20px; }
.profile-chip {
  flex: 1; padding: 12px; border-radius: 16px; border: 2px solid var(--surface-2);
  background: var(--surface); color: var(--text); font-size: 16px; font-weight: 700;
  cursor: pointer; text-align: center;
}
.profile-chip.active { border-color: var(--blue); background: var(--blue-dim); }

.gender-row { display: flex; align-items: center; gap: 8px; margin: -8px 0 20px; }
.gender-label { font-size: 13px; color: var(--muted); font-weight: 700; margin-right: 4px; }
.gender-chip {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 700; cursor: pointer;
}
.gender-chip.active { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }

.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; margin-bottom: 14px; border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
}
.card.tappable { cursor: pointer; }
.card.tappable:active { transform: scale(0.98); }
.cat-card { display: flex; align-items: center; gap: 16px; }
.cat-ico {
  width: 52px; height: 52px; border-radius: 16px; background: var(--blue-dim);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cat-ico svg { width: 30px; height: 30px; stroke: var(--blue); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cat-card h3 { margin: 0 0 4px; font-size: 19px; }
.cat-card p { margin: 0; color: var(--muted); font-size: 14px; }
.cat-card .chev { margin-left: auto; color: var(--blue); font-size: 24px; font-weight: 700; }
.soon { opacity: 0.6; }
.soon-tag {
  margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--muted); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}

.machine-card { display: flex; gap: 14px; align-items: center; }
.machine-card img { width: 96px; height: 96px; object-fit: cover; border-radius: 16px; background: #000; flex-shrink: 0; }
.machine-card h3 { margin: 0 0 4px; font-size: 17px; }
.machine-card p { margin: 0; color: var(--muted); font-size: 13px; }
.machine-card .chev { margin-left: auto; color: var(--blue); font-size: 24px; font-weight: 700; }

.hero-img { width: 100%; border-radius: var(--radius); display: block; background: #000; }
.prev-box {
  background: var(--blue-dim); border: 1px solid var(--blue-line);
  border-radius: 16px; padding: 12px 14px; margin: 14px 0; font-size: 14px;
}
.prev-box b { color: var(--blue); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; padding: 14px; font-size: 18px; border-radius: 14px;
  border: 2px solid var(--input-border); background: var(--input-bg); color: var(--text);
}
.field input:focus { outline: none; border-color: var(--blue); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.btn {
  display: block; width: 100%; padding: 16px; border: none; border-radius: 18px;
  font-size: 17px; font-weight: 800; cursor: pointer; margin-top: 10px;
}
.btn-primary { background: var(--blue); color: var(--blue-ink); }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: #e05656; border: 1px solid rgba(224,86,86,0.4); }

.set-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 16px; padding: 10px 12px; margin-bottom: 10px;
}
.set-row.done { opacity: 0.6; }
.set-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.set-row.done .set-num { background: var(--blue); color: var(--blue-ink); }
.set-row input {
  width: 62px; padding: 10px 6px; font-size: 16px; text-align: center; border-radius: 12px;
  border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text);
}
.set-row .lbl { font-size: 12px; color: var(--muted); }
.check-btn {
  margin-left: auto; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--blue);
  background: transparent; color: var(--blue); font-size: 24px; font-weight: 800; cursor: pointer; flex-shrink: 0;
}
.set-row.done .check-btn { background: var(--blue); color: var(--blue-ink); }

.section-title { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 22px 0 10px; }
.back-link { color: var(--blue); font-size: 15px; font-weight: 700; cursor: pointer; margin-bottom: 12px; display: inline-block; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--bar-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--hairline);
}
.bottom-bar .inner { max-width: 520px; margin: 0 auto; }
.bottom-bar .btn { margin-top: 0; }

.summary-hero { text-align: center; padding: 26px 0 10px; }
.summary-hero .big { font-size: 44px; font-weight: 800; color: var(--blue); }
.summary-hero p { color: var(--muted); margin: 6px 0 0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; padding: 14px 6px; text-align: center; }
.stat .v { font-size: 22px; font-weight: 800; color: var(--blue); }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 4px; }

.hist-row { display: flex; align-items: center; gap: 12px; }
.hist-row .date { font-weight: 800; font-size: 16px; }
.hist-row .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

#timer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 50;
  display: flex; align-items: center; justify-content: center;
}
#timer-overlay.hidden { display: none; }
.timer-card { background: var(--surface); border-radius: 26px; padding: 34px 44px; text-align: center; border: 1px solid var(--blue-line); }
.timer-label { color: var(--muted); font-weight: 800; letter-spacing: 3px; font-size: 14px; }
.timer-clock { font-size: 64px; font-weight: 800; color: var(--blue); margin: 8px 0 16px; font-variant-numeric: tabular-nums; }
.timer-card .btn { margin-top: 0; padding: 12px 34px; width: auto; display: inline-block; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 100px;
  background: var(--blue); color: var(--blue-ink); font-weight: 800; padding: 12px 22px;
  border-radius: 999px; z-index: 60; font-size: 15px; white-space: nowrap;
}
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 15px; }

/* calorie estimates */
.cal-line { color: var(--muted); font-size: 14px; margin: 2px 0 4px; }
.est {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--blue); border: 1px solid var(--blue-line); border-radius: 999px; padding: 2px 8px;
  white-space: nowrap;
}
.cal-hero {
  text-align: center; font-size: 20px; font-weight: 800; color: var(--blue);
  background: var(--blue-dim); border: 1px solid var(--blue-line);
  border-radius: 16px; padding: 14px; margin: 4px 0 6px;
}

/* recovery */
.rec-row { margin-bottom: 12px; }
.rec-row:last-child { margin-bottom: 0; }
.rec-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.rec-status { color: var(--muted); font-weight: 600; }
.rec-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rec-fill { height: 100%; border-radius: 999px; background: var(--blue); transition: width 0.6s ease; }

/* report card */
.seg {
  display: flex; background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 4px; margin-bottom: 18px;
}
.seg-btn {
  flex: 1; border: none; background: transparent; color: var(--muted);
  font-size: 15px; font-weight: 800; padding: 10px; border-radius: 999px; cursor: pointer;
}
.seg-btn.active { background: var(--blue); color: var(--blue-ink); }
.streak-banner {
  display: flex; align-items: center; gap: 12px; background: var(--blue-dim);
  border: 1px solid var(--blue-line); border-radius: 16px; padding: 12px 16px;
  margin-bottom: 4px; font-size: 15px; font-weight: 700;
}
.streak-n { font-size: 30px; font-weight: 800; color: var(--blue); }
.day-chart { display: flex; align-items: flex-end; gap: 6px; height: 92px; padding-top: 8px; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.day-bar { width: 100%; max-width: 26px; background: var(--blue); border-radius: 6px 6px 2px 2px; opacity: 0.85; }
.day-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }
.chart-note { color: var(--muted); font-size: 12px; text-align: center; margin-top: 8px; }
.link { color: var(--blue); font-weight: 700; cursor: pointer; }
.tracker-note {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--blue); margin-bottom: 12px; text-align: center;
}

/* goals */
.goal-card { padding: 16px 18px; }
.goal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.goal-name { font-weight: 800; font-size: 16px; }
.goal-pct { color: var(--blue); font-weight: 800; flex-shrink: 0; }
.goal-done {
  font-size: 12px; font-weight: 800; color: var(--blue-ink); background: var(--blue);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap; flex-shrink: 0;
}
.goal-bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.goal-fill { height: 100%; border-radius: 999px; background: var(--blue); transition: width 0.6s ease; }
.goal-sub { color: var(--muted); font-size: 13px; margin-top: 8px; }
.btn-sm { padding: 10px; font-size: 14px; }
.sel {
  width: 100%; padding: 14px; font-size: 16px; border-radius: 14px;
  border: 2px solid var(--input-border); background: var(--input-bg); color: var(--text);
}

/* PR celebration */
#pr-overlay,
#goal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 70;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
#pr-overlay.hidden,
#goal-overlay.hidden { display: none; }
.pr-card {
  background: var(--surface); border-radius: 26px; padding: 36px 40px; text-align: center;
  border: 2px solid var(--blue); box-shadow: var(--shadow); position: relative; z-index: 2;
  max-width: 82vw;
}
.pr-kicker {
  font-size: 15px; font-weight: 800; letter-spacing: 4px; color: var(--blue);
  animation: pr-pulse 1s ease-in-out infinite;
}
.pr-big { font-size: 30px; font-weight: 800; margin: 10px 0 6px; }
.pr-card p { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.pr-card .btn { margin-top: 0; }
@keyframes pr-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.75; transform: scale(1.06); } }
#pr-confetti,
#goal-confetti { position: absolute; inset: 0; pointer-events: none; }
#pr-confetti i,
#goal-confetti i {
  position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px;
  animation: pr-fall linear forwards;
}
@keyframes pr-fall { to { transform: translateY(105vh) rotate(720deg); } }
