/* RunCoach — mobile-first, dark, modern. System fonts, no images. */
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --radius: 20px;
  --radius-sm: 14px;
  --easy: #34d399;
  --mp: #fbbf24;
  --thr: #fb7185;
  --done: #34d399;
  --missed: #fb7185;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.3), 0 20px 40px -16px rgba(0,0,0,.6);
}

/* Robyn — deep navy + coral, refined and data-forward */
body[data-theme="navy"] {
  --bg: #080f1c;
  --bg2: #0d1a30;
  --card: rgba(255,255,255,.045);
  --card-solid: #101d33;
  --card2: rgba(255,255,255,.07);
  --line: rgba(255,255,255,.08);
  --text: #eef3fb;
  --muted: #93a4c4;
  --accent: #ff7a6b;
  --accent-2: #ff9d72;
  --accent-soft: rgba(255,122,107,.14);
  --accent-text: #0a1120;
  --grad: linear-gradient(135deg, #ff7a6b, #ff9d72);
  --glow: rgba(255,122,107,.35);
}

/* Mercedez — teal + violet, playful and bright */
body[data-theme="teal"] {
  --bg: #0a0a1f;
  --bg2: #101033;
  --card: rgba(255,255,255,.05);
  --card-solid: #16163a;
  --card2: rgba(255,255,255,.09);
  --line: rgba(255,255,255,.1);
  --text: #f3f0ff;
  --muted: #b7aee8;
  --accent: #b98bff;
  --accent-2: #45e0c8;
  --accent-soft: rgba(185,139,255,.16);
  --accent-text: #12082a;
  --grad: linear-gradient(135deg, #c08bff 0%, #7c6cff 45%, #2dd4bf 100%);
  --glow: rgba(150,110,255,.4);
}

body {
  background: var(--bg);
  background-image:
    radial-gradient(1000px 600px at 100% -10%, var(--accent-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 8%, var(--bg2), transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
body[data-theme="teal"] {
  background-image:
    radial-gradient(900px 520px at 105% -8%, rgba(45,212,191,.14), transparent 55%),
    radial-gradient(900px 520px at -10% 6%, rgba(150,110,255,.18), transparent 55%);
}

#app { max-width: 480px; margin: 0 auto; padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }

h1 {
  font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em;
  padding: 10px 2px 14px; line-height: 1.1;
}
h2 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.02em; }

/* Cards — glassy, bordered, elevated */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: rise .35s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card.big {
  padding: 24px 20px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  position: relative; overflow: hidden;
}
.card.big::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad);
}
.card .type { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.68rem; font-weight: 700; color: var(--muted); }
.card .title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; margin: 8px 0; line-height: 1.2; }
.card .target { font-size: 1.05rem; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.card .detail { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

/* Countdown */
.countdown { display: flex; justify-content: space-between; align-items: center; }
.countdown .n {
  font-size: 2.6rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.countdown .lbl { color: var(--muted); font-size: 0.82rem; font-weight: 500; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: 0.78rem; font-weight: 600;
  margin: 3px 5px 3px 0;
}
.badge.streak { background: var(--grad); color: var(--accent-text); border: 0; font-weight: 800; box-shadow: 0 6px 16px -6px var(--glow); }

/* Buttons */
.btnrow { display: flex; gap: 10px; margin-top: 18px; }
button {
  font: inherit; border: 0; border-radius: var(--radius-sm); cursor: pointer;
  padding: 15px 18px; font-weight: 700; font-size: 1rem; letter-spacing: -0.01em;
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  min-height: 52px; transition: transform .08s ease, filter .15s ease, opacity .15s ease;
}
button:active { transform: scale(.97); }
button.primary {
  background: var(--grad); color: var(--accent-text); border: 0; flex: 2;
  box-shadow: 0 8px 22px -8px var(--glow);
}
button.primary:active { filter: brightness(1.05); }
button.ghost { flex: 1; }
button:disabled { opacity: 0.45; transform: none; }

/* Notices */
.notice {
  background: var(--accent-soft); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 0.88rem; line-height: 1.45; margin-bottom: 10px;
}
.notice.warn { border-left-color: var(--thr); background: rgba(251,113,133,.12); }

/* Forms */
label { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 600; margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 15px; min-height: 50px; transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
::placeholder { color: var(--muted); opacity: .7; }

/* RPE / scale pickers */
.rpe-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rpe-row button { min-height: 48px; min-width: 42px; padding: 8px 6px; flex: 1; font-size: 1.05rem; border-radius: 12px; }
.rpe-row button.sel { background: var(--grad); color: var(--accent-text); border: 0; box-shadow: 0 6px 16px -8px var(--glow); }

/* Pace zones */
.zone {
  display: flex; justify-content: space-between; padding: 12px 14px; border-radius: var(--radius-sm);
  margin-bottom: 7px; background: var(--card2); border: 1px solid var(--line); font-weight: 700;
}
.zone .pace { font-variant-numeric: tabular-nums; }
.zone.easy .pace { color: var(--easy); }
.zone.mp .pace { color: var(--mp); }
.zone.thr .pace { color: var(--thr); }
.zone.int .pace { color: var(--accent); }

/* Week nav */
.weeknav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.weeknav > div { font-weight: 700; }
.weeknav button { min-height: 44px; padding: 8px 18px; border-radius: 999px; }

/* Session rows */
.sess {
  display: flex; gap: 12px; align-items: center; padding: 13px 14px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line); margin-bottom: 9px;
  animation: rise .3s cubic-bezier(.2,.7,.3,1) both;
}
.sess .day { width: 46px; text-align: center; color: var(--muted); font-size: 0.74rem; line-height: 1.25; }
.sess .day b { display: block; font-size: 1.1rem; color: var(--text); font-weight: 800; }
.sess .info { flex: 1; min-width: 0; }
.sess .info .t { font-weight: 700; font-size: 0.92rem; }
.sess .info .g { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.sess .st { font-size: 1.15rem; }
.sess.done { opacity: 0.7; border-left: 3px solid var(--done); }
.sess.missed, .sess.skipped { opacity: 0.55; border-left: 3px solid var(--missed); }
.sess.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 20px -12px var(--glow); }
.sess.adjusted { border-left: 3px solid var(--mp); }

/* Floating pill nav */
nav {
  position: fixed; bottom: calc(10px + env(safe-area-inset-bottom)); left: 12px; right: 12px;
  display: flex; max-width: 456px; margin: 0 auto;
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 22px; padding: 6px; gap: 2px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
nav button {
  flex: 1; background: none; border: 0; font-size: 0.66rem; font-weight: 600;
  padding: 8px 2px; min-height: 52px; color: var(--muted); border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: color .15s ease, background .15s ease;
}
nav button.active { color: var(--accent-text); background: var(--grad); box-shadow: 0 6px 16px -8px var(--glow); }
nav button .ico { font-size: 1.25rem; line-height: 1; }

/* v1.1 */
.readiness { padding: 14px 16px; display: block; border-left: 3px solid var(--easy); }
.readiness b { font-size: 1.02rem; }
.readiness.amber { border-left-color: var(--mp); }
.readiness.red { border-left-color: var(--thr); }

.linkbtn { background: none; border: 0; color: var(--accent); padding: 10px 4px; min-height: 40px; font-size: 0.9rem; font-weight: 600; text-align: left; }
.fitrow { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.fitrow input { width: 96px; }

.menu { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.menu button {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); text-align: left; font-size: 0.95rem; font-weight: 600; padding: 16px 18px;
}
.menu button span:last-child { color: var(--muted); font-size: 1.2rem; }

/* Chat */
.chatlog { display: flex; flex-direction: column; gap: 10px; min-height: 52vh; padding-bottom: 76px; }
.bubble { max-width: 84%; padding: 11px 15px; border-radius: 18px; font-size: 0.92rem; line-height: 1.5; white-space: pre-wrap; animation: rise .25s ease both; }
.bubble.user { align-self: flex-end; background: var(--grad); color: var(--accent-text); font-weight: 500; border-bottom-right-radius: 5px; }
.bubble.assistant { align-self: flex-start; background: var(--card-solid); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.chatbar {
  position: fixed; bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px;
  max-width: 456px; margin: 0 auto; display: flex; gap: 8px; padding: 8px;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.chatbar input { flex: 1; min-height: 46px; border-radius: 14px; }
.chatbar button { min-width: 52px; padding: 0; }

/* Bars */
.bars { display: flex; gap: 6px; align-items: flex-end; height: 96px; padding: 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.bar .fill { width: 100%; background: var(--grad); border-radius: 6px 6px 2px 2px; opacity: .9; transition: height .4s cubic-bezier(.2,.7,.3,1); }
.bar .lbl { font-size: 0.65rem; color: var(--muted); }

/* Shoes */
.shoebar { height: 7px; background: var(--card2); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.shoebar div { height: 100%; background: var(--easy); border-radius: 4px; transition: width .4s ease; }
.shoebar div.warn { background: var(--mp); }

/* Pace table */
.pacetable { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.pacetable th, .pacetable td { padding: 4px; text-align: center; border-bottom: 1px solid var(--line); }
.pacetable th { color: var(--muted); font-weight: 700; }

@media print {
  body { background: #fff; color: #000; background-image: none; }
  .noprint, nav, h1 { display: none !important; }
  #app { padding: 0; max-width: none; }
  .card.printcard { background: #fff; color: #000; border: 1px solid #ccc; box-shadow: none; }
  .printcard .muted, .pacetable th { color: #444; }
  .pacetable th, .pacetable td { border-bottom: 1px solid #ddd; }
}

/* Login / user pick */
.userpick { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.userpick button {
  padding: 22px; font-size: 1.15rem; font-weight: 700; text-align: left;
  background: var(--card-solid); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.userpick button .muted { font-weight: 500; margin-top: 4px; }

.center { text-align: center; color: var(--muted); padding: 28px 8px; }
.error { color: var(--thr); padding: 10px 2px; font-weight: 700; }
.muted { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.spacer { height: 8px; }
.phaseTag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--muted); }
