:root {
  --bg: #050505;
  --card: #141414;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --muted: #8d8d97;
  --purple: #c44dff;
  --lime: #d2ff3f;
  --glow-p: rgba(196, 77, 255, 0.28);
  --glow-g: rgba(210, 255, 63, 0.18);
  --radius: 16px;
  --header-h: 58px;
  --pad: clamp(12px, 4vw, 28px);
  --max: 1180px;
  --font: "Manrope", system-ui, sans-serif;
  --display: "Unbounded", "Manrope", sans-serif;
  --title: clamp(22px, 5.2vw, 40px);
  --hero-title: clamp(28px, 8vw, 64px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.nav-open { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, .btn { font-family: inherit; }

.wrap,
.hero,
.header-inner {
  width: min(var(--max), calc(100% - (var(--pad) * 2)));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header {
  position: relative;
  z-index: 51;
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  background: rgba(5, 5, 5, 0.94);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--purple), var(--lime));
  color: #050505;
  font-size: 14px;
}

.header-cta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-account,
.user-name { display: none; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b1d57, #1f3b18);
  color: var(--lime);
  font-weight: 700;
  font-size: 12px;
}

.menu-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
  cursor: pointer;
}

.menu-btn span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.2s ease;
}

body.nav-open .menu-btn span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.nav-open .menu-btn span:nth-child(2) { opacity: 0; }
body.nav-open .menu-btn span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.nav {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: #070707;
  flex-direction: column;
  padding: 8px var(--pad) calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

body.nav-open .nav { display: flex; }

.nav a {
  min-height: 52px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}

.nav a.is-active { color: var(--lime); }

.nav-account {
  margin-top: 16px;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--purple);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--purple);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-solid { background: var(--purple); color: #fff; }
.btn-lime { border-color: var(--lime); color: var(--lime); }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-text-short { display: inline; }
.btn-text-full { display: none; }

.hero,
.section,
.page-head { padding: 28px 0; }

.hero {
  display: grid;
  gap: 18px;
}

.kicker {
  color: var(--purple);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  margin: 0 0 8px;
}

.hero h1,
.section-title,
.greet h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 12px;
}

.hero h1 { font-size: var(--hero-title); }
.section-title,
.greet h1 { font-size: var(--title); }

.lead, .muted { color: var(--muted); }
.lead { margin: 0 0 10px; }

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.hero-actions .btn { width: 100%; }

