﻿:root {
  --bg: #060708;
  --surface: #111317;
  --surface-2: #171b21;
  --border: #2a313b;
  --text: #f3f7fb;
  --muted: #97a0ab;
  --green: #36d54f;
  --blue: #4b93ff;
  --red: #dc4040;
}

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

html, body {
  margin: 0;
  touch-action: manipulation;
  overscroll-behavior: contain;
  background: radial-gradient(120% 80% at 50% 0%, #141921, var(--bg));
  color: var(--text);
  font-family: "Rubik", "Segoe UI", Tahoma, sans-serif;
}

input, textarea, select { font-size: 16px; }

.app-shell { max-width: 430px; min-height: 100vh; margin: 0 auto; padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.content { padding: 10px; }
.panel { display: none; }
.panel.active { display: block; animation: panel-fade .22s ease; }

@keyframes panel-fade {
  from { opacity: 0; transform: translateY(6px) scale(.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero {
  background: linear-gradient(105deg, #0f7d2a 0%, #16222b 55%, #0b0d11 100%);
  border: 1px solid #24422e;
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
}
.hero h1 { margin: 0 0 8px; font-size: 28px; font-weight: 800; }
.status-line { display: flex; gap: 6px; margin-bottom: 8px; }
.status-pill { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.15); border-radius: 8px; padding: 3px 7px; font-size: 12px; }
.profile-mini { margin: 0; color: #e1f8e3; font-size: 12px; }
.hero-photo-wrap { display: grid; place-items: center; }
.hero-photo {
  width: 120px;
  height: 120px;
  border-radius: 18px;
  border: 2px solid #48ff71;
  box-shadow: 0 0 20px rgba(54, 213, 79, .35);
  background: #121416 center/cover no-repeat;
}

.workout-cta { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; background: #10141a; border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.section-title { text-transform: uppercase; font-size: 13px; letter-spacing: .6px; color: #c8d0d8; margin: 14px 0 9px; }
.search-wrap { display: grid; grid-template-columns: 1fr 44px; gap: 8px; margin-bottom: 10px; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filter-row select { background: #10141a; border: 1px solid #2a3340; color: #e8eef5; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #0f1318;
  color: var(--text);
  font-family: inherit;
}

.card-stack { display: grid; gap: 8px; }

.exercise-card {
  display: grid;
  grid-template-columns: 72px 1fr 44px;
  gap: 10px;
  align-items: center;
  background: linear-gradient(160deg, #171b21, #11151a);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
}

.exercise-card img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #ececec; }
.exercise-title { margin: 0; font-size: 16px; line-height: 1.2; }
.muted { color: var(--muted); }
.btn-danger { border: 1px solid #7a3030; background: #4f1d1d; color: #ffd4d4; border-radius: 10px; padding: 8px 10px; font-weight: 700; }

.exercise-card.card-added {
  animation: card-added .42s ease;
}
.exercise-card.card-removed {
  animation: card-removed .42s ease;
}
@keyframes card-added {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(54,213,79,0); }
  45% { transform: scale(1.02); box-shadow: 0 0 0 2px rgba(54,213,79,.35), 0 0 18px rgba(54,213,79,.3); }
  100% { transform: scale(1); box-shadow: none; }
}
@keyframes card-removed {
  0% { transform: translateX(0); box-shadow: none; }
  30% { transform: translateX(-3px); box-shadow: 0 0 0 2px rgba(220,64,64,.22), 0 0 14px rgba(220,64,64,.24); }
  60% { transform: translateX(3px); }
  100% { transform: translateX(0); box-shadow: none; }
}

.plus-round {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #2faa45;
  background: #154724;
  color: #95ffac;
  display: grid;
  place-items: center;
}
.plus-round.remove { border-color: #9e2c2c; background: #4b1717; color: #ff8c8c; }

.training-head { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 10px; }

.circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #131820;
  color: var(--text);
  display: grid;
  place-items: center;
}

.exercise-view { background: linear-gradient(160deg, #15191e, #101419); border: 1px solid var(--border); border-radius: 14px; padding: 10px; }
.exercise-view.empty { text-align: center; color: var(--muted); }
.exercise-media { width: 100%; height: 185px; object-fit: contain; border-radius: 12px; background: #ececec; }
.gallery-wrap { position: relative; }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #2b3542;
  background: rgba(8, 12, 18, 0.75);
  color: #dbe7f6;
  display: grid;
  place-items: center;
}
.gallery-nav.left { left: 8px; }
.gallery-nav.right { right: 8px; }
.gallery-dots { margin-top: 6px; display: flex; justify-content: center; gap: 6px; }
.gallery-dots span { width: 6px; height: 6px; border-radius: 50%; background: #4f5965; }
.gallery-dots span.active { background: #7cc9ff; }
.exercise-name { margin: 10px 0 8px; font-size: 28px; font-weight: 700; }
.exercise-name i { color: var(--green); margin-right: 7px; }

.set-row { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 6px; margin-top: 6px; }

.ghost-btn, .icon-btn, .primary-btn, .goal-btn, .history-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 600;
}
.primary-btn { background: var(--green); color: #031105; border-color: transparent; }
.done-btn {
  border: 1px solid #3a4655;
  background: linear-gradient(180deg, #1a2230, #111923);
  color: #ffffff;
  border-radius: 10px;
  padding: 9px 10px;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(141, 245, 160, 0.35);
  box-shadow: inset 0 0 0 1px rgba(141, 245, 160, 0.2);
}
.done-btn i {
  color: #8df5a0;
  filter: drop-shadow(0 0 4px rgba(141, 245, 160, 0.6));
}

.builder-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
textarea { margin-top: 8px; min-height: 72px; }
.training-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

.done-card { margin-top: 10px; background: linear-gradient(160deg, #161b21, #11151a); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.done-icon { font-size: 48px; color: var(--green); }
.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hidden { display: none !important; }

.calendar-head { display: grid; grid-template-columns: 34px 1fr 34px; gap: 8px; align-items: center; text-align: center; margin: 6px 0; }
#monthTitle { font-size: 24px; font-weight: 700; }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays span { text-align: center; color: var(--muted); font-size: 11px; }

.day-cell {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #11151a;
  color: #a5afb8;
  display: grid;
  place-items: center;
  font-weight: 600;
  position: relative;
}
.day-cell.empty { visibility: hidden; }
.day-cell.has-workout { border-color: #2a6bff; background: linear-gradient(180deg, #111726, #11141a); color: #eaf0ff; }
.day-cell.has-workout::after {
  content: "\f44b";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 11px;
  color: var(--green);
}
.day-cell.selected { background: #f1f3f6; color: #0d1115; }

.workout-day-card { background: linear-gradient(160deg, #161b21, #11151a); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.day-card-head { display: grid; grid-template-columns: 42px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.day-card-head img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: #ececec; }
.day-card-head strong { font-size: 14px; }
.day-set-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: #15191f; border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; overflow: hidden; }
.day-set-row div { padding: 10px; }
.day-set-row div + div { border-left: 1px solid #29313b; }

.profile-hero, .kcal-card, .profile-form { background: linear-gradient(160deg, #161b21, #11151a); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.profile-hero { text-align: center; margin-bottom: 10px; }
.strength-card { background: linear-gradient(160deg, #171d24, #0f141a); border: 1px solid #2b3340; border-radius: 12px; padding: 10px; margin-top: 10px; }
.strength-title { font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.strength-title i { color: #56d5ff; }
.strength-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.strength-kpi { background: #10151c; border: 1px solid #2a3340; border-radius: 10px; padding: 8px; text-align: center; }
.strength-kpi strong { display: block; font-size: 22px; line-height: 1; margin-bottom: 3px; }
.strength-kpi span { color: #9fb0c2; font-size: 12px; }
.strength-list { display: grid; gap: 6px; }
.strength-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; background: #10151c; border: 1px solid #2a3340; border-radius: 10px; padding: 8px; }
.strength-row strong { display: block; font-size: 14px; }
.strength-row .muted { font-size: 12px; }
.delta-up { color: #5af37a; font-weight: 700; }
.delta-down { color: #ff7474; font-weight: 700; }
.delta-flat { color: #a8b5c4; font-weight: 700; }
.avatar { width: 86px; height: 86px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; font-size: 32px; font-weight: 700; background: linear-gradient(135deg, #39414a, #242b33); }
.avatar.photo { background-size: cover; background-position: center; color: transparent; }

.kcal-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.weight-badge {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 14px;
  border: 1px solid #344052;
  background: linear-gradient(180deg, #0f1520, #0e1218);
  position: relative;
  overflow: hidden;
}
.weight-badge::after {
  content: "||||||||";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  letter-spacing: 1px;
  font-size: 10px;
  color: #6f7f93;
}
.weight-badge span {
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 700;
  line-height: 1;
  max-width: 100%;
  white-space: nowrap;
}
.weight-badge small { color: var(--muted); margin-top: -6px; z-index: 1; }

.kcal-gauge-wrap { display: grid; place-items: center; margin-top: 2px; }
.kcal-gauge {
  width: 260px;
  height: 130px;
  border-top-left-radius: 260px;
  border-top-right-radius: 260px;
  overflow: hidden;
  position: relative;
  background: conic-gradient(from 180deg, #f2f3f5 0 26%, #f25c05 26% 31%, var(--blue) 31% 100%);
}
.kcal-gauge::before {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  top: 15px;
  bottom: 0;
  border-top-left-radius: 260px;
  border-top-right-radius: 260px;
  background: #11151a;
}
.kcal-center { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); text-align: center; }
.kcal-center #kcalValue { font-size: 64px; line-height: 1; font-weight: 700; }
.kcal-center small { color: var(--muted); }
.macro-row { margin-top: 8px; color: #e4eaf1; font-size: 18px; line-height: 1.1; }

.goal-switch { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin-top: 6px; }
.goal-btn.active { background: #2a3039; }

.timer-bar {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(430px,100%);
  background: rgba(7,9,11,.96);
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 8px;
  align-items: center;
  transition: transform .25s ease, opacity .2s ease;
}
#timerText { font-size: 40px; font-weight: 700; line-height: 1; }
.start-btn { border: 0; border-radius: 999px; padding: 8px 14px; background: var(--green); color: #041106; font-weight: 700; }

.bottom-nav {
  --glass-reflex-dark: 1.8;
  --glass-reflex-light: 1;
  --saturation: 160%;
  --slot-size: calc((100% - 8px) / 5);
  --toggle-height: calc(100% - 10px);
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(430px, calc(100% - 10px));
  background: color-mix(in srgb, #4f5866 18%, rgba(7, 10, 14, 0.78));
  backdrop-filter: blur(8px) url(#liquidGlassDistortion) saturate(var(--saturation));
  -webkit-backdrop-filter: blur(8px) saturate(var(--saturation));
  display: grid;
  grid-template-columns: repeat(5,1fr);
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  border: 1px solid rgba(238, 248, 255, 0.12);
  border-top: 1px solid rgba(238, 248, 255, 0.16);
  border-radius: 18px 18px 0 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 1.8px 3px 0 -2px rgba(255, 255, 255, 0.18),
    inset -2px -2px 0 -2px rgba(255, 255, 255, 0.16),
    inset -0.3px -1px 4px 0 rgba(0, 0, 0, 0.2),
    0 6px 16px 0 rgba(0, 0, 0, 0.34);
  transition: transform .25s ease, opacity .2s ease;
  overflow: hidden;
}
.bottom-nav::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: var(--slot-size);
  height: var(--toggle-height);
  border-radius: 99em;
  background-color: color-mix(in srgb, #d4dde8 20%, transparent);
  z-index: 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 2px 1px 0 -1px rgba(255, 255, 255, 0.24),
    inset -1.5px -1px 0 -1px rgba(255, 255, 255, 0.2),
    inset -1px 2px 3px -1px rgba(0, 0, 0, 0.2),
    inset 0 -4px 1px -2px rgba(0, 0, 0, 0.16),
    0 3px 6px 0 rgba(0, 0, 0, 0.2);
  transition:
    background-color 400ms cubic-bezier(1, 0, 0.4, 1),
    box-shadow 400ms cubic-bezier(1, 0, 0.4, 1),
    transform 400ms cubic-bezier(1, 0, 0.4, 1),
    opacity 200ms ease;
  transform: translateX(var(--nav-toggle-x, 0px));
}

.bottom-nav.hidden-nav,
.timer-bar.hidden-nav {
  transform: translate(-50%, 120%);
  opacity: 0;
}

.nav-btn {
  border: none;
  background: transparent;
  color: #c4ccd6;
  display: grid;
  justify-items: center;
  align-content: center;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 12px;
  transition: color .2s ease;
  z-index: 1;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  min-height: 48px;
}
.nav-btn span {
  white-space: nowrap;
  font-size: 11px;
  line-height: 1;
  display: block;
  text-align: center;
}
.nav-btn i { font-size: 16px; transition: scale .2s cubic-bezier(.5, 0, 0, 1); }
.nav-btn.active:not(.center) {
  color: #ffffff;
  font-weight: 700;
}
.nav-btn > i,
.nav-btn > span {
  position: relative;
  z-index: 1;
}
.nav-btn:not(.active):not(.center):hover i { scale: 1.15; }
.nav-btn.center i { width: 34px; height: 34px; border-radius: 50%; background: #1a3a21; border: 1px solid #2bac44; color: #58f173; display: grid; place-items: center; }
.nav-btn.center.active i {
  box-shadow:
    0 0 0 1px rgba(88, 241, 115, 0.35),
    0 0 14px rgba(88, 241, 115, 0.6),
    0 0 22px rgba(88, 241, 115, 0.38);
}
.nav-btn.center span { display: none; }

.bottom-nav.toggle-left::after { transform-origin: left; }
.bottom-nav.toggle-right::after { transform-origin: right; }
.bottom-nav.toggle-pop::after { animation: scaleToggle2 420ms ease; }

.liquid-filter {
  width: 0;
  height: 0;
  position: absolute;
}

.bottom-nav.hidden-nav::after,
.bottom-nav.center-active::after {
  opacity: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-card {
  position: relative;
  width: min(430px, calc(100% - 20px));
  max-height: calc(100vh - 20px);
  overflow: auto;
  background: #10151c;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 14px;
  z-index: 1;
  animation: slide-up .2s ease;
}
.modal-card img { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; background: #ececec; }
.modal-card h3 { margin: 10px 0 6px; }
.modal-close { position: absolute; right: 10px; top: 10px; }

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.achievement-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(160deg, #161b21, #11151a);
  padding: 8px;
  min-height: 88px;
  display: grid;
  gap: 6px;
  justify-items: center;
  align-content: center;
  text-align: center;
}
.achievement-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #25313d;
  color: #95a6ba;
}
.achievement-tile.unlocked .achievement-icon {
  background: #1f4f2b;
  color: #82f39a;
  box-shadow: 0 0 12px rgba(54, 213, 79, 0.4);
}
.achievement-title-short {
  font-size: 12px;
  line-height: 1.2;
  color: #ffffff;
}

.achievement-big-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #25313d;
  color: #95a6ba;
  font-size: 28px;
}
.achievement-modal-card.unlocked .achievement-big-icon {
  background: #1f4f2b;
  color: #82f39a;
  box-shadow: 0 0 14px rgba(54, 213, 79, 0.45);
}

@keyframes slide-up {
  from { transform: translateY(18px); opacity: .4; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes scaleToggle {
  0% { scale: 1 1; }
  50% { scale: 1.1 1; }
  100% { scale: 1 1; }
}

@keyframes scaleToggle2 {
  0% { scale: 1 1; }
  50% { scale: 1.2 1; }
  100% { scale: 1 1; }
}

@keyframes scaleToggle3 {
  0% { scale: 1 1; }
  50% { scale: 1.1 1; }
  100% { scale: 1 1; }
}

@media (max-width: 360px) {
  .hero { grid-template-columns: 1fr; }
  .hero-photo-wrap { justify-content: start; }
  .hero-photo { width: 100px; height: 100px; }
}
