/*
 * Brutal Fit — Sprint V4 Visual Identity
 * Camada exclusivamente visual. Onboarding e comportamento permanecem intactos.
 */

:root {
  --bf-black: #050505;
  --bf-graphite-1: #0b0c0e;
  --bf-graphite-2: #111215;
  --bf-graphite-3: #18191d;
  --bf-steel: #25272c;
  --bf-line: rgba(255, 255, 255, 0.11);
  --bf-line-strong: rgba(255, 255, 255, 0.18);
  --bf-white: #f5f6f7;
  --bf-soft: #b2b5bb;
  --bf-dim: #777b83;
  --bf-red: #e50914;
  --bf-red-dark: #8e0008;
  --bf-red-soft: #ff656d;
  --bf-green: #43d58a;
  --bf-amber: #e8a53a;
  --bf-radius-s: 10px;
  --bf-radius-m: 16px;
  --bf-radius-l: 22px;
  --bf-gap-1: 6px;
  --bf-gap-2: 10px;
  --bf-gap-3: 14px;
  --bf-gap-4: 18px;
  --bf-gap-5: 24px;
  --bf-module-shadow:
    0 20px 52px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

/* Commercial shell — activated only after onboarding. */

body:has(.screen.active:not(#onboarding)) .app {
  position: relative;
  max-width: 960px;
  padding-inline: clamp(14px, 3vw, 28px);
}

body:has(.screen.active:not(#onboarding)) .app::before {
  display: none;
}

:where(#home, #workout, #evolution, #nutrition, #profile) {
  color: var(--bf-white);
}

:where(#home, #workout, #evolution, #nutrition, #profile) > .topbar {
  min-height: 58px;
  margin-bottom: var(--bf-gap-5);
  padding-bottom: var(--bf-gap-3);
  border-bottom: 1px solid var(--bf-line);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .brand {
  gap: 12px;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .brand-logo {
  width: 50px;
  height: 50px;
  border-radius: var(--bf-radius-s);
  border-color: rgba(229, 9, 20, 0.62);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 10px 28px rgba(0, 0, 0, 0.44);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .brand b {
  font-size: 0.875rem;
  letter-spacing: 0.055em;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .brand small {
  color: var(--bf-dim);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}

/* Type system: telemetry labels and dominant readings. */

:where(#home, #workout, #evolution, #nutrition, #profile) .screen-title {
  margin: var(--bf-gap-3) 0 var(--bf-gap-4);
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  line-height: 0.88;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

:where(#home, #workout, #evolution, #nutrition, #profile)
  :where(.kicker, .section-label small, .exercise-type, .comparison-table th) {
  color: var(--bf-red-soft);
  font-size: 0.625rem;
  font-weight: 900;
  line-height: 1.35;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .muted {
  color: var(--bf-soft);
  line-height: 1.55;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .section-label {
  min-height: 34px;
  margin: 28px 2px 10px;
  gap: var(--bf-gap-3);
  border-bottom: 1px solid var(--bf-line);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .section-label h3 {
  margin-bottom: 10px;
  font-size: 0.875rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

/* Hardware modules. */

:where(#home, #workout, #evolution, #nutrition, #profile)
  :where(.card, .metric, .bio-snapshot, .mini-chart, .insight) {
  position: relative;
  border: 1px solid var(--bf-line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 36%),
    linear-gradient(180deg, var(--bf-graphite-2), var(--bf-graphite-1));
  box-shadow: var(--bf-module-shadow);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .card {
  isolation: isolate;
  overflow: hidden;
  margin-top: var(--bf-gap-3);
  padding: clamp(17px, 2.4vw, 24px);
  border-radius: var(--bf-radius-l);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .card::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  left: 24px;
  width: 42px;
  height: 2px;
  background: var(--bf-red);
  box-shadow: 0 0 14px rgba(229, 9, 20, 0.24);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .card::after {
  display: none;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .card > :first-child {
  margin-top: 0;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .card h2 {
  margin: var(--bf-gap-1) 0 var(--bf-gap-2);
  color: var(--bf-white);
  font-size: clamp(1.25rem, 3vw, 1.625rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .grid-2 {
  gap: var(--bf-gap-3);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .metric {
  min-width: 0;
  overflow: hidden;
  padding: var(--bf-gap-4);
  border-radius: var(--bf-radius-m);
}

:where(#home, #workout, #evolution, #nutrition, #profile) .metric::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 11px;
  width: 18px;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--bf-dim) 0 2px, transparent 2px 5px);
  opacity: 0.45;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .metric small {
  display: block;
  margin-bottom: 12px;
  color: var(--bf-dim);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.4;
  text-transform: uppercase;
}

:where(#home, #workout, #evolution, #nutrition, #profile) .metric strong {
  color: var(--bf-white);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

/* Home: asymmetric performance cockpit. */

#home .hero {
  min-height: 430px;
  border: 1px solid var(--bf-line-strong);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(4, 4, 5, 0.96) 0%, rgba(4, 4, 5, 0.63) 56%, rgba(4, 4, 5, 0.3)),
    linear-gradient(180deg, transparent 48%, rgba(0, 0, 0, 0.85)),
    url("../../brutal-bg.png") center/cover;
  box-shadow:
    0 28px 72px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

#home .hero::before {
  content: "";
  position: absolute;
  inset: 16px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 19px;
  clip-path: polygon(0 0, 34% 0, 34% 1px, 100% 1px, 100% 100%, 66% 100%, 66% calc(100% - 1px), 0 calc(100% - 1px));
}

#home .hero::after {
  right: -100px;
  top: -120px;
  width: 380px;
  height: 380px;
  opacity: 0.72;
  filter: none;
}

#home .hero-content {
  width: min(100%, 590px);
}

#home .hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

#home .hero .kicker::before {
  content: "";
  width: 20px;
  height: 2px;
  background: var(--bf-red);
}

#home .hero h1 {
  max-width: 8ch;
  margin: 15px 0;
  font-size: clamp(3.25rem, 9vw, 5rem);
  line-height: 0.82;
  letter-spacing: -0.07em;
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.52);
}

#home .hero p {
  max-width: 45ch;
  color: #d4d6d9;
  font-size: 0.9375rem;
}

#home .chips {
  gap: 7px;
  margin-top: var(--bf-gap-4);
}

#home .chip,
:where(#workout, #evolution, #nutrition, #profile) :where(.chip, .plan-pill) {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-radius-s);
  background: rgba(4, 4, 5, 0.72);
  color: #d8dade;
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.015em;
}

#home .hero .primary {
  min-width: 184px;
  margin-top: var(--bf-gap-5) !important;
}

#home > .card:not(:last-of-type) {
  min-height: 164px;
}

#home #lostWeight {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
}

#home #journeyPercent {
  color: var(--bf-white);
  font-size: clamp(2rem, 5vw, 3rem) !important;
  letter-spacing: -0.06em;
}

#home #weekCount,
#home #streak {
  font-size: clamp(2.15rem, 5vw, 3rem);
}

#home #weightLine,
#home #coachMessage {
  color: var(--bf-soft);
  line-height: 1.55;
}

#home #coachMessage {
  border-left-width: 2px;
  background:
    linear-gradient(90deg, rgba(229, 9, 20, 0.09), transparent 70%),
    var(--bf-graphite-1);
}

/* Instrument bars and data flags. */

:where(#home, #nutrition) .progress {
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, transparent 0 9%, rgba(255, 255, 255, 0.055) 9% 10%),
    var(--bf-steel);
}

:where(#home, #nutrition) .progress span {
  border-radius: 1px;
  background: linear-gradient(90deg, var(--bf-red-dark), var(--bf-red), #ff454e);
}

:where(#home, #nutrition) .progress.green span {
  background: linear-gradient(90deg, #176744, var(--bf-green));
}

:where(#home, #nutrition) .mission-line {
  padding-block: var(--bf-gap-3);
}

:where(#home, #nutrition) .mission-line .row span {
  color: var(--bf-soft);
  font-size: 0.75rem;
}

:where(#home, #nutrition) .mission-line .row b {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

:where(#home, #nutrition) .remaining {
  margin-top: 7px;
  color: var(--bf-dim);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}

/* Buttons: machined primary, restrained secondary. */

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal,
    #celebration
  )
  :where(.primary, .secondary, .danger) {
  min-height: 52px;
  padding-inline: 20px;
  border-radius: var(--bf-radius-s);
  font-size: 0.75rem;
  font-weight: 950;
  line-height: 1.2;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal,
    #celebration
  )
  .primary {
  border: 1px solid #ff303a;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(135deg, var(--bf-red), #ad0009);
  color: #fff;
  box-shadow:
    0 12px 28px rgba(229, 9, 20, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal,
    #celebration
  )
  .secondary {
  border: 1px solid var(--bf-line-strong);
  background: linear-gradient(180deg, #1b1c20, #111216);
  color: #e5e6e8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 8px 18px rgba(0, 0, 0, 0.2);
}

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal,
    #celebration
  )
  .danger {
  border: 1px solid rgba(229, 9, 20, 0.44);
  background: #170b0d;
  color: #ff8e94;
  box-shadow: inset 3px 0 0 rgba(229, 9, 20, 0.72);
}

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal,
    #celebration
  )
  button:disabled {
  cursor: not-allowed;
  border-color: var(--bf-line);
  opacity: 0.42;
  filter: grayscale(0.45);
  box-shadow: none;
}

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal
  )
  .icon-btn {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--bf-line-strong);
  border-radius: var(--bf-radius-s);
  background: linear-gradient(145deg, var(--bf-graphite-3), var(--bf-graphite-1));
  color: var(--bf-white);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 20px rgba(0, 0, 0, 0.26);
}

:where(
    #home,
    #workout,
    #evolution,
    #nutrition,
    #profile,
    #foodModal,
    #bioModal,
    #celebration,
    #mainNav
  )
  button:focus-visible,
:where(#workout, #nutrition, #profile, #foodModal, #bioModal)
  :where(input, select, textarea):focus-visible {
  outline: 2px solid #ff6c73;
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  :where(
      #home,
      #workout,
      #evolution,
      #nutrition,
      #profile,
      #foodModal,
      #bioModal,
      #celebration
    )
    .primary:not(:disabled):hover {
    border-color: #ff5b63;
    box-shadow:
      0 16px 34px rgba(229, 9, 20, 0.27),
      inset 0 1px 0 rgba(255, 255, 255, 0.24);
  }

  :where(
      #home,
      #workout,
      #evolution,
      #nutrition,
      #profile,
      #foodModal,
      #bioModal,
      #celebration
    )
    .secondary:not(:disabled):hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(180deg, #222329, #15161a);
  }
}

/* Inputs and set controls. */

:where(#workout, #nutrition, #profile, #foodModal, #bioModal)
  :where(.field, input:not([type="file"]), select, textarea) {
  min-height: 50px;
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-radius-s);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent),
    #090a0c;
  color: var(--bf-white);
  line-height: 1.35;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.28);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

:where(#workout, #nutrition, #profile, #foodModal, #bioModal)
  :where(.field, input:not([type="file"]), select, textarea):focus {
  border-color: rgba(255, 82, 91, 0.78);
  outline: none;
  background-color: #101115;
  box-shadow:
    0 0 0 3px rgba(229, 9, 20, 0.11),
    inset 0 2px 5px rgba(0, 0, 0, 0.22);
}

:where(#workout, #nutrition, #profile, #foodModal, #bioModal)
  :where(input, textarea)::placeholder {
  color: #656971;
  opacity: 1;
}

/* Workout: session console. */

#workout .plan-pill {
  min-height: 34px;
  border-radius: var(--bf-radius-s);
}

#workout #exerciseList {
  padding-block: 10px;
}

#workout .exercise {
  padding: 18px 8px;
  border-bottom-color: var(--bf-line);
}

#workout .exercise-head {
  gap: var(--bf-gap-3);
}

#workout .exercise-index {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(229, 9, 20, 0.32);
  border-radius: var(--bf-radius-s);
  background:
    linear-gradient(145deg, rgba(229, 9, 20, 0.13), transparent),
    var(--bf-graphite-2);
  color: var(--bf-red-soft);
  font-variant-numeric: tabular-nums;
}

#workout .exercise-head button,
#workout .check {
  min-width: 44px;
  min-height: 44px;
  border-color: var(--bf-line);
  border-radius: var(--bf-radius-s);
}

