/* Sportzk — modern sports UI (#0B0E14) */
:root {
  --bg-app: #0b0e14;
  --bg-surface: #141922;
  --bg-card: #1a2030;
  --bg-card-glass: rgba(26, 32, 48, 0.72);
  --bg-input: #0f131c;
  --bg-table-alt: #121820;
  --accent: #00e5a0;
  --accent-dim: #00b87d;
  --glow: #7c5cff;
  --text-primary: #eef1f6;
  --text-muted: #8b93a7;
  --text-dim: #5c6478;
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(0, 229, 160, 0.25);
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --error: #ff6b6b;
  --success: #00e5a0;
  --radius-lg: 1.25rem;
  --radius-md: 1rem;
  --bottom-nav-h: 4.35rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-glow: 0 0 40px rgba(0, 229, 160, 0.12), 0 8px 32px rgba(0, 0, 0, 0.45);
}

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

.hidden { display: none !important; }

body.app-shell {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
}

html.is-standalone .app-header {
  padding-top: max(0.85rem, env(safe-area-inset-top, 0px));
}

a { color: var(--accent); transition: color 0.2s, opacity 0.2s; }
a:hover { color: var(--accent-dim); }

/* === Header === */
.app-header {
  background: linear-gradient(180deg, #121820 0%, var(--bg-app) 100%);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1rem 0.75rem;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.app-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-header__brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
}

.app-header__avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--glow));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0b0e14;
  text-decoration: none;
}

.desktop-nav {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

.desktop-nav__link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

.desktop-nav__link:hover,
.desktop-nav__link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.desktop-nav__link--admin { color: var(--glow); }
.desktop-nav__user { color: var(--text-dim); margin-left: auto; font-size: 0.8rem; }

@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
  .desktop-nav { display: flex; }
  .app-body { padding-bottom: 0; }
}

/* === Layout === */
.app-body {
  min-height: calc(100dvh - 4rem);
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.5rem);
}

.app-main {
  padding: 1rem 1rem 1.5rem;
  max-width: 42rem;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 769px) {
  .app-main { max-width: 56rem; padding: 1.5rem 1.25rem 2rem; }
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 1rem;
}

/* === Bottom nav === */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  min-height: var(--bottom-nav-h);
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.35rem 0.2rem;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav__item.is-active {
  color: var(--accent);
}

.bottom-nav__item.is-active .bottom-nav__icon {
  filter: drop-shadow(0 0 6px rgba(0, 229, 160, 0.5));
}

.bottom-nav__icon {
  width: 1.35rem;
  height: 1.35rem;
}

/* FAB «Завершить день» — над нижней навигацией на мобильных */
.fab-workout {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 0.85rem);
  z-index: 55;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #0b0e14;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 229, 160, 0.35);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.fab-workout:hover {
  color: #0b0e14;
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0, 229, 160, 0.45);
}

@media (min-width: 769px) {
  .fab-workout {
    bottom: 1.5rem;
    right: 1.5rem;
  }
}

/* === Home === */
.home-hero { margin-bottom: 1.25rem; }
.home-hero__eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--glow);
}
.home-hero__title {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
}
.home-hero__lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.home-cta { margin-top: 2rem; }

.level-widget {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
}

.level-widget__icon { flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.level-widget__body { flex: 1; min-width: 0; }
.level-widget__rank { margin: 0 0 0.15rem; font-weight: 700; font-size: 0.95rem; }
.level-widget__desc {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  font-style: italic;
}
.level-widget__op { margin: 0 0 0.25rem; color: var(--accent); font-weight: 800; }
.level-widget__next { margin: 0 0 0.35rem; font-size: 0.78rem; color: var(--text-muted); }
.level-widget__bar { max-width: 100%; }
.level-widget__link {
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.home-section { margin-top: 1.75rem; }
.home-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.home-section__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}
.home-section__link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.home-cta { margin-top: 2rem; }

/* === Challenge hero card === */
.challenge-hero-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--bg-card-glass);
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-glow);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.challenge-hero-card__cover {
  position: relative;
  height: 9rem;
  overflow: hidden;
}

