:root {
  --bg: #15100b;
  --surface: #211810;
  --surface-2: #2c2116;
  --border: #40301f;
  --text: #f7ece0;
  --text-dim: #c2a68c;
  --accent: #ffcc94;
  --accent-strong: #f97316;
  --accent-strong-text: #2a0f00;
  --danger: #e11d48;
  --danger-text: #ffffff;
  --radius: 14px;
  --tag-text: #211208;

  --m-chest: #ff8a5c;
  --m-back: #5cc8ff;
  --m-shoulders: #ffd166;
  --m-biceps: #c084fc;
  --m-triceps: #f472b6;
  --m-forearms: #cbb8a8;
  --m-abs: #fde047;
  --m-quads: #4ade80;
  --m-hamstrings: #22d3ee;
  --m-glutes: #fb7185;
  --m-calves: #38bdf8;
  --m-traps: #fbbf24;
  --m-neck: #a9b6c4;
  --m-full_body: #fdba74;
  --m-cardio: #f87171;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbf5ef;
    --surface: #ffffff;
    --surface-2: #fbe9d7;
    --border: #f0d7ba;
    --text: #2a1a0a;
    --text-dim: #7a5c3f;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hero { position: relative; padding: 1rem 1.25rem 1.5rem; text-align: center; }
.hero__topbar { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }
.hero__brand { display: inline-block; text-decoration: none; color: inherit; max-width: 480px; }
.hero__logo {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  margin: 0.5rem auto 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
}
.hero h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.tagline { margin: 0.35rem 0 0; color: var(--text-dim); font-size: 0.95rem; }

.lang-switch { display: flex; gap: 0.25rem; }
.lang-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
}
.lang-btn--active { background: var(--accent-strong); color: var(--accent-strong-text); border-color: var(--accent-strong); }

.icon { display: block; stroke: currentColor; }

.hamburger {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  cursor: pointer;
}
.hamburger__icon--close { display: none; }
.hamburger[aria-expanded="true"] .hamburger__icon--menu { display: none; }
.hamburger[aria-expanded="true"] .hamburger__icon--close { display: block; }

.site-menu {
  position: absolute;
  top: 3.2rem;
  right: 1.25rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}
.site-menu a {
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  text-align: left;
}
.site-menu a:hover { background: var(--surface-2); }

.tabs { display: flex; gap: 0.5rem; padding: 0 1.25rem; margin-top: 0.5rem; }
.tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.6rem 0.25rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.tab--active { color: var(--text); border-color: var(--accent-strong); }

.filters { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip--active { background: var(--accent-strong); color: var(--accent-strong-text); border-color: var(--accent-strong); font-weight: 600; }

.filter-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.filter-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--text-dim); }
.filter-field--grow { flex: 1 1 200px; }
.filter-field select, .filter-field input {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
}
.search-input { position: relative; display: flex; }
.search-input__icon { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search-input input { width: 100%; padding-left: 2.1rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn--primary { background: var(--accent-strong); color: var(--accent-strong-text); }
.btn--danger { background: var(--danger); color: var(--danger-text); }
.btn--ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn--small { padding: 0.4rem 0.8rem; font-size: 0.78rem; }

main { padding: 1rem 1.25rem 3rem; max-width: 1100px; margin: 0 auto; }
.meta { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 0.75rem; }
.empty { color: var(--text-dim); padding: 2rem 0; text-align: center; }
.load-more { display: block; margin: 1.5rem auto 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.tile__video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; display: block; }
.tile__body { padding: 0.75rem 0.9rem 0.9rem; }
.tile__title { margin: 0 0 0.5rem; font-size: 0.95rem; }
.tile__tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.tag--box { background: transparent; }
.tag--chest, .tag--back, .tag--shoulders, .tag--biceps, .tag--triceps,
.tag--forearms, .tag--abs, .tag--quads, .tag--hamstrings, .tag--glutes,
.tag--calves, .tag--traps, .tag--neck, .tag--full_body, .tag--cardio {
  color: var(--tag-text);
  border-color: transparent;
  font-weight: 600;
}
.tag--chest { background: var(--m-chest); }
.tag--back { background: var(--m-back); }
.tag--shoulders { background: var(--m-shoulders); }
.tag--biceps { background: var(--m-biceps); }
.tag--triceps { background: var(--m-triceps); }
.tag--forearms { background: var(--m-forearms); }
.tag--abs { background: var(--m-abs); }
.tag--quads { background: var(--m-quads); }
.tag--hamstrings { background: var(--m-hamstrings); }
.tag--glutes { background: var(--m-glutes); }
.tag--calves { background: var(--m-calves); }
.tag--traps { background: var(--m-traps); }
.tag--neck { background: var(--m-neck); }
.tag--full_body { background: var(--m-full_body); }
.tag--cardio { background: var(--m-cardio); }

.study-panel { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.75rem; padding: 2rem 0; }
.hint { color: var(--text-dim); max-width: 420px; }

.deck { position: relative; width: 100%; max-width: 420px; margin: 0 auto; }
.deck__shadow {
  position: absolute; inset: 0; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.deck__shadow--1 { transform: translateY(10px) scale(0.97); opacity: 0.7; }
.deck__shadow--2 { transform: translateY(20px) scale(0.94); opacity: 0.4; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,0.3);
}
.card__media { position: relative; }
.card__video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; display: block; }

.deck-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.deck-nav:hover:not(:disabled) { background: rgba(0, 0, 0, 0.65); }
.deck-nav:disabled { opacity: 0.3; cursor: default; }
.deck-nav--prev { left: 10px; }
.deck-nav--next { right: 10px; }
.card__body { padding: 1rem 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
.card__title { margin: 0; font-size: 1.1rem; }

.grade-row { display: flex; gap: 0.6rem; width: 100%; }
.grade-row .btn { flex: 1; }

.study-session__bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
  max-width: 420px;
  position: relative;
}
.study-session__bar #study-progress { margin: 0; }
.study-session__bar #study-exit { position: absolute; left: 0; }

.finished-actions { display: flex; gap: 0.6rem; }

.cue-list-inline {
  margin: 0; padding-left: 1.2rem; text-align: left; width: 100%;
  color: var(--text-dim); font-size: 0.85rem; display: flex;
  flex-direction: column; gap: 0.2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--text); }

.detail { max-width: 640px; margin: 0 auto; }
.detail__video {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000;
  border-radius: var(--radius); display: block;
}
.detail__title { margin: 1rem 0 0.5rem; font-size: 1.4rem; }
.detail .tile__tags { margin-bottom: 1.5rem; }

.cues {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}
.cues h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.cues ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.45rem; }
.cues__disclaimer { margin: 1rem 0 0; font-size: 0.78rem; }
.cues__credit { margin: 0.35rem 0 0; font-size: 0.72rem; }

.page { max-width: 640px; margin: 0 auto; padding: 1rem 0 3rem; line-height: 1.6; }
.page h2 { font-size: 1.5rem; margin: 0 0 1rem; }
.page p { color: var(--text-dim); margin: 0 0 1rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-strong);
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .hero__logo { max-width: 280px; }
  .hero h1 { font-size: 1.6rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
