:root {
  --sandc-blue: #a8d8f0;
  --sandc-blue-strong: #67bce7;
  --sandc-blue-dark: #0f4168;
  --sandc-orange-light: #ffc29a;
  --sandc-orange: #ff3d00;
  --sandc-orange-deep: #e66a00;
  --sandc-stone: #dbd6d0;
  --sandc-paper: #fdfdf7;
  --sandc-soft: #f4f0f0;
  --sandc-charcoal: #31302e;
  --sandc-ink: #181817;
  --sandc-line: rgba(49, 48, 46, 0.16);
  --sandc-shadow: 0 18px 45px rgba(24, 24, 23, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(90deg, var(--sandc-orange-deep) 0%, var(--sandc-stone) 48%, var(--sandc-blue-dark) 100%);
  background-attachment: fixed;
  color: var(--sandc-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.sandc-app {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(253, 253, 247, 0.82), rgba(253, 253, 247, 0.5)),
    linear-gradient(90deg, rgba(230, 106, 0, 0.92), rgba(219, 214, 208, 0.78) 48%, rgba(15, 65, 104, 0.9));
}

.app-header {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px 18px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 24, 23, 0.5);
  backdrop-filter: blur(6px);
}

.auth-gate[hidden] {
  display: none;
}

.auth-panel {
  width: min(560px, 100%);
  max-height: 94vh;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(168, 216, 240, 0.34), rgba(255, 194, 154, 0.28)),
    var(--sandc-paper);
  border: 1px solid var(--sandc-line);
  box-shadow: 0 28px 80px rgba(24, 24, 23, 0.32);
}

.auth-copy h2 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.auth-copy p:last-child {
  margin: 0 0 18px;
  color: rgba(24, 24, 23, 0.72);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab,
.primary-button {
  min-height: 46px;
  border: 1px solid rgba(49, 48, 46, 0.22);
  background: rgba(255, 255, 255, 0.78);
  color: var(--sandc-ink);
  cursor: pointer;
  font-weight: 900;
  border-radius: 4px;
}

.auth-tab.is-active,
.primary-button {
  border-color: var(--sandc-charcoal);
  background: var(--sandc-blue);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--sandc-charcoal);
  font-weight: 850;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(49, 48, 46, 0.2);
  background: rgba(255, 255, 255, 0.86);
  color: var(--sandc-ink);
  padding: 10px 12px;
  border-radius: 4px;
}

.auth-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: rgba(255, 61, 0, 0.1);
  border: 1px solid rgba(255, 61, 0, 0.28);
  color: var(--sandc-ink);
  font-weight: 850;
}

.auth-note {
  margin: 14px 0 0;
  color: rgba(24, 24, 23, 0.62);
  font-size: 0.86rem;
  line-height: 1.35;
}

.account-bar {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 190px;
}

.account-bar span {
  color: var(--sandc-charcoal);
  font-size: 0.88rem;
  font-weight: 850;
  text-align: right;
}

.account-bar .ghost-button {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
}

.training-router {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 24, 23, 0.42);
  backdrop-filter: blur(5px);
}

.training-router[hidden] {
  display: none;
}

.router-panel {
  width: min(920px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(168, 216, 240, 0.28), rgba(255, 194, 154, 0.24)),
    var(--sandc-paper);
  border: 1px solid var(--sandc-line);
  box-shadow: 0 28px 80px rgba(24, 24, 23, 0.28);
}

.router-panel h2 {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.02;
}

.router-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: min(520px, 58vh);
  overflow: auto;
  padding-right: 4px;
}

.router-option {
  min-height: 58px;
  padding: 13px 14px;
  border: 1px solid rgba(49, 48, 46, 0.2);
  background: rgba(255, 255, 255, 0.8);
  color: var(--sandc-ink);
  cursor: pointer;
  text-align: left;
  font-weight: 850;
  border-radius: 4px;
}

.router-keyword {
  color: var(--sandc-orange);
  font-weight: 950;
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.12em;
}

.router-option:hover,
.router-option:focus {
  background: var(--sandc-blue);
  border-color: var(--sandc-charcoal);
  outline: none;
}

.router-panel > .ghost-button {
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.practice-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1100;
  display: grid;
  gap: 14px;
  justify-items: center;
  width: min(680px, calc(100vw - 36px));
  padding: 32px;
  background: linear-gradient(135deg, var(--sandc-blue), var(--sandc-orange-light));
  border: 1px solid rgba(24, 24, 23, 0.2);
  box-shadow: 0 28px 80px rgba(24, 24, 23, 0.28);
  text-align: center;
}

.practice-toast[hidden] {
  display: none;
}

.practice-toast p {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.12;
  font-weight: 950;
}

.practice-toast button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid rgba(24, 24, 23, 0.25);
  background: rgba(253, 253, 247, 0.78);
  color: var(--sandc-ink);
  cursor: pointer;
  font-weight: 850;
  border-radius: 4px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  background: transparent;
  border: 0;
}

