:root{
    --bg:#0b0b0c;
    --card:#131316;
    --text:#f2f2f2;
    --muted:#b5b5b5;
    --line:#232327;
    --btn:#1f1f24;
    --btn2:#2b2b33;
    --accent:#ffffff;
  
    --radius:14px;
    --radius2:12px;
  }
  
  *{ box-sizing:border-box; }
  
  body{
    margin:0;
    font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
    background:var(--bg);
    color:var(--text);
  }
  
  /* ---------- Header ---------- */
  .header{
    padding:16px 16px;
    border-bottom:1px solid var(--line);
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
  }
  
  .headerLeft{
    display:flex;
    flex-direction:column;
    gap:4px;
  }
  
  .appTitle{
    font-size:16px;
    font-weight:800;
    letter-spacing:0.2px;
  }
  
  .sub{
    margin:0;
    color:var(--muted);
    font-size:12px;
  }
  
  /* ---------- Layout ---------- */
  .container{
    max-width:980px;
    margin:0 auto;
    padding:16px;
    display:grid;
    gap:12px;
    padding-bottom:84px; /* space for bottom nav */
  }
  
  .card{
    background:var(--card);
    border:1px solid var(--line);
    border-radius:var(--radius);
    padding:14px;
  }
  
  .screen{ display:block; }
  
  /* ---------- Badges ---------- */
  .badges{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    justify-content:flex-end;
  }
  
  .badge{
    border:1px solid var(--line);
    background:#0f0f12;
    padding:8px 10px;
    border-radius:999px;
    font-size:12px;
    color:var(--muted);
  }
  
  /* ---------- Typography ---------- */
  h1,h2{ margin:0; }
  h2{ font-size:18px; }
  
  .muted{
    color:var(--muted);
    font-size:13px;
    margin:6px 0 0;
  }
  
  .small{
    font-size:12px;
    color:var(--muted);
  }
  
  /* ---------- Buttons ---------- */
  .actions{
    display:flex;
    gap:10px;
    margin:12px 0 0;
    flex-wrap:wrap;
  }
  
  .btn{
    border:1px solid var(--line);
    background:var(--btn);
    color:var(--text);
    padding:10px 12px;
    border-radius:var(--radius2);
    font-weight:700;
    cursor:pointer;
  }
  
  .btn.primary{ background:var(--accent); color:#000; }
  .btn.secondary{ background:var(--btn2); }
  
  .btn:disabled{
    opacity:.45;
    cursor:not-allowed;
  }
  
  .btn.tiny{
    padding:8px 10px;
    border-radius:10px;
    font-weight:700;
    font-size:12px;
  }
  
  /* ---------- Rows / Grids ---------- */
  .rowBetween{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
  }
  
  .grid2{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:10px;
  }
  @media (max-width:760px){ .grid2{ grid-template-columns:1fr; } }
  
  .field{
    border:1px solid var(--line);
    border-radius:var(--radius2);
    padding:10px;
    background:#0f0f12;
  }
  .fieldLabel{
    font-size:12px;
    color:var(--muted);
    margin-bottom:6px;
  }
  
  /* ---------- Inputs ---------- */
  .input{
    width:100%;
    padding:9px 10px;
    border-radius:10px;
    border:1px solid var(--line);
    background:#0b0b0c;
    color:var(--text);
    outline:none;
  }
  
  .input:focus{ border-color:#3a3a44; }
  .input:disabled{ opacity:.55; }
  
  /* ---------- Home ---------- */
  .homeStack{
    display:grid;
    gap:10px;
  }

  .homeTodayBlock{
    border:1px solid var(--line);
    background:#0f0f12;
    border-radius:var(--radius2);
    padding:12px;
  }

  .homeTodayTitle{
    font-weight:900;
    letter-spacing:.2px;
    font-size:16px;
  }

  .homePill{
    width:100%;
    border-radius:999px;
  }

  .homePillPrimary{
    min-height:58px;
    font-size:16px;
  }

  .homePillSecondary{
    min-height:46px;
    font-size:14px;
  }

  #homeHelper{
    min-height:16px;
    margin-top:2px;
  }

  /* ---------- Wizard Logging ---------- */
  .wizardCard{
    margin-top:12px;
    border:1px solid var(--line);
    border-radius:var(--radius2);
    padding:12px;
    background:#0f0f12;
    display:grid;
    gap:10px;
  }

  .wizardExerciseName{
    font-size:20px;
    font-weight:900;
    line-height:1.2;
  }

  .wizardSetProgress{
    color:var(--muted);
    font-size:13px;
    font-weight:700;
  }

  .wizardTarget{
    color:var(--muted);
    font-size:13px;
  }

  .wizardWeightInput{
    min-height:48px;
    font-size:16px;
  }

  .wizardActions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
  }

  .restOverlay{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:16px;
    z-index:50;
  }

  .restOverlayCard{
    width:min(420px,100%);
    border:1px solid var(--line);
    border-radius:var(--radius);
    background:var(--card);
    padding:14px;
    display:grid;
    gap:10px;
  }

  .restOverlayTitle{
    font-size:16px;
    font-weight:800;
  }

  .restOverlayCountdown{
    font-size:42px;
    font-weight:900;
    letter-spacing:1px;
    line-height:1;
  }

  .restOverlayActions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
  }
  
  /* ---------- Exercise List ---------- */
  .exerciseList{ display:grid; gap:10px; margin-top:12px; }
  
  .exercise{
    border:1px solid var(--line);
    border-radius:var(--radius2);
    padding:10px;
    background:#0f0f12;
  }
  
  .exerciseHeader{
    display:flex;
    justify-content:space-between;
    gap:10px;
    flex-wrap:wrap;
  }
  
  .exerciseName{ font-weight:800; }
  .exerciseTarget{ color:var(--muted); font-size:12px; }
  
  .sets{ margin-top:10px; display:grid; gap:8px; }
  
  .setRow{
    display:grid;
    grid-template-columns:70px 1fr 1fr 80px;
    gap:8px;
    align-items:center;
  }
  @media (max-width:520px){
    .setRow{ grid-template-columns:60px 1fr 1fr; }
    .setRow .del{ display:none; }
  }
  
  /* ---------- Summary table placeholder ---------- */
  .summaryTable{
    margin-top:10px;
    display:grid;
    gap:8px;
  }
  
  .summaryRow{
    border:1px solid var(--line);
    background:#0f0f12;
    border-radius:var(--radius2);
    padding:10px;
    display:grid;
    grid-template-columns:1fr auto;
    gap:10px;
  }
  .summaryRowTitle{ font-weight:800; }
  .summaryRowMeta{ color:var(--muted); font-size:12px; text-align:right; }
  
  /* ---------- Recent Logs ---------- */
  .recent{ display:grid; gap:8px; }
  
  .logItem{
    border:1px solid var(--line);
    background:#0f0f12;
    border-radius:var(--radius2);
    padding:10px;
  }
  
  /* ---------- Divider ---------- */
  .divider{
    height:1px;
    background:var(--line);
    border:0;
  }
  
  /* ---------- Bottom Navigation ---------- */
  .nav{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    background:#0f0f12;
    border-top:1px solid var(--line);
    display:flex;
    justify-content:center;
    gap:8px;
    padding:10px 12px;
    z-index:50;
  }
  
  .navItem{
    border:1px solid var(--line);
    background:var(--btn);
    color:var(--muted);
    padding:10px 14px;
    border-radius:999px;
    font-weight:800;
    cursor:pointer;
    min-width:100px;
  }
  
  .navItem.active{
    background:var(--accent);
    color:#000;
  }
  
  /* ---------- Footer ---------- */
  .footer{
    padding:14px 16px;
    color:var(--muted);
    font-size:12px;
    border-top:1px solid var(--line);
  }

  .footer {
    display: none;
  }

  /* Streak “pop” (positive reinforcement) */
