:root {
  color-scheme: dark;
  --page: #08090a;
  --surface: #0e1012;
  --card: #17191c;
  --card-raised: #1d2024;
  --ink: #f2f3f1;
  --muted: #a2a7aa;
  --accent: #c4c7c5;
  --accent-soft: rgba(196, 199, 197, 0.11);
  --success: #83d3a4;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-fast: 140ms;
  --motion-medium: 220ms;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, rgba(196, 199, 197, 0.08), transparent 32rem),
    var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(180deg, #111315 0%, var(--surface) 38%, #0a0b0d 100%);
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: max(24px, env(safe-area-inset-top)) 20px 16px;
  background: rgba(14, 16, 18, 0.86);
  backdrop-filter: blur(20px) saturate(135%);
}

.brand-row,
.workout-heading,
.section-title,
.progress-meta,
.attendance-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #101214;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 10px 30px rgba(196, 199, 197, 0.13);
}

.content {
  padding: 20px 16px max(48px, env(safe-area-inset-bottom));
}

.attendance-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(145deg, #202327, #16181b);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.attendance-copy {
  justify-content: flex-start;
}

.calendar-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 21px;
}

.attendance-copy p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.attendance-copy strong {
  font-size: 15px;
}

.date-field {
  align-self: center;
}

.date-field input {
  width: 48px;
  height: 48px;
  padding: 7px;
  border: 0;
  border-radius: 13px;
  background: #292c30;
  color: transparent;
}

.date-field input::-webkit-calendar-picker-indicator {
  width: 22px;
  height: 22px;
  margin: auto;
  filter: invert(1);
  opacity: 0.72;
  cursor: pointer;
}

.attendance-button {
  grid-column: 1 / -1;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: #292c30;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  transition: transform var(--motion-fast) var(--ease-out), background var(--motion-medium) ease;
}

.attendance-button:hover {
  background: #33373b;
}

.attendance-button:active {
  transform: scale(0.985);
}

.attendance-button.registered {
  background: var(--accent);
  color: #111315;
  box-shadow: 0 10px 28px rgba(196, 199, 197, 0.12);
}

.routine-label {
  display: flex;
  justify-content: space-between;
  margin: 28px 3px 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.routine-label span:last-child {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: none;
  opacity: 0.75;
}

.day-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 6px;
  border-radius: 21px;
  background: #121416;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.day-tab {
  min-height: 70px;
  padding: 10px 7px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #a0a5a8;
  text-align: center;
  transition: transform var(--motion-fast) var(--ease-out), background var(--motion-medium) ease, color var(--motion-medium) ease;
}

.day-tab:hover:not(.active) {
  background: #202327;
  color: var(--ink);
}

.day-tab:active {
  transform: scale(0.97);
}

.day-tab strong,
.day-tab span {
  display: block;
}

.day-tab strong {
  margin-bottom: 5px;
  font-size: 18px;
}

.day-tab span {
  color: inherit;
  font-size: 10px;
  line-height: 1.2;
  opacity: 0.72;
}

.day-tab.active {
  background: var(--accent);
  color: #111315;
  box-shadow: 0 9px 24px rgba(196, 199, 197, 0.13);
}

.workout-heading {
  align-items: flex-end;
  margin: 34px 3px 17px;
}