.brand-mark img {
  width: 118px;
  height: 118px;
  object-fit: contain;
}

.header-copy h1,
.picker-band h2,
.workout-heading h2 {
  margin: 0;
  line-height: 1.02;
}

.header-copy h1 {
  max-width: 760px;
  font-size: clamp(2rem, 4.8vw, 4.4rem);
  font-weight: 850;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--sandc-charcoal);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 42px;
}

.picker-band {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 22px 0;
  border-top: 1px solid var(--sandc-line);
  border-bottom: 1px solid var(--sandc-line);
}

.picker-band h2 {
  font-size: 2rem;
}

.workout-picker {
  display: grid;
  gap: 16px;
}

.workout-group {
  display: grid;
  gap: 8px;
}

.workout-group-title {
  margin: 0;
  color: rgba(24, 24, 23, 0.68);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workout-group-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workout-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(49, 48, 46, 0.2);
  background: rgba(255, 255, 255, 0.72);
  color: var(--sandc-ink);
  cursor: pointer;
  font-weight: 800;
  border-radius: 4px;
}

.workout-button:hover,
.workout-button[aria-pressed="true"] {
  border-color: var(--sandc-charcoal);
  background: var(--sandc-blue);
}

.tracker-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  padding-top: 26px;
}

.session-panel {
  position: sticky;
  top: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--sandc-line);
  box-shadow: var(--sandc-shadow);
}

.session-photo {
  display: grid;
  place-items: stretch;
  min-height: 230px;
  background: linear-gradient(135deg, rgba(168, 216, 240, 0.75), rgba(255, 194, 154, 0.72));
  overflow: hidden;
}

.session-photo svg {
  width: 100%;
  height: 230px;
  display: block;
}

.session-photo .profile-picture {
  width: 100%;
  height: 230px;
  display: block;
  object-fit: contain;
  background: #ffffff;
}

.session-stats {
  display: grid;
  gap: 10px;
  padding: 16px 2px 12px;
}

.session-stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  border-bottom: 1px solid var(--sandc-line);
  padding-bottom: 8px;
}

.stat-label {
  color: rgba(24, 24, 23, 0.68);
  font-size: 0.86rem;
  font-weight: 750;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: var(--sandc-stone);
  border: 1px solid rgba(24, 24, 23, 0.12);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--sandc-blue), var(--sandc-orange-light));
  transition: width 0.2s ease;
}

.ghost-button {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  border: 1px solid var(--sandc-line);
  background: transparent;
  color: var(--sandc-charcoal);
  cursor: pointer;
  font-weight: 800;
  border-radius: 4px;
}

.ghost-button:hover {
  background: var(--sandc-soft);
}

.workout-heading {
  display: grid;
  gap: 8px;
  padding: 3px 0 18px;
}

.workout-heading h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.workout-heading p:last-child {
  max-width: 720px;
  margin: 0;
  color: rgba(24, 24, 23, 0.72);
  font-size: 1.02rem;
}

#workout-description {
  max-width: 760px;
  margin: 0;
  color: rgba(24, 24, 23, 0.72);
  font-size: 1.02rem;
  line-height: 1.45;
  white-space: pre-line;
}

.workout-visual {
  min-height: 190px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--sandc-line);
  background: linear-gradient(135deg, rgba(168, 216, 240, 0.75), rgba(255, 194, 154, 0.7));
}

.workout-visual svg {
  display: block;
  width: 100%;
  height: 190px;
}

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

.exercise-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  gap: 18px;
  min-height: 220px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--sandc-line);
  border-left: 8px solid var(--sandc-stone);
  transition: opacity 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.exercise-card.is-active {
  border-left-color: var(--sandc-orange-light);
  box-shadow: var(--sandc-shadow);
}

.exercise-card.is-complete {
  opacity: 0.5;
}

.exercise-card.is-complete:focus-within,
.exercise-card.is-complete:hover {
  opacity: 0.88;
}

.exercise-card.is-upcoming {
  opacity: 0.72;
}

.exercise-main {
  display: grid;
  gap: 14px;
  align-content: start;
}

.exercise-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.step-number,
.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
}

.step-number {
  background: var(--sandc-blue);
}

.source-pill {
  background: var(--sandc-soft);
  color: rgba(24, 24, 23, 0.72);
}

.exercise-card h3 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.08;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail {
  min-height: 92px;
  padding: 12px;
  background: var(--sandc-soft);
  border: 1px solid rgba(49, 48, 46, 0.12);
}

.detail span {
  display: block;
  margin-bottom: 6px;
  color: rgba(24, 24, 23, 0.64);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.detail p {
  margin: 0;
  line-height: 1.35;
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
}

.entry-field label {
  display: block;
  margin-bottom: 6px;
  color: rgba(24, 24, 23, 0.72);
  font-size: 0.82rem;
  font-weight: 850;
}

.entry-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(49, 48, 46, 0.24);
  background: #ffffff;
  color: var(--sandc-ink);
  padding: 10px 12px;
  border-radius: 4px;
}