.challenge-hero-card__cover-img,
.challenge-hero-card__cover img,
.challenge-hero-card__cover video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.challenge-hero-card__cover-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-card) 0%, transparent 55%);
  pointer-events: none;
}

.challenge-hero-card__inner { padding: 1.15rem 1.15rem 1.25rem; }

.challenge-hero-card__top {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.challenge-hero-card__eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.challenge-hero-card__title {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
}

.challenge-hero-card__dates {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.challenge-hero-card__desc {
  margin: 0.85rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.challenge-hero-card__countdown-wrap { margin-top: 1rem; }
.challenge-hero-card__countdown-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.challenge-hero-card__progress { margin-top: 1rem; }
.challenge-hero-card__cta {
  display: block;
  width: 100%;
  margin-top: 1.15rem;
  text-align: center;
}

/* Countdown */
.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.countdown__block { text-align: center; min-width: 2.75rem; }
.countdown__value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.countdown__label {
  display: block;
  font-size: 0.55rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.countdown__sep {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dim);
  padding-bottom: 0.75rem;
}

/* Progress bar */
.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.progress-bar {
  height: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--glow));
  border-radius: 999px;
  transition: width 0.8s ease;
}

/* XP ring */
.xp-ring {
  position: relative;
  width: 4.25rem;
  height: 4.25rem;
  flex-shrink: 0;
}

.xp-ring__svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.xp-ring__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 2.5;
}
.xp-ring__fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(0, 229, 160, 0.6));
}

.xp-ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.xp-ring__value {
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
}

.xp-ring__unit {
  font-size: 0.55rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Exercise tiles */
.exercise-tiles { margin-top: 1rem; }
.exercise-tiles__title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.exercise-tiles__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .exercise-tiles__grid { grid-template-columns: repeat(4, 1fr); }
}

.exercise-tile {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.55rem 0.5rem;
  text-align: center;
}

