/* ═════════════════════════════════════════════════════════════
   DIARIO FIT — Stylesheet
   Editorial wellness: cream, clay, sage. Fraunces + Instrument.
   ═════════════════════════════════════════════════════════════ */

:root {
  --cream: #F5EFE6;
  --cream-deep: #EBE2D3;
  --ivory: #FBF7F0;
  --paper: #FFFFFF;
  --clay: #B8674A;
  --clay-deep: #8E4A33;
  --clay-soft: #E6C7B5;
  --sage: #8A9A82;
  --sage-soft: #C9D1C2;
  --gold: #C49A5C;
  --blush: #ECD4C8;
  --ink: #211B14;
  --ink-soft: #4A3F33;
  --ink-muted: #7A6E60;
  --line: rgba(33, 27, 20, 0.08);
  --line-strong: rgba(33, 27, 20, 0.14);
  --shadow-sm: 0 1px 2px rgba(33, 27, 20, 0.04), 0 2px 8px rgba(33, 27, 20, 0.04);
  --shadow-md: 0 4px 16px rgba(33, 27, 20, 0.06), 0 12px 32px rgba(33, 27, 20, 0.06);
  --shadow-lg: 0 20px 48px rgba(33, 27, 20, 0.12), 0 8px 24px rgba(33, 27, 20, 0.08);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
html { font-size: 16px; }

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
}

.serif { font-family: 'Fraunces', Georgia, serif; font-optical-sizing: auto; font-variation-settings: "SOFT" 80; font-weight: 300; letter-spacing: -0.02em; }
.serif-italic { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-weight: 400; }

button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.hidden { display: none !important; }

/* ═══ SPLASH ═══════════════════════════════════════════════════ */
.splash {
  position: fixed;
  inset: 0;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.6s ease;
}
.splash.fade-out { opacity: 0; pointer-events: none; }
.splash-mark { font-size: 38px; color: var(--ink); }
.splash-mark em { color: var(--clay); font-family: 'Instrument Serif', serif; font-style: italic; }
.splash-tag { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-muted); }

/* ═══ APP ROOT ═════════════════════════════════════════════════ */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  max-width: 540px;
  margin: 0 auto;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}

/* ═══ VIEW: WELCOME ════════════════════════════════════════════ */
.view-welcome {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  background: linear-gradient(180deg, var(--cream) 0%, var(--blush) 100%);
}
.welcome-art {
  flex: 1;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 30% 30%, var(--clay-soft), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--sage-soft), transparent 60%),
    linear-gradient(135deg, var(--clay) 0%, var(--blush) 100%);
  position: relative;
  margin-bottom: 24px;
  overflow: hidden;
  min-height: 50vh;
}
.welcome-art::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.3) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.2) 0%, transparent 40%);
}
.welcome-quote {
  position: absolute; left: 24px; right: 24px; bottom: 24px;
  color: white; z-index: 2;
}
.welcome-quote .qmark {
  font-size: 64px; line-height: 0.6;
  display: block; opacity: 0.7; margin-bottom: 4px;
}
.welcome-quote p {
  font-family: 'Instrument Serif', serif; font-style: italic;
  font-size: 22px; line-height: 1.25;
}
.welcome-content h1 {
  font-size: 38px; line-height: 1; margin-bottom: 14px;
  font-variation-settings: "SOFT" 80, "opsz" 144;
}
.welcome-content h1 em { color: var(--clay); }
.welcome-content p {
  font-size: 15px; color: var(--ink-soft);
  margin-bottom: 24px; line-height: 1.5; max-width: 380px;
}

.welcome-install {
  background: var(--paper);
  border: 1.5px solid var(--clay-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  width: 100%;
  transition: transform 0.15s ease;
}
.welcome-install:active { transform: scale(0.99); }
.wi-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--clay);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.wi-text { flex: 1; min-width: 0; }
.wi-text strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 14px;
  margin-bottom: 2px;
  color: var(--ink);
}
.wi-text em {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.3;
  display: block;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}
