/* Restart Uomo — mobile first, offline, touch friendly */
:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #f97316;
  --accent2: #0d9488;
  --line: #e2e8f0;
  --ok: #16a34a;
  --radius: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f1f5f9;
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  color: #fff;
  padding: 12px 12px 10px;
  border-radius: 0 0 18px 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.topbar-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.topbar h1 { font-size: 1.05rem; line-height: 1.2; }
.topbar h1 span { display: block; font-size: .75rem; font-weight: 400; opacity: .8; }
.save-state { font-size: .72rem; opacity: .75; margin-top: 2px; }
.icon-btn {
  min-width: 44px; min-height: 44px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12);
  color: #fff; border-radius: 12px; font-size: 1.3rem; cursor: pointer;
}
.days { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.day-tab {
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1);
  color: #fff; border-radius: 12px; padding: 10px 4px;
  font-size: .9rem; font-weight: 700; cursor: pointer; min-height: 56px;
}
.day-tab span { display: block; font-size: .68rem; font-weight: 400; opacity: .85; margin-top: 2px; }
.day-tab.active { background: var(--accent); border-color: var(--accent); }
.weeks-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.weeks { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; flex: 1; }
.week-chip {
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1);
  color: #fff; border-radius: 10px; min-height: 44px; font-weight: 700; cursor: pointer;
}
.week-chip.active { background: #fff; color: var(--ink); }
.progress-wrap { margin-top: 8px; }
.progress-top { display: flex; justify-content: space-between; font-size: .72rem; opacity: .9; margin-bottom: 4px; }
.progress { height: 8px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: #4ade80; border-radius: 99px; transition: width .3s; }

/* ---------- tools ---------- */
.tools { background: #fffbeb; border-bottom: 1px solid #fde68a; padding: 10px 12px; }
.tools-title { font-size: .8rem; margin-bottom: 8px; }
.tools-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 10px 12px; font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 44px;
}
.btn.danger { color: #b91c1c; border-color: #fecaca; }

/* ---------- layout ---------- */
.container { max-width: 640px; margin: 0 auto; padding: 12px 12px 0; }
.home { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; }
.home h2 { font-size: 1.1rem; margin-bottom: 8px; }
.home p { font-size: .9rem; color: #334155; line-height: 1.5; }
.home-cards { display: grid; gap: 8px; margin-top: 12px; }
.home-card {
  text-align: left; background: var(--bg2); color: #fff;
  border: none; border-radius: 14px; padding: 14px; cursor: pointer;
}
.home-card b { display: block; font-size: 1rem; }
.home-card span { font-size: .8rem; opacity: .85; }

.lista { display: grid; gap: 12px; margin-top: 12px; }

/* ---------- exercise card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card.done { border-color: #86efac; box-shadow: 0 0 0 1px #86efac; }
.card-img { width: 100%; aspect-ratio: 16/7; object-fit: cover; object-fit-position: center; display: block; background: #0f172a; }
.card-body { padding: 12px; }
.card-num { font-size: .7rem; font-weight: 800; color: var(--accent2); letter-spacing: .04em; }
.card h3 { font-size: 1.02rem; margin: 2px 0 8px; }
.specs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.spec { font-size: .72rem; background: #f1f5f9; border: 1px solid var(--line); border-radius: 99px; padding: 4px 9px; }
.spec b { font-weight: 700; }
.spec.target { background: #ecfdf5; border-color: #a7f3d0; }
.track { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 10px; }
.track-title { font-size: .75rem; font-weight: 800; color: #334155; margin-bottom: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field label { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.field input {
  width: 100%; min-height: 46px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff;
}
.fb-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.fb {
  min-height: 46px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-weight: 800; font-size: .95rem; cursor: pointer;
}
.fb.active-r { background: #dcfce7; border-color: var(--ok); color: #166534; }
.fb.active-p { background: #ffedd5; border-color: var(--accent); color: #9a3412; }
.fb.active-e { background: #e0e7ff; border-color: #6366f1; color: #3730a3; }
.section-title { margin: 14px 2px 0; }
.section-title h2 { font-size: 1rem; }
.section-title span { font-size: .75rem; color: var(--muted); }
.home-note { margin-top: 10px; font-size: .82rem; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px; padding: 10px; }

/* week rows: S1-S8 under each exercise */
.whead, .wrow { display: grid; grid-template-columns: 30px 1fr 1.4fr auto; gap: 6px; align-items: center; }
.whead { font-size: .68rem; font-weight: 800; color: var(--muted); margin-bottom: 4px; }
.whead span:nth-child(2), .whead span:nth-child(3) { padding-left: 2px; }
.wrow { margin-bottom: 6px; }
.wlab { font-size: .75rem; font-weight: 800; color: #334155; }
.wkg, .wreps {
  width: 100%; min-height: 44px; font-size: .92rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #fff;
}
.wfb { display: flex; gap: 4px; }
.fb-mini {
  min-width: 40px; min-height: 44px; padding: 0 8px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 800; font-size: .8rem; cursor: pointer;
}
.fb-mini.active-r { background: #dcfce7; border-color: var(--ok); color: #166534; }
.fb-mini.active-p { background: #ffedd5; border-color: var(--accent); color: #9a3412; }
.fb-mini.active-e { background: #e0e7ff; border-color: #6366f1; color: #3730a3; }
.fb-mini.copy { color: var(--muted); }
.note { margin-top: 8px; }
.note textarea {
  width: 100%; min-height: 52px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: .88rem; font-family: inherit;
}
.prev-week { font-size: .72rem; color: var(--muted); margin-top: 6px; }

.footer { max-width: 640px; margin: 16px auto 0; padding: 0 14px; font-size: .72rem; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.footer a { color: var(--accent2); }

@media (min-width: 640px) {
  .topbar-inner, .days, .weeks-row, .progress-wrap { max-width: 640px; margin-left: auto; margin-right: auto; }
  .weeks-row { margin-top: 8px; }
}
