/* 365 km — thème « Nuit » */
:root {
  --bg: #0b0c10;
  --surface: #15171d;
  --surface-2: #1c1f27;
  --line: #2a2e37;
  --bar: #2f333d;
  --bar-strong: #5a5f6b;
  --text: #f4f5f7;
  --text-2: #a3a8b3;
  --text-3: #8a8f9c;
  --accent: #c6f432;
  --accent-ink: #0b0c10;
  --good: #3ddc84;
  --warn: #ffb547;
  --bad: #ff8a4c;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

.icon {
  display: block;
  flex-shrink: 0;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- Barre du haut ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 12px 0 20px;
}

.topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.topbar-title span {
  color: var(--text-3);
  font-weight: 500;
}

.topbar-back {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface);
}

/* ---------- Mise en page ---------- */

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
}

.card h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 181, 71, 0.1);
  color: var(--warn);
  font-size: 0.875rem;
  line-height: 1.4;
}

.notice-bad {
  background: rgba(255, 138, 76, 0.12);
  color: var(--bad);
}

/* ---------- Anneau de progression ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

.ring {
  position: relative;
  width: 260px;
  height: 260px;
}

.ring svg {
  display: block;
}

.ring-track {
  stroke: var(--surface-2);
}

.ring-fill {
  stroke: var(--accent);
  animation: ring-grow 1s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes ring-grow {
  from { stroke-dasharray: 0 1000; }
}

.ring-marker {
  fill: var(--bg);
  stroke: #fff;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ring-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4rem;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.ring-sub {
  font-size: 0.875rem;
  color: var(--text-2);
}

.legend {
  display: flex;
  gap: 18px;
  font-size: 0.75rem;
  color: var(--text-2);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.dot-ring {
  background: none;
  border: 2px solid #fff;
}

/* ---------- Chiffres clés ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.kpis-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.kpi-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kpi-value small {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}

.is-good { color: var(--good); }
.is-warn { color: var(--warn); }
.is-bad { color: var(--bad); }

/* ---------- Rythme à tenir ---------- */

.pace {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pace-label {
  font-size: 0.8125rem;
  color: var(--text-2);
}

.pace-value {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.pace-value small {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
}

/* ---------- Graphiques ---------- */

.progress-chart {
  display: block;
  width: 100%;
  height: auto;
}

.month-labels {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
  font-size: 0.6875rem;
  color: var(--text-3);
  text-align: center;
}

.month-labels .is-current {
  color: var(--text);
  font-weight: 700;
}

.bar-chart {
  height: 100px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 5px;
  align-items: end;
}

.bar {
  min-height: 3px;
  border-radius: 4px;
  background: var(--bar);
  animation: bar-grow 0.7s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.bar-best { background: var(--bar-strong); }
.bar-current { background: var(--accent); }

@keyframes bar-grow {
  from { height: 0; }
}

/* ---------- Dernières sorties ---------- */

.section-title {
  margin: 4px 4px 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-list li {
  display: grid;
  grid-template-columns: 1fr auto 72px;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
}

.activity-date,
.activity-duration {
  font-size: 0.875rem;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.activity-duration {
  text-align: right;
}

.activity-distance {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}

.empty {
  margin: 0 4px;
  color: var(--text-2);
  font-size: 0.9rem;
}

/* ---------- Boutons ---------- */

.btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn:active {
  transform: scale(0.99);
}

.btn-quiet {
  background: var(--surface-2);
  color: var(--text);
}

.sync-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
  text-align: center;
}

.sync-status .dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  background: var(--good);
}

.sync-status.is-warn .dot {
  background: var(--warn);
}

.sync-status.is-warn {
  color: var(--warn);
}

/* ---------- Connexion ---------- */

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
}

.auth {
  max-width: 420px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 64px 24px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
}

.auth-top {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.auth-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.auth h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.5rem;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.auth-lead {
  margin: 12px 0 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-2);
}

.auth form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
}

.input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 0 18px;
  font-family: var(--font-body);
  font-size: 1rem;
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.error {
  margin: 0;
  color: var(--bad);
  font-size: 0.9rem;
}

.success {
  margin: 0;
  color: var(--good);
  font-size: 0.9rem;
}

/* ---------- Réglages ---------- */

.hint {
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.5;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.month-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
}

.month-field .input {
  height: 48px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  padding: 0 14px;
}

.month-field .input::placeholder {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-3);
}

@media (prefers-reduced-motion: reduce) {
  .ring-fill, .bar { animation: none; }
}
