/* ================================================
   Live (最近 / 朋友圈)
   Aligned with site-wide design tokens (see assets/css/index.css).
   Notebook / logbook aesthetic — palette, accents, gradient and
   corner / grid decorations are shared with the rest of makislife.
   ================================================ */

[data-theme="light"] {
  --bg-base: #fafaf9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: rgba(234, 88, 12, 0.08);
  --accent-glow: rgba(234, 88, 12, 0.2);
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.1);
  --gradient: linear-gradient(135deg, #ea580c 0%, #7c3aed 50%, #0891b2 100%);
  --toolbar-bg: rgba(255, 255, 255, 0.9);
  --toolbar-border: rgba(15, 23, 42, 0.1);
  --header-bg: rgba(255, 255, 255, 0.82);
  /* Decoration palette (matched to site) */
  --bookend-grid-color: rgba(234, 88, 12, 0.05);
  --bookend-orb-opacity: 0.25;
  --bookend-corner-color: rgba(8, 145, 178, 0.35);
  --bookend-line-color: rgba(234, 88, 12, 0.4);
  --btn-hover-bg: rgba(15, 23, 42, 0.05);
  --font-mono: "code", "JetBrains Mono", "Fira Code", monospace;
  --glow: 0 4px 32px rgba(234, 88, 12, 0.12);
}

[data-theme="dark"] {
  --bg-base: #0a0e1a;
  --bg-surface: rgba(15, 23, 42, 0.85);
  --bg-card: rgba(255, 255, 255, 0.04);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #f97316;
  --accent-2: #a855f7;
  --accent-3: #06b6d4;
  --accent-hover: #ea580c;
  --accent-soft: rgba(249, 115, 22, 0.1);
  --accent-glow: rgba(249, 115, 22, 0.3);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --gradient: linear-gradient(135deg, #f97316 0%, #a855f7 50%, #06b6d4 100%);
  --toolbar-bg: rgba(255, 255, 255, 0.06);
  --toolbar-border: rgba(255, 255, 255, 0.08);
  --header-bg: rgba(10, 14, 26, 0.82);
  --bookend-grid-color: rgba(255, 255, 255, 0.04);
  --bookend-orb-opacity: 0.35;
  --bookend-corner-color: rgba(6, 182, 212, 0.35);
  --bookend-line-color: rgba(6, 182, 212, 0.45);
  --btn-hover-bg: rgba(255, 255, 255, 0.06);
  --font-mono: "code", "JetBrains Mono", "Fira Code", monospace;
  --glow: 0 0 60px rgba(249, 115, 22, 0.2);
}

/* ================================================
   Base
   ================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ================================================
   Back-to-home button
   ================================================ */
.back-btn {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.back-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.back-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--glow);
}

.back-btn:hover svg {
  transform: translateX(-4px);
}

/* ================================================
   Background decorations (shared with site)
   ================================================ */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bg-grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(var(--bookend-grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--bookend-grid-color) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, black 20%, transparent 75%);
  opacity: 0.6;
}

.bg-corner {
  position: absolute;
  width: 72px;
  height: 72px;
  border-color: var(--bookend-corner-color);
  border-style: solid;
  opacity: 0.5;
  transition: border-color 0.35s ease, opacity 0.35s ease;
}

.bg-corner-tl { top: 32px; left: 32px; border-width: 2px 0 0 2px; border-radius: 12px 0 0 0; }
.bg-corner-tr { top: 32px; right: 32px; border-width: 2px 2px 0 0; border-radius: 0 12px 0 0; }
.bg-corner-bl { bottom: 56px; left: 32px; border-width: 0 0 2px 2px; border-radius: 0 0 0 12px; }
.bg-corner-br { bottom: 56px; right: 32px; border-width: 0 2px 2px 0; border-radius: 0 0 12px 0; }

.bg-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 12px var(--accent-3);
  opacity: 0.5;
  animation: sparkFloat 4s ease-in-out infinite;
}

.bg-spark-1 { top: 22%; left: 12%; animation-delay: 0s; }
.bg-spark-2 { top: 30%; right: 18%; animation-delay: -1.2s; }
.bg-spark-3 { bottom: 30%; left: 20%; animation-delay: -2.4s; }
.bg-spark-4 { bottom: 36%; right: 14%; animation-delay: -3.1s; }

@keyframes sparkFloat {
  0%, 100% { transform: translate(0, 0); opacity: 0.5; }
  50% { transform: translate(0, -10px); opacity: 0.8; }
}

