/* styles.css — mobile-first, dark, calm. Big tap targets (used one-handed). */
:root {
  --bg: #12141a;
  --card: #1c1f28;
  --card2: #242833;
  --ink: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #ff8a3d;      /* warm orange — streak / weights */
  --accent2: #4dd6a8;     /* green — "done" */
  --danger: #ff5d6c;      /* streak-at-risk */
  --line: #ff8a3d;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 18px calc(84px + env(safe-area-inset-bottom));
  min-height: 100%;
}

h1, h2, h3 { margin: 0 0 10px; font-weight: 700; }
h1 { font-size: 1.5rem; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

/* Buttons */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  padding: 15px 18px;
  color: var(--ink);
  background: var(--card2);
  width: 100%;
  font-weight: 600;
  transition: transform .05s ease, filter .15s ease;
}
button:active { transform: scale(.98); }
button.primary { background: var(--accent); color: #1a1006; font-weight: 800; }
button.done { background: var(--accent2); color: #05271c; font-weight: 800; }
button.ghost { background: transparent; border: 1px solid #333a49; color: var(--muted); }
.btn-row { display: flex; gap: 10px; }
.btn-row button { width: auto; flex: 1; }
.small { font-size: .9rem; padding: 11px 12px; }

/* Streak header */
.streak {
  text-align: center;
  padding: 26px 18px;
  background: linear-gradient(160deg, #2a1c12, #1c1f28);
}
.streak .num { font-size: 4rem; line-height: 1; font-weight: 800; color: var(--accent); }
.streak .num.zero { color: var(--danger); }
.streak .label { color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }
.streak .msg { margin-top: 14px; font-size: 1.02rem; }
.streak.risk { background: linear-gradient(160deg, #2c1518, #1c1f28); }

/* Routine list */
.ex-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid #2a2e3a;
}
.ex-item:last-child { border-bottom: none; }
.ex-item .tag {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--card2); padding: 3px 8px; border-radius: 999px;
}
.ex-item .nm { font-weight: 600; }
.ex-item .rs { color: var(--muted); font-size: .85rem; }

/* Exercise (workout) screen */
.stage {
  background: var(--card);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 14px;
}
.stick { width: 100%; height: 300px; display: block; }
.stick .bone { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.stick .head { fill: var(--ink); }
.stick .dot { fill: var(--ink); }
.stick .joint { stroke: var(--ink); stroke-width: 6; fill: none; }
.stick .joint2 { fill: var(--ink); }
.stick .ground { stroke: #3a3f4d; stroke-width: 3; stroke-linecap: round; }
.stick .weight { fill: var(--accent); }
.stick .weight-stroke { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; fill: none; }
.stick .arrow { stroke: var(--accent2); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; opacity: .95; }
.stick .arrow-lbl { fill: var(--accent2); font: 700 9px -apple-system, sans-serif; }

.cues { list-style: none; padding: 0; margin: 8px 0 0; }
.cues li { padding: 8px 0 8px 26px; position: relative; }
.cues li::before {
  content: "✓"; position: absolute; left: 0; color: var(--accent2); font-weight: 800;
}
.progress-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 14px; }
.progress-dots span { width: 8px; height: 8px; border-radius: 50%; background: #333a49; }
.progress-dots span.on { background: var(--accent); }

/* Calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-grid .dow { text-align: center; color: var(--muted); font-size: .72rem; padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: .85rem; background: var(--card2); color: var(--muted);
}
.cal-cell.empty { background: transparent; }
.cal-cell.done { background: var(--accent); color: #1a1006; font-weight: 800; }
.cal-cell.today { outline: 2px solid var(--ink); }
.stats { display: flex; gap: 10px; margin-top: 14px; }
.stat { flex: 1; text-align: center; background: var(--card2); border-radius: 14px; padding: 12px 6px; }
.stat .v { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat .k { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Settings */
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #2a2e3a; }
.row:last-child { border-bottom: none; }
input[type="time"] {
  font: inherit; background: var(--card2); color: var(--ink); border: none;
  border-radius: 10px; padding: 8px 10px;
}
.switch { position: relative; width: 52px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #333a49; border-radius: 999px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 24px; width: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent2); }
.switch input:checked + .slider::before { transform: translateX(22px); }
textarea {
  width: 100%; font-family: ui-monospace, monospace; font-size: .78rem; background: var(--card2);
  color: var(--muted); border: none; border-radius: 10px; padding: 10px; min-height: 90px; resize: vertical;
}

/* Bottom nav */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: #171a22; border-top: 1px solid #262b36;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto;
}
.nav button {
  background: none; width: auto; flex: 1; padding: 6px 0; border-radius: 0;
  color: var(--muted); font-size: .72rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.nav button .ic { font-size: 1.3rem; line-height: 1; }
.nav button.active { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: var(--card2); color: var(--ink); padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .25s;
  z-index: 20; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; }