.wi-arrow {
  color: var(--clay);
  font-size: 16px;
  flex-shrink: 0;
}

/* ═══ BUTTONS ══════════════════════════════════════════════════ */
.btn-primary {
  background: var(--ink); color: var(--cream);
  padding: 16px 20px; border-radius: 100px;
  font-size: 14px; letter-spacing: 0.02em;
  width: 100%; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-primary:active { transform: scale(0.98); opacity: 0.92; }
.btn-text {
  background: transparent; color: var(--ink-soft);
  font-size: 13px; padding: 10px;
  width: 100%; text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--clay-soft);
}
.btn-mini {
  background: var(--ink); color: var(--cream);
  padding: 8px 16px; border-radius: 100px;
  font-size: 12px;
  white-space: nowrap;
}
.btn-mini.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream-deep); color: var(--ink);
  font-size: 16px;
}

/* ═══ ONBOARDING ═══════════════════════════════════════════════ */
.view-onboard {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(16px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  background: var(--cream);
}
.onboard-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.progress {
  flex: 1;
  display: flex; gap: 4px;
}
.progress span {
  flex: 1; height: 3px;
  border-radius: 4px;
  background: var(--cream-deep);
  transition: background 0.3s ease;
}
.progress span.active { background: var(--clay); }
.progress span.complete { background: var(--ink); }
.progress-text {
  font-size: 10px; color: var(--ink-muted);
  letter-spacing: 0.16em; text-transform: uppercase;
  white-space: nowrap;
}
.onboard-body {
  flex: 1;
  display: flex; flex-direction: column;
}
.onboard-eyebrow {
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--clay);
  margin-bottom: 12px;
}
.onboard-q {
  font-size: 32px; line-height: 1.05;
  margin-bottom: 6px;
}
.onboard-q em { color: var(--clay); }
.onboard-sub {
  font-size: 14px; color: var(--ink-muted);
  margin-bottom: 28px;
}
.onboard-footer { padding-top: 16px; }

/* Onboarding option cards */
.options {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 12px;
}
.opt {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}
.opt:active { transform: scale(0.99); }
.opt.selected {
  background: var(--ink); color: var(--cream);
  border-color: var(--ink);
}
.opt-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--cream-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.opt.selected .opt-icon { background: var(--clay); }
.opt-text { flex: 1; font-size: 14px; }
.opt-text small {
  display: block; font-size: 11px; opacity: 0.7;
  margin-top: 2px; line-height: 1.3;
}

/* Name input */
.name-input {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 18px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: 'Fraunces', serif;
  font-weight: 400;
}
.name-input:focus { border-color: var(--clay); }

/* ═══ SHELL & TABS ═════════════════════════════════════════════ */
.shell {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  position: relative;
}
.shell-main {
  flex: 1;
  padding: calc(24px + var(--safe-top)) 20px 100px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-view {
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(251, 247, 240, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  z-index: 50;
  max-width: 540px;
  margin: 0 auto;
}
.tab {
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  font-size: 9px; letter-spacing: 0.08em;
  color: var(--ink-muted);
  padding: 6px 12px;
  border-radius: 12px;
  transition: color 0.2s ease;
  min-width: 56px;
}
.tab svg { width: 20px; height: 20px; stroke-width: 1.6; }
.tab.active { color: var(--clay); }
.tab.active svg { stroke-width: 1.8; }

/* ═══ PAGE HEAD ════════════════════════════════════════════════ */
.page-head { margin-bottom: 24px; }
.eyebrow {
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-muted);
  display: block; margin-bottom: 6px;
}
.page-head h2 {
  font-size: 32px; line-height: 1.05;
}
.page-head h2 em { color: var(--clay); }
.subhead {
  font-size: 14px; color: var(--ink-muted);
  margin-top: 8px;
}
.section-eyebrow {
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-muted);
  font-weight: 400;
  margin: 28px 0 12px;
}