.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: var(--bookend-orb-opacity);
  animation: blobFloat 8s ease-in-out infinite;
}

.bg-blob-1 {
  width: 420px;
  height: 420px;
  top: -10%;
  left: -8%;
  background: var(--accent);
  animation-delay: 0s;
}

.bg-blob-2 {
  width: 360px;
  height: 360px;
  bottom: -15%;
  right: -6%;
  background: var(--accent-2);
  animation-delay: -2.5s;
}

.bg-blob-3 {
  width: 280px;
  height: 280px;
  top: 40%;
  right: 15%;
  background: var(--accent-3);
  animation-delay: -5s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(12px, -16px) scale(1.05); }
}

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
}

a {
  color: inherit;
  text-decoration: none;
}

html {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s ease, color 0.35s ease;
}

button {
  font: inherit;
  color: inherit;
}

/* ================================================
   Header
   ================================================ */
.live-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.1rem clamp(1.25rem, 5vw, 1.75rem);
  padding-top: max(1.1rem, env(safe-area-inset-top, 0px));
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.live-header .back-link {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.35rem 0;
  transition: color 0.2s ease;
}

.live-header .back-link:hover,
.live-header .back-link:focus-visible {
  color: var(--text-primary);
  outline: none;
}

.live-header .back-link .arrow {
  transition: transform 0.2s ease;
}

.live-header .back-link:hover .arrow {
  transform: translateX(-2px);
}

