:root {
  --bg: #000;
  --surface: #0f0f0f;
  --card: #151515;
  --card-2: #1d1d1d;
  --card-3: #262626;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #fff;
  --muted: #8b8b8b;
  --dim: #5a5a5a;
  --accent: #fff;
  --on-accent: #000;
  --accent-soft: rgba(255, 255, 255, 0.13);
  --lime: #c8f03c;
  --lime-deep: #6f9a12;
  --lime-grad: linear-gradient(135deg, #e2ff7a 0%, #c8f03c 45%, #8dbb1c 100%);
  --lime-glow: rgba(200, 240, 60, 0.35);
  --up: #c8f03c;
  --up-soft: rgba(200, 240, 60, 0.13);
  --down: #ff5b4a;
  --down-soft: rgba(255, 91, 74, 0.14);
  --radius: 24px;
  --radius-sm: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 52px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input { outline: none; }
svg { display: block; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; position: relative; }

.view {
  padding: calc(var(--safe-top) + 18px) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 64px);
  min-height: 100vh;
}
.view.enter { animation: viewIn 0.38s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.stagger > * { animation: rise 0.5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(n+7) { animation-delay: 0.26s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #3a3a3a, #161616);
  border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.hello { color: var(--muted); font-size: 12.5px; }
.name { font-weight: 600; font-size: 17px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 2px; }
.page-sub { color: var(--muted); font-size: 13px; }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, #1b1b1b 0%, #111 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255,255,255,0.06), transparent 60%);
}
.hero {
  padding: 20px;
  background:
    radial-gradient(110% 85% at 100% 0%, rgba(200, 240, 60, 0.20), transparent 58%),
    radial-gradient(60% 50% at 85% 100%, rgba(141, 187, 28, 0.08), transparent 70%),
    linear-gradient(180deg, #1b1b1b 0%, #101010 100%);
  border-color: rgba(200, 240, 60, 0.16);
}
.label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.chip-ico { width: 22px; height: 22px; border-radius: 7px; background: var(--card-3); display: grid; place-items: center; }
.chip-ico svg { width: 12px; height: 12px; stroke: #bbb; fill: none; stroke-width: 2; }
.big-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 4px; }
.big { font-size: 38px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.big .dec, .val .dec { color: var(--dim); }
.big .unit { font-size: 17px; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 99px;
  background: var(--card-3); color: var(--muted);
}
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.hero .divider { height: 1px; background: var(--line); margin: 16px 0; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.action { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; color: #ddd; }
.action .btn-circ {
  width: 100%; height: 46px; border-radius: 99px;
  background: var(--card-2); border: 1px solid var(--line-2);
  display: grid; place-items: center;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.action .btn-circ svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.action.primary .btn-circ { background: var(--lime-grad); border-color: transparent; box-shadow: 0 8px 24px -10px var(--lime-glow); color: #000; }
.action:active .btn-circ { transform: scale(0.92); }

.sec-head { display: flex; justify-content: space-between; align-items: center; margin: 32px 2px 14px; }
.sec-head h3 { margin: 0; font-size: 14.5px; font-weight: 500; color: var(--muted); }
.sec-head .link { font-size: 14px; color: #eee; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.sec-head .link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* lift cards (horizontal) */
.hscroll {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 20px;
  margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; touch-action: pan-x pan-y;
  cursor: grab;
}
/* spacer so the last card can scroll fully into view (flex containers drop end padding) */
.hscroll::after { content: ""; flex: 0 0 6px; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll.dragging, .picker-row.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.hscroll.dragging > * { pointer-events: none; }
.lift-card {
  flex: 0 0 62%; scroll-snap-align: start; padding: 14px 14px 0; min-height: 168px;
  display: flex; flex-direction: column; text-align: left;
  transition: transform 0.18s var(--ease);
}
.lift-card:active { transform: scale(0.97); }
.lift-card .lc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lift-card .lc-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lift-card .lc-sub { color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.mono {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px; background: #000; border: 1px solid var(--line-2);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -0.02em;
}
.lift-card .val { font-size: 22px; font-weight: 600; margin-top: 14px; letter-spacing: -0.02em; }
.val .unit { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.chg { font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; }
.chg.up { color: var(--up); } .chg.down { color: var(--down); } .chg.flat { color: var(--dim); }
.spark { margin: auto -14px 0; height: 64px; }
.spark svg { width: 100%; height: 100%; }

/* list rows (watchlist style) */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 15px 2px;
  border-bottom: 1px solid var(--line); width: 100%; text-align: left;
  transition: background 0.2s, transform 0.15s var(--ease);
}
.row:last-child { border-bottom: 0; }
.row:active { transform: scale(0.985); }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-sub { color: var(--dim); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-right { text-align: right; }
.row .r-val { font-weight: 600; font-size: 14.5px; }
.row .r-chg { font-size: 11.5px; margin-top: 2px; }
.row .mono { width: 40px; height: 40px; border-radius: 12px; }
.mono.done { background: var(--up-soft); color: var(--up); border-color: transparent; }
.mono.today { background: var(--lime-grad); color: #000; border-color: transparent; }
.badge { font-size: 11px; padding: 3px 8px; border-radius: 99px; background: var(--card-3); color: var(--muted); font-weight: 500; }
.badge.up { background: var(--up-soft); color: var(--up); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.panel { padding: 4px 14px; }

.empty { color: var(--muted); text-align: center; padding: 28px 16px; font-size: 13.5px; }
.empty b { color: var(--text); display: block; font-size: 15px; margin-bottom: 4px; }

/* ---------- progress ---------- */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px; position: relative; }
.seg button { flex: 1; padding: 7px 0; font-size: 12.5px; font-weight: 500; color: var(--muted); border-radius: 99px; position: relative; z-index: 1; transition: color 0.25s; }
.seg button.on { color: #000; }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; border-radius: 99px; background: var(--lime-grad); box-shadow: 0 4px 14px -6px var(--lime-glow); transition: left 0.3s var(--ease), width 0.3s var(--ease); }
.picker-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 2px; scrollbar-width: none; }
.picker-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 99px; font-size: 13px; font-weight: 500;
  background: var(--card); border: 1px solid var(--line); color: #cfcfcf; white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--lime-grad); color: #000; border-color: transparent; }
.chart-card { padding: 16px 0 10px; }
.chart-card .cc-head { padding: 0 16px; }
.chart { height: 220px; margin-top: 8px; position: relative; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none;
  background: #fff; color: #000; font-size: 11.5px; font-weight: 600; padding: 5px 8px; border-radius: 8px; white-space: nowrap;
  opacity: 0; transition: opacity 0.15s;
}
.chart .tip small { display: block; font-weight: 500; color: #555; font-size: 10.5px; }
.chart-path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.9s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart-fill { opacity: 0; animation: fadeIn 0.6s 0.35s ease forwards; }
@keyframes fadeIn { to { opacity: 1; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { padding: 12px; }
.stat .s-l { color: var(--dim); font-size: 11.5px; }
.stat .s-v { font-weight: 600; font-size: 17px; margin-top: 4px; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px; }
.cal-head .m { font-weight: 600; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px 10px 14px; }
.cal-grid .wd { text-align: center; font-size: 11px; color: var(--dim); padding: 6px 0; }
.day {
  aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 13.5px; position: relative; transition: background 0.2s, transform 0.15s;
}
.day:active { transform: scale(0.9); }
.day.out { color: #333; }
.day.planned::after { content: ""; position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--dim); }
.day.trained { background: var(--accent-soft); color: #fff; font-weight: 600; }
.day.trained::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.day.today { box-shadow: inset 0 0 0 1.5px #fff; }
.day.sel { background: var(--lime-grad); color: #000; }
.day.sel::after { background: #000; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin: 10px 4px 0; }
.legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.streak { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }

/* ---------- plan ---------- */
.stepper-lg { display: flex; align-items: center; justify-content: space-between; padding: 16px; }
.stepper-lg .num { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; min-width: 48px; text-align: center; }
.round {
  width: 42px; height: 42px; border-radius: 50%; background: var(--card-3); border: 1px solid var(--line-2);
  display: grid; place-items: center; transition: transform 0.15s var(--ease), background 0.2s;
}
.round:active { transform: scale(0.88); background: #333; }
.round svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.round.accent { background: var(--lime-grad); color: #000; border-color: transparent; box-shadow: 0 6px 18px -8px var(--lime-glow); }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0 16px 16px; }
.wdb {
  aspect-ratio: 1; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--muted); transition: all 0.2s var(--ease);
}
.wdb.on { background: var(--lime-grad); color: #000; box-shadow: 0 6px 16px -8px var(--lime-glow); border-color: transparent; transform: translateY(-2px); }
.day-card { padding: 14px; margin-bottom: 10px; }
.day-card .dc-head { display: flex; align-items: center; gap: 12px; }
.day-card .dc-title { flex: 1; min-width: 0; }
.day-card .dc-title input {
  background: transparent; border: 0; font-weight: 600; font-size: 16px; width: 100%; padding: 2px 0;
  border-bottom: 1px dashed transparent;
}
.day-card .dc-title input:focus { border-bottom-color: var(--line-2); }
.ex-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 6px 6px 11px; border-radius: 99px; background: var(--card-3); font-size: 12.5px; animation: pop 0.25s var(--ease); }
.tag button { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.tag button svg { width: 10px; height: 10px; stroke: currentColor; stroke-width: 2.5; }
.tag.add { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); padding: 6px 12px; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; border-radius: 99px; font-weight: 600; font-size: 15px; width: 100%;
  background: var(--lime-grad); color: #000; transition: transform 0.15s var(--ease), opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.accent { background: var(--lime-grad); color: #000; box-shadow: 0 10px 30px -12px var(--lime-glow); }
.btn.ghost { background: var(--card-2); color: #fff; border: 1px solid var(--line-2); }
.btn.danger { background: var(--down-soft); color: var(--down); }
.btn.sm { height: 40px; font-size: 13.5px; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- tab bar: floating translucent pill ---------- */
.tabbar {
  position: fixed; z-index: 20; left: 50%; bottom: calc(var(--safe-bottom) + 14px);
  width: min(calc(100% - 64px), 300px); height: var(--tabbar-h);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(44, 44, 44, 0.52), rgba(8, 8, 8, 0.62));
  backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: width 0.45s var(--ease), height 0.45s var(--ease), bottom 0.45s var(--ease), padding 0.45s var(--ease),
    background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.tabbar button {
  flex: 1 1 0; min-width: 0; height: 100%; border-radius: 999px; position: relative;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  color: rgba(255, 255, 255, 0.55); font-size: 12.5px; font-weight: 600;
  transition: flex-grow 0.4s var(--ease), color 0.25s, background 0.3s, opacity 0.2s;
}
/* labels only show inside the active capsule */
.tabbar button > span:not(.fab) { display: none; } /* icons only; names stay as aria-labels */
.tabbar button.active { color: #fff; background: rgba(255, 255, 255, 0.13); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); }
.tabbar svg { flex: 0 0 auto; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; transition: transform 0.3s var(--ease); }
.tabbar button.active svg { stroke: var(--lime); }
.tabbar button:active svg { transform: scale(0.88); }

/* collapsed: just a thin line; tap it (or scroll up) to bring the bar back */
.tabbar::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 72px; height: 5px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.6); box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%) scaleX(0.3); opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.45s var(--ease);
}
.tabbar.mini {
  width: 120px; height: 26px; bottom: calc(var(--safe-bottom) + 8px); padding: 0; cursor: pointer;
  background: transparent; border-color: transparent; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.tabbar.mini > button { opacity: 0; pointer-events: none; }
.tabbar.mini::after { opacity: 1; transform: translate(-50%, -50%) scaleX(1); }

/* ---------- sheets / overlays ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40; animation: fadeIn 0.25s ease forwards; opacity: 0; }
.backdrop.out { animation: fadeOut 0.22s ease forwards; }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 480px; z-index: 41;
  background: #121212; border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 10px 16px calc(var(--safe-bottom) + 18px);
  max-height: 88vh; overflow-y: auto;
  transform: translate(-50%, 100%); animation: sheetIn 0.38s var(--ease) forwards;
}
.sheet.out { animation: sheetOut 0.26s ease-in forwards; }
@keyframes sheetIn { to { transform: translate(-50%, 0); } }
@keyframes sheetOut { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 100%); } }
.grab { width: 38px; height: 4px; border-radius: 4px; background: #3a3a3a; margin: 0 auto 14px; }
.sheet h2 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sheet .sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.field {
  width: 100%; height: 50px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line-2);
  padding: 0 14px; font-size: 16px; transition: border-color 0.2s;
}
.field:focus { border-color: #666; }
.field-label { font-size: 12px; color: var(--muted); margin: 12px 2px 6px; display: block; }
.sheet .btns { display: flex; gap: 8px; margin-top: 18px; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.check-row .box { width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid #444; display: grid; place-items: center; transition: all 0.2s var(--ease); flex: 0 0 auto; }
.check-row .box svg { width: 14px; height: 14px; stroke: #000; stroke-width: 3; fill: none; opacity: 0; transform: scale(0.5); transition: all 0.2s var(--ease); }
.check-row.on .box { background: var(--lime-grad); border-color: transparent; }
.check-row.on .box svg { opacity: 1; transform: none; stroke: var(--on-accent); }
.check-row .cr-main { flex: 1; min-width: 0; }
.check-row .cr-sub { color: var(--dim); font-size: 12px; }
.mini-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); background: var(--card-2); flex: 0 0 auto; }
.mini-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mini-btn:active { transform: scale(0.9); }

/* ---------- workout (full screen) ---------- */
.workout {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  max-width: 480px; margin: 0 auto; overflow-y: auto;
  padding: calc(var(--safe-top) + 12px) 16px calc(var(--safe-bottom) + 110px);
  animation: woIn 0.42s var(--ease) both;
}
.workout.out { animation: woOut 0.28s ease-in forwards; }
@keyframes woIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes woOut { to { transform: translateY(40px); opacity: 0; } }
.wo-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.wo-timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 99px; display: flex; align-items: center; gap: 8px; }
.wo-timer .rec { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.wo-progress { height: 4px; background: var(--card-3); border-radius: 4px; overflow: hidden; margin: 12px 0 4px; }
.wo-progress i { display: block; height: 100%; background: var(--lime-grad); border-radius: 4px; transition: width 0.5s var(--ease); }
.ex-card { padding: 14px; margin-top: 12px; }
.ex-card .ex-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ex-card .ex-title { flex: 1; min-width: 0; }
.ex-card .ex-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-card .ex-title span { font-size: 12px; color: var(--dim); }
.set-head, .set-row { display: grid; grid-template-columns: 26px 1fr 1fr 44px; gap: 8px; align-items: center; }
.set-head { font-size: 11px; color: var(--dim); padding: 0 2px 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.set-head span:nth-child(2), .set-head span:nth-child(3) { text-align: center; }
.set-row { padding: 6px 2px; border-radius: 14px; transition: background 0.3s, opacity 0.3s; }
.set-row.new { animation: rise 0.3s var(--ease) both; }
.set-row.done { background: var(--up-soft); }
.set-row .n { font-weight: 600; color: var(--muted); text-align: center; font-size: 13px; }
.set-row.done .n { color: var(--up); }
.stp { display: flex; align-items: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; height: 44px; overflow: hidden; }
.stp button { width: 34px; height: 100%; display: grid; place-items: center; color: var(--muted); flex: 0 0 auto; transition: background 0.15s, color 0.15s; }
.stp button:active { background: var(--card-3); color: #fff; }
.stp button svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.stp input { flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font-weight: 600; font-size: 16px; padding: 0; }
.stp input::-webkit-outer-spin-button, .stp input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tick {
  width: 44px; height: 44px; border-radius: 12px; background: var(--card-3); display: grid; place-items: center;
  transition: background 0.25s var(--ease), transform 0.15s var(--ease);
}
.tick svg { width: 20px; height: 20px; stroke: var(--dim); stroke-width: 2.6; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.2s; }
.tick:active { transform: scale(0.88); }
.set-row.done .tick { background: var(--lime-grad); animation: tickPop 0.35s var(--ease); }
.set-row.done .tick svg { stroke: #000; }
@keyframes tickPop { 40% { transform: scale(1.15); } }
.ex-foot { display: flex; gap: 8px; margin-top: 8px; }
.ex-foot .btn { height: 38px; font-size: 13px; font-weight: 500; }
.last-hint { font-size: 11.5px; color: var(--muted); margin: -4px 2px 8px; }
.last-hint b { color: #ddd; font-weight: 600; }
.wo-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; z-index: 31;
  padding: 14px 16px calc(var(--safe-bottom) + 14px);
  background: linear-gradient(180deg, transparent, #000 35%);
}
.rest {
  position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 86px); z-index: 32;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #fff; color: #000; border-radius: 99px; padding: 8px 8px 8px 16px;
  display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px;
  transition: transform 0.35s var(--ease), opacity 0.3s;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.rest.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.rest .t { font-variant-numeric: tabular-nums; min-width: 42px; }
.rest button { background: #000; color: #fff; border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 12px); z-index: 60;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: #fff; color: #000; font-weight: 600; font-size: 13.5px; padding: 10px 16px; border-radius: 99px;
  transition: transform 0.35s var(--ease), opacity 0.3s; white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.muted { color: var(--muted); }
.mt { margin-top: 12px; }
.mt2 { margin-top: 20px; }
.flex { display: flex; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- login ---------- */
body.locked #app, body.locked .rest { display: none; }
.login { position: fixed; inset: 0; z-index: 80; background: var(--bg); overflow: hidden; transition: opacity 0.35s ease, transform 0.35s var(--ease); }
.login.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.lg-view {
  position: absolute; inset: 0; margin: 0 auto; max-width: 420px;
  display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 16px) 20px calc(var(--safe-bottom) + 22px);
  opacity: 0; transform: translateX(28px); pointer-events: none;
  transition: opacity 0.32s ease, transform 0.42s var(--ease);
}
.lg-view.on { opacity: 1; transform: none; pointer-events: auto; }
.lg-view.left { transform: translateX(-28px); }
.lg-top { display: flex; justify-content: center; align-items: center; height: 44px; position: relative; }
.lg-top .icon-btn { position: absolute; left: 0; }
.lg-mark { width: 30px; height: 30px; border-radius: 9px; }
.lg-art { flex: 1; display: grid; place-items: center; min-height: 0; }
.lg-art canvas { width: min(94vw, 400px, 50vh); height: min(94vw, 400px, 50vh); touch-action: none; cursor: crosshair; }
.lg-welcome h1 { text-align: center; font-size: 46px; font-weight: 700; letter-spacing: -0.035em; margin: 0; }
.lg-welcome .lg-tagline { text-align: center; color: var(--muted); margin: 6px 0 28px; font-size: 15px; }
.lg-welcome .btn { height: 54px; margin-top: 10px; }
.lg-foot { text-align: center; color: var(--dim); font-size: 11.5px; margin-top: 18px; line-height: 1.5; }
.lg-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 26px 0 4px; }
.lg-sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.pw { position: relative; }
.pw .field { padding-right: 50px; }
.pw-eye { position: absolute; right: 6px; top: 5px; width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); border-radius: 10px; }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.login-err { color: var(--down); font-size: 13px; min-height: 20px; margin: 10px 2px 8px; text-align: inherit; }
.lg-user .btn { margin-top: 18px; }
.lg-pin { align-items: center; text-align: center; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin: 34px 0 6px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #555; transition: background 0.15s, border-color 0.15s, transform 0.2s var(--ease); }
.pin-dots i.on { background: #fff; border-color: #fff; transform: scale(1.1); }
.pin-dots.ok i { background: #fff; border-color: #fff; }
.keypad { display: grid; grid-template-columns: repeat(3, 96px); gap: 6px 14px; justify-content: center; margin-top: auto; }
/* plain numbers, no circles: the whole cell is the tap target, a press just dims the digit */
.key {
  width: 96px; height: 68px; border: 0; border-radius: 0; background: transparent; color: #fff;
  font-size: 30px; font-weight: 400; display: grid; place-items: center;
  transition: opacity 0.12s, transform 0.12s var(--ease);
}
.key:active { opacity: 0.4; transform: scale(0.9); }
.key.ghost { color: var(--muted); }
.key svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shake { animation: shake 0.4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (max-height: 680px) { .key { width: 84px; height: 58px; } .keypad { grid-template-columns: repeat(3, 84px); gap: 4px 12px; } .lg-welcome h1 { font-size: 38px; } }

/* ---------- past-workout logging ---------- */
.wo-log .set-head, .wo-log .set-row { grid-template-columns: 26px 1fr 1fr; }
.log-dur { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-top: 14px; }
.log-dur .stp { width: 150px; flex: 0 0 auto; }

/* login keeps its black & white look */
.login .btn:not(.ghost) { background: #fff; color: #000; box-shadow: none; }
/* "Enter username" on the Welcome screen uses the lime accent */
.login .lg-welcome .btn[data-lg="user"] { background: var(--lime-grad); color: #000; box-shadow: 0 10px 30px -14px var(--lime-glow); }

/* ---------- center tab: green button, white app logo ---------- */
.tabbar .tab-center { flex: 0 0 auto; width: 60px; background: none; box-shadow: none; }
.tabbar .tab-center > span:not(.fab) { display: none; }
.tabbar .tab-center .fab {
  position: relative; width: 58px; height: 40px; border-radius: 99px; display: grid; place-items: center;
  background: var(--lime-grad); color: #000; /* same as the Start button on Home */
  box-shadow: none;
  transition: transform 0.2s var(--ease);
}
.tabbar .tab-center .fab svg.play-mark { width: 18px; height: 18px; fill: none; stroke: #000; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .tab-center:active .fab { transform: scale(0.9); }

.set-row .n small { display: block; font-size: 9.5px; color: var(--muted); font-weight: 500; line-height: 1; margin-top: 2px; }

/* login backdrop: dark animated halftone behind everything */
.lg-bg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; animation: fadeIn 1.6s 0.2s ease forwards; }

/* ---------- mobile touch fixes ---------- */
/* no double-tap-to-zoom: quick repeated taps (passcode keypad, steppers) made the page jump */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; }
button, .key, .tabbar, .keypad { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* while the login is showing, the page behind it can't scroll, so the keyboard can't shove it around */
body.locked { position: fixed; inset: 0; overflow: hidden; }
.login { overscroll-behavior: none; }
