:root {
  color-scheme: dark;
  --ink: #f6f3ed;
  --muted: #a7a49f;
  --line: rgba(255, 255, 255, .14);
  --accent: #ffffff;
  --surface: rgba(15, 16, 18, .78);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    linear-gradient(rgba(0, 0, 0, .82), rgba(0, 0, 0, .88)),
    url("album-art.jpg") center / cover fixed;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button, input { color: inherit; font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  align-items: stretch;
  width: min(100% - 28px, 560px);
  margin: 0 auto;
  padding: 18px 0 36px;
}

.hero {
  position: relative;
  display: flex;
  min-height: clamp(210px, 58vw, 310px);
  align-items: flex-end;
  overflow: hidden;
  margin-bottom: 26px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  isolation: isolate;
  background: #08090a;
}

.hero::before,
.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background-position: center 35%;
  background-size: cover;
  content: "";
  transition: opacity 700ms ease;
}

.hero::before {
  background-image:
    linear-gradient(0deg, rgba(0, 0, 0, .88), rgba(0, 0, 0, .08) 75%),
    var(--hero-image-1, none);
}

.hero::after {
  background-image:
    linear-gradient(0deg, rgba(0, 0, 0, .88), rgba(0, 0, 0, .08) 75%),
    var(--hero-image-2, none);
  opacity: 0;
}
.hero.show-second-slide::before { opacity: 0; }
.hero.show-second-slide::after { opacity: 1; }

.hero-photo-menu {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  display: grid;
  min-width: 142px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 13, 15, .96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.hero-photo-menu[hidden] { display: none; }
.hero-photo-menu button {
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.hero-photo-menu button:hover,
.hero-photo-menu button:focus-visible { background: rgba(255, 255, 255, .12); outline: none; }
.hero-photo-menu button:disabled { opacity: .45; cursor: default; }
.hero-crop-dialog {
  width: min(100% - 32px, 480px);
  max-width: calc(100% - 32px);
  margin: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111214;
  color: var(--ink);
}
.hero-crop-dialog::backdrop { background: rgba(0, 0, 0, .78); }
.hero-crop-dialog h2 { margin: 0 0 14px; font-size: 17px; }
.hero-crop-frame {
  position: relative;
  width: 100%;
  height: min(52vh, 320px);
  min-height: 150px;
  overflow: hidden;
  background: #050505;
}
.hero-crop-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.hero-crop-selection {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .58);
  cursor: move;
  touch-action: none;
}
.hero-crop-resize {
  position: absolute;
  right: -12px;
  bottom: -12px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #171717;
  border-radius: 50%;
  background: #fff;
  cursor: nwse-resize;
  touch-action: none;
}
.hero-crop-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.hero-crop-actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.hero-crop-actions #save-hero-crop { background: var(--accent); color: #171717; }
.hero-crop-actions button:disabled { opacity: .55; }
.hero-photo-manager {
  width: min(100% - 32px, 480px);
  max-width: calc(100% - 32px);
  max-height: 84vh;
  overflow: auto;
  margin: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111214;
  color: var(--ink);
}
.hero-photo-manager::backdrop { background: rgba(0, 0, 0, .78); }
.hero-photo-manager-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hero-photo-manager-heading h2 { margin: 0; font-size: 16px; }
.hero-photo-manager-heading button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  cursor: pointer;
}
.hero-photo-list { display: grid; gap: 7px; }
.hero-photo-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.hero-photo-item img { display: block; width: 76px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 3px; }
.hero-photo-item span { color: var(--muted); font-size: 12px; }
.hero-photo-item button {
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  cursor: pointer;
}
.hero-photo-item button:disabled { opacity: .5; }
.hero-photo-empty { margin: 0; padding: 10px 0; color: var(--muted); font-size: 12px; }

