/* styles.css — mobile-first, dark, tactile. Themed via CSS variables. */

:root {
  --bg: #0f1115;
  --bg-elev: #181b22;
  --bg-elev2: #21252e;
  --line: #2c313c;
  --text: #eef1f6;
  --text-dim: #9aa3b2;
  --text-faint: #5d6675;
  --accent: #4ade80;        /* green — go / progress */
  --accent-press: #22c55e;
  --accent-ghost: #1c2a20;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tap: 48px;
  font-size: 17px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;   /* prevent pull-to-refresh killing timers (§2) */
}

/* Non-interactive text is not selectable on tap targets (§2) */
button, .tap, .badge, .pill, h1, h2, h3, .label { user-select: none; -webkit-user-select: none; }
input, textarea { user-select: text; -webkit-user-select: text; }

.app { min-height: 100dvh; }
.view {
  max-width: 560px; margin: 0 auto;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 96px);
}

/* --- Typography --- */
h1 { font-size: 1.65rem; margin: 2px 0 2px; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; margin: 22px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 1rem; margin: 0 0 6px; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.tnum { font-variant-numeric: tabular-nums; }
.center { text-align: center; }

/* --- Badges / pills --- */
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; background: var(--bg-elev2); color: var(--text-dim);
}
.badge.hamburg { color: #fcd34d; background: #2a2410; }
.badge.berlin  { color: #93c5fd; background: #141f33; }
.badge.accent  { color: var(--accent); background: var(--accent-ghost); }

/* --- Cards --- */
.card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
.card.tight { padding: 12px 14px; }
.card.rest { text-align: center; padding: 28px 16px; }

/* --- Buttons --- */
button { font-family: inherit; font-size: 1rem; cursor: pointer; border: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--bg-elev2); color: var(--text); font-weight: 600;
  border: 1px solid var(--line); transition: transform .06s ease, background .12s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); color: #07140c; border-color: transparent; }
.btn.primary:active { background: var(--accent-press); }
.btn.big { min-height: 60px; font-size: 1.15rem; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* --- Bottom action bar (sticky CTA) --- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  display: flex; gap: 10px; z-index: 50;
}
.actionbar .inner { max-width: 560px; margin: 0 auto; width: 100%; display: flex; gap: 10px; }
.actionbar .btn { flex: 1; }

/* --- Lists --- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; min-height: var(--tap);
}
.item .ico { width: 30px; height: 30px; flex: none; color: var(--text-dim); }
.item .meta { flex: 1; min-width: 0; }
.item .meta .t { font-weight: 600; }
.item .meta .s { font-size: 0.85rem; color: var(--text-dim); }

/* --- Misc --- */
.divider { height: 1px; background: var(--line); margin: 18px 0; border: none; }
.note { font-size: 0.85rem; color: var(--text-dim); }
.warn { color: var(--amber); }
a { color: var(--blue); }
.hidden { display: none !important; }

/* svg line-art default */
svg.line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.illo { display: block; width: 100%; height: 100%; }

/* Everkinetic exercise illustrations — 2 frames cross-fading on a light card */
.exillo { position: relative; width: 100%; height: 100%; min-width: 30px; min-height: 30px;
  background: #f3f4f6; border-radius: 8px; overflow: hidden; }
.exillo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 7%; }
.exillo .f1 { opacity: 0; animation: everrep 1.8s ease-in-out infinite; }
@keyframes everrep { 0%, 12% { opacity: 0; } 50%, 62% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .exillo .f1 { animation: none; } }

/* --- Routine engine --- */
.routine-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.progress { height: 6px; background: var(--bg-elev2); border-radius: 999px; overflow: hidden; margin: 4px 0 14px; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .35s ease; }
.routine-illo { width: 110px; height: 110px; margin: 6px auto 0; color: var(--accent); }
.routine-illo svg { width: 100%; height: 100%; }
.timer-wrap { position: relative; width: 230px; height: 230px; margin: 16px auto 6px;
  display: flex; align-items: center; justify-content: center; }
.timer-ring { position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--accent) var(--p, 100%), var(--bg-elev2) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 13px), #000 calc(100% - 12px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 13px), #000 calc(100% - 12px)); }
.timer-ring.transition { background: conic-gradient(var(--amber) var(--p, 100%), var(--bg-elev2) 0); }
.timer-big { position: relative; font-size: 4.6rem; font-weight: 700; letter-spacing: -0.03em; }
.ctl-zone { margin-top: 8px; }
.routine-done { padding-top: 60px; }
.routine-done .tick { font-size: 4.5rem; color: var(--accent); line-height: 1; }

/* --- Strength logging --- */
.ex-head .cue { color: var(--text-dim); font-size: .9rem; }
.ex-head .rx { color: var(--text-faint); font-size: .85rem; margin-top: 2px; }
.setlist { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.setrow { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-elev); min-height: var(--tap); }
.setrow.done { border-color: var(--accent); background: var(--accent-ghost); }
.setrow .n { width: 26px; color: var(--text-faint); font-weight: 600; }
.setrow .val { flex: 1; font-variant-numeric: tabular-nums; font-weight: 600; }
.setrow .ghost { color: var(--text-faint); font-weight: 400; }
.setrow .tick { color: var(--accent); }

/* plate calculator */
.bar-vis { display: flex; align-items: center; justify-content: center; gap: 1px; height: 96px; margin: 6px 0 2px; }
.bar-core { height: 6px; background: var(--text-faint); flex: 0 0 26px; }
.bar-sleeve { height: 10px; background: var(--text-dim); flex: 0 0 10px; }
.plate { width: 16px; border-radius: 3px; background: var(--blue); display: flex; align-items: center;
  justify-content: center; font-size: .6rem; color: #04101f; font-weight: 700; }
.plate:active { transform: scaleY(.96); }
.platepick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.plate-btn { min-width: 52px; min-height: 46px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-elev2); color: var(--text); font-weight: 700; }
.plate-btn:active { transform: scale(.95); }
.bigtotal { text-align: center; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.bigtotal small { font-size: .85rem; color: var(--text-dim); font-weight: 500; }

/* dumbbell / cable scroller */
.scroller { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 10px 0; }
.scroller .stepbtn { width: 54px; height: 54px; border-radius: 50%; font-size: 1.6rem; font-weight: 700;
  background: var(--bg-elev2); color: var(--text); border: 1px solid var(--line); }
.scroller .stepbtn:active { transform: scale(.93); }
.scroller .reading { min-width: 130px; text-align: center; }
.scroller .reading .w { font-size: 2.3rem; font-weight: 700; letter-spacing: -0.02em; }
.scroller .reading .eff { font-size: .82rem; color: var(--text-dim); }

/* reps stepper */
.reps-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.numfield { display: flex; align-items: center; gap: 10px; }
.numfield input { width: 72px; text-align: center; font-size: 1.3rem; font-weight: 700; padding: 8px;
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); }

/* rest timer pill */
.resttimer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 88px);
  background: var(--bg-elev2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px;
  display: flex; align-items: center; gap: 12px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.resttimer .t { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 44px; }
