/* TRAIN · 12KG
   Palette: cast iron + kettlebell-sport blue (12kg bells are blue) + chalk
   Display: Barlow Condensed · Body: Inter */

:root {
  --bg: #101418;
  --panel: #181f27;
  --panel-2: #1e2732;
  --line: #2a3441;
  --text: #e8edf2;
  --muted: #8a97a5;
  --blue: #3e8ee8;
  --blue-deep: #1d4e8f;
  --chalk: #f2efe8;
  --amber: #e8a33e;
  --green: #46c078;
  --red: #e05555;
  --radius: 14px;
  --disp: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  font-size: 15px;
  line-height: 1.45;
}
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; }
.hidden { display: none !important; }

/* ---------- shell ---------- */
.app { max-width: 560px; margin: 0 auto; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 10px;
  position: sticky; top: 0; background: linear-gradient(var(--bg) 75%, transparent); z-index: 5;
}
.mark {
  font-family: var(--disp); font-weight: 700; font-size: 24px; letter-spacing: .06em; color: var(--chalk);
}
.mark span { color: var(--blue); }
.chip {
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 600; color: var(--muted);
}
main { padding: 6px 16px 20px; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; max-width: 560px; margin: 0 auto;
  background: rgba(16,20,24,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; padding: 10px 0 12px; text-align: center; color: var(--muted);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  display: flex; flex-direction: column; gap: 3px; align-items: center;
}
.tab-ico { font-size: 16px; line-height: 1; }
.tab.active { color: var(--blue); }

/* ---------- lock ---------- */
.lock { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lock-card { width: 100%; max-width: 320px; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.lock-card p { color: var(--muted); }
.lock-card input {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); padding: 13px; text-align: center; letter-spacing: .3em; width: 100%;
}
.error { color: var(--red); font-size: 13px; }

/* ---------- shared ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.h-disp {
  font-family: var(--disp); font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin: 18px 2px 8px;
}
.btn {
  border-radius: var(--radius); padding: 13px 18px; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- today ---------- */
.date-line { color: var(--muted); font-size: 13px; margin: 4px 2px 12px; }
.session-card { display: flex; align-items: center; gap: 16px; }
.session-card .time {
  font-family: var(--disp); font-weight: 700; font-size: 44px; line-height: 1; color: var(--chalk);
  min-width: 104px;
}
.session-card.next .time { color: var(--blue); }
.session-card .info { flex: 1; }
.session-card .name { font-family: var(--disp); font-weight: 600; font-size: 20px; text-transform: uppercase; letter-spacing: .04em; }
.session-card .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.session-card .status { font-size: 22px; }
.status.done { color: var(--green); }
.countdown { color: var(--blue); font-weight: 600; font-size: 13px; margin-top: 4px; }

.notify-banner { display: flex; gap: 12px; align-items: center; border-color: var(--blue-deep); background: #14202e; }
.notify-banner p { flex: 1; font-size: 13px; color: var(--muted); }

/* ---------- train ---------- */
.session-pick { display: flex; gap: 10px; margin-bottom: 14px; }
.session-pick .btn { flex: 1; }
.session-pick .btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.ex { padding: 0; overflow: hidden; }
.ex-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 4px; }
.ex-name { font-family: var(--disp); font-weight: 600; font-size: 19px; text-transform: uppercase; letter-spacing: .03em; flex: 1; }
.ex-level { font-size: 11px; font-weight: 600; color: var(--blue); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.ex-target { padding: 0 16px 10px; color: var(--muted); font-size: 13px; }
.ex-cue { padding: 0 16px 12px; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.set-row { display: flex; gap: 8px; padding: 12px 16px 14px; flex-wrap: wrap; }
.set-btn {
  min-width: 58px; padding: 10px 0; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); font-family: var(--disp); font-weight: 700; font-size: 20px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
}
.set-btn small { font-family: var(--body); font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.set-btn.done { background: var(--blue-deep); border-color: var(--blue); color: var(--chalk); }
.rep-adjust { display: flex; align-items: center; gap: 10px; padding: 0 16px 14px; color: var(--muted); font-size: 13px; }
.rep-adjust button {
  width: 34px; height: 34px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 18px; font-weight: 700; color: var(--text);
}

.rest-bar {
  position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 9;
  max-width: 560px; margin: 0 auto; padding: 0 16px;
}
.rest-inner {
  background: var(--blue); color: #fff; border-radius: var(--radius);
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.rest-inner .t { font-family: var(--disp); font-weight: 700; font-size: 30px; min-width: 64px; line-height: 1; }
.rest-inner p { flex: 1; font-size: 13px; opacity: .9; }
.rest-inner button { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 10px; }

.finish-box { margin-top: 16px; }

/* ---------- progress ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat .v { font-family: var(--disp); font-weight: 700; font-size: 30px; color: var(--chalk); line-height: 1.05; }
.stat .l { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.chart-wrap { padding: 14px 12px 8px; }
.chart-wrap h3 { font-family: var(--disp); font-weight: 600; font-size: 16px; text-transform: uppercase; letter-spacing: .05em; margin: 0 4px 8px; }
svg.chart { width: 100%; height: auto; display: block; }
.levels-list .lv-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.levels-list .lv-row:last-child { border-bottom: none; }
.lv-row .n { flex: 1; }
.lv-row .b { color: var(--blue); font-weight: 600; font-size: 12px; white-space: nowrap; }
.weight-input { display: flex; gap: 10px; }
.weight-input input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); padding: 12px 14px;
}
.hist-row { display: flex; justify-content: space-between; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.hist-row b { color: var(--text); font-weight: 600; }

/* ---------- settings ---------- */
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: none; }
.field label { font-weight: 500; }
.field .hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.field input[type="time"], .field select {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text);
  padding: 9px 12px; color-scheme: dark;
}
.switch { position: relative; width: 50px; height: 29px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 2; cursor: pointer; }
.switch .knob {
  position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; transition: background .15s;
}
.switch .knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .knob { background: var(--blue-deep); border-color: var(--blue); }
.switch input:checked + .knob::after { transform: translateX(21px); background: var(--chalk); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--chalk); color: #14181c; font-weight: 600; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  max-width: 90vw; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
