:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --accent-dim: #238636;
  --warn: #d29922;
  --rest: #58a6ff;
  --danger: #f85149;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--rest); text-decoration: none; }
.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + var(--nav-h) + var(--safe-b));
}
header {
  text-align: center;
  margin-bottom: 16px;
  padding-top: 8px;
}
header h1 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
header .sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}
.badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card.placeholder {
  opacity: 0.85;
  border-style: dashed;
}
.card h2, .card h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.day-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.day-link:active .card { transform: scale(0.99); }
.day-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.day-title { font-size: 1.1rem; font-weight: 700; }
.pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ready { color: var(--accent); border-color: var(--accent-dim); }
.pill.done { color: #fff; background: var(--accent-dim); border-color: var(--accent); }
.pill.soon { color: var(--warn); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: var(--accent-dim);
  width: 100%;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }
.btn.secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.warn { background: var(--warn); color: #000; }
.btn.rest { background: var(--rest); }
.btn.danger { background: var(--danger); }
.btn.row { width: auto; display: inline-block; padding: 10px 14px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field input, .field textarea, .field select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
}
.field textarea { min-height: 72px; resize: vertical; }
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.check-item:last-child { border-bottom: none; }
.check-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.check-item .label { flex: 1; }
.check-item .label strong { display: block; font-size: 0.95rem; }
.check-item .label span { color: var(--muted); font-size: 0.8rem; }
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(22, 27, 34, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 8px 8px calc(8px + var(--safe-b));
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-width: 480px;
  margin: 0 auto;
}
.bottom-nav a {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 10px;
  text-decoration: none;
}
.bottom-nav a.active { color: var(--accent); background: var(--surface2); }
.bottom-nav .ico { display: block; font-size: 1.15rem; margin-bottom: 2px; }
footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 0.7rem;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.hidden { display: none !important; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.stat .n { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.stat .l { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.day-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--muted);
}
.day-cell.done { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.day-cell.today { box-shadow: 0 0 0 2px rgba(88,166,255,0.45); }
.day-cell .d { font-weight: 700; font-size: 0.8rem; }
.chart-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px 8px;
  overflow: hidden;
}
.chart-wrap svg { width: 100%; height: auto; display: block; }
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.list-row:last-child { border-bottom: none; }
.list-row .r { color: var(--muted); text-align: right; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px + var(--safe-b));
  transform: translateX(-50%) translateY(20px);
  background: var(--accent-dim);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Workout page extras (from Hari1) */
.warmup { border-left: 3px solid var(--warn); }
.warmup strong { color: var(--warn); }
.gif-box {
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  position: relative;
}
.gif-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.gif-note {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  font-size: 0.7rem;
  background: rgba(0,0,0,0.7);
  color: var(--warn);
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
}
.ex-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.ex-name { font-size: 1.25rem; font-weight: 700; }
.ex-sets { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.howto { color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }
.phase {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.phase.work { color: var(--accent); }
.phase.rest { color: var(--rest); }
.phase.idle { color: var(--muted); }
.timer {
  text-align: center;
  font-size: 4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 4px 0 8px;
}
.timer.rest { color: var(--rest); }
.timer.work { color: var(--accent); }
.status-line {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
  min-height: 1.4em;
}
.plank-opts {
  display: none;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.plank-opts.show { display: flex; }
.plank-opts button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.plank-opts button.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #fff;
}
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.controls button {
  border: none;
  border-radius: 12px;
  padding: 14px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s, transform 0.1s;
}
.controls button:active { transform: scale(0.97); }
.controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}
.btn-start { background: var(--accent-dim); grid-column: 1 / -1; }
.btn-pause { background: var(--warn); color: #000; }
.btn-skip { background: var(--surface2); border: 1px solid var(--border) !important; color: var(--text); }
.btn-done { background: var(--rest); grid-column: 1 / -1; }
.progress-dots {
  display: flex;
  gap: 6px;
  margin: 16px 0 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.progress-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.progress-dots .dot.done { background: var(--accent); border-color: var(--accent); }
.progress-dots .dot.current { background: var(--rest); border-color: var(--rest); box-shadow: 0 0 0 3px rgba(88,166,255,0.25); }
.list-preview { font-size: 0.8rem; color: var(--muted); }
.list-preview ol { padding-left: 1.2em; margin-top: 6px; }
.list-preview li { margin-bottom: 2px; }
.list-preview li.current-ex { color: var(--text); font-weight: 600; }
.cooldown { border-left: 3px solid var(--rest); display: none; }
.cooldown.show { display: block; }
.done-screen {
  display: none;
  text-align: center;
  padding: 24px 8px;
}
.done-screen.show { display: block; }
.done-screen .check { font-size: 4rem; color: var(--accent); margin-bottom: 8px; }
.done-screen h2 { font-size: 1.5rem; margin-bottom: 8px; }
.done-screen p { color: var(--muted); margin-bottom: 16px; }
.tips {
  text-align: left;
  background: var(--surface2);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.9rem;
  color: var(--text);
}
.tips li { margin-left: 1.1em; margin-bottom: 6px; }
.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
  font-weight: 600;
}
.back-link:hover { color: var(--text); }