#workout .set-row {
  gap: var(--bf-gap-2);
  margin-top: var(--bf-gap-2);
}

#workout .check.done {
  border-color: #ff353e;
  background: var(--bf-red);
  box-shadow: 0 6px 18px rgba(229, 9, 20, 0.2);
}

/* Evolution: score and body telemetry. */

#evolution .evolution-hero {
  min-height: 190px;
  border-color: var(--bf-line-strong);
  background:
    linear-gradient(100deg, rgba(229, 9, 20, 0.08), transparent 42%),
    linear-gradient(145deg, var(--bf-graphite-3), var(--bf-graphite-1));
}

#evolution .evolution-hero h2 {
  max-width: 17ch;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
}

#evolution .score-ring {
  width: 128px;
  height: 128px;
  flex-basis: 128px;
  border: 1px solid var(--bf-line-strong);
  background:
    radial-gradient(circle at center, #0b0c0e 55%, transparent 57%),
    conic-gradient(var(--bf-red) calc(var(--score) * 1%), var(--bf-steel) 0);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.34),
    inset 0 0 0 5px rgba(0, 0, 0, 0.24);
}

#evolution .score-ring strong {
  font-size: 2.25rem;
  letter-spacing: -0.07em;
}

#evolution :where(.bio-snapshot, .mini-chart, .insight) {
  border-radius: var(--bf-radius-m);
}

