@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700;800;900&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg: #080808;
  --surface: #101010;
  --surface2: #181818;
  --border: #1e1e1e;
  --text: #f0f0f0;
  --muted: #555;
  --accent: #e8ff47;
  --accent2: #ff6b35;
  --accent3: #47b8ff;
  --green: #4cff91;
  --red: #ff4c6e;
  --purple: #b47fff;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { background:var(--bg); color:var(--text); font-family:'DM Sans',sans-serif; min-height:100vh; text-transform:lowercase; }
a { text-decoration:none; color:inherit; }
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-thumb { background:var(--border); }

/* ── NAV ── */
.nav {
  position: sticky; top:0; z-index:100;
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display:none; }
.nav-brand {
  font-family:'DM Sans',sans-serif; font-weight:800;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--text);
  margin-right: 24px;
  white-space: nowrap;
  padding: 14px 0;
}
.nav-brand span { color:var(--accent); }
.nav-link {
  font-family:'DM Mono',monospace;
  font-size: 11px;
  letter-spacing: 1px;
  
  padding: 16px 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  cursor: pointer;
}
.nav-link:hover { color:var(--text); }
.nav-link.active { color:var(--accent); border-bottom-color:var(--accent); }
.nav-link.coach { color:var(--accent2); }
.nav-link.coach.active { border-bottom-color:var(--accent2); }

/* ── PROGRESS STRIP ── */
.strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.strip-item { flex:1; min-width:120px; }
.strip-label { font-size:9px; font-family:'DM Mono',monospace;  letter-spacing:1px; color:var(--muted); display:flex; justify-content:space-between; margin-bottom:4px; }
.strip-label span { color:var(--text); }
.strip-track { height:3px; background:var(--border); }
.strip-fill { height:100%; transition:width 0.6s ease; }

/* ── PAGE CONTAINER ── */
.page { max-width:1100px; margin:0 auto; padding:32px 24px 80px; }
.page-sm { max-width:760px; margin:0 auto; padding:32px 24px 80px; }

/* ── SECTION TITLE ── */
.section-title {
  font-family:'DM Sans',sans-serif; font-weight:800;
  font-size:28px;
  letter-spacing:2px;
  margin-bottom:16px;
  display:flex;
  align-items:center;
  gap:12px;
}
.section-title::after { content:''; flex:1; height:1px; background:var(--border); }

/* ── GRADIENT CARDS (home) ── */
.card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:12px; margin-bottom:32px; }
.gcard {
  position:relative;
  overflow:hidden;
  border-radius:2px;
  padding:24px;
  cursor:pointer;
  transition:transform 0.2s, box-shadow 0.2s;
  min-height:160px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  text-decoration:none;
}
.gcard:hover { transform:translateY(-3px); box-shadow:0 12px 40px rgba(0,0,0,0.5); }
.gcard-label { font-family:'DM Mono',monospace; font-size:10px;  letter-spacing:2px; opacity:0.7; }
.gcard-value { font-family:'DM Sans',sans-serif; font-weight:800; font-size:56px; line-height:1; margin:8px 0; }
.gcard-sub { font-size:12px; opacity:0.75; }
.gcard-arrow { position:absolute; top:20px; right:20px; font-size:20px; opacity:0.5; }
.gcard-bar { height:3px; background:rgba(255,255,255,0.2); margin-top:16px; }
.gcard-bar-fill { height:100%; background:rgba(255,255,255,0.7); transition:width 0.8s ease; }
.gcard-icon { font-size:32px; position:absolute; bottom:16px; right:20px; opacity:0.3; }

