/* Mobile-first dark UI for training site */

:root {
  --bg: #0a0a0a;
  --surface: #161616;
  --surface-2: #222;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --text-muted: #999;
  --accent: #ff6b35;
  --accent-soft: #ff6b3520;
  --done: #34c759;
  --done-soft: #34c75920;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 17px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 80px) env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.page-header .subtitle {
  color: var(--text-muted);
  font-size: 15px;
}
.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 12px;
}
.back-link:active { color: var(--accent); }

/* Index page session cards */
.session-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}
.session-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s;
}
.session-card:active { background: var(--surface-2); }
.session-card .title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 4px;
}
.session-card .meta {
  color: var(--text-muted);
  font-size: 14px;
}

/* Info banner */
.info {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Exercise list */
.exercise {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.exercise-name {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  line-height: 1.3;
}
.exercise-target {
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  margin-left: 12px;
  white-space: nowrap;
}
.exercise-note {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 10px;
  font-style: italic;
}

/* Alternating exercise image (start ↔ end position) */
.exercise-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 240px;
  margin: 0 auto 12px;
  background: #f8f8f8;
  border-radius: 10px;
  overflow: hidden;
}
.exercise-img .frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: blink 1.6s infinite;
}
.exercise-img .frame-1 { animation-delay: 0.8s; }
@keyframes blink {
  0%, 49.99% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Primary muscle pill */
.exercise-primary {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* Howto toggle */
.howto-toggle {
  margin-top: 12px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.howto-toggle:active { background: var(--surface-2); }
.howto {
  display: none;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.howto.open { display: block; }

/* Set checkboxes */
.sets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.set-btn {
  flex: 1;
  min-width: 64px;
  min-height: 52px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  transition: all 0.15s;
}
.set-btn:active { transform: scale(0.96); }
.set-btn.done {
  background: var(--done-soft);
  border-color: var(--done);
  color: var(--done);
}
.set-btn.done::before {
  content: "✓ ";
}

/* Shopping list */
.shop-section {
  margin-bottom: 24px;
}
.shop-section h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}
.shop-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.shop-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.shop-item:last-child { border-bottom: none; }
.shop-item:active { background: var(--surface-2); }
.shop-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-radius: 6px;
  margin-right: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.shop-item.done .shop-checkbox {
  background: var(--done);
  border-color: var(--done);
}
.shop-item.done .shop-checkbox::after {
  content: "✓";
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.shop-name {
  flex: 1;
  font-size: 16px;
}
.shop-item.done .shop-name {
  color: var(--text-muted);
  text-decoration: line-through;
}
.shop-qty {
  color: var(--text-muted);
  font-size: 14px;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

/* Footer actions */
.footer-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom)) 20px;
  display: flex;
  gap: 10px;
  z-index: 10;
}
.btn {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn:active { background: var(--border); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Done banner */
.done-banner {
  background: var(--done-soft);
  border: 1.5px solid var(--done);
  color: var(--done);
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
  margin-bottom: 16px;
  display: none;
}
.done-banner.visible { display: block; }

/* Tiny screens */
@media (max-width: 360px) {
  .container { padding: 20px 16px; }
  .set-btn { min-width: 56px; min-height: 48px; font-size: 14px; }
  .page-header h1 { font-size: 24px; }
}