.page-title {
  justify-self: center;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.page-title .mark {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.65rem;
  vertical-align: middle;
  box-shadow: 0 0 8px var(--accent-glow);
}

.theme-toggle {
  justify-self: end;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* ================================================
   Bottom floating bar (mobile-only)
   ================================================ */
.bottom-bar {
  display: none;
}

.bb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.2s ease, background-color 0.2s ease;
  min-height: 36px;
  white-space: nowrap;
}

.bb-btn:hover,
.bb-btn:focus-visible {
  color: var(--text-primary);
  background: var(--accent-soft);
  outline: none;
}

.bb-btn.bb-center {
  color: var(--text-primary);
  font-weight: 500;
  padding: 8px 18px;
  min-width: 76px;
  justify-content: center;
}

.bb-icon-close { display: none; }
#drawer-toggle.is-open .bb-icon-menu { display: none; }
#drawer-toggle.is-open .bb-icon-close { display: inline-block; }
#drawer-toggle.is-open { color: var(--accent); }

.bb-icon-moon { display: none; }
[data-theme="dark"] .bb-icon-sun { display: none; }
[data-theme="dark"] .bb-icon-moon { display: inline-block; }

/* ================================================
   Layout: sidebar + content
   ================================================ */
.layout {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

/* ================================================
   Sidebar — table of contents
   ================================================ */
.sidebar {
  position: sticky;
  top: 53px;
  height: calc(100vh - 53px);
  height: calc(100dvh - 53px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}

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

.month-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 32px 28px 18px;
  border-bottom: 1px solid var(--border);
}

.month-tab {
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s ease;
}

.month-tab:hover {
  color: var(--text-secondary);
}

.month-tab.is-active {
  color: var(--text-primary);
}

.month-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -19px; /* sits on the border line */
  height: 1px;
  background: var(--accent);
}

.day-list {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 32px;
  scrollbar-width: thin;
}

.day-list::-webkit-scrollbar {
  width: 4px;
}
.day-list::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

.day-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 9px 28px 9px 28px;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  color: var(--text-muted);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.day-item:hover {
  color: var(--text-secondary);
}

.day-item .day-num {
  font-size: 1.1rem;
  font-weight: 400;
  color: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.day-item .day-info {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.85;
  min-width: 0;
}

.day-item .day-tag {
  display: none;
}

.day-item .day-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.day-item.is-today .day-info {
  color: var(--accent);
  opacity: 1;
}

.day-item.is-today .day-num {
  color: var(--text-primary);
}

.day-item.is-active {
  color: var(--text-primary);
}

.day-item.is-active .day-num {
  color: var(--text-primary);
}

.day-item.is-active .day-info {
  color: var(--text-secondary);
  opacity: 1;
}

.day-item.is-active::before {
  /* The bookmark ribbon */
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 34px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
  box-shadow: 0 1px 4px var(--accent-glow);
  animation: ribbonIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================================================
   Sidebar — Home button
   ================================================ */
.home-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s ease;
}

.home-btn:hover {
  color: var(--text-secondary);
}

.home-btn-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.home-btn.is-active {
  color: var(--text-primary);
}

.home-btn.is-active .home-btn-mark {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.home-btn.is-active::before {
  /* Bookmark ribbon, same shape as day-item */
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 34px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%);
  box-shadow: 0 1px 4px var(--accent-glow);
  animation: ribbonIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ribbonIn {
  from { transform: translate(-6px, -50%); opacity: 0; }
  to   { transform: translate(0, -50%); opacity: 1; }
}

/* ================================================
   Main content area
   ================================================ */
.content {
  min-width: 0;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.5rem, 5vw, 3rem);
  padding-left: max(clamp(1.5rem, 5vw, 3rem), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(1.5rem, 5vw, 3rem), env(safe-area-inset-right, 0px));
  max-width: 680px;
  width: 100%;
  margin-left: clamp(24px, 4vw, 56px);
}

/* ================================================
   Day header (chapter title)
   ================================================ */
.day-header {
  margin-bottom: 3.5rem;
}

.day-header .chapter {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 1rem;
}

.day-header .year {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.day-header .date {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.5vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.day-header .date .sep {
  color: var(--text-muted);
  margin: 0 0.15em;
  font-weight: 300;
}

.day-header .tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.day-header-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.day-header-meta .sep {
  opacity: 0.4;
}

.day-header-meta .count strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ================================================
   Home — workout card (default landing)
   ================================================ */
.home {
  max-width: 640px;
  animation: homeIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes homeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.home-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.home-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.home-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  background-image: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin-bottom: 0.4rem;
}

.home-location {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.home-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.75rem 0;
}

.home-context {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}

.home-context .sep {
  opacity: 0.4;
}

.home-hero {
  text-align: center;
  margin: 1rem 0 0.5rem;
  padding: 1.5rem 0 1rem;
}

.hero-value {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 14vw, 7.5rem);
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.045em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.hero-unit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-left: 10px;
  vertical-align: super;
  position: relative;
  top: -0.6em;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 1.25rem;
  margin: 0;
  padding: 0;
}

.home-stats .stat dt {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.home-stats .stat dt .muted {
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  margin-left: 3px;
}

.home-stats .stat dd {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
}

.home-hint {
  margin-top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  opacity: 0.7;
  font-style: italic;
}

.home-hint-mobile { display: none; }

/* ================================================
   Home — sections (overview / activity / distance)
   ================================================ */
.home-section {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.home-section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 1.75rem;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.home-section-sub {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  opacity: 0.6;
  text-transform: none;
  font-style: italic;
}

.home-state {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  padding: 1rem 0;
}

/* --- Overview grid --- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem 1.5rem;
}

.overview-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}

.overview-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.015em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.overview-value .unit {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-left: 4px;
  vertical-align: super;
  position: relative;
  top: -0.3em;
  font-weight: 400;
}

.overview-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Activity timeline removed --- */

/* --- Distance chart --- */
.distance-chart {
  width: 100%;
  overflow: visible;
}

.distance-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.distance-chart .axis-line {
  stroke: var(--border);
  stroke-width: 1;
}

.distance-chart .grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.6;
}

.distance-chart .axis-label {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-muted);
  letter-spacing: 0.04em;
}

.distance-chart .axis-tick {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--text-muted);
}

.distance-chart .data-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.distance-chart .data-area {
  fill: var(--accent);
  opacity: 0.08;
}

.distance-chart .data-point {
  fill: var(--accent);
  stroke: var(--bg-base);
  stroke-width: 2;
  transition: r 0.2s ease;
  cursor: pointer;
}

.distance-chart .data-point:hover {
  r: 6;
}

.distance-chart-empty {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}

.distance-chart-single {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 1rem 0;
  text-align: center;
}

.distance-meta {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.distance-meta strong {
  color: var(--text-primary);
  font-weight: 500;
  margin-right: 4px;
}

.distance-meta .sep {
  opacity: 0.4;
}

/* ================================================
   Home — Timeline (workout log)
   ================================================ */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

/* The vertical rail */
.timeline::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border-strong);
  opacity: 0.6;
}

.timeline-item {
  position: relative;
  padding: 0 0 1.25rem 44px;
  cursor: pointer;
  transition: transform 0.18s ease;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item:hover {
  transform: translateX(2px);
}

.timeline-item:hover .timeline-marker {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.timeline-item:hover .timeline-card {
  border-color: var(--border-strong);
}

/* The dot on the rail */
.timeline-marker {
  position: absolute;
  left: 8px;
  top: 6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 1.5px solid var(--accent);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.timeline-date .dow {
  color: var(--accent);
  margin-left: 6px;
}

.timeline-date .time {
  color: var(--text-secondary);
  margin-left: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: none;
}

.timeline-date .time-sep {
  margin: 0 2px;
  opacity: 0.5;
}

.timeline-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.95rem 1rem 1rem;
  background: var(--bg-card);
  transition: border-color 0.18s ease;
  position: relative;
}

.timeline-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0.55rem;
}

.timeline-card-type {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.timeline-card-dist {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.timeline-card-dist .unit {
  color: var(--text-muted);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-left: 4px;
}

.timeline-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.timeline-card-meta span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.timeline-card-meta .key {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.6rem;
}

.timeline-card-foot {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.timeline-card-foot .sep { opacity: 0.4; }

.timeline-empty {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0;
}

@media (max-width: 480px) {
  .timeline::before { left: 9px; }
  .timeline-item { padding-left: 32px; }
  .timeline-marker { left: 3px; width: 11px; height: 11px; }
  .timeline-card { padding: 0.8rem 0.85rem 0.85rem; }
  .timeline-card-type { font-size: 0.95rem; }
}

/* ================================================
   Entry
   ================================================ */
.entries {
  display: flex;
  flex-direction: column;
}

.entry {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  animation: entryIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.entry:first-child {
  border-top: none;
  padding-top: 1rem;
}

.entry:nth-of-type(1) { animation-delay: 0.04s; }
.entry:nth-of-type(2) { animation-delay: 0.10s; }
.entry:nth-of-type(3) { animation-delay: 0.16s; }
.entry:nth-of-type(n+4) { animation-delay: 0.22s; }

@keyframes entryIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.entry-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.entry-time {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
}

.entry-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.entry-location svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.entry-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.entry-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 56ch;
}

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 56ch;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-primary);
}

.entry-list li {
  padding: 0.15rem 0;
}

.entry-list li + li {
  border-top: 1px dashed var(--border);
  margin-top: 0.15rem;
  padding-top: 0.35rem;
}

/* ================================================
   Image grid
   ================================================ */
.entry-images {
  display: grid;
  gap: 4px;
  --img-radius: 4px;
  max-width: 560px;
}

.entry-images img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: var(--img-radius);
  background: var(--bg-card);
  cursor: zoom-in;
  transition: opacity 0.25s ease;
}

.entry-images img:hover,
.entry-images img:focus-visible {
  opacity: 0.9;
  outline: none;
}

.entry-images.images-1 {
  grid-template-columns: 1fr;
  max-width: 480px;
}
.entry-images.images-1 img {
  aspect-ratio: 4 / 3;
  max-height: 360px;
}

.entry-images.images-2 {
  grid-template-columns: repeat(2, 1fr);
}
.entry-images.images-2 img {
  aspect-ratio: 1 / 1;
}

.entry-images.images-3 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto auto;
}
.entry-images.images-3 img:nth-child(1) {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}
.entry-images.images-3 img:nth-child(n+2) {
  aspect-ratio: 1 / 1;
}

.entry-images.images-4 {
  grid-template-columns: repeat(2, 1fr);
}
.entry-images.images-4 img {
  aspect-ratio: 1 / 1;
}

.entry-images.images-5,
.entry-images.images-6,
.entry-images.images-7,
.entry-images.images-8,
.entry-images.images-9 {
  grid-template-columns: repeat(3, 1fr);
}
.entry-images.images-5 img,
.entry-images.images-6 img,
.entry-images.images-7 img,
.entry-images.images-8 img,
.entry-images.images-9 img {
  aspect-ratio: 1 / 1;
}

/* ================================================
   Workout card inside day entries
   ================================================ */
.entry-workout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  max-width: 560px;
}