/* ═══ TODAY: WORKOUT CARD ═════════════════════════════════════ */
.today-card {
  background: linear-gradient(135deg, var(--clay) 0%, var(--clay-deep) 100%);
  color: var(--cream);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.today-card::before {
  content: ''; position: absolute;
  top: -30px; right: -30px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.today-card::after {
  content: ''; position: absolute;
  bottom: -40px; left: -20px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.tc-tag {
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; opacity: 0.75;
  margin-bottom: 12px;
  position: relative;
}
.today-card h3 {
  font-size: 26px; font-weight: 400;
  line-height: 1.05;
  margin-bottom: 14px;
  position: relative;
}
.tc-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11px; opacity: 0.85;
  position: relative;
}
.tc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tc-btn {
  margin-top: 16px;
  background: var(--cream);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 13px;
  display: inline-flex;
  align-items: center; gap: 6px;
  position: relative;
}

/* ═══ RINGS ═══════════════════════════════════════════════════ */
.ring-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.ring-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  transition: transform 0.15s ease;
}
.ring-card:active { transform: scale(0.97); }
.ring {
  width: 52px; height: 52px;
  margin: 0 auto 6px;
  display: block;
}
.ring-track {
  fill: none;
  stroke: var(--cream-deep);
  stroke-width: 3;
}
.ring-fill {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0 100;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dasharray 0.6s ease;
}
.ring-fill.move { stroke: var(--clay); }
.ring-fill.mind { stroke: var(--sage); }
.ring-fill.hydrate { stroke: var(--gold); }
.ring-card small {
  display: block;
  font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.ring-card strong {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--ink);
}

/* ═══ QUICK LIST ══════════════════════════════════════════════ */
.quick-list {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.quick-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  transition: transform 0.15s ease;
  width: 100%;
}
.quick-item:active { transform: scale(0.99); }
.qi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--blush);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.quick-item.j .qi-icon { background: var(--sage-soft); }
.quick-item.h .qi-icon { background: var(--clay-soft); }
.quick-item.w .qi-icon { background: var(--cream-deep); color: var(--clay); }
.qi-text { flex: 1; font-size: 13px; line-height: 1.3; }
.qi-text small {
  display: block; font-size: 11px;
  color: var(--ink-muted);
  margin-top: 3px;
  font-style: italic;
  font-family: 'Instrument Serif', serif;
}
.qi-arrow {
  color: var(--ink-muted); font-size: 14px;
  margin-left: 4px;
}

/* ═══ INSTALL BANNER ══════════════════════════════════════════ */
.install-banner {
  background: var(--ink); color: var(--cream);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
  position: relative;
}
.install-banner strong { display: block; font-size: 15px; margin-bottom: 2px; font-weight: 400; }
.install-banner p { font-size: 11px; opacity: 0.7; line-height: 1.3; }
.install-banner .btn-mini {
  background: var(--cream); color: var(--ink);
  flex-shrink: 0;
}
.install-close {
  background: none; color: var(--cream);
  opacity: 0.5; font-size: 18px;
  width: 28px; height: 28px;
  border-radius: 50%;
}

/* ═══ PLAN (week grid) ════════════════════════════════════════ */
.week-grid {
  display: flex; flex-direction: column;
  gap: 12px;
}
.week-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}
.week-block.current { border-color: var(--clay); border-width: 1.5px; }
.week-block h4 {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 16px;
  margin-bottom: 4px;
}
.week-block h4 em { color: var(--clay); font-family: 'Instrument Serif', serif; font-style: italic; }
.week-block .wb-sub {
  font-size: 11px; color: var(--ink-muted);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 14px;
}
.day-row {
  display: flex; gap: 6px;
}
.day-dot {
  flex: 1;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--cream-deep);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 10px; color: var(--ink-muted);
  position: relative;
  padding: 4px;
}
.day-dot.done {
  background: var(--clay); color: white;
}
.day-dot.today {
  border: 2px solid var(--ink);
}
.day-dot small {
  font-size: 8px; opacity: 0.7;
  margin-bottom: 1px;
}
.day-dot strong {
  font-family: 'Fraunces', serif; font-weight: 400;
  font-size: 12px;
}