/* card colour themes */
.gcard-yellow { background:linear-gradient(135deg,#1a1a00 0%,#2a2800 50%,#1f1f00 100%); border:1px solid rgba(232,255,71,0.2); color:var(--accent); }
.gcard-orange { background:linear-gradient(135deg,#1a0a00 0%,#2a1200 50%,#1f0e00 100%); border:1px solid rgba(255,107,53,0.2); color:var(--accent2); }
.gcard-blue   { background:linear-gradient(135deg,#000d1a 0%,#001525 50%,#000f1a 100%); border:1px solid rgba(71,184,255,0.2); color:var(--accent3); }
.gcard-green  { background:linear-gradient(135deg,#001a0a 0%,#002a12 50%,#001a0c 100%); border:1px solid rgba(76,255,145,0.2); color:var(--green); }
.gcard-purple { background:linear-gradient(135deg,#0d001a 0%,#150025 50%,#0e001a 100%); border:1px solid rgba(180,127,255,0.2); color:var(--purple); }
.gcard-red    { background:linear-gradient(135deg,#1a0008 0%,#2a0010 50%,#1a0008 100%); border:1px solid rgba(255,76,110,0.2); color:var(--red); }
.gcard-white  { background:linear-gradient(135deg,#111 0%,#1a1a1a 100%); border:1px solid var(--border); color:var(--text); }

/* ── STAT PILLS ── */
.pills-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:8px; }
.pill {
  background:var(--surface);
  border:1px solid var(--border);
  padding:14px;
  transition:border-color 0.2s;
}
.pill:hover { border-color:var(--accent); }
.pill-label { font-size:9px;  letter-spacing:1.5px; color:var(--muted); font-family:'DM Mono',monospace; }
.pill-value { font-family:'DM Sans',sans-serif; font-weight:700; font-size:30px; line-height:1.1; margin-top:2px; }
.pill-target { font-size:10px; color:var(--muted); font-family:'DM Mono',monospace; margin-top:2px; }
.pill-bar { height:3px; background:var(--border); margin-top:8px; }
.pill-bar-fill { height:100%; transition:width 0.6s ease; }
.pill.hit { border-color:var(--green); }
.pill.hit .pill-value { color:var(--green); }
.pill.warn .pill-value { color:var(--accent2); }

/* ── SURFACE CARDS ── */
.scard { background:var(--surface); border:1px solid var(--border); padding:20px; }
.scard + .scard { margin-top:8px; }

/* ── EXERCISE ITEM ── */
.ex-item {
  background:var(--surface);
  border-left:3px solid var(--border);
  padding:14px 18px;
  display:grid;
  grid-template-columns:auto 1fr auto auto auto auto;
  align-items:center;
  gap:14px;
  transition:border-color 0.2s;
  margin-bottom:2px;
}
.ex-gif {
  position:relative;
  width:72px; height:72px;
  background:var(--surface2);
  border:1px solid var(--border);
  overflow:hidden;
  flex-shrink:0;
}
.ex-gif img {
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover;
  opacity:0;
  animation:exGifFlip 1.4s steps(1) infinite;
}
.ex-gif img:nth-child(2) { animation-delay:0.7s; }
@keyframes exGifFlip {
  0%, 49.99% { opacity:1; }
  50%, 100% { opacity:0; }
}
.ex-gif-placeholder {
  width:72px; height:72px;
  background:var(--surface2);
  border:1px dashed var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:26px; color:var(--muted);
  flex-shrink:0;
}
.ex-item:hover { border-left-color:var(--accent); }
.ex-name { font-weight:600; font-size:14px; }
.ex-tip { font-size:11px; color:var(--muted); margin-top:2px; font-family:'DM Mono',monospace; }
.ex-sets { font-family:'DM Sans',sans-serif; font-weight:700; font-size:22px; color:var(--accent); }
.ex-reps { font-size:11px; color:var(--muted); text-align:center; font-family:'DM Mono',monospace; }
.ex-check {
  width:24px; height:24px; border:1px solid var(--border);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  font-size:13px; flex-shrink:0; transition:all 0.2s;
}
.ex-check:hover { border-color:var(--accent); }
.ex-check.done { background:var(--accent); border-color:var(--accent); color:#000; }
.yt-btn {
  font-size:9px; font-family:'DM Mono',monospace; 
  padding:2px 7px; background:rgba(255,0,0,0.15);
  border:1px solid rgba(255,0,0,0.3); color:#ff4444;
  text-decoration:none; transition:background 0.2s;
}
.yt-btn:hover { background:rgba(255,0,0,0.3); }

/* ── HABIT CARD ── */
.habit-card {
  background:var(--surface); border:1px solid var(--border);
  padding:14px; display:flex; align-items:center; gap:12px;
  cursor:pointer; transition:all 0.2s; margin-bottom:8px;
}
.habit-card.checked { border-color:var(--green); background:rgba(76,255,145,0.04); }
.habit-check {
  width:26px; height:26px; border:1.5px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:14px; flex-shrink:0;
}
.habit-card.checked .habit-check { background:var(--green); border-color:var(--green); color:#000; }

/* ── MEAL CARD ── */
.meal-card { background:var(--surface); border:1px solid var(--border); margin-bottom:8px; overflow:hidden; }
.meal-header { padding:16px 20px; display:flex; justify-content:space-between; align-items:center; cursor:pointer; }
.meal-header:hover { background:var(--surface2); }
.meal-body { padding:0 20px 20px; display:none; }
.meal-body.open { display:block; }
.food-row { padding:10px 0; border-bottom:1px solid var(--border); display:grid; grid-template-columns:1fr auto auto auto; gap:12px; align-items:center; font-size:13px; }
.food-row:last-child { border-bottom:none; }
.macro { font-family:'DM Mono',monospace; font-size:11px; color:var(--muted); text-align:center; }
.macro span { display:block; font-size:13px; color:var(--text); }

/* ── SUPP CARD ── */
.supp-card { background:var(--surface); border:1px solid var(--border); padding:20px; position:relative; margin-bottom:8px; }
.supp-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; }
.supp-card.essential::before { background:var(--accent); }
.supp-card.performance::before { background:var(--accent2); }
.supp-card.health::before { background:var(--accent3); }
.supp-name { font-family:'DM Sans',sans-serif; font-weight:700; font-size:20px; letter-spacing:1px; }
.supp-dose { font-size:12px; color:var(--accent); font-family:'DM Mono',monospace; margin:4px 0; }
.supp-when { font-size:11px; color:var(--muted); }
.supp-why { font-size:12px; margin-top:10px; color:var(--text); line-height:1.5; }

/* ── CHAT ── */
.chat-window { background:var(--surface); border:1px solid var(--border); min-height:300px; max-height:500px; overflow-y:auto; padding:20px; display:flex; flex-direction:column; gap:12px; scroll-behavior:smooth; }
.msg { max-width:85%; }
.msg.coach { align-self:flex-start; }
.msg.user { align-self:flex-end; }
.msg-bubble { padding:12px 16px; font-size:13px; line-height:1.65; }
.msg.coach .msg-bubble { background:var(--surface2); border:1px solid var(--border); border-left:3px solid var(--accent2); }
.msg.user .msg-bubble { background:rgba(232,255,71,0.07); border:1px solid rgba(232,255,71,0.2); }
.msg-label { font-size:9px; font-family:'DM Mono',monospace;  letter-spacing:1px; color:var(--muted); margin-bottom:4px; }
.msg.user .msg-label { text-align:right; }
.chat-input-row { display:flex; gap:8px; margin-top:12px; }
.chat-input { flex:1; background:var(--surface); border:1px solid var(--border); color:var(--text); padding:12px 16px; font-family:'DM Sans',sans-serif; font-size:13px; outline:none; resize:none; height:48px; transition:border-color 0.2s; }
.chat-input:focus { border-color:var(--accent2); }
.send-btn { background:var(--accent2); color:#fff; border:none; padding:12px 20px; font-family:'DM Sans',sans-serif; font-size:16px; letter-spacing:1px; cursor:pointer; }
.typing-indicator { display:none; align-self:flex-start; padding:10px 14px; background:var(--surface2); border:1px solid var(--border); border-left:3px solid var(--accent2); gap:5px; align-items:center; }
.typing-indicator.visible { display:flex; }
.dot { width:5px; height:5px; background:var(--accent2); border-radius:50%; animation:bounce 1.2s infinite; }
.dot:nth-child(2) { animation-delay:0.2s; }
.dot:nth-child(3) { animation-delay:0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:0.4;}30%{transform:translateY(-5px);opacity:1;} }

/* ── MISC ── */
.divider { height:1px; background:var(--border); margin:24px 0; }
.badge { font-size:9px;  letter-spacing:1px; padding:3px 8px; font-family:'DM Mono',monospace; display:inline-block; }
.badge-yellow { background:rgba(232,255,71,0.1); color:var(--accent); }
.badge-orange { background:rgba(255,107,53,0.1); color:var(--accent2); }
.badge-blue   { background:rgba(71,184,255,0.1); color:var(--accent3); }
.badge-green  { background:rgba(76,255,145,0.1); color:var(--green); }
.meta-tag { font-size:11px; font-family:'DM Mono',monospace; padding:3px 10px; border:1px solid var(--border); color:var(--muted);  display:inline-block; margin-right:6px; margin-bottom:4px; }

@media (max-width:600px) {
  .page, .page-sm { padding:20px 16px 60px; }
  .card-grid { grid-template-columns:1fr 1fr; }
  .gcard-value { font-size:40px; }
  .ex-item { grid-template-columns:auto 1fr auto auto; gap:10px; }
  .ex-gif, .ex-gif-placeholder { width:56px; height:56px; }
  .nav { padding:0 12px; }
}
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)} }
.fade-in { animation:fadeIn 0.3s ease; }

/* ── ROUNDED CARD EDGES ── */
.gcard, .scard, .pill, .log-entry, .result-card, .image-drop, .log-input-area,
.chat-window, .ex-item, .ex-gif, .ex-gif-placeholder, .macro-card {
  border-radius: 14px;
}
.ex-check, .yt-btn, .icon-btn, .log-btn, .send-btn,
.chat-input, .log-textarea, .msg-bubble,
.log-item-edit input, .log-item-edit .save-btn, .log-item-edit .cancel-btn,
.mode-btn {
  border-radius: 10px;
}
.strip-track, .gcard-bar, .pill-bar, .macro-bar {
  border-radius: 2px;
  overflow: hidden;
}
.strip-fill, .gcard-bar-fill, .pill-bar-fill, .macro-bar-fill {
  border-radius: 2px;
}

/* ── FLOATING ACTION BUTTON ── */
.fab-wrap { position:fixed; bottom:20px; right:20px; z-index:1000; }
.fab {
  width:58px; height:58px; border-radius:50%;
  background:var(--accent); color:#000;
  border:none; font-size:30px; font-weight:800;
  cursor:pointer; box-shadow:0 6px 18px rgba(0,0,0,0.55);
  transition: transform 0.2s ease, background 0.2s ease;
  display:flex; align-items:center; justify-content:center;
  font-family:'DM Sans',sans-serif;
  line-height:1;
}
.fab:hover { transform:scale(1.06); }
.fab.open { transform:rotate(45deg); background:var(--accent2); color:#fff; }
.fab-menu {
  position:absolute; bottom:68px; right:0;
  flex-direction:column; gap:8px; align-items:flex-end;
}
.fab-item {
  background:var(--surface); border:1px solid var(--border);
  padding:10px 16px; border-radius:12px;
  display:flex; align-items:center; gap:10px;
  font-family:'DM Mono',monospace; font-size:12px; color:var(--text);
  text-decoration:none; min-width:150px;
  box-shadow:0 2px 10px rgba(0,0,0,0.35);
  transition:border-color 0.15s, transform 0.15s;
}
.fab-item:hover { border-color:var(--accent); transform:translateX(-2px); }
.fab-item .fab-emoji { font-size:18px; }
.fab-backdrop {
  position:fixed; inset:0; background:rgba(0,0,0,0.35); z-index:999;
  display:none;
}
.fab-backdrop.open { display:block; }

/* Catch-all: round inline-styled surface containers (weight panel, mode buttons, day pills, etc.) */
[style*="background:var(--surface)"],
[style*="background:var(--surface2)"] {
  border-radius: 14px;
}
[style*="background:var(--border)"]:not(.strip-track):not(.gcard-bar):not(.pill-bar):not(.macro-bar) {
  border-radius: 4px;
}
.fab-backdrop { border-radius: 0; }