#evolution .bio-timeline {
  gap: var(--bf-gap-3);
  padding: var(--bf-gap-2) 1px var(--bf-gap-1);
}

#evolution .bio-snapshot {
  min-width: 220px;
  padding: var(--bf-gap-4);
}

#evolution .bio-snapshot.latest {
  border-color: rgba(229, 9, 20, 0.46);
  box-shadow:
    var(--bf-module-shadow),
    inset 3px 0 0 rgba(229, 9, 20, 0.7);
}

#evolution .bio-mini-grid span {
  color: var(--bf-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#evolution .bio-mini-grid b {
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

#evolution .comparison-table th,
#evolution .comparison-table td {
  padding: var(--bf-gap-3) var(--bf-gap-2);
  border-bottom-color: var(--bf-line);
  font-variant-numeric: tabular-nums;
}

#evolution .mini-chart {
  padding: var(--bf-gap-4);
}

#evolution .insight {
  padding: var(--bf-gap-3);
}

#evolution .insight-icon {
  border: 1px solid rgba(229, 9, 20, 0.18);
  background: #1a1012;
}

:where(#evolution, #nutrition) .badge {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(229, 9, 20, 0.32);
  border-radius: 6px;
  background: #1a0d0f;
  color: var(--bf-red-soft);
  font-size: 0.625rem;
  font-weight: 850;
  letter-spacing: 0.055em;
}

