:root,
[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #30363d;
  --text: #f0f6fc;
  --muted: #8b949e;
  --primary: #22c55e;
  --primary-text: #04130a;
  --danger: #ef4444;
  --warning: #f59e0b;
  --link: #60a5fa;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

select {
  appearance: none;
  -webkit-appearance: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.topbar form { margin: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

main.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 1rem 1rem 8.5rem 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}
.card-accent { border-color: var(--primary); }
.card-title { margin: 0 0 0.25rem 0; font-size: 1.05rem; }
.card-link { display: flex; color: inherit; text-decoration: none; }
.card-link:hover { border-color: var(--primary); text-decoration: none; }

.superset-group {
  border-left: 4px solid var(--primary);
  padding-left: 0.65rem;
  margin-bottom: 0.9rem;
}
.superset-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.muted { color: var(--muted); font-size: 0.875rem; }
.text-primary { color: var(--primary); font-weight: 700; }
.small { font-size: 0.8rem; }
.mt-sm { margin-top: 0.75rem; }
.pre-line { white-space: pre-line; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.row form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 0.65rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.checkbox-row input { width: auto; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  margin: 0;
  width: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { opacity: 0.92; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0.3rem 0.65rem; font-size: 0.82rem; border-radius: 8px; }
.btn-block { width: 100%; }

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}
.alert-error { border-color: var(--danger); color: #fecaca; background: rgba(239, 68, 68, 0.12); }
.alert-success { border-color: var(--primary); color: #bbf7d0; background: rgba(34, 197, 94, 0.12); }
.alert-warn { border-color: var(--warning); color: #fde68a; background: rgba(245, 158, 11, 0.12); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.set-row {
  padding: 0.6rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.set-row.completed { border-color: var(--primary); }
.set-inputs {
  display: grid;
  grid-template-columns: 58px 1fr 1fr 56px;
  gap: 0.4rem;
  margin-top: 0.35rem;
  align-items: center;
}
.set-inputs input,
.set-inputs select,
.set-inputs button {
  margin-bottom: 0;
  min-height: 42px;
  padding: 0.35rem 0.5rem;
}
.set-check.done {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}

.rest-timer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 58px;
  z-index: 25;
  background: var(--surface);
  border-top: 2px solid var(--primary);
  padding: 0.65rem 1rem;
}
.rest-timer[hidden] { display: none; }
.rest-timer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.timer-digits { font-size: 1.4rem; font-weight: 800; color: var(--primary); }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav a {
  text-align: center;
  padding: 0.85rem 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.bottom-nav a.active {
  color: var(--primary);
  border-top: 2px solid var(--primary);
}

.pill-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill-list form { margin: 0; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
}
.bar-track {
  flex: 1;
  height: 14px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
}
.chart-svg { width: 100%; height: 120px; display: block; }

details { margin-bottom: 0; border-bottom: 0; padding-bottom: 0; }
details > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
details > summary::after { display: none; }
details > summary::-webkit-details-marker { display: none; }
