@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --bg0: #06080d;
  --bg1: #0c1018;
  --surface: rgba(22, 28, 40, 0.72);
  --surface-solid: #161c28;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f2f5fa;
  --muted: #93a0b8;
  --accent: #5b9dff;
  --accent2: #7cf5c8;
  --done: #4ade80;
  --warn: #fbbf24;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(91, 157, 255, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(124, 245, 200, 0.08), transparent),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  padding: 1rem 1rem 5.5rem;
  max-width: 520px;
  margin-inline: auto;
}

h1, h2 { font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; color: var(--accent2); }

.muted { color: var(--muted); font-size: 0.88rem; }

.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.75rem 0 1rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(180deg, var(--bg0) 70%, transparent);
  backdrop-filter: blur(8px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #3d6bff);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 4px 16px rgba(91, 157, 255, 0.35);
}

.sync-pill {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.sync-pill[data-ok="1"] { color: var(--done); background: rgba(74, 222, 128, 0.12); }
.sync-pill[data-ok="0"] { color: var(--warn); background: rgba(251, 191, 36, 0.12); }

.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.hero-card {
  background: linear-gradient(145deg, rgba(91, 157, 255, 0.12), rgba(124, 245, 200, 0.06));
  border-color: rgba(91, 157, 255, 0.2);
}

.next-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #051018;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: 12px;
}

button, .btn {
  font-family: inherit;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 0.12s, background 0.12s;
}
button:active { transform: scale(0.98); }
button.primary {
  background: linear-gradient(135deg, var(--accent), #4070e8);
  border: none;
  color: #fff;
  font-weight: 600;
}

.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }

input, select, textarea {
  font-family: inherit;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  font-size: 0.95rem;
}
input[type="number"] { width: 4.5rem; min-height: 2.75rem; font-size: 1.05rem; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--done); }

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.tabs button {
  flex: 1;
  min-width: 4.5rem;
  padding: 0.5rem 0.4rem;
  font-size: 0.8rem;
}
.tabs button.active {
  background: linear-gradient(135deg, rgba(91, 157, 255, 0.35), rgba(124, 245, 200, 0.2));
  border-color: rgba(124, 245, 200, 0.35);
  color: #fff;
}

@media (max-width: 520px) {
  .tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    margin: 0;
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
    background: rgba(6, 8, 13, 0.92);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
  }
  .tabs button { font-size: 0.72rem; }
  #btnCompleteWorkout { width: 100%; margin-top: 0.5rem; }
}

.panel { display: none; }
.panel.active { display: block; }

.session-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.session-head .letter {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.25;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ex-card {
  overflow: hidden;
  transition: border-color 0.2s;
}
.ex-card.done {
  border-color: rgba(74, 222, 128, 0.35);
  opacity: 0.85;
}
.ex-card.done .ex-name { text-decoration: line-through; color: var(--muted); }

.ex-header { display: flex; gap: 0.65rem; align-items: flex-start; }
.ex-thumb {
  width: 72px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #000;
}
.ex-name { font-weight: 600; font-size: 0.98rem; }
.ex-meta { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.ex-chip {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(91, 157, 255, 0.15);
  color: var(--accent);
  margin-top: 0.35rem;
}

.technique {
  margin-top: 0.65rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}
.technique summary {
  list-style: none;
  cursor: pointer;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
  color: var(--accent2);
  font-weight: 500;
}
.technique summary::-webkit-details-marker { display: none; }
.technique-video {
  width: calc(100% - 1rem);
  margin: 0 0.5rem 0.5rem;
  border-radius: 12px;
  background: #000;
  max-height: 220px;
}
.vid-switch-row { padding: 0 0.5rem 0.35rem; margin: 0 !important; }
.vid-switch.active {
  border-color: rgba(124, 245, 200, 0.5);
  background: rgba(124, 245, 200, 0.12);
}
.technique .cue {
  margin: 0;
  padding: 0 0.65rem 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.sets-grid { display: grid; gap: 0.4rem; margin-top: 0.65rem; }
.set-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  padding: 0.35rem 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}
.set-line label { font-size: 0.75rem; color: var(--muted); min-width: 2rem; font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { border-bottom: 1px solid var(--border); padding: 0.5rem 0.35rem; text-align: left; }
th { color: var(--muted); font-weight: 500; }

.history-item {
  font-size: 0.85rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.help-block { margin-bottom: 1.25rem; }
.help-block h2 { margin-top: 0; }
.help-block ul { padding-left: 1.1rem; color: var(--muted); }
.help-block li { margin-bottom: 0.35rem; }
