:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c2330;
  --text: #e6edf3;
  --muted: #9da7b3;
  --accent: #4cc2ff;
  --accent-2: #7ee787;
  --border: #2a313c;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar .brand { font-weight: 700; letter-spacing: .02em; color: #fff; }
.topbar nav { display: flex; gap: 1rem; }
.topbar nav a { color: var(--muted); padding: .25rem .55rem; border-radius: 4px; }
.topbar nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.topbar nav a.active { color: var(--accent); background: var(--panel-2); }

.container { max-width: 1280px; margin: 0 auto; padding: 1.5rem; }

.hero h1 { font-size: 2rem; margin: 1rem 0 .35rem; color: #fff; }
.muted { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.brand-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.1rem;
  transition: transform .12s ease, border-color .12s ease;
}
.brand-card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.brand-card__title { font-size: 1.2rem; color: #fff; font-weight: 600; }
.brand-card__sub { color: var(--muted); margin-top: .2rem; font-size: .92rem; }

.page-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { color: #fff; margin: .25rem 0; flex: 0 0 auto; }
.search {
  flex: 1 1 280px;
  padding: .55rem .8rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: .95rem;
}
.search:focus { outline: none; border-color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .img-wrap {
  aspect-ratio: 4/3;
  background: #0a0d12;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.card .body { padding: .7rem .85rem; display: flex; flex-direction: column; gap: .25rem; }
.card .title { color: #fff; font-weight: 600; font-size: .98rem; line-height: 1.25; }
.card .subtitle { color: var(--muted); font-size: .82rem; }
.card .desc { color: var(--muted); font-size: .82rem; margin-top: .35rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

.card { cursor: pointer; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center; justify-content: center;
  padding: 1.5rem;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  animation: modal-in .15s ease;
}
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal__img {
  background: #0a0d12;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  min-height: 280px;
}
.modal__img img { max-width: 100%; max-height: 60vh; object-fit: contain; }
.modal__body {
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: .8rem;
}
.modal__title {
  font-size: 1.35rem;
  color: #fff;
  font-weight: 600;
  margin: 0;
  padding-right: 2rem;
}
.modal__desc { color: var(--text); line-height: 1.45; font-size: .95rem; }
.modal__fields { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .85rem; font-size: .88rem; }
.modal__fields dt { color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; padding-top: .15em; }
.modal__fields dd { margin: 0; color: var(--text); word-break: break-word; }
.modal__fields dd a { color: var(--accent); }
.modal__close {
  position: absolute;
  top: .6rem; right: .8rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal__close:hover { color: #fff; border-color: var(--accent); }
.modal { position: relative; }

@media (max-width: 720px) {
  .modal { grid-template-columns: 1fr; }
  .modal__img { min-height: 200px; }
}

/* ---- muscle catalogue ---- */
.filters { display: flex; gap: .35rem; flex: 0 0 auto; }
.chip {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .3rem .75rem;
  font-size: .82rem;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip--active { background: var(--accent); color: #0e1116; border-color: var(--accent); font-weight: 600; }

.muscle-group { margin: 1.5rem 0 2rem; }
.muscle-group__head {
  font-size: 1.1rem;
  color: var(--accent-2);
  margin: 0 0 .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  padding-bottom: .35rem;
}
.muscle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .9rem;
}
.muscle-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .12s ease, border-color .12s ease;
}
.muscle-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.muscle-card__body-img {
  background: #11151c;
  display: flex; align-items: center; justify-content: center;
  padding: .35rem;
}
.body-stack { display: flex; gap: .3rem; align-items: stretch; justify-content: center; width: 100%; }
.body-stack--pair { gap: .25rem; }
.body-svg { width: 100%; max-height: 240px; height: auto; aspect-ratio: 100/222; }
.body-svg .m {
  fill: #2c3340;
  stroke: #4a5260;
  stroke-width: .35;
  transition: fill .15s ease, stroke .15s ease;
}
.body-svg .m--hi {
  fill: var(--accent);
  stroke: #ffffff;
  stroke-width: .5;
}
.body-svg .m--outline {
  fill: #232a36;
  stroke: #4a5260;
  stroke-width: .35;
}
.modal__img--body { padding: 1.5rem; }
.modal__img--body .body-svg { max-height: 70vh; }
.muscle-card__body { padding: .55rem .7rem .75rem; }
.muscle-card__title { color: #fff; font-weight: 600; font-size: .98rem; }
.muscle-card__sub { color: var(--muted); font-size: .8rem; font-style: italic; }
.muscle-card__tags { display: flex; gap: .35rem; margin-top: .45rem; flex-wrap: wrap; }
.tag {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .12rem .45rem;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.tag--front { color: var(--accent); border-color: var(--accent); }
.tag--back  { color: var(--accent-2); border-color: var(--accent-2); }
.tag--both  { color: #c084fc; border-color: #c084fc; }

.small { font-size: .8rem; }

.modal--muscle .modal__img img { max-height: 70vh; }