.entry-workout-head {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.entry-workout-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.entry-workout-hero {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.entry-workout-hero .hero-value {
  font-size: clamp(3.2rem, 10vw, 4.5rem);
  letter-spacing: -0.04em;
}

.entry-workout-hero .hero-unit {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
}

.entry-workout-sub,
.entry-workout-weather {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}

.entry-workout-sub .sep,
.entry-workout-weather .sep {
  opacity: 0.4;
}

.entry-workout-weather {
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
  margin-top: 0.3rem;
}

.entry-workout-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem 1rem;
  margin: 0;
  padding: 1.25rem 0 0;
  border-top: 1px dashed var(--border);
}

.entry-workout-stats .stat dt {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: 5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.entry-workout-stats .stat dt .muted {
  color: var(--text-muted);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  margin-left: 3px;
}

.entry-workout-stats .stat dd {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0;
}

@media (max-width: 480px) {
  .entry-workout {
    padding: 1.15rem 1rem 1.4rem;
    border-radius: 6px;
  }
  .entry-workout-hero .hero-value {
    font-size: 3.4rem;
  }
  .entry-workout-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 0.75rem;
  }
}

/* ================================================
   Empty / loading / error states
   ================================================ */
.entries-empty {
  padding: 4rem 0;
  text-align: left;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.entries-empty .hint {
  margin-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  opacity: 0.75;
  max-width: 52ch;
  line-height: 1.7;
}

.entries-empty code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.state {
  padding: 3rem 0;
  text-align: left;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.state .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================
   Footer
   ================================================ */
.live-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ================================================
   Lightbox
   ================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 2rem;
  cursor: zoom-out;
  animation: lightboxIn 0.2s ease;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
}

@keyframes lightboxIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ================================================
   Mobile: drawer + bottom bar
   ================================================ */
.backdrop {
  /* Hidden by default; mobile media query below sets position + opacity
     and toggles pointer-events via .is-open. Do NOT use display:none —
     that overrides .is-open and breaks backdrop click-to-close. */
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 860px) {
  .layout {
    padding: 0 16px;
  }

  /* Header: hide theme toggle on desktop too (T shortcut is enough) */
  .live-header .theme-toggle {
    display: none;
  }

  /* Sidebar removed — keep block as no-op to avoid stale CSS breakage */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    height: 100vh;
    height: 100dvh;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-base);
    border-right: 1px solid var(--border-strong);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  /* Padding inside drawer for iPhone notch */
  .sidebar-inner {
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
  }

  /* Larger tap targets on mobile */
  .month-tab {
    padding: 6px 0;
    font-size: 0.78rem;
  }

  .day-item {
    padding: 14px 24px;
    min-height: 48px;
    align-items: center;
  }

  .day-num {
    font-size: 1.2rem;
  }

  .home-btn {
    padding: 16px 24px;
    min-height: 52px;
  }

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s ease;
  }

  .backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Bottom floating bar (mobile only) */
  .bottom-bar {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 5px;
    border-radius: 999px;
    background: var(--bg-base);
    border: 1px solid var(--border-strong);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  }

  .content {
    padding-bottom: 110px;
    margin-left: 0;
  }

  /* home-hint: mobile-friendly wording */
  .home-hint-desktop { display: none; }
  .home-hint-mobile { display: inline; }
  .home-hint {
    font-size: 0.85rem;
    font-style: normal;
    opacity: 0.85;
  }
}