@keyframes streakPop {
    0%   { transform: translateY(0) scale(1);   filter: none; }
    25%  { transform: translateY(-2px) scale(1.06); }
    55%  { transform: translateY(0) scale(1.02); }
    100% { transform: translateY(0) scale(1); }
  }
  
  @keyframes streakGlow {
    0%   { text-shadow: 0 0 0 rgba(255,255,255,0); }
    35%  { text-shadow: 0 0 18px rgba(255,255,255,.22); }
    100% { text-shadow: 0 0 0 rgba(255,255,255,0); }
  }
  
  .streak-animate {
    animation: streakPop 420ms ease-out, streakGlow 600ms ease-out;
    will-change: transform, text-shadow;
  }

  /* ---------- Charts ---------- */
.chartWrap{
  margin-top:10px;
  border:1px solid var(--line);
  background:#0f0f12;
  border-radius:var(--radius2);
  padding:10px;
  overflow:hidden;
}

.chartWrap canvas{
  width:100% !important;
  height:220px !important;
  display:block;
}

#weightChart{
  width:100% !important;
  height:260px !important;
  display:block;
  margin-top:10px;
}

/* optional: label spacing */
#weightRangeLabel,
#calRangeLabel{
  font-size:12px;
  color:var(--muted);
  margin-top:2px;
}

/* =========================
   STATS SCREEN SPACING
   ========================= */

#screenStats .card {
  padding: 22px;
}

/* section headers */
#screenStats h3 {
  margin-top: 26px;
  margin-bottom: 8px;
}

/* dividers */
#screenStats .divider {
  margin: 24px 0;
}

/* top stats grid */
#screenStats .grid2 {
  gap: 18px;
}

/* individual stat rows */
#screenStats .small {
  margin-top: 6px;
}

#screenStats .statStrengthGrid {
  margin-top: 10px;
  gap: 10px;
}

#screenStats .statStrengthCard {
  text-align: left;
  border: 1px solid var(--line);
  background: #0f0f12;
  color: var(--text);
  border-radius: var(--radius2);
  padding: 12px;
  cursor: pointer;
}

#screenStats .statStrengthCard:focus {
  outline: none;
  border-color: #3a3a44;
}

#screenStats .statStrengthTitle {
  font-size: 13px;
  font-weight: 800;
}

#screenStats .statStrengthMain {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
}

#screenStats .statStrengthSub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.calendarDay {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  background: #1f2937;
  cursor: pointer;
  user-select: none;
}

.calendarWorkout { background: #14532d; }
.calendarRest { background: #1e3a8a; }
.calendarEmpty { background: #1f2937; }
.calendarToday { outline: 2px solid #facc15; }

.hidden { display:none; }

.aboutList {
  margin: 10px 0 12px;
  padding-left: 18px;
}

.aboutList li {
  margin: 6px 0;
}

#screenAbout h3 {
  margin: 16px 0 6px;
}

.aboutFooterLine {
  margin-top: 12px;
}