.focus {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.workout-heading h2 {
  max-width: 285px;
  margin: 0;
  font-size: 30px;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.counter {
  text-align: right;
}

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

.counter strong {
  color: var(--accent);
  font-size: 23px;
  letter-spacing: -0.045em;
}

.counter span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.daily-progress {
  padding: 17px 18px;
  border-radius: 20px;
  background: linear-gradient(145deg, #1d2024, #141619);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
}

.progress-meta {
  margin-bottom: 11px;
  font-size: 12px;
  font-weight: 750;
}

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

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #090a0c;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #898e8b, #d3d5d3);
  box-shadow: 0 0 14px rgba(196, 199, 197, 0.2);
  transition: width 250ms var(--ease-out);
}

.daily-progress p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.section-title {
  margin: 31px 3px 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-title button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  padding: 0 4px;
  font-size: 12px;
  transition: color 160ms ease;
}

.section-title button:hover {
  color: var(--ink);
}

.exercise-list {
  display: grid;
  gap: 11px;
}

.exercise-card {
  overflow: hidden;
  scroll-margin-top: 92px;
  border-radius: 21px;
  background: var(--card);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  transition: background var(--motion-medium) ease, box-shadow var(--motion-medium) ease;
}

.exercise-card:hover {
  background: #1b1e21;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
}

.exercise-card:has(.exercise-main[aria-expanded="true"]) {
  background: var(--card-raised);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}

.exercise-card.complete {
  background: linear-gradient(135deg, rgba(131, 211, 164, 0.11), #171b19 62%);
}

.exercise-main {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 14px 15px;
  border: 0;
  background: transparent;
  text-align: left;
  transition: background var(--motion-fast) ease;
}

.exercise-main:active {
  background: rgba(255, 255, 255, 0.04);
}

.exercise-number {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: #292c30;
  color: #afb3b1;
  font-size: 10px;
  font-weight: 850;
}

.exercise-card.complete .exercise-number {
  background: var(--success);
  color: #0c120e;
  box-shadow: 0 8px 22px rgba(131, 211, 164, 0.15);
}

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

.exercise-name strong,
.exercise-name span,
.load strong,
.load span {
  display: block;
}

.exercise-name strong {
  font-size: 15px;
  line-height: 1.22;
  letter-spacing: -0.012em;
}

.exercise-name span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.load {
  text-align: right;
}

.load strong {
  color: var(--accent);
  font-size: 13px;
}

.load span {
  margin-top: 3px;
  color: #898f92;
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.chevron {
  position: relative;
  width: 18px;
  height: 18px;
  flex: none;
  color: #8d9295;
  font-size: 0;
  transition: color var(--motion-fast) ease, transform var(--motion-medium) var(--ease-out);
}

.chevron::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 6px;
  height: 6px;
  border-right: 1.75px solid currentColor;
  border-bottom: 1.75px solid currentColor;
  transform: rotate(45deg);
}

.exercise-main[aria-expanded="true"] .chevron {
  color: var(--accent);
  transform: rotate(180deg);
}

.exercise-details {
  padding: 2px 15px 16px;
  background: rgba(7, 8, 10, 0.2);
}

.prescription {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 0 11px;
}

.pill {
  padding: 6px 9px;
  border-radius: 9px;
  background: #292c30;
  color: #d0d3d1;
  font-size: 11px;
  font-weight: 700;
}

.note {
  margin: 0 0 13px;
  padding: 11px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--accent-soft);
  color: #d5d7d5;
  font-size: 11px;
  line-height: 1.5;
}

.sets-label {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.set-button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: #292c30;
  color: #c3c6c4;
  font-size: 12px;
  font-weight: 750;
  transition: transform 140ms ease, background 160ms ease, color 160ms ease;
}

.set-button:hover:not(.done) {
  background: #35393e;
  color: var(--ink);
}

.set-button:active {
  transform: scale(0.96);
}

.set-button.done {
  background: var(--accent);
  color: #111315;
  box-shadow: 0 8px 20px rgba(196, 199, 197, 0.12);
}

.set-button.done::before {
  content: "✓ ";
  font-weight: 900;
}

.exercise-status {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.exercise-card.complete .exercise-status {
  color: var(--success);
  font-weight: 750;
}

@media (max-width: 350px) {
  .content {
    padding-inline: 12px;
  }

  .topbar {
    padding-inline: 16px;
  }

  .day-tab span {
    font-size: 8px;
  }

  .workout-heading h2 {
    font-size: 27px;
  }

  .exercise-main {
    padding-inline: 12px;
  }

  .set-grid {
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