@media (max-width: 480px) {
  .page-title {
    font-size: 0.85rem;
    letter-spacing: 0.28em;
  }
  .entry-time {
    font-size: 1.35rem;
  }
  .entry-text {
    font-size: 0.97rem;
    line-height: 1.8;
  }
  .day-header .date {
    font-size: 2.1rem;
  }
  .home-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1rem;
  }
  .hero-value {
    font-size: 4.5rem;
  }
  .home-title {
    font-size: 1.9rem;
  }
  .home-context {
    font-size: 0.72rem;
  }
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1rem;
  }
  .overview-value {
    font-size: 1.4rem;
  }
}

@media (max-width: 360px) {
  .live-header {
    padding: 0.95rem 1rem;
  }
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ================================================
   Reduced motion
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  .entry {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .day-item.is-active::before {
    animation: none;
  }
  .entry-images img,
  .sidebar,
  .backdrop,
  .lightbox {
    transition: none;
  }
  body {
    transition: none;
  }
}

/* ================================================
   Focus visible
   ================================================ */
:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ================================================
   Keyboard shortcut hints (bottom-right, desktop only)
   ================================================ */
.key-hint {
  position: fixed;
  right: 24px;
  z-index: 49;            /* below bottom-bar (50) so it doesn't sit on top */
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 13px 7px 11px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.08),
    0 1px 0 var(--border-strong);
  user-select: none;
  pointer-events: none;
}

.key-hint-theme { bottom: 24px; }
.key-hint-top   { bottom: 68px; }

.key-hint-letter {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.key-hint-icon {
  width: 13px;
  height: 13px;
  display: none;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.key-hint-arrow { flex-shrink: 0; color: var(--text-secondary); }

[data-theme="light"] .key-hint-moon { display: inline-block; }
[data-theme="dark"]  .key-hint-sun  { display: inline-block; }

@media (max-width: 860px) {
  /* On mobile the bottom-bar already shows the theme icon; hints are redundant. */
  .key-hint { display: none; }
}