:root {
  /* dark palette (contrast-verified: text on accent fills must be --on-accent, not white) */
  --bg-base: #0d0f12;
  --bg-surface-1: #161a1f;
  --bg-surface-2: #1f242b;
  --bg-overlay: #282e36;
  --text-primary: #f2f4f7;
  --text-secondary: #a9b1bc;
  --text-tertiary: #767f8a;
  --accent-orange: #ff9d4d;
  --accent-blue: #5b9dff;
  --accent-green: #3ddc97;
  --accent-red: #ff6b6b;
  --accent-purple: #b48eff;
  --accent-ice: #a8cfdd;
  --on-accent: #0d0f12;

  /* legacy aliases so older selectors keep working */
  --bg: var(--bg-base);
  --card: var(--bg-surface-1);
  --card-2: var(--bg-surface-2);
  --line: #2a313a;
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --primary: var(--accent-blue);
  --primary-2: #4a8bef;
  --good: var(--accent-green);
  --warn: var(--accent-orange);
  --danger: var(--accent-red);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --radius: 16px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--text);
}

/* No text selection anywhere except real inputs: a long-press or stray tap on
   a label was popping the browser's tap-to-define bar mid-workout. */
body {
  user-select: none;
  -webkit-user-select: none;
}
input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(0.92rem, 3.2vw, 1rem);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  padding: env(safe-area-inset-top) 1rem calc(env(safe-area-inset-bottom) + 5rem);
  max-width: 640px;
  margin: 0 auto;
}

h1 { font-size: clamp(1.25rem, 5vw, 1.5rem); font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.error { color: var(--danger); }
.block { display: block; }
.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.screen { padding-top: 0.8rem; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}
.topbar h1 { flex: 1; }

/* Surfaces: elevation by lightness + soft shadow, no borders */
.card {
  background: var(--bg-surface-1);
  border: none;
  border-radius: var(--r-lg);
  padding: 1.25rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-card);
}

/* Buttons */
.btn {
  appearance: none;
  border: none;
  border-radius: var(--r-md);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 1rem;
  color: var(--text);
  background: var(--bg-surface-2);
  cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 120ms var(--spring), background 150ms ease, filter 150ms ease;
}
.btn:active { transform: scale(0.96); filter: brightness(1.12); }
.btn-primary {
  background: linear-gradient(135deg, #6aa8ff, #4a8bef);
  color: var(--on-accent);
}
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09); color: var(--muted); }
.btn-lg { width: 100%; font-size: 1.1rem; padding: 0.95rem; min-height: 52px; }
.btn-small { min-height: 36px; padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-danger-text { color: var(--danger); }

/* Inputs */
input, textarea, select {
  width: 100%;
  background: var(--bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 0;
}

/* Login */
#screen-login { padding-top: 22vh; text-align: center; }
#screen-login h1 {
  font-size: clamp(1.8rem, 8vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#login-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.4rem; text-align: left; }

/* ---- Home ---- */
.home-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-top: 0.6rem;
  margin-bottom: 0.2rem;
}
.home-hello { color: var(--text-secondary); font-size: 1.05rem; }
.home-name {
  font-size: clamp(1.9rem, 8vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

/* Honeycomb hero */
.hex-grid {
  /* Two cells plus the body's 1rem padding decide the widest the comb can be. */
  --hex-w: min(45vw, 176px);
  position: relative;
  margin: 1.5rem 0 1.4rem;
  z-index: 0;
}
.hex-grid::before {
  content: "";
  position: absolute;
  /* Vertical bleed only: 12% of horizontal bleed pushed the document wider than
     the viewport and gave the whole app a sideways scrollbar. */
  inset: -14% 0;
  background:
    radial-gradient(circle at 28% 18%, rgba(91, 157, 255, 0.2), transparent 64%),
    radial-gradient(circle at 72% 80%, rgba(255, 157, 77, 0.18), transparent 64%);
  filter: blur(26px);
  z-index: -1;
  pointer-events: none;
}
/* A real comb, so the geometry has to be exact: regular hexagons (height =
   2/sqrt(3) x width), rows that touch with no gap, and each row pulled up by a
   quarter of a hex height so the slanted edges meet. The seam between cells is
   painted, not spaced: each cell scales down a hair inside its own slot, which
   keeps the tessellation intact. One cell, two, one, Start at the apex. */
.hex-row { display: flex; justify-content: center; gap: 0; }
.hex-row + .hex-row { margin-top: calc(var(--hex-w) * -0.2887); }
.hex {
  position: relative;
  width: var(--hex-w);
  aspect-ratio: 1 / 1.1547;
  transform: scale(0.975);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 130ms var(--spring), filter 150ms ease;
}
.hex:active { transform: scale(0.925); filter: brightness(1.08); }
.hex svg { width: 34px; height: 34px; }
/* Two-line labels ("Start workout", "Progress charts") must sit as one optical
   block against the one-line ones, so the icon gap does the balancing. */
.hex span { display: block; }
.hex-blue { background: linear-gradient(160deg, #6aa8ff, #4487f2); color: var(--on-accent); }
.hex-teal { background: linear-gradient(160deg, #bfe0ec, #8fc3d6); color: #10242c; }
.hex-orange { background: linear-gradient(160deg, #ffb066, #ff8b38); color: #2b1503; }
.hex-green { background: linear-gradient(160deg, #7ce0b0, #45c98b); color: #06281a; }

/* In-progress bar under the honeycomb */
.resume-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-surface-1);
  border-radius: var(--r-md);
  padding: 0.55rem 0.95rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-card);
}
.resume-bar p { flex: 1; color: var(--text-secondary); font-size: 0.9rem; }
.resume-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-orange);
  flex: none;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

#home-status { margin-top: 0.5rem; }
#home-coach-status .btn { margin-top: 0.6rem; }

/* Skeleton loading */
.skel {
  height: 56px;
  border-radius: var(--r-md);
  background: var(--bg-surface-2);
  margin-bottom: 0.6rem;
  animation: skeleton-pulse 1.1s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}