.media {
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(5, 5, 5, 0.1), rgba(5, 5, 5, 0.5)),
    url("https://images.unsplash.com/photo-1547153760-18fc86324438?auto=format&fit=crop&w=900&q=80") center/cover;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.link-more {
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.carousel-nav {
  display: flex;
  gap: 8px;
  flex: none;
}
.carousel-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.carousel-btn:hover:not(:disabled) {
  border-color: var(--purple);
  color: var(--lime);
}
.carousel-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.about-grid,
.split,
.cta-box,
.footer-grid,
.feature-grid,
.dirs,
.stats {
  display: grid;
  gap: 10px;
}

.about-grid { gap: 18px; }

.feature-grid,
.dirs,
.stats { grid-template-columns: 1fr 1fr; }

.trainers {
  --trainer-gap: 12px;
  --trainer-visible: 1;
  --trainer-peek: 36px;
  display: flex;
  gap: var(--trainer-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 2px;
}
.trainers::-webkit-scrollbar { display: none; }

.trainers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  scroll-snap-type: none;
}
.trainers-grid .trainer-card {
  flex: none;
  width: auto;
  min-width: 0;
  scroll-snap-align: unset;
}
@media (min-width: 900px) {
  .trainers-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}
@media (min-width: 1200px) {
  .trainers-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.trainer-card {
  flex: 0 0 calc((100% - (var(--trainer-visible) - 1) * var(--trainer-gap) - var(--trainer-peek, 0px)) / var(--trainer-visible));
  scroll-snap-align: start;
  min-width: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.feature-card h3,
.dir-card span,
.trainer-card h3,
.event-card h3,
.news-item h3,
.lesson-main h3,
.action-btn span,
.note-body b {
  font-size: 14px;
  margin: 0 0 4px;
}

.feature-card .muted,
.trainer-card .muted { font-size: 12px; }

.icon { margin-bottom: 8px; }
.icon.purple { color: var(--purple); }
.icon.lime { color: var(--lime); }

.dir-card { overflow: hidden; padding: 0; }
.dir-card .thumb { height: 110px; background: #222 center/cover; }
.dir-card p {
  margin: 0;
  padding: 10px 12px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.accent-bar { height: 3px; }
.accent-bar.p { background: var(--purple); }
.accent-bar.g { background: var(--lime); }

.trainer-card { text-align: center; padding: 14px 10px; }
.photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 10px;
  background: #222 center/cover;
  border: 2px solid rgba(196, 77, 255, 0.35);
}

.event-card,
.news-item,
.lesson-card,
.note,
.action-btn {
  display: flex;
  gap: 10px;
  align-items: center;
}

.event-card + .event-card,
.news-item + .news-item,
.lesson-card + .lesson-card,
.note + .note { margin-top: 8px; }

/* Компактный список мероприятий */
#events .event-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

#events .event-card {
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  gap: 8px;
  min-height: 0;
  background: transparent;
  align-items: center;
}

#events .event-card:last-child { border-bottom: 0; }
#events .event-card + .event-card { margin-top: 0; }

#events .date-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1;
}

#events .date-box small {
  font-size: 8px;
  letter-spacing: 0.02em;
}

#events .event-card h3 {
  font-size: 13px;
  margin: 0;
  line-height: 1.25;
}

#events .event-card .muted {
  font-size: 11px;
  margin: 1px 0 0;
  line-height: 1.3;
}

#events .event-body { min-width: 0; }
#events .event-empty { margin: 0; padding: 12px; }

#events .section-head {
  margin-bottom: 8px;
}

#events .section-title {
  margin-bottom: 0;
  font-size: 20px;
}


.date-box {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(210, 255, 63, 0.12);
  color: var(--lime);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 800;
  line-height: 1.05;
  font-size: 16px;
}

.date-box small {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.news-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  flex: none;
  background: #222 center/cover;
}

.cta-box {
  padding: 18px;
  border-radius: 20px;
  background: radial-gradient(circle at 20% 20%, var(--glow-p), transparent 40%), var(--card);
  border: 1px solid var(--line);
}

.cta-box .btn { width: 100%; margin-top: 8px; }
.cta-media { display: none; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 calc(20px + env(safe-area-inset-bottom, 0px));
}

.footer-grid { grid-template-columns: 1fr 1fr; gap: 18px 12px; }
.footer-grid h4 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.footer-grid a,
.footer-grid p {
  display: block;
  color: var(--muted);
  margin: 0 0 6px;
  font-size: 13px;
}