/* ═══ WORKOUT LIBRARY ═════════════════════════════════════════ */
.workout-library {
  display: flex; flex-direction: column;
  gap: 10px;
}
.lib-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex; gap: 12px; align-items: center;
  text-align: left;
  width: 100%;
}
.lib-thumb {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--clay-soft), var(--blush));
}
.lib-thumb.lower { background: linear-gradient(135deg, var(--clay-soft), var(--blush)); }
.lib-thumb.upper { background: linear-gradient(135deg, var(--sage-soft), var(--cream-deep)); }
.lib-thumb.full  { background: linear-gradient(135deg, var(--blush), var(--clay)); color: white; }
.lib-thumb.mobility { background: linear-gradient(135deg, var(--sage-soft), var(--sage)); color: white; }
.lib-thumb.core { background: linear-gradient(135deg, var(--gold), var(--clay)); color: white; }
.lib-info { flex: 1; }
.lib-info h4 {
  font-family: 'Fraunces', serif;
  font-size: 15px; font-weight: 500;
  line-height: 1.15;
}
.lib-meta {
  font-size: 11px; color: var(--ink-muted);
  margin-top: 3px;
}
.lib-arrow { color: var(--ink-muted); }

/* ═══ MIND (journal/checkin entry points) ═════════════════════ */
.mind-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.mind-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: left;
  display: flex; flex-direction: column;
  gap: 8px;
  transition: transform 0.15s ease;
}
.mind-card:active { transform: scale(0.98); }
.mind-card.primary {
  background: var(--ink); color: var(--cream);
  border-color: var(--ink);
}
.mc-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--sage-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: 4px;
}
.mind-card.primary .mc-icon { background: var(--clay); }
.mind-card h3 { font-size: 16px; line-height: 1.1; }
.mind-card p {
  font-size: 12px; color: var(--ink-muted);
  line-height: 1.3;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}
.mind-card.primary p { color: rgba(245,239,230,0.7); }

/* Entry list (past journals) */
.entry-list {
  display: flex; flex-direction: column;
  gap: 8px;
}
.entry-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.entry-row .er-head {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 6px;
}
.entry-row .er-date {
  font-size: 11px; color: var(--ink-muted);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.entry-row .er-mood {
  font-size: 18px;
}
.entry-row .er-text {
  font-family: 'Fraunces', serif;
  font-size: 14px; font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-muted);
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 14px;
}