.exercise-tile__name {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.exercise-tile__target {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.exercise-tile__target small {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-dim);
}

.exercise-tile__pending {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Mini challenge cards */
.mini-challenge-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mini-challenge-card {
  display: block;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s;
}

a.mini-challenge-card:hover { border-color: var(--border-accent); }

.mini-challenge-card--mock { opacity: 0.85; }
.mini-challenge-card.is-done { opacity: 0.65; }

.mini-challenge-card__badge { margin-bottom: 0.35rem; }
.mini-challenge-card__title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.mini-challenge-card__meta {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Animations — visible by default; hide only when JS enables motion */
.anim-fade-up {
  opacity: 1;
  transform: translateY(0);
}

html.js-anim .anim-fade-up {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  transition-delay: var(--anim-delay, 0s);
}

html.js-anim .anim-fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* === Shared components === */
.page-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

.page-lead {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #0b0e14;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-primary:hover {
  color: #0b0e14;
  transform: translateY(-1px);
}

.btn-glow {
  box-shadow: 0 4px 20px rgba(0, 229, 160, 0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-accent);
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.85rem; }
.btn-danger { background: var(--error); color: #fff; padding: 0.4rem 1rem; border-radius: var(--radius-md); border: none; cursor: pointer; }

.flash { padding: 0.75rem 1rem; border-radius: var(--radius-md); margin-bottom: 1rem; }
.flash-success { background: rgba(0, 229, 160, 0.1); border: 1px solid var(--accent); color: var(--accent); }
.flash-error { background: rgba(255, 107, 107, 0.12); border: 1px solid var(--error); color: var(--error); }
.flash-info { background: var(--bg-card); border: 1px solid var(--border); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="email"], input[type="time"], input[type="datetime-local"], textarea, select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 229, 160, 0.15);
}

label { display: block; margin-bottom: 0.25rem; color: var(--text-muted); font-size: 0.875rem; }
.form-group { margin-bottom: 1rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { background: rgba(0, 229, 160, 0.08); color: var(--accent); padding: 0.75rem; text-align: left; border-bottom: 2px solid var(--border-accent); }
.data-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); }
.table-empty { text-align: center; color: var(--text-muted); padding: 1.5rem 0.75rem !important; }
.data-table tbody tr:nth-child(even) { background: var(--bg-table-alt); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-active { background: rgba(0, 229, 160, 0.15); color: var(--accent); }
.badge-draft { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.badge-completed { background: rgba(255, 107, 107, 0.15); color: var(--error); }
.badge-scheduled { background: rgba(124, 92, 255, 0.15); color: var(--glow); }

.nav-link { color: var(--text-muted); }
.nav-link:hover { color: var(--accent); }

.text-accent { color: var(--accent) !important; }
.text-gray-400, .text-gray-500 { color: var(--text-muted) !important; }
.text-white { color: var(--text-primary) !important; }
.text-green-400 { color: var(--success) !important; }
.text-amber-400 { color: #ffb020 !important; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 0.375rem;
  border: 1px solid var(--border-accent); color: var(--accent);
  text-decoration: none; background: transparent; cursor: pointer;
}

.file-upload-label {
  display: inline-block; width: 100%; text-align: center;
  padding: 0.55rem 1rem; border-radius: var(--radius-md);
  border: 1px dashed var(--border-accent); color: var(--accent);
  background: rgba(0, 229, 160, 0.05); cursor: pointer; font-size: 0.9rem;
}

.file-upload-wrap { position: relative; display: inline-block; width: 100%; }
.file-upload-wrap input[type="file"] { position: absolute; width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; z-index: -1; }

.menu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.menu-list__item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1rem;
  background: var(--bg-card); border-radius: var(--radius-md); border: 1px solid var(--border);
  text-decoration: none; color: var(--text-primary); font-weight: 600;
}
.menu-list__icon {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--accent); color: #0b0e14;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.rank-gold td:first-child { border-left: 4px solid var(--gold); }
.rank-silver td:first-child { border-left: 4px solid var(--silver); }
.rank-bronze td:first-child { border-left: 4px solid var(--bronze); }

.challenge-card-cover, .challenge-index-cover {
  margin: 0; width: 100%; overflow: hidden;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.challenge-index-cover { height: 9rem; }
.challenge-card-cover img, .challenge-index-cover img,
.challenge-card-cover video, .challenge-index-cover video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.cover-wrap { position: relative; width: 100%; height: 100%; }
.cover-wrap .cover-placeholder { display: none; }
.cover-wrap.cover-missing img { display: none; }
.cover-wrap.cover-missing .cover-placeholder { display: flex; }
.cover-placeholder {
  width: 100%; height: 100%; min-height: 6rem;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.85rem;
}

.challenge-hero { position: relative; border-radius: var(--radius-md); overflow: hidden; }
.challenge-hero img, .challenge-hero video { width: 100%; max-height: 220px; object-fit: cover; display: block; }

.exercise-demo-video {
  margin-top: 0.5rem; width: min(100%, 20rem); aspect-ratio: 16/9;
  border-radius: 0.5rem; overflow: hidden; background: var(--bg-input); border: 1px solid var(--border);
}
.exercise-demo-video video { width: 100%; height: 100%; object-fit: cover; display: block; }

.exercise-demo-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exercise-demo-video-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.exercise-demo-video-row .exercise-demo-video {
  margin-top: 0;
  width: 100%;
  max-width: 20rem;
}

.exercise-demo-video-row__actions {
  display: flex;
  justify-content: flex-start;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.flatpickr-input[readonly], .flatpickr-alt-input {
  background: var(--bg-input) !important; border: 1px solid var(--border) !important;
  color: var(--text-primary) !important; border-radius: 0.5rem; padding: 0.5rem 0.75rem; width: 100%;
}
input[type="checkbox"] { accent-color: var(--accent); }

@media (max-width: 640px) {
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.5rem; }
}

/* === Progress page === */
.progress-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.progress-hero img,
.progress-hero video {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.progress-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 14, 20, 0.95) 0%, rgba(11, 14, 20, 0.2) 55%);
}

.progress-hero-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.1rem 1.15rem;
}

.progress-hero-top {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
}

.progress-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.btn-leave-challenge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.btn-leave-challenge img {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 520px) {
  .progress-stats { grid-template-columns: repeat(4, 1fr); }
}