.socials { display: flex; gap: 8px; margin-top: 12px; }
.socials a {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.copy { margin-top: 18px; color: #5e5e66; font-size: 12px; }

.page-head { padding-bottom: 8px; }
.greet { margin-bottom: 4px; }
.greet .btn { display: none; }

.stats { margin: 16px 0 8px; }
.stat:first-child { grid-column: 1 / -1; }
.stat { min-height: 0; }
.stat .muted { margin: 0; font-size: 12px; }
.stat .value {
  font-family: var(--display);
  font-size: 22px;
  margin: 6px 0 0;
}
.stat .value.lime { color: var(--lime); }
.stat .value.purple { color: var(--purple); }

.stat-fold {
  padding: 0;
  overflow: hidden;
}

.stat-fold-head {
  list-style: none;
  display: grid;
  gap: 2px;
  padding: 14px;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 36px;
}

.stat-fold-head::-webkit-details-marker,
.stat-fold-head::marker {
  display: none;
  content: none;
}

.stat-fold-head::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat-fold[open] {
  grid-column: 1 / -1;
}

.stat-fold[open] > .stat-fold-head {
  border-bottom: 1px solid var(--line);
}

.stat-fold[open] > .stat-fold-head::after {
  transform: rotate(45deg);
  border-color: var(--text);
}

.stat-fold-body {
  display: grid;
  gap: 8px;
  padding: 10px;
  max-height: min(58vh, 420px);
  overflow: auto;
}

.attendance-row {
  align-items: center;
}

.attendance-when {
  color: var(--text) !important;
  font-weight: 600;
  font-size: 13px !important;
  margin: 2px 0 4px !important;
}

.attendance-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.attendance-badge.present {
  color: var(--lime);
  background: rgba(180, 255, 80, 0.12);
  border: 1px solid rgba(180, 255, 80, 0.28);
}

.attendance-badge.missed {
  color: #e8b0ff;
  background: rgba(196, 77, 255, 0.12);
  border: 1px solid rgba(196, 77, 255, 0.28);
}

.attendance-row.is-present {
  border-color: rgba(180, 255, 80, 0.22);
}

.attendance-row.is-missed {
  border-color: rgba(196, 77, 255, 0.22);
}

.phone-link {
  color: var(--lime);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.phone-link:hover { text-decoration: underline; }


.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress { width: 54px; height: 54px; }

.lesson-folds {
  display: grid;
  gap: 10px;
}

.lesson-fold {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.lesson-fold-head {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.lesson-fold-head::-webkit-details-marker,
.lesson-fold-head::marker {
  display: none;
  content: none;
}

.lesson-fold-head::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.18s ease, color 0.18s ease;
  flex: none;
}

.lesson-fold[open] > .lesson-fold-head {
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.lesson-fold[open] > .lesson-fold-head::after {
  transform: rotate(45deg);
}

.lesson-fold-head:hover {
  color: var(--text);
}

.lesson-fold-body {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.lesson-fold-body > .muted {
  margin: 4px 2px 6px;
}

.lesson-card { justify-content: space-between; }
.lesson-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.lesson-card .btn {
  flex: none;
  min-height: 34px;
  padding: 0 10px;
  font-size: 10px;
}

.meta { color: var(--muted); font-size: 12px; }
.level {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  margin-right: 6px;
}

.legend { display: flex; gap: 12px; color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.dot.g { background: var(--lime); }
.dot.p { background: var(--purple); }

.chart {
  height: 160px;
  display: flex;
  align-items: end;
  gap: 8px;
}

.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars { display: flex; align-items: end; justify-content: center; gap: 4px; height: 120px; width: 100%; }
.bar { width: 12px; border-radius: 6px 6px 3px 3px; }
.bar.g { background: var(--lime); }
.bar.p { background: var(--purple); }

.actions { display: grid; gap: 8px; }
.action-btn {
  width: 100%;
  text-align: left;
  min-height: 46px;
  cursor: pointer;
}

.note {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: start;
  gap: 10px;
}
.note .meta {
  margin-left: 0;
  grid-column: 3;
  grid-row: 1;
}
.note-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
}
.note-icon.p { background: rgba(196, 77, 255, 0.12); color: var(--purple); }
.note-icon.g { background: rgba(210, 255, 63, 0.12); color: var(--lime); }
.note .meta { margin-left: auto; white-space: nowrap; font-size: 11px; }
.note-body { min-width: 0; flex: 1; }
.note-body .muted { margin: 0; font-size: 12px; }
.hidden { display: none; }

@media (max-width: 379px) {
  .hero-actions { grid-template-columns: 1fr; }
  .feature-grid,
  .dirs { grid-template-columns: 1fr; }
  .note { grid-template-columns: 34px 1fr; }
  .note .meta { grid-column: 2; grid-row: 2; }
}

@media (min-width: 760px) {
  :root { --pad: 24px; --header-h: 68px; --radius: 18px; }
  body { font-size: 16px; }
  .hero,
  .section,
  .page-head { padding: 48px 0; }
  .hero { grid-template-columns: 1.1fr 0.9fr; gap: 32px; align-items: center; }
  .hero h1 { font-size: clamp(40px, 6vw, 56px); }
  .section-title, .greet h1 { font-size: clamp(26px, 3vw, 34px); }
  .media { height: 340px; border-radius: 24px; }
  .about-grid { grid-template-columns: 0.9fr 1.1fr; gap: 28px; }
  .dirs { grid-template-columns: repeat(3, 1fr); }
  .trainers { --trainer-visible: 3; --trainer-peek: 0px; }
  .split { grid-template-columns: 1fr 1fr; gap: 20px; }
  .cta-media {
    display: block;
    min-height: 200px;
    border-radius: 18px;
    background:
      linear-gradient(180deg, transparent, rgba(5, 5, 5, 0.45)),
      url("https://images.unsplash.com/photo-1508700115892-45ecd05ae2ad?auto=format&fit=crop&w=1200&q=80") center/cover;
  }
  .cta-box { grid-template-columns: 1.1fr 0.9fr; padding: 28px; align-items: center; }
  .cta-box .btn { width: auto; }
  .btn-text-short { display: none; }
  .btn-text-full { display: inline; }
  .greet { display: flex; justify-content: space-between; align-items: center; }
  .greet .btn { display: inline-flex; width: auto; }
  .footer-grid { grid-template-columns: 1.3fr 1fr 1fr 1.1fr; }
  .dir-card .thumb { height: 150px; }
  .photo { width: 80px; height: 80px; }
}

@media (min-width: 1100px) {
  :root { --header-h: 76px; }
  .menu-btn { display: none; }
  .btn-header-account,
  .user-name { display: inline-flex; }
  .topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    background: rgba(5, 5, 5, 0.94);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
    padding-inline: max(20px, calc((100% - var(--max)) / 2));
  }
  .site-header,
  .header-inner { display: contents; width: auto; }
  .logo { grid-column: 1; }
  .header-cta { grid-column: 3; }
  .nav {
    display: flex;
    position: static;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    grid-column: 2;
    background: transparent;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 0;
    overflow: visible;
    z-index: auto;
  }
  .nav a {
    min-height: auto;
    border: 0;
    font-size: 14px;
    color: var(--muted);
  }
  .nav a:hover,
  .nav a.is-active { color: var(--text); }
  .nav-account { display: none; }
  .header-inner { display: grid; grid-template-columns: auto 1fr auto; }
  .hero { min-height: calc(100vh - 120px); }
  .hero h1 { font-size: clamp(48px, 5.5vw, 68px); }
  .dirs { grid-template-columns: repeat(5, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stat:first-child { grid-column: auto; }
  .media { height: 420px; box-shadow: 0 0 80px var(--glow-p); }
  .btn { min-height: 42px; font-size: 13px; }
}

.photo-initials {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  background: linear-gradient(135deg, #3b1d57, #1f3b18);
  color: var(--text);
}

.family-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 8px;
}
.family-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.family-chip.is-active {
  border-color: var(--purple);
  color: var(--text);
  background: rgba(196, 77, 255, 0.12);
}

.site-flash {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.site-flash.error {
  border-color: rgba(224, 85, 85, 0.45);
  color: #ff8d8d;
  background: rgba(224, 85, 85, 0.08);
}
.site-flash.success {
  border-color: rgba(210, 255, 63, 0.35);
  color: var(--lime);
  background: rgba(210, 255, 63, 0.08);
}

.portal-login {
  max-width: 460px;
  margin: 12px auto 40px;
  padding: 22px;
}
.portal-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}
.portal-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.portal-form input {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f0f0f;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}
.portal-form .btn { width: 100%; }

.action-btn { color: inherit; }

/* Signup choice modal */
.signup-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
  padding: 12px;
}
.signup-modal[hidden] { display: none !important; }
.signup-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}
.signup-modal__panel {
  position: relative;
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px 18px 14px 14px;
  padding: 18px 16px 16px;
  margin-bottom: max(8px, env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(0,0,0,.35);
}
.signup-modal__x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.signup-modal__panel h3 {
  font-family: var(--display);
  font-size: 20px;
  margin: 0 28px 4px 0;
}
.signup-modal__panel > .muted { margin: 0 0 12px; }
.signup-modal__actions {
  display: grid;
  gap: 8px;
}
.signup-choice {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  text-align: left;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}
.signup-choice__icon {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(196, 77, 255, 0.14);
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
}
.signup-choice__label {
  font-weight: 700;
  font-size: 14px;
}
.signup-choice__hint {
  font-size: 12px;
  margin: 0;
}
.signup-choice:hover {
  border-color: rgba(196, 77, 255, 0.45);
}
.signup-phone {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  justify-items: start;
}
.signup-phone__number {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  color: var(--lime);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.signup-phone .btn { width: 100%; }
@media (min-width: 900px) {
  .signup-modal { place-items: center; }
  .signup-modal__panel { border-radius: 18px; }
}


/* === adaptive polish === */
.wrap,
.hero,
.header-inner {
  width: min(var(--max), calc(100% - (var(--pad) * 2)));
}

.trainer-card h3,
.dir-card span,
.lesson-main h3,
.event-card h3,
.news-item h3 {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trainer-card .muted,
.lesson-main .meta,
.event-card .muted {
  overflow-wrap: anywhere;
}

.chart {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.family-switch {
  max-width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.family-switch::-webkit-scrollbar { display: none; }
.family-chip { flex: none; max-width: 80vw; }

.greet h1 {
  overflow-wrap: anywhere;
}

.signup-phone__number {
  font-size: clamp(18px, 6vw, 24px);
  overflow-wrap: anywhere;
}

.portal-login {
  width: min(460px, calc(100% - (var(--pad) * 2)));
  margin-inline: auto;
}

.attendance-row {
  flex-wrap: wrap;
  gap: 8px;
}

.attendance-badge {
  margin-left: auto;
}

/* phones / small */
@media (max-width: 479px) {
  :root { --header-h: 56px; }
  body { font-size: 14px; }
  .card { padding: 12px; }
  .stats { gap: 8px; }
  .stat .value { font-size: 20px; }
  .hero-actions { grid-template-columns: 1fr; }
  .feature-grid,
  .dirs,
  .trainers-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .note { grid-template-columns: 34px 1fr; }
  .note .meta { grid-column: 2; grid-row: 2; margin-left: 0; }
  .attendance-row {
    align-items: flex-start;
  }
  .attendance-badge {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
  .lesson-fold-body,
  .stat-fold-body { padding: 8px; }
  .date-box { width: 40px; height: 40px; font-size: 14px; border-radius: 10px; }
  .chart { height: 140px; }
  .bars { height: 100px; }
  .cta-box { padding: 16px; }
  .signup-modal { padding: 10px; align-items: end; }
  .btn { min-height: 46px; }
}

/* mid phones already covered; tighten 380 override conflict */
@media (max-width: 379px) {
  .feature-grid,
  .dirs,
  .trainers-grid { grid-template-columns: 1fr; }
}

/* tablet */
@media (min-width: 480px) and (max-width: 759px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:first-child { grid-column: 1 / -1; }
  .trainers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dirs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
}

@media (min-width: 760px) and (max-width: 1099px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:first-child { grid-column: 1 / -1; }
  .stat-fold[open] { grid-column: 1 / -1; }
  .trainers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .menu-btn { display: flex; }
  .btn-header-account { display: none; }
  .user-name { display: none; }
  /* keep mobile nav on tablet widths where topbar grid isn't active */
  .topbar {
    display: block;
  }
  .site-header,
  .header-inner {
    display: flex;
    width: min(var(--max), calc(100% - (var(--pad) * 2)));
  }
  .nav {
    display: none;
  }
  body.nav-open .nav {
    display: flex;
    position: fixed;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    background: #070707;
    z-index: 80;
    padding: 8px var(--pad) calc(24px + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1100px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat:first-child { grid-column: auto; }
  .family-switch { flex-wrap: wrap; overflow: visible; }
}

/* landscape phones */
@media (max-height: 480px) and (orientation: landscape) {
  .hero { min-height: auto; padding-top: 20px; padding-bottom: 20px; }
  .media { height: 180px; }
  .signup-modal { place-items: center; }
  .signup-modal__panel { max-height: 90vh; overflow: auto; }
}

/* cabinet denser sections on small screens */
@media (max-width: 759px) {
  .page-head { padding-top: 18px; padding-bottom: 4px; }
  .section { padding-top: 18px; padding-bottom: 18px; }
  #lessons { padding-top: 0 !important; }
  .actions { gap: 8px; }
  .action-btn { min-height: 48px; }
  .progress { width: 48px; height: 48px; }
}


/* Attendance week summary (cabinet) */
.attend-summary__hint {
  margin: -4px 0 12px;
  font-size: 12px;
}
.attend-weeks {
  display: grid;
  gap: 10px;
}
.attend-week {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}
.attend-week.is-empty {
  opacity: 0.72;
}
.attend-week__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.attend-week__label {
  font-weight: 700;
  font-size: 13px;
}
.attend-week__total,
.attend-week__empty {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.attend-week__track {
  height: 6px;
  border-radius: 999px;
  background: rgba(196, 77, 255, 0.22);
  overflow: hidden;
  margin-bottom: 8px;
}
.attend-week__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  min-width: 0;
}
.attend-week__fill.g { background: var(--lime); }
.attend-week__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attend-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.attend-pill.present {
  color: var(--lime);
  background: rgba(210, 255, 63, 0.1);
  border: 1px solid rgba(210, 255, 63, 0.25);
}
.attend-pill.missed {
  color: #e8b0ff;
  background: rgba(196, 77, 255, 0.1);
  border: 1px solid rgba(196, 77, 255, 0.25);
}


/* First-login credentials modal */
.creds-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}
.creds-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.creds-modal__panel {
  position: relative;
  width: min(420px, 100%);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #141414;
  padding: 22px 20px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.creds-modal__panel h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.15rem;
}
.creds-modal__panel > .muted { margin: 0 0 14px; }
.creds-modal__current {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  font-size: 14px;
}
.creds-modal__current code {
  color: var(--lime);
  font-size: 14px;
}
.creds-modal__actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.creds-modal__actions .btn,
.creds-modal__form .btn { width: 100%; }
.creds-modal__form { margin-top: 8px; }
.creds-modal [hidden] { display: none !important; }
@media (max-width: 560px) {
  .creds-modal { align-items: end; padding: 10px; }
  .creds-modal__panel { border-radius: 18px 18px 12px 12px; max-height: 90vh; overflow: auto; }
}


/* Password show/hide in cabinet credentials modal */
.pw-field {
  position: relative;
  display: block;
}
.pw-field input {
  padding-right: 46px;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.pw-toggle:hover,
.pw-toggle:focus-visible {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  outline: none;
}
.pw-toggle svg { display: block; }
.field-error {
  display: block;
  color: #ff8d7a;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 4px;
}


/* Call studio: reveal glowing phone number (desktop-friendly) */
.call-studio {
  display: grid;
  gap: 8px;
}
.call-studio > .action-btn {
  width: 100%;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.call-studio__number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(210, 255, 63, 0.45);
  background: rgba(210, 255, 63, 0.1);
  color: var(--lime);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 0 0 0 rgba(210, 255, 63, 0.35);
  animation: call-glow 1.4s ease-in-out infinite alternate;
}
.call-studio__number[hidden] {
  display: none !important;
}
.call-studio.is-open .action-btn {
  border-color: rgba(210, 255, 63, 0.35);
}
@keyframes call-glow {
  from {
    box-shadow: 0 0 8px rgba(210, 255, 63, 0.25), 0 0 0 1px rgba(210, 255, 63, 0.15);
    filter: brightness(1);
  }
  to {
    box-shadow: 0 0 22px rgba(210, 255, 63, 0.55), 0 0 0 1px rgba(210, 255, 63, 0.4);
    filter: brightness(1.12);
  }
}