/* Nutrition: mission-control presentation. */

#nutrition .ai-cta,
#home .ai-cta {
  min-height: 84px;
  border: 1px solid rgba(229, 9, 20, 0.32);
  border-radius: var(--bf-radius-m);
  background:
    linear-gradient(100deg, rgba(229, 9, 20, 0.12), transparent 48%),
    linear-gradient(180deg, var(--bf-graphite-2), var(--bf-graphite-1));
  box-shadow: var(--bf-module-shadow);
}

:where(#nutrition, #home) .ai-icon {
  width: 50px;
  height: 50px;
  flex-basis: 50px;
  border: 1px solid #ff3f48;
  border-radius: var(--bf-radius-s);
  background: linear-gradient(145deg, #ed1822, #960008);
  box-shadow: 0 10px 24px rgba(229, 9, 20, 0.18);
}

#nutrition .meal {
  gap: var(--bf-gap-3);
  padding-block: var(--bf-gap-3);
  border-bottom-color: var(--bf-line);
}

#nutrition .meal img {
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-radius-s);
}

#nutrition .macro {
  color: var(--bf-dim);
  line-height: 1.45;
}

#nutrition .ai-status {
  border-color: var(--bf-line);
  border-radius: var(--bf-radius-s);
  background: #0c0d10;
}

/* Profile: technical dossier. */

#profile .assessment-row {
  min-height: 48px;
  align-items: center;
  padding-block: 12px;
  border-bottom-color: var(--bf-line);
}

#profile .assessment-row .muted {
  color: var(--bf-dim);
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

#profile .assessment-row b {
  max-width: 62%;
  line-height: 1.4;
}

#profile .profile-actions {
  gap: var(--bf-gap-2);
}

/* Modal workspace. */

:where(#foodModal, #bioModal) {
  background:
    radial-gradient(circle at 50% 0, rgba(229, 9, 20, 0.08), transparent 34%),
    rgba(3, 3, 4, 0.96) !important;
}

:where(#foodModal, #bioModal) > div {
  padding-block: 8px 28px;
}