.progress-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.9rem;
}

.progress-stat__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.progress-stat__value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.progress-stat__sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.progress-bar-block { margin-bottom: 1.25rem; }
.progress-bar-block__row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.progress-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  margin-bottom: 1rem;
}

.progress-panel--glow {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.progress-panel__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.progress-rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.progress-rules li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.progress-rules__icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.progress-rules strong { color: var(--accent); }

.progress-grid-2 {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

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

.progress-exercise-list { list-style: none; margin: 0; padding: 0; }
.progress-exercise-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.progress-exercise-list li:last-child { border: 0; padding-bottom: 0; }

.progress-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.progress-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.tab-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn.tab-active {
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
  border-color: var(--border-accent);
}

.tab-btn.tab-inactive:hover { color: var(--text-primary); }

.progress-chart-wrap { height: 260px; margin-top: 0.5rem; }

.card-flush { padding: 0; overflow: hidden; }

.progress-link-row { margin-bottom: 1rem; font-size: 0.875rem; }

/* === Admin wizard === */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.wizard-step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.wizard-step__num {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
}

.wizard-step.is-current {
  border-color: var(--border-accent);
  color: var(--accent);
  background: rgba(0, 229, 160, 0.08);
}

.wizard-step.is-current .wizard-step__num {
  background: var(--accent);
  color: var(--bg-app);
}

.wizard-step.is-done {
  color: var(--text-primary);
}

.wizard-step.is-upcoming { opacity: 0.65; }

span.wizard-step {
  cursor: default;
  text-decoration: none;
}

.wizard-steps--complete .wizard-step.is-done {
  border-color: rgba(0, 229, 160, 0.2);
}

.wizard-shell {
  max-width: 42rem;
  margin: 0 auto;
}

.wizard-shell--wide {
  max-width: none;
}

.wizard-step__sep {
  width: 1.25rem;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.wizard-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.wizard-page-head__title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
}

.wizard-page-head__sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.wizard-page-head__meta {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.wizard-lead {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(0, 229, 160, 0.06);
  border: 1px solid var(--border-accent);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.wizard-step2-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .wizard-step2-grid {
    grid-template-columns: 1fr min(320px, 32%);
    align-items: start;
  }
}

.wizard-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wizard-panel__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.wizard-panel__badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
}

.wizard-cover-preview {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 0.5rem;
  display: block;
}

.wizard-cover-placeholder {
  height: 100px;
  border-radius: 0.5rem;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.exercise-admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.exercise-admin-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
  transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.exercise-admin-card.is-dragging {
  opacity: 0.55;
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.exercise-admin-card.is-drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 229, 160, 0.35);
}

.exercise-admin-card__drag {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.exercise-admin-card__drag--inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0.1rem 0.35rem;
  vertical-align: middle;
  cursor: default;
}

.exercise-admin-card__drag:active {
  cursor: grabbing;
}

.exercise-reorder-status {
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--accent);
}

.exercise-reorder-status.is-error {
  color: var(--error);
}

.exercise-admin-card__num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.exercise-admin-card__body { flex: 1; min-width: 0; }

.exercise-admin-card__name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.exercise-admin-card__desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.exercise-admin-card__meta {
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.exercise-admin-card__hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.exercise-admin-card__tag {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0.25rem;
  background: rgba(0, 229, 160, 0.1);
  color: var(--accent);
}

.exercise-admin-card__tag--warn {
  background: rgba(255, 107, 107, 0.12);
  color: var(--error);
}

.exercise-admin-card__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.wizard-empty {
  text-align: center;
  padding: 2rem 1rem;
}

.wizard-empty__title {
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.35rem;
}

.wizard-empty__text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.wizard-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.wizard-footer__back {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.wizard-footer__back:hover { color: var(--accent); }

.form-section {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.form-section:first-of-type { padding-top: 0; }

.form-section:last-of-type { border-bottom: none; }

.form-section__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text-primary);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 0.65rem;
}

.form-footnote {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.participant-preview {
  border-color: var(--border-accent);
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.06), rgba(124, 92, 255, 0.04));
}

.participant-preview__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.participant-preview__name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.participant-preview__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.participant-preview__desc {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  white-space: pre-wrap;
}

.exercise-description {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.exercise-description--compact {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.exercise-description p {
  margin: 0 0 0.35rem;
}

.exercise-description p:last-child {
  margin-bottom: 0;
}

.w-full { width: 100%; }

/* Wizard step 1–4 shared */
.wizard-form-card { padding: 1.25rem 1.35rem; }

.wizard-fields-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .wizard-fields-grid { grid-template-columns: repeat(3, 1fr); }
  .wizard-fields-grid--2 { grid-template-columns: repeat(2, 1fr); }
}

.wizard-check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
  margin-bottom: 0.65rem;
}

.wizard-check-row--inline {
  display: inline-flex;
  margin-right: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.65rem;
}

.wizard-check-row input { margin-top: 0.2rem; flex-shrink: 0; }

.wizard-check-row__hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.15rem;
}