.hero-copy { position: relative; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .16em;
}
.hero h1 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: .9;
  text-transform: uppercase;
}
.calendar-section,
.workout-log { width: 100%; }
.calendar-section { margin-bottom: 30px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-heading h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.calendar-section .section-heading h2 { white-space: nowrap; }
.calendar-navigation {
  display: flex;
  align-items: center;
  gap: 5px;
}
.calendar-navigation h3 {
  min-width: 52px;
  margin: 0;
  color: #e4e0d9;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.icon-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  cursor: pointer;
}
.icon-button:disabled { color: #666; cursor: default; }
.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.calendar-weekdays { margin-bottom: 5px; }
.calendar-weekdays span {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}
.calendar-day {
  display: grid;
  min-width: 0;
  aspect-ratio: 1.45;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface);
  color: #dedbd5;
  font-size: 12px;
  cursor: pointer;
}
.calendar-day.is-empty { background: transparent; }
.calendar-day.is-today { border-color: rgba(255, 255, 255, .7); }
.calendar-day.is-checked {
  border-color: var(--accent);
  background: rgba(255, 255, 255, .18);
  color: #fff;
}
.calendar-day:disabled:not(.is-empty) { color: #5e5b57; cursor: default; }
.calendar-day:focus-visible,
.icon-button:focus-visible,
.add-workout-button:focus-visible,
.complete-toggle:focus-visible,
.delete-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.log-heading { margin-bottom: 12px; }
.history-controls { display: flex; gap: 5px; }
.history-button { font-size: 16px; }
.history-button:disabled { opacity: .42; }
.history-controls #edit-workout-log[aria-pressed="true"] { background: rgba(255, 255, 255, .18); }
.workout-form {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, .65fr) minmax(0, 1fr) 36px;
  gap: 7px;
  align-items: center;
  margin-bottom: 10px;
}
.form-input-row { display: contents; }
.form-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  outline: none;
  background: rgba(12, 13, 15, .78);
  color: var(--ink);
  font-size: 12px;
}
.form-input::placeholder { color: #95918b; opacity: 1; }
.form-input:focus { border-color: rgba(255, 255, 255, .8); }
.add-workout-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #171717;
  font-size: 23px;
  font-weight: 800;
  cursor: pointer;
}
.add-workout-button:active { background: #dedede; }
.exercise-list { border-top: 1px solid var(--line); }
.empty-log {
  margin: 0;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
.exercise-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) minmax(52px, 70px) minmax(64px, 100px);
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.exercise-list.is-editing .exercise-row {
  grid-template-columns: 18px 24px minmax(0, 1fr) minmax(52px, 70px) minmax(64px, 100px) 30px;
}
.exercise-row.is-dragging { opacity: .45; }
.complete-toggle {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #fff;
  cursor: pointer;
}
.complete-toggle:checked ~ .exercise-details .exercise-name { text-decoration: line-through; }
.drag-handle,
.delete-button {
  display: grid;
  width: 24px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aaa69f;
  cursor: pointer;
}
.drag-handle,
.delete-button { display: none; }
.exercise-list.is-editing .drag-handle,
.exercise-list.is-editing .delete-button { display: grid; }
.drag-handle {
  font-size: 18px;
  touch-action: none;
}
.exercise-details { min-width: 0; }
.exercise-name {
  display: block;
  width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  outline: none;
  background: transparent;
  color: #f5f2ed;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exercise-name:not([readonly]):focus,
.exercise-sets:not([readonly]):focus,
.exercise-weight:not([readonly]):focus { border-bottom-color: rgba(255, 255, 255, .65); }
.exercise-sets,
.exercise-weight {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  outline: none;
  background: transparent;
  color: #e7e7e7;
  font-size: 13px;
  font-weight: 600;
}
.exercise-weight {
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}
.delete-button { justify-self: end; font-size: 19px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 560px) {
  .app-shell { width: min(100% - 24px, 480px); }
  .hero { min-height: 220px; padding: 18px; }
  .section-heading h2 { font-size: 22px; }
  .calendar-section .section-heading h2 { font-size: 19px; }
  .calendar-navigation { gap: 3px; }
  .calendar-navigation h3 { min-width: 48px; font-size: 10px; }
  .calendar-navigation .icon-button { width: 25px; height: 27px; }
  .calendar-weekdays, .calendar-grid { gap: 4px; }
  .calendar-day { aspect-ratio: 1.25; }
  .exercise-row { grid-template-columns: 17px minmax(0, 1fr) minmax(44px, 58px) minmax(56px, 76px); column-gap: 10px; row-gap: 6px; }
  .exercise-list.is-editing .exercise-row { grid-template-columns: 17px 22px minmax(0, 1fr) minmax(44px, 58px) minmax(56px, 76px) 22px; }
  .drag-handle, .delete-button { width: 22px; }
}