:where(#foodModal, #bioModal) > div > .card {
  padding: var(--bf-gap-5);
  border: 1px solid var(--bf-line-strong);
  border-radius: var(--bf-radius-l);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 34%),
    var(--bf-graphite-1);
  box-shadow: 0 28px 76px rgba(0, 0, 0, 0.6);
}

:where(#foodModal, #bioModal) .camera-box {
  border-color: var(--bf-line-strong);
  border-radius: var(--bf-radius-l);
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, 0.018) 23px 24px),
    #090a0c;
}

:where(#foodModal, #bioModal) .photo-actions,
#profile .profile-actions {
  gap: var(--bf-gap-2);
}

/* Integrated system navigation. */

#mainNav {
  min-height: calc(74px + var(--safe));
  gap: 5px;
  padding: 9px 12px calc(9px + var(--safe));
  border: 1px solid var(--bf-line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 42%),
    rgba(8, 9, 11, 0.97);
  box-shadow:
    0 -18px 48px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

#mainNav button {
  min-width: 0;
  min-height: 52px;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: var(--bf-radius-s);
  color: #70747c;
  font-size: 0.5625rem;
  font-weight: 780;
  line-height: 1.2;
  letter-spacing: 0.045em;
}

#mainNav button b {
  margin-bottom: 5px;
  color: #8a8e96;
  font-size: 1.125rem;
  line-height: 1;
}

#mainNav button.active {
  border-color: rgba(255, 255, 255, 0.075);
  background:
    linear-gradient(180deg, rgba(229, 9, 20, 0.09), transparent),
    #111216;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 6px 16px rgba(0, 0, 0, 0.22);
}

#mainNav button.active b {
  color: var(--bf-red-soft);
}

#mainNav button.active::after {
  width: 24px;
  height: 2px;
  margin-top: 4px;
  background: var(--bf-red);
  box-shadow: 0 0 9px rgba(229, 9, 20, 0.24);
}

/* Desktop cockpit composition. */

@media (min-width: 900px) {
  #home.active {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    grid-template-areas:
      "topbar topbar"
      "coach coach"
      "day week"
      "observation observation";
    gap: var(--bf-gap-3) var(--bf-gap-4);
    align-items: stretch;
  }

  #home > .topbar {
    grid-area: topbar;
    margin-bottom: 2px;
  }

  #home > .hero {
    grid-area: hero;
    min-height: 520px;
    margin: 0;
  }

  #home > .card:has(#homeProgress) {
    grid-area: evolution;
    margin: 0;
  }

  #home > .card:has(#homeNutrition) {
    grid-area: nutrition;
    margin: 0;
    padding-block: 18px;
  }

  #home > .card:has(#homeNutrition) .mission-line {
    padding-block: 9px;
  }

  #home > .grid-2 {
    grid-area: metrics;
    margin-top: 0 !important;
  }

  #home > .grid-2 .metric {
    min-height: 126px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  #home > .ai-cta {
    grid-area: analyzer;
    margin-top: 0 !important;
  }

  #home > .notice {
    grid-area: coach;
    margin-top: 0 !important;
  }

  #home > #dashboardDay {
    grid-area: day;
    margin: 0;
  }

  #home > #dashboardWeek {
    grid-area: week;
    margin: 0;
  }

  #home > #dashboardDay.hidden ~ #dashboardWeek:not(.hidden) {
    grid-column: 1 / -1;
  }

  #home > #dashboardObservation {
    grid-area: observation;
    margin: 0;
  }

  #evolution .mini-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #profile .profile-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Mobile discipline. */

@media (max-width: 520px) {
  body:has(.screen.active:not(#onboarding)) .app {
    padding-inline: 13px;
  }

  :where(#home, #workout, #evolution, #nutrition, #profile) > .topbar {
    margin-bottom: var(--bf-gap-4);
  }

  :where(#home, #workout, #evolution, #nutrition, #profile) .screen-title {
    font-size: clamp(2.05rem, 10vw, 2.6rem);
  }

  :where(#home, #workout, #evolution, #nutrition, #profile) .card {
    padding: var(--bf-gap-3);
    border-radius: 18px;
  }

  :where(#home, #workout, #evolution, #nutrition, #profile) .card::before {
    left: 16px;
  }

  :where(#home, #workout, #evolution, #nutrition, #profile) .metric {
    padding: var(--bf-gap-3);
  }

  #home .hero {
    min-height: 430px;
    padding: 20px;
    border-radius: 22px;
  }

  #home .hero::before {
    inset: 11px;
    border-radius: 15px;
  }

  #home .hero h1 {
    font-size: clamp(2rem, 8vw, 2.2rem);
    max-width: 100%;
  }

  #home .chip {
    font-size: 0.625rem;
  }

  #evolution .score-ring {
    width: 104px;
    height: 104px;
    flex-basis: 104px;
  }

  :where(#foodModal, #bioModal) > div > .card {
    padding: var(--bf-gap-3);
  }

  #mainNav {
    padding-inline: 7px;
    border-radius: 16px 16px 0 0;
  }
}