.wizard-lead--success {
  background: rgba(0, 229, 160, 0.1);
  border-color: rgba(0, 229, 160, 0.35);
}

.wizard-done-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .wizard-done-grid { grid-template-columns: 1.2fr 1fr 1fr; }
}

.wizard-done-card { display: flex; flex-direction: column; }

.wizard-done-card--primary {
  border-color: var(--border-accent);
  background: linear-gradient(145deg, rgba(0, 229, 160, 0.08), var(--bg-card));
}

.wizard-done-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.wizard-done-links__item {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0;
}

.wizard-done-links__item:hover { color: var(--accent); }

.wizard-review-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .wizard-review-grid { grid-template-columns: 1fr 1fr; }
}

.wizard-info-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.wizard-info-list li + li { margin-top: 0.35rem; }

.wizard-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.wizard-summary-list__item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.wizard-summary-list__num {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.35rem;
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wizard-summary-list__name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.wizard-summary-list__meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
  line-height: 1.35;
}

.wizard-preview-badge {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--glow);
}

.wizard-preview-cover {
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 220px;
}

.wizard-preview-cover img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.wizard-op-rules {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.video-rules-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.video-rules-list.is-empty::before {
  content: "Правил пока нет";
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  padding: 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
}

.video-wizard-card .form-section:last-of-type { border-bottom: none; }

.video-wizard-section__head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
}

.video-wizard-section--muted {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.video-wizard-note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.video-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border-accent);
  background: linear-gradient(135deg, rgba(0, 229, 160, 0.08), rgba(124, 92, 255, 0.04));
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.video-mode-card:has(input:checked) {
  box-shadow: 0 0 0 1px rgba(0, 229, 160, 0.25);
}

.video-mode-card input {
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.video-mode-card__icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: rgba(0, 229, 160, 0.15);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.video-mode-card__body strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.video-mode-card__hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.video-rule-editor {
  padding: 1.1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.video-rule-editor__head {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.video-rule-editor__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.video-rule-editor__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.video-rule-scope__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.video-rule-scope__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.video-scope-pill {
  cursor: pointer;
}

.video-scope-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.video-scope-pill span {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.video-scope-pill input:checked + span {
  border-color: var(--border-accent);
  background: rgba(0, 229, 160, 0.12);
  color: var(--accent);
}

.video-exercise-select {
  width: 100%;
}

.video-params-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (min-width: 540px) {
  .video-params-grid { grid-template-columns: repeat(3, 1fr); }
}

.video-param label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.video-param__input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-input);
}

.video-param__input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--text-primary);
}

.video-param__unit {
  font-size: 0.78rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.video-score-row { margin-bottom: 0.75rem; }

.video-rule-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.55rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.video-rule-item__badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 0.3rem;
  background: rgba(124, 92, 255, 0.15);
  color: var(--glow);
}

.video-rule-item__text {
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.35;
}

.video-rule-item__actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.video-rule-item__actions button {
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.video-rule-item__actions button:hover {
  color: var(--accent);
  border-color: var(--border-accent);
}

.video-rule-item__actions .btn-danger:hover {
  color: var(--error);
  border-color: rgba(255, 107, 107, 0.4);
}

/* User avatar */
.user-avatar {
  position: relative;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--glow));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(0, 229, 160, 0.35);
  box-shadow: 0 0 24px rgba(0, 229, 160, 0.15);
}