/* ═══ ME (profile/progress) ═══════════════════════════════════ */
.streak-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 14px;
}
.streak-card > small {
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.streak-num {
  font-size: 42px; font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 8px 0 6px;
}
.streak-num em { color: var(--clay); font-size: 22px; }
.streak-sub {
  font-size: 12px; color: var(--sage);
  margin-bottom: 14px;
}
.bars {
  display: flex; gap: 5px;
  align-items: flex-end;
  height: 60px;
}
.bar {
  flex: 1;
  min-height: 6px;
  background: var(--cream-deep);
  border-radius: 4px;
  transition: height 0.6s ease;
}
.bar.active { background: var(--clay); }
.bar.today { background: var(--ink); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.mini-stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.mini-stat small {
  font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.mini-stat .n {
  font-size: 24px; font-weight: 400;
  margin-top: 4px;
  line-height: 1;
}

.settings-list {
  display: flex; flex-direction: column;
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 24px;
}
.setting-row {
  background: var(--paper);
  padding: 14px 16px;
  display: flex; justify-content: space-between;
  align-items: center;
  text-align: left;
  width: 100%;
  font-size: 14px;
}
.setting-row .arrow { color: var(--ink-muted); }
.setting-row.danger { color: var(--clay-deep); }
.footer-note {
  font-size: 11px; color: var(--ink-muted);
  text-align: center;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  line-height: 1.5;
  padding: 20px 12px 8px;
}

/* ═══ MODALS ══════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0;
  background: var(--ivory);
  z-index: 100;
  max-width: 540px; margin: 0 auto;
  display: flex; flex-direction: column;
  animation: slideUp 0.35s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-hero {
  padding: calc(20px + var(--safe-top)) 20px 28px;
  background: linear-gradient(180deg, var(--clay) 0%, var(--clay-deep) 100%);
  color: var(--cream);
  position: relative;
  min-height: 180px;
  display: flex; flex-direction: column;
  justify-content: flex-end;
}
.modal-hero.soft {
  background: linear-gradient(180deg, var(--blush) 0%, var(--ivory) 100%);
  color: var(--ink);
}
.modal-hero.blush {
  background: linear-gradient(180deg, var(--blush) 0%, var(--cream) 100%);
  color: var(--ink);
}
.exercise-hero {
  min-height: 140px;
  background: linear-gradient(180deg, var(--sage) 0%, var(--clay-deep) 100%);
}
.back-btn {
  position: absolute; top: calc(16px + var(--safe-top)); left: 16px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: inherit;
  font-size: 16px;
}
.modal-hero.soft .back-btn,
.modal-hero.blush .back-btn {
  background: rgba(33,27,20,0.08);
  color: var(--ink);
}
.wh-tag {
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; opacity: 0.8;
  margin-bottom: 6px;
}
.modal-hero h2 {
  font-size: 28px; line-height: 1.05;
  font-weight: 300;
}
.modal-hero h2 em { color: inherit; opacity: 0.95; }
.modal-hero.soft h2 em,
.modal-hero.blush h2 em { color: var(--clay); }
.modal-hero .eyebrow { color: rgba(255,255,255,0.7); }
.modal-hero.soft .eyebrow,
.modal-hero.blush .eyebrow { color: var(--ink-muted); }
.modal-hero .subhead {
  color: rgba(245,239,230,0.8);
  margin-top: 6px; font-size: 12px;
}
.modal-hero.blush .subhead { color: var(--ink-muted); }

/* Workout content */
.workout-content { padding: 20px; flex: 1; }
.workout-stats {
  display: flex; justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.workout-stats div { text-align: center; flex: 1; }
.workout-stats small {
  display: block; font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.workout-stats strong {
  font-family: 'Fraunces', serif;
  font-weight: 400; font-size: 15px;
}
.ex-list {
  display: flex; flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}
.ex {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
}
.ex:last-child { border: none; }
.ex-thumb {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--cream-deep);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.ex-thumb.a { background: linear-gradient(135deg, var(--clay-soft), var(--blush)); }
.ex-thumb.b { background: linear-gradient(135deg, var(--sage-soft), var(--cream-deep)); }
.ex-thumb.c { background: linear-gradient(135deg, var(--blush), var(--clay-soft)); }
.ex-thumb.d { background: linear-gradient(135deg, var(--sage-soft), var(--sage)); }
.ex-thumb.e { background: linear-gradient(135deg, var(--gold), var(--clay-soft)); }
.ex-thumb.f { background: linear-gradient(135deg, var(--clay), var(--blush)); color: white; }
.ex-info { flex: 1; }
.ex-name {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.2;
}
.ex-meta {
  font-size: 11px; color: var(--ink-muted);
  margin-top: 3px;
}
.ex-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  flex-shrink: 0;
}
.ex-check.done {
  background: var(--ink); border-color: var(--ink);
  color: var(--cream);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}

/* Exercise modal */
.exercise-hero h2 { color: white; }
.ex-cue {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  margin-top: 8px;
}
.exercise-content { padding: 24px 20px; flex: 1; display: flex; flex-direction: column; }
.set-progress {
  display: flex; justify-content: center; gap: 8px;
  margin-bottom: 24px;
}
.set-progress span {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cream-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 13px;
  color: var(--ink-muted);
  border: 1.5px solid transparent;
}
.set-progress span.done {
  background: var(--ink); color: var(--cream);
}
.set-progress span.current {
  background: var(--clay); color: white;
  border-color: var(--clay-deep);
}
.timer-display {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 24px;
}
.timer-label {
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-muted);
  margin-bottom: 8px;
}
.timer-time {
  font-size: 64px;
  font-weight: 300;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 16px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.timer-time.active { color: var(--clay); }
.timer-time.done { color: var(--sage); }
.timer-controls {
  display: flex; gap: 8px; justify-content: center;
}

/* Journal modal */
.journal-content { padding: 24px 20px; flex: 1; display: flex; flex-direction: column; }
.mood-row {
  display: flex; justify-content: space-between;
  margin-bottom: 20px;
}
.mood {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  font-size: 9px; color: var(--ink-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px;
}
.mood-orb {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--cream-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}
.mood.selected .mood-orb {
  background: var(--clay);
  color: white;
  box-shadow: 0 0 0 3px var(--clay-soft);
}
.mood.selected { color: var(--clay); }
.prompt-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.prompt-card small {
  font-size: 9px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--clay);
  display: block; margin-bottom: 8px;
}
.prompt-card p {
  font-size: 16px; line-height: 1.4;
  color: var(--ink);
}
.journal-area {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Fraunces', serif;
  font-size: 15px; line-height: 1.55;
  color: var(--ink);
  width: 100%;
  resize: none;
  outline: none;
  margin-bottom: 16px;
  flex: 1;
  min-height: 160px;
  transition: border-color 0.2s ease;
  user-select: text; -webkit-user-select: text;
}
.journal-area:focus { border-color: var(--clay); }

/* Check-in modal */
.checkin-content { padding: 24px 20px; flex: 1; }
.ci-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
}
.ci-section h5 {
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-muted);
  font-weight: 400;
  margin-bottom: 12px;
}
.scale {
  display: flex; gap: 4px;
  justify-content: space-between;
}
.scale span {
  flex: 1;
  height: 32px;
  border-radius: 10px;
  background: var(--cream-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 12px; color: var(--ink-muted);
  transition: all 0.15s ease;
}
.scale span.active {
  background: var(--clay); color: var(--cream);
  transform: scale(1.05);
}
.habits {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.habit {
  padding: 8px 12px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--cream);
  font-size: 12px;
  display: flex; align-items: center; gap: 4px;
  transition: all 0.15s ease;
}
.habit.on {
  background: var(--ink); color: var(--cream);
  border-color: var(--ink);
}
.word-input {
  background: var(--cream); border: none;
  font-size: 22px; color: var(--clay);
  text-align: center;
  padding: 8px 0;
  width: 100%;
  outline: none;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  user-select: text; -webkit-user-select: text;
}
.word-input::placeholder { color: var(--ink-muted); opacity: 0.4; }

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--cream);
  padding: 12px 20px;
  border-radius: 100px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toastIn 0.3s ease;
  max-width: 90%;
  text-align: center;
}
@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Info modal */
.info-modal {
  position: fixed; inset: 0;
  background: rgba(33,27,20,0.5);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.info-card {
  background: var(--ivory);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.info-card h3 {
  font-size: 22px; margin-bottom: 12px;
}
.info-body {
  font-size: 14px; line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 20px;
}
.info-body ol { padding-left: 20px; margin: 12px 0; }
.info-body li { margin-bottom: 8px; }
.info-body strong { color: var(--ink); font-weight: 500; }

/* ═══ RESPONSIVE / LARGER SCREENS ═════════════════════════════ */
@media (min-width: 600px) {
  body {
    background: var(--cream-deep);
  }
  .app {
    box-shadow: var(--shadow-lg);
    min-height: 100vh;
  }
}

/* ═══ PHASE 2: AUTH UI ════════════════════════════════════════ */

/* Soft prompt to encourage sign-up after 3 days */
.auth-prompt {
  background: linear-gradient(135deg, var(--sage-soft) 0%, var(--blush) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
  position: relative;
}
.ap-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--clay);
  flex-shrink: 0;
}
.ap-text { flex: 1; min-width: 0; }
.ap-text strong {
  display: block;
  font-size: 15px;
  font-weight: 400;
  margin-bottom: 4px;
  color: var(--ink);
}
.ap-text p {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
}
.ap-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ap-close {
  background: none;
  color: var(--ink-muted);
  font-size: 18px;
  width: 28px; height: 28px;
  border-radius: 50%;
  opacity: 0.6;
}

/* Sign-in modal */
.signin-content {
  padding: 28px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.signin-intro {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 20px;
}
.email-input {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  font-size: 17px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s ease;
  margin-bottom: 12px;
  user-select: text;
  -webkit-user-select: text;
}
.email-input:focus { border-color: var(--clay); }
.signin-fine {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 14px;
  text-align: center;
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  line-height: 1.5;
}
.signin-fine-em {
  background: var(--cream-deep);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin: 18px 0 14px;
  text-align: left;
}
.link-inline {
  background: none;
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--clay);
  font-style: italic;
  font-size: inherit;
  font-family: inherit;
}
.sent-mark {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
}
.signin-step h3 {
  font-size: 26px;
  line-height: 1.1;
  margin-bottom: 12px;
  text-align: center;
}
.signin-step h3 em { color: var(--clay); }
#signin-step-sent { text-align: center; }
#signin-step-sent .signin-intro { text-align: center; }
#signin-step-sent strong {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  color: var(--ink);
  word-break: break-all;
}

/* Migration modal */
.migration-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}
.migration-list li {
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.migration-list li strong {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  color: var(--clay);
}

/* ═══ PHASE 3.1: EXERCISE MEDIA (photos/video) ═════════════════ */

/* Inside the small 46x46 list thumbnail */
.ex-thumb .ex-media {
  border-radius: 12px;
}

/* The hero media on the active exercise screen */
.exercise-art {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--cream-deep);
}
.exercise-art .ex-media,
.exercise-art .ex-media-fallback {
  border-radius: var(--radius-lg);
}