@media (max-width: 390px) {
  :where(#home, #workout, #evolution, #nutrition, #profile) .grid-2 {
    gap: var(--bf-gap-2);
  }

  :where(#home, #workout, #evolution, #nutrition, #profile) .metric strong {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
  }

  #home .hero {
    padding: 18px;
  }

  #home .hero h1 {
    font-size: clamp(2rem, 8vw, 2.2rem);
  }

  #home #weekCount,
  #home #streak {
    font-size: 1.75rem;
  }

  #mainNav button {
    font-size: 0.525rem;
    letter-spacing: 0;
  }
}

@media (max-width: 360px) {
  #home .hero {
    min-height: 415px;
  }

  #home .hero h1 {
    font-size: 2.9rem;
  }

  #home .chips {
    gap: 5px;
  }

  #home .chip {
    min-height: 30px;
    padding-inline: 8px;
  }

  #workout .exercise-head {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px;
  }

  #workout .exercise-index {
    width: 38px;
    height: 38px;
  }

  #mainNav {
    gap: 2px;
    padding-inline: 5px;
  }

  #mainNav button {
    font-size: 0.5rem;
  }
}

.workout-companion {
  display: grid;
  gap: 5px;
  margin: 12px 0 14px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent, #ef3b2d) 28%, transparent);
  border-left: 3px solid var(--accent, #ef3b2d);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface, #171717) 94%, white 6%);
}

.celebration.workout-complete,
.celebration.workout-incomplete {
  align-items: start;
  overflow-y: auto;
}

:is(.workout-complete, .workout-incomplete) .celebration-card {
  width: min(680px, 100%);
  margin: auto;
  padding: 18px 0 28px;
  text-align: left;
}

:is(.workout-complete, .workout-incomplete) :is(
    .celebration-smoke,
    .celebration-particles,
    .celebration-emblem
  ) {
  display: none;
}

:is(.workout-complete, .workout-incomplete) .celebration-card h2 {
  margin: 8px 0 6px;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1;
}

.debrief-section,
.workout-complete .celebration-achievements {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line, #343434);
  border-radius: 14px;
  background: rgba(18, 18, 18, 0.9);
}

.debrief-section > small,
.workout-complete .celebration-achievements > small {
  color: var(--accent, #ef3b2d);
  font-weight: 900;
  letter-spacing: 0.1em;
}

.celebration-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.celebration-metrics > div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.celebration-metrics strong {
  font-size: 17px;
}

.celebration-metrics small {
  color: var(--muted, #aaa);
}

.celebration-execution {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.celebration-execution span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent, #ef3b2d);
  transition: width 280ms ease-out;
}

.debrief-statements {
  display: grid;
  gap: 7px;
}

.debrief-statements p {
  margin: 0;
}

.celebration-next strong,
.celebration-next span {
  display: block;
}

.celebration-next span {
  color: var(--muted, #aaa);
}

:is(.workout-complete, .workout-incomplete) #closeCelebration {
  width: 100%;
  margin-top: 16px;
}

.workout-companion strong {
  line-height: 1.3;
}

.workout-companion p {
  margin: 0;
  color: var(--muted, #aaa);
  line-height: 1.45;
}

.workout-companion.companion-updated {
  animation: companion-feedback-in 180ms ease-out both;
}

@keyframes companion-feedback-in {
  from {
    opacity: 0.72;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .workout-companion.companion-updated {
    animation: none;
  }

  .celebration-execution span {
    transition: none;
  }
  body:has(.screen.active:not(#onboarding)) .app::before {
    display: none;
  }

  :where(#home, #workout, #evolution, #nutrition, #profile, #mainNav)
    :where(
      .card,
      .metric,
      .bio-snapshot,
      .mini-chart,
      .insight,
      button,
      input,
      select,
      textarea
    ) {
    transition-duration: 0.01ms !important;
  }
}