.user-avatar--md { width: 2.25rem; height: 2.25rem; }
.user-avatar--lg { width: 5rem; height: 5rem; }
.user-avatar--xl { width: 7.5rem; height: 7.5rem; }

.user-avatar__letter {
  font-weight: 800;
  color: #0b0e14;
}

.user-avatar--md .user-avatar__letter { font-size: 0.95rem; }
.user-avatar--lg .user-avatar__letter { font-size: 2rem; }
.user-avatar--xl .user-avatar__letter { font-size: 2.75rem; }

.user-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar__level {
  position: absolute;
  right: -0.15rem;
  bottom: -0.15rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid rgba(255, 200, 80, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.user-avatar__level-medal {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.user-avatar--xl .user-avatar__level {
  width: 2.35rem;
  height: 2.35rem;
}

.level-medal {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.level-medal--sm { width: 1.75rem; height: 1.75rem; }
.level-medal--md { width: 2.5rem; height: 2.5rem; }
.level-medal--lg { width: 3.25rem; height: 3.25rem; flex-shrink: 0; }
.level-medal--xl { width: 4.5rem; height: 4.5rem; }

.profile-hero__desc {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  max-width: 28rem;
}

.app-header__avatar--photo { padding: 0; overflow: hidden; }
.app-header__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Profile page */
.profile-page { max-width: 42rem; margin: 0 auto; }

.profile-hero {
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(145deg, rgba(0, 229, 160, 0.08), rgba(0, 0, 0, 0.2));
  border-color: rgba(0, 229, 160, 0.2);
}

.profile-hero__top {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.profile-hero__avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.profile-avatar-form__btn {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.profile-avatar-form__btn input { display: none; }

.profile-avatar-delete {
  margin-top: 0.5rem;
  text-align: center;
}

.profile-avatar-delete__btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.profile-hero__eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.profile-hero__name {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
}

.profile-hero__rank {
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.profile-hero__op {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 0.35rem;
}

.profile-hero__next {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.profile-hero__next--max { color: var(--accent); }

.profile-hero__bar { max-width: 100%; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
}

.profile-stat {
  text-align: center;
  padding: 0.65rem 0.35rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.65rem;
  border: 1px solid var(--border);
}

.profile-stat__value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.profile-stat__label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.2;
}

.profile-hero__since {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
}

.profile-section { margin-bottom: 1.25rem; }

.profile-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.profile-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.profile-section__link {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-action {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.profile-action:hover {
  border-color: rgba(0, 229, 160, 0.35);
  background: rgba(0, 229, 160, 0.04);
}

.profile-action--admin:hover { border-color: rgba(255, 200, 100, 0.35); }

.profile-action__icon {
  font-size: 1.35rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 0.65rem;
  flex-shrink: 0;
}

.profile-action__body { flex: 1; min-width: 0; }

.profile-action__title {
  display: block;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.profile-action__desc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.profile-action__arrow {
  color: var(--text-dim);
  font-size: 1.1rem;
}

.profile-referral { padding: 1.25rem; }

.profile-referral__badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 229, 160, 0.1);
  border: 1px solid rgba(0, 229, 160, 0.25);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.profile-referral__lead {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.45;
}

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

.profile-referral__code {
  flex: 1;
  min-width: 8rem;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0.5rem;
  color: var(--accent);
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
}

.profile-referral__link {
  flex: 1;
  min-width: 10rem;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.profile-referral__meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 0.5rem 0 0;
}

.profile-badges-scroll {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.profile-badge-chip {
  flex: 0 0 auto;
  width: 5.5rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.profile-badge-chip__icon { font-size: 1.75rem; display: block; }

.profile-badge-chip__name {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.2;
}

.profile-empty-badges { padding: 1.25rem; text-align: center; }

.profile-logout {
  text-align: center;
  margin: 1.5rem 0 0.5rem;
}

.profile-logout a {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-decoration: none;
}

.profile-logout a:hover { color: var(--text-muted); }