/* Row container with main button + info button */
.ex-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}
.ex-row:last-child { border: none; }
.ex-row .ex-main {
  flex: 1;
  border-bottom: none;
  padding: 12px 0;
  display: flex;
  gap: 12px;
  align-items: center;
  background: none;
  text-align: left;
}
.ex-info-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cream-deep);
  color: var(--clay);
  border: 1px solid var(--line);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 14px;
  font-weight: 400;
  align-self: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
}
.ex-info-btn:active {
  transform: scale(0.95);
  background: var(--clay-soft);
}

/* Hide the legacy single-button .ex styling — we use ex-main now */
.ex-row .ex.ex-main { border-bottom: none; }

/* Exercise detail modal */
.exercise-detail-body {
  padding: 0 0 40px;
  flex: 1;
}
.ed-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--cream-deep);
}
.ed-art .ex-media,
.ed-art .ex-media-fallback {
  border-radius: 0;
}
.ed-content {
  padding: 24px 20px;
}
.ed-content .eyebrow {
  display: block;
  margin-bottom: 6px;
}
.ed-content h3 {
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.ed-equipment {
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  font-family: 'Instrument Serif', serif;
  margin-bottom: 24px;
}
.ed-section {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.ed-section:last-child { border: none; padding-bottom: 0; }
.ed-section h5 {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--clay);
  font-weight: 500;
  margin-bottom: 10px;
}
.ed-section p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.ed-section ol,
.ed-section ul {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  padding-left: 18px;
}
.ed-section ol li,
.ed-section ul li {
  margin-bottom: 6px;
}
.ed-section ol li::marker {
  color: var(--clay);
  font-family: 'Fraunces', serif;
}
.ed-breath {
  font-family: 'Instrument Serif', serif !important;
  font-style: italic;
  font-size: 16px !important;
  color: var(--clay-deep) !important;
}
.ed-modify h5 { color: var(--sage); }
.ed-progress h5 { color: var(--gold); }
.ed-why p {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}