.entry-field input:focus {
  outline: 3px solid rgba(168, 216, 240, 0.72);
}

.done-button {
  min-height: 46px;
  border: 1px solid var(--sandc-charcoal);
  background: var(--sandc-charcoal);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  border-radius: 4px;
}

.done-button[aria-pressed="true"] {
  background: var(--sandc-orange-light);
  color: var(--sandc-ink);
}

.diagram-wrap {
  display: grid;
  gap: 10px;
  align-content: start;
}

.diagram-frame {
  display: grid;
  place-items: center;
  min-height: 178px;
  background: var(--sandc-soft);
  border: 1px solid rgba(49, 48, 46, 0.13);
  overflow: hidden;
}

.diagram-frame img {
  width: 100%;
  height: 100%;
  max-height: 210px;
  object-fit: contain;
}

.diagram-frame svg {
  width: 100%;
  height: 178px;
}

.warmup-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.warmup-gallery img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid rgba(49, 48, 46, 0.12);
}

.diagram-note {
  margin: 0;
  color: rgba(24, 24, 23, 0.62);
  font-size: 0.78rem;
  font-weight: 750;
}

.missing-diagram {
  padding: 18px;
  text-align: center;
  color: rgba(24, 24, 23, 0.64);
  font-weight: 800;
}

.completion-message {
  margin-bottom: 16px;
  padding: 18px;
  background: linear-gradient(135deg, var(--sandc-blue), var(--sandc-orange-light));
  border: 1px solid rgba(24, 24, 23, 0.14);
}

.completion-message h3 {
  margin: 0 0 6px;
  font-size: 2rem;
}

.completion-message p {
  margin: 0;
  font-weight: 750;
}

.finish-area {
  display: flex;
  justify-content: flex-end;
  padding: 18px 0 0;
}

.finish-button {
  min-height: 50px;
  padding: 12px 20px;
  border: 1px solid var(--sandc-charcoal);
  background: var(--sandc-orange-light);
  color: var(--sandc-ink);
  cursor: pointer;
  font-weight: 950;
  border-radius: 4px;
}

.finish-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.progress-dashboard {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--sandc-line);
}

.dashboard-heading {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin-bottom: 18px;
}

.dashboard-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.04;
}

.dashboard-heading p:last-child {
  margin: 0;
  color: rgba(24, 24, 23, 0.72);
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.summary-card {
  min-height: 110px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--sandc-line);
}

.summary-card span {
  display: block;
  color: rgba(24, 24, 23, 0.62);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.55rem;
  line-height: 1;
}

.summary-card small {
  display: block;
  margin-top: 8px;
  color: rgba(24, 24, 23, 0.66);
  font-weight: 750;
}

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

.chart-panel {
  min-height: 360px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--sandc-line);
}

.chart-panel h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.chart-box {
  min-height: 288px;
}

.chart-box svg {
  width: 100%;
  min-height: 250px;
}

.chart-empty {
  display: grid;
  place-items: center;
  min-height: 250px;
  background: var(--sandc-soft);
  color: rgba(24, 24, 23, 0.62);
  font-weight: 850;
  text-align: center;
  padding: 20px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.admin-panel {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--sandc-line);
}

.admin-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.admin-table-panel {
  padding: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--sandc-line);
}

.admin-table-panel h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.admin-table-wrap {
  overflow: auto;
}

.admin-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 10px 9px;
  border-bottom: 1px solid rgba(49, 48, 46, 0.12);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--sandc-charcoal);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  background: var(--sandc-soft);
  color: rgba(24, 24, 23, 0.62);
  font-weight: 850;
  text-align: center;
  padding: 18px;
}

@media (max-width: 900px) {
  .tracker-shell,
  .picker-band,
  .exercise-card,
  .chart-grid {
    grid-template-columns: 1fr;
  }

  .router-options {
    grid-template-columns: 1fr;
  }


  .session-panel {
    position: static;
  }

  .session-photo {
    min-height: 160px;
  }

  .detail-grid,
  .entry-row,
  .history-summary {
    grid-template-columns: 1fr;
  }

  .done-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-header {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 18px 14px 14px;
  }

  .account-bar {
    grid-column: 1 / -1;
    justify-items: stretch;
  }

  .account-bar span {
    text-align: left;
  }

  main {
    padding: 0 14px 30px;
  }

  .brand-mark {
    width: 82px;
    height: 82px;
  }

  .brand-mark img {
    width: 78px;
    height: 78px;
  }

  .workout-button {
    flex: 1 1 calc(50% - 8px);
  }

  .exercise-card {
    padding: 14px;
  }
}
