/* FarmStrong — mobile-first, barn-at-dusk palette */
:root {
  --bg: #171410;
  --card: #221d17;
  --card2: #2a241c;
  --ink: #f0e8da;
  --muted: #a89a84;
  --accent: #e07b39;      /* rusted orange */
  --green: #7da462;
  --red: #c65f4a;
  --gold: #d9a441;
  --radius: 12px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 76px; /* room for nav */
}

header {
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, #2b2015, var(--bg));
  text-align: center;
}
header h1 { font-size: 1.5rem; letter-spacing: 0.5px; }
header h1 span { color: var(--accent); }
header p { color: var(--muted); font-size: 0.8rem; }

main { max-width: 640px; margin: 0 auto; padding: 10px 12px; }

.card {
  background: var(--card);
  border: 1px solid #352c21;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 { font-size: 1.15rem; margin-bottom: 6px; }
.card h3 {
  font-size: 1rem; color: var(--gold);
  border-bottom: 1px solid #3a2f22; padding-bottom: 6px; margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: 1px;
}
.card p { margin: 6px 0; color: var(--ink); }
.intro p { color: var(--muted); }

.weekhead { display: flex; align-items: center; justify-content: space-between; }
.phase {
  font-size: 0.75rem; padding: 4px 10px; border-radius: 20px;
  background: var(--card2); color: var(--gold); border: 1px solid #453722;
}
.phase-peak { color: var(--red); }
.phase-hypertrophy { color: var(--green); }
.phase-deload { color: var(--muted); }

.ex { padding: 10px 0; border-bottom: 1px dashed #3a2f22; display: flex; gap: 10px; }
.ex:last-child { border-bottom: none; }
.exbody { flex: 1; min-width: 0; }
.exicon { flex: 0 0 auto; cursor: pointer; border-radius: 50%; transition: transform 0.1s; }
.exicon:active { transform: scale(0.92); }
.exicon svg { width: 42px; height: 42px; display: block; }
.exicon.small { display: inline-block; vertical-align: middle; margin-right: 8px; }
.exicon.small svg { width: 30px; height: 30px; }

/* cartoon layers */
.icbg { fill: rgba(224, 123, 57, 0.10); }
.role-main .icbg { fill: rgba(224, 123, 57, 0.22); }
.icgear { stroke: #93a1ad; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icgear circle, .icgear rect { fill: rgba(147, 161, 173, 0.25); }
.icfig { stroke: #ecb75f; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.icfig circle { fill: #ecb75f; stroke: none; }
.role-main .icfig { stroke: var(--accent); }
.role-main .icfig circle { fill: var(--accent); }

/* how-to card */
.modal-overlay { position: fixed; inset: 0; background: rgba(10, 8, 5, 0.8);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border: 1px solid #453722; border-radius: var(--radius);
  max-width: 440px; width: 100%; max-height: 85vh; overflow-y: auto;
  padding: 20px; position: relative; text-align: center; }
.modal-close { position: absolute; top: 10px; right: 10px; background: var(--card2);
  border: 1px solid #453722; color: var(--muted); padding: 6px 10px; font-size: 0.85rem; }
.modal-icon svg { width: 120px; height: 120px; }
.modal h2 { margin: 6px 0 2px; }
.modal-kit { color: var(--muted); font-size: 0.82rem; margin-bottom: 10px; }
.modal-section { text-align: left; margin: 12px 0; }
.modal-section b { color: var(--gold); display: block; margin-bottom: 4px;
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; }
.modal-section ol { margin-left: 20px; }
.modal-section li { margin: 4px 0; }
.modal-section p { color: var(--ink); }
.exname { font-weight: 600; }
.role-main .exname { color: var(--accent); }
.rest { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.rx { font-size: 1.05rem; margin: 2px 0; }
.warmups { color: var(--muted); font-size: 0.85rem; margin: 2px 0 2px 8px; }
.note { color: var(--gold); font-size: 0.85rem; margin: 4px 0; }
.cues { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }

details.routine summary { cursor: pointer; font-weight: 600; color: var(--gold); }
details.routine ul, .histday ul { margin: 8px 0 0 20px; color: var(--muted); }
.legend { color: var(--muted); font-size: 0.85rem; }
.legend b { color: var(--ink); }

button {
  font: inherit; border: none; border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer; color: var(--ink);
}
.primary { background: var(--accent); color: #1c1207; font-weight: 700; width: 100%; }
.primary.big { font-size: 1.05rem; padding: 16px; margin: 8px 0 20px; }
.secondary { background: var(--card2); border: 1px solid #453722; display: block; width: 100%; margin-bottom: 8px; text-align: center; }
.filebtn { padding: 12px 16px; border-radius: var(--radius); cursor: pointer; }
.danger { background: none; border: 1px solid var(--red); color: var(--red); width: 100%; }

.fbrow .exname { margin-bottom: 8px; }
.fbbtns { display: flex; gap: 8px; }
.fb {
  flex: 1; background: var(--card2); border: 1px solid #453722;
  font-size: 0.85rem; padding: 10px 4px;
}
.fb-fail.sel { background: var(--red); color: #fff; border-color: var(--red); }
.fb-right.sel { background: var(--green); color: #14200c; border-color: var(--green); }
.fb-easy.sel { background: var(--gold); color: #201804; border-color: var(--gold); }

.eqrow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px dashed #3a2f22; cursor: pointer;
}
.eqrow:last-child { border-bottom: none; }
.eqrow input { width: 20px; height: 20px; accent-color: var(--accent); }
.diy { color: var(--gold); font-size: 0.7rem; font-style: normal; border: 1px solid var(--gold); border-radius: 4px; padding: 0 4px; margin-left: 6px; }

/* --- workout player --- */
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid #3a2f22; padding-bottom: 6px; margin-bottom: 8px; }
.dayhead h3 { border: none; padding: 0; margin: 0; }
.startbtn { background: var(--accent); color: #1c1207; font-weight: 700; font-size: 0.8rem;
  padding: 8px 12px; white-space: nowrap; }

.playerhead { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; color: var(--muted); }
.exitbtn { background: none; border: 1px solid #453722; color: var(--muted);
  font-size: 0.8rem; padding: 6px 10px; }
.player { text-align: center; padding: 22px 16px; }
.player h2 { margin: 8px 0 2px; }
.steptype { font-size: 0.75rem; letter-spacing: 2px; color: var(--gold); font-weight: 700; }
.steptype.resting { color: var(--green); }
.playericon { margin-top: 8px; cursor: pointer; }
.playericon svg { width: 96px; height: 96px; display: inline-block; }
.playericon .icfig { stroke: var(--accent); }
.playericon .icfig circle { fill: var(--accent); }
.playericon .icbg { fill: rgba(224, 123, 57, 0.16); }
.steplabel { color: var(--muted); margin: 2px 0 6px; }
.target { font-size: 1.5rem; font-weight: 700; margin: 6px 0; }
.player .cues { max-width: 420px; margin: 8px auto 14px; }
.player .note { margin: 6px 0; }
.bigtimer { font-size: 4rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--green); margin: 10px 0 14px; line-height: 1; }
.bigtimer.idle { color: var(--muted); }
.nextup { color: var(--muted); font-size: 0.9rem; margin: 4px 0 16px; }
.nextup b { color: var(--ink); }
.player .primary.big { margin: 6px 0 10px; }
.player .secondary { margin-bottom: 0; }
.ghost { background: none; border: none; color: var(--muted); display: block;
  margin: 0 auto 16px; font-size: 0.85rem; text-decoration: underline; }
.donecard .bigicon { font-size: 3rem; margin-bottom: 8px; }

.selectors { margin: 10px 0; }
.selrow { display: block; padding: 8px 0; }
.selrow span { display: block; color: var(--gold); font-size: 0.85rem; margin-bottom: 4px; }
.selrow select {
  width: 100%; font: inherit; padding: 10px; border-radius: var(--radius);
  background: var(--card2); color: var(--ink); border: 1px solid #453722;
}

.hist-fb { float: right; color: var(--muted); font-size: 0.85rem; }
.histday { margin-top: 10px; }

nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: #100d0a; border-top: 1px solid #352c21;
  padding-bottom: env(safe-area-inset-bottom);
}
nav button {
  flex: 1; background: none; color: var(--muted); border-radius: 0;
  font-size: 0.8rem; padding: 12px 4px 10px;
}
nav button.active { color: var(--accent); font-weight: 700; }
nav button .ico { display: block; font-size: 1.25rem; }

@media (min-width: 700px) {
  nav { position: static; max-width: 640px; margin: 0 auto; border: 1px solid #352c21; border-radius: var(--radius); }
  body { padding-bottom: 20px; }
}
