:root {
  --bg: #101216;
  --bg-soft: #14171c;
  --panel: #1b1e24;
  --panel-hi: #232730;
  --text: #f4f5f7;
  --muted: #8b919c;
  --run: #ff6a3d;
  --run-soft: rgba(255, 106, 61, 0.16);
  --walk: #3aa8ff;
  --walk-soft: rgba(58, 168, 255, 0.16);
  --accent: #ff6a3d;
  --accent-2: #ff8f5c;
  --ghost: #262a32;
  --good: #34d17c;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% -10%, #1a1d24 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100%;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 1.1rem env(safe-area-inset-bottom);
  max-width: 480px;
  margin: 0 auto;
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.35rem 0 0.9rem;
}
.topbar h1 {
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.topbar h1 .dot {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0.15rem;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.streak {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.overall-bar {
  height: 5px;
  background: var(--ghost);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.9rem;
  flex-shrink: 0;
}
.overall-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.hint { color: var(--muted); margin: 0 0 0.85rem; font-size: 0.92rem; }

.grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  padding-bottom: 1.25rem;
}

.week-block {
  background: var(--panel);
  border-radius: 16px;
  padding: 0.85rem 0.9rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: outline-color 0.2s;
}
.week-block.is-current { outline: 1.5px solid rgba(255, 106, 61, 0.5); }
.week-block h2 {
  font-size: 0.85rem;
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.up-next-chip {
  background: var(--run-soft);
  color: var(--accent-2);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.day-row { display: flex; gap: 0.5rem; }
.day-btn {
  flex: 1;
  background: var(--panel-hi);
  border: none;
  border-radius: 12px;
  color: var(--text);
  padding: 0.75rem 0.3rem;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: transform 0.08s ease, background 0.15s ease;
}
.day-btn:active { transform: scale(0.96); background: #2a2f39; }
.day-btn .day-num { font-weight: 700; }
.day-btn .day-check { color: var(--good); font-size: 0.75rem; font-weight: 600; }
.day-btn.active-pick { outline: 2px solid var(--accent); }
.day-btn.is-next { box-shadow: inset 0 0 0 1.5px var(--accent); }

.run-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  flex-shrink: 0;
}
.icon-btn {
  background: var(--panel);
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { background: var(--ghost); }
.run-title { font-weight: 700; color: var(--muted); font-size: 0.92rem; }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  min-height: 40vh;
}

.segment-label {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--walk);
  transition: color 0.25s ease;
}
.segment-label.is-run { color: var(--run); }

.ring-wrap {
  position: relative;
  width: min(68vw, 260px);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track {
  fill: none;
  stroke: var(--ghost);
  stroke-width: 11;
}
.ring-fill {
  fill: none;
  stroke: var(--walk);
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dasharray: 628.318;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.25s linear, stroke 0.25s ease;
}
.ring-fill.is-run { stroke: var(--run); }

.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.next-label { color: var(--muted); font-size: 0.92rem; min-height: 1.2em; }

.done-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--run-soft);
  color: var(--good);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}
.done-msg { color: var(--muted); font-size: 1.02rem; margin-top: 0.3rem; }

.progress-wrap { padding: 0 0.25rem 1rem; flex-shrink: 0; }
.progress-bar {
  height: 7px;
  background: var(--ghost);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s linear;
}
.progress-time {
  text-align: center;
  color: var(--muted);
  font-size: 0.83rem;
  margin-top: 0.45rem;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  flex-shrink: 0;
}

.btn {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 1rem;
  font-size: 1.05rem;
  font-weight: 700;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #16130f; box-shadow: 0 6px 18px rgba(255, 106, 61, 0.28); }
.btn-primary:active { filter: brightness(0.94); }
.btn-ghost { background: var(--panel-hi); color: var(--text); }
.btn-ghost:active { filter: brightness(1.15); }
