:root {
  color-scheme: dark;
  --bg: #090d12;
  --surface: #111821;
  --surface-2: #172230;
  --text: #f3f7fb;
  --muted: #aebbc8;
  --line: #263545;
  --blue: #45c7ef;
  --gold: #d1ae46;
  --red: #e5483f;
  --green: #5cd08d;
  --shadow: 0 24px 70px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(69, 199, 239, .08), transparent 30%),
    radial-gradient(circle at 85% 8%, rgba(209, 174, 70, .12), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 13, 18, .88);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 74px;
  height: 54px;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.site-link:hover {
  border-color: rgba(69, 199, 239, .7);
}

.icon-btn,
.back-btn {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.icon-btn:hover,
.back-btn:hover,
.secondary-btn:hover {
  border-color: rgba(69, 199, 239, .7);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 390px;
  gap: 28px;
  align-items: stretch;
  min-height: calc(100vh - 160px);
}

.hero-panel > div:first-child,
.signin-card,
.panel,
.module-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(23, 34, 48, .92), rgba(13, 19, 27, .96));
  box-shadow: var(--shadow);
}

.hero-panel > div:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 70px);
  border-radius: 8px;
}

.signin-card,
.panel {
  border-radius: 8px;
  padding: 24px;
}

.signin-card {
  align-self: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(36px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 20px;
}

label {
  display: block;
  margin: 16px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
}

select option {
  color: #111821;
}

.primary-btn,
.secondary-btn {
  min-height: 46px;
  margin-top: 18px;
  padding: 12px 18px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, var(--blue), #1687bb);
  color: #031018;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.page-title-row,
.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-title-row h1,
.subpage-header h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
}

.session-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.session-stats span,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 13px;
}

.session-stats strong {
  margin-right: 5px;
  color: var(--text);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.module-card {
  min-height: 148px;
  padding: 20px;
  border-radius: 8px;
  color: var(--text);
  text-align: left;
}

.module-card span,
.module-card small {
  display: block;
}

.module-card span {
  font-size: 22px;
  font-weight: 800;
}

.module-card small {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: rgba(69, 199, 239, .7);
}

.two-column,
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.workout-card,
.stack {
  display: grid;
  gap: 12px;
}

.workout-row,
.calendar-row,
.record-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .04);
}

.leaderboard {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.leaderboard li {
  margin: 10px 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.segmented button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.segmented button.active {
  border-color: var(--blue);
  color: var(--text);
}

.exercise-grid,
.analytics-grid,
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.exercise-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.exercise-card p,
.panel p,
.workout-row p,
.record-row p {
  color: var(--muted);
}

.feature-panel {
  max-width: 820px;
}

.qr-card {
  display: grid;
  place-items: center;
  text-align: center;
}

.qr-faux {
  width: 210px;
  aspect-ratio: 1;
  border: 12px solid #fff;
  background:
    linear-gradient(90deg, #111 12px, transparent 12px 28px, #111 28px 42px, transparent 42px 58px, #111 58px 72px, transparent 72px),
    linear-gradient(#111 12px, transparent 12px 28px, #111 28px 42px, transparent 42px 58px, #111 58px 72px, transparent 72px);
  background-color: #fff;
}

@media (max-width: 920px) {
  .hero-panel,
  .two-column,
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .module-grid,
  .exercise-grid,
  .analytics-grid,
  .nutrition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .app-shell,
  .page-title-row,
  .subpage-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .brand img {
    width: 58px;
  }

  .module-grid,
  .exercise-grid,
  .analytics-grid,
  .nutrition-grid {
    grid-template-columns: 1fr;
  }
}
