:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --ink: #111827;
  --muted: #627084;
  --panel: #ffffff;
  --line: #e2e8f0;
  --blue: #2563eb;
  --blue-dark: #173f9f;
  --green: #16a34a;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.16), transparent 34rem),
    linear-gradient(180deg, #eef4ff 0%, var(--bg) 24rem);
  color: var(--ink);
}

body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 18px 14px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .76rem;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.45rem, 7vw, 5.6rem);
  line-height: .88;
  letter-spacing: -0.075em;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 28px);
}
.brand-title img {
  width: clamp(86px, 15vw, 150px);
  height: auto;
  flex: none;
  filter: drop-shadow(0 12px 24px rgba(15, 23, 42, .14));
}
.brand-title h1 {
  margin-bottom: 0;
}

h2 { margin-bottom: 0; font-size: clamp(1.45rem, 3vw, 2.1rem); letter-spacing: -0.04em; }
h3 { margin-bottom: 0; letter-spacing: -0.03em; }

.subhead {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.5;
  margin-bottom: 0;
}

.hero-card, .panel {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(226,232,240,.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-card {
  border-radius: var(--radius);
  padding: 20px;
}

.hero-card span, .tag, .day-label {
  display: inline-block;
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .1em;
}

.hero-card strong { display: block; font-size: 1.25rem; margin: 6px 0; }
.hero-card p { color: var(--muted); margin-bottom: 0; line-height: 1.45; }

main { max-width: 1180px; margin: 0 auto; padding: 0 18px 56px; }
.section { margin-top: 24px; }
.layout { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }

.panel {
  border-radius: var(--radius);
  padding: 22px;
}

.panel-head, .day-header, .modal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}
.ghost:hover { border-color: #b8c4d6; }

.day-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.day-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 12px 10px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  min-height: 92px;
}

.day-tab:hover { border-color: #b8c4d6; transform: translateY(-1px); }
.day-tab[aria-selected="true"] {
  background: #113b91;
  color: #fff;
  border-color: #113b91;
  box-shadow: 0 16px 35px rgba(37, 99, 235, .24);
}
.day-tab[aria-selected="true"] .tab-day,
.day-tab[aria-selected="true"] .tab-progress { color: rgba(255,255,255,.76); }

.tab-day {
  display: block;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .7rem;
  font-weight: 850;
}
.tab-title { display: block; margin: 7px 0 8px; line-height: 1.05; }
.tab-progress { color: var(--muted); font-weight: 750; }

.day-detail {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 18px;
}

.day-header { align-items: end; margin-bottom: 16px; }
.day-meta {
  color: var(--blue-dark);
  background: #eaf1ff;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: .8rem;
  font-weight: 850;
  white-space: nowrap;
}
.day-note { color: var(--muted); line-height: 1.5; margin: 8px 0 0; }

.exercise-list { display: grid; gap: 10px; margin-top: 16px; }
.exercise-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.complete-box {
  width: 25px;
  height: 25px;
  margin: 14px 0 0 4px;
  accent-color: var(--green);
  cursor: pointer;
}

.exercise-button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.exercise-button:hover { border-color: #aebed4; background: #f7fbff; }
.exercise-row.is-done .exercise-button { opacity: .62; }
.exercise-row.is-done .row-name { text-decoration: line-through; color: var(--muted); }

.row-main { display: grid; gap: 4px; }
.row-name { font-size: 1rem; }
.row-prescription { color: var(--muted); font-weight: 700; line-height: 1.35; }
.row-pill {
  flex: none;
  color: var(--blue-dark);
  background: #eaf1ff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .78rem;
  font-weight: 850;
}

.note-row {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 16px;
  padding: 13px 14px;
  color: #475569;
  line-height: 1.45;
  font-weight: 700;
}

.side-copy { color: var(--muted); line-height: 1.5; margin: 10px 0 0; }
.check-list {
  color: #263244;
  margin: 16px 0 0;
  padding-left: 21px;
  line-height: 1.75;
}

.modal {
  width: min(940px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  border: 0;
  padding: 0;
  background: transparent;
}
.modal::backdrop { background: rgba(2, 6, 23, .72); backdrop-filter: blur(4px); }
.modal-shell {
  position: relative;
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.modal-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.modal-video {
  aspect-ratio: 16 / 9;
  background: #0f172a;
}
.modal-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.video-fallback {
  color: white;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}
.modal-body { padding: 20px; }
.open-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 850;
  font-size: .95rem;
  white-space: nowrap;
}
.open-link:hover { text-decoration: underline; }
.why { color: var(--muted); line-height: 1.5; margin: 12px 0; }
.steps { margin: 0; padding-left: 20px; color: #263244; line-height: 1.55; }
summary {
  margin-top: 14px;
  cursor: pointer;
  color: var(--blue-dark);
  font-weight: 850;
}
.edit-video { display: flex; gap: 8px; margin-top: 10px; }
input[type="url"] {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  min-width: 0;
  width: 100%;
  outline: none;
}
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.edit-video button {
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: white;
  font-weight: 850;
  padding: 9px 14px;
  cursor: pointer;
}

@media (max-width: 1060px) {
  .day-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero, .layout { grid-template-columns: 1fr; }
  .hero-card { max-width: 560px; }
}

@media (max-width: 680px) {
  .hero { padding-top: 28px; }
  .brand-title { align-items: flex-start; }
  .panel { padding: 16px; }
  .panel-head, .day-header, .modal-title-row { display: grid; }
  .day-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .day-tab {
    min-width: 132px;
    scroll-snap-align: start;
  }
  .exercise-button { align-items: flex-start; }
  .row-pill { display: none; }
  .edit-video { flex-direction: column; }
}

.lock-note {
  border-radius: 14px;
  padding: 11px 13px;
  margin: 12px 0 2px;
  font-weight: 800;
  line-height: 1.35;
}
.lock-note.unlocked {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.lock-note.locked {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.exercise-row.is-locked .complete-box {
  cursor: not-allowed;
}
.exercise-row.is-locked .exercise-button {
  background: #f8fafc;
}

.calendar-panel {
  margin-top: 20px;
}
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.calendar-controls .ghost {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}
#calendarTitle {
  min-width: 150px;
  text-align: center;
  letter-spacing: -0.02em;
}
.calendar-note {
  color: var(--muted);
  margin: 12px 0 16px;
  line-height: 1.45;
}
.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.calendar-weekdays span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: center;
}
.calendar-grid {
  margin-top: 8px;
}
.calendar-day {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 10px;
  display: grid;
  align-content: space-between;
  gap: 6px;
}
.calendar-day.blank {
  opacity: 0;
  pointer-events: none;
}
.calendar-day.today {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.calendar-day.complete {
  background: #ecfdf5;
  border-color: #86efac;
}
.calendar-day.rest-day {
  background: #f8fafc;
}
.calendar-number {
  font-weight: 900;
}
.calendar-day small {
  color: var(--muted);
  font-weight: 850;
}
.calendar-day strong {
  justify-self: start;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--blue-dark);
  padding: 4px 8px;
  font-size: .82rem;
}
.calendar-day.complete strong {
  background: var(--green);
  color: #fff;
}
.calendar-day.rest-day strong {
  background: #e2e8f0;
  color: #475569;
}

@media (max-width: 680px) {
  .calendar-controls {
    justify-content: space-between;
  }
  .calendar-weekdays,
  .calendar-grid {
    gap: 5px;
  }
  .calendar-day {
    min-height: 64px;
    border-radius: 12px;
    padding: 7px;
  }
  .calendar-day small {
    display: none;
  }
  .calendar-day strong {
    font-size: .7rem;
    padding: 3px 6px;
  }
}
.calendar-day.pre-start {
  opacity: .42;
  background: #f8fafc;
}
.calendar-day.pre-start strong {
  background: #e2e8f0;
  color: #64748b;
}

/* PW1 visual refresh */
:root {
  --pw-navy: #06133a;
  --pw-blue: #061f8f;
  --pw-royal: #1238c2;
  --pw-gold: #ffc928;
  --pw-gold-dark: #e0a900;
  --ink: #071026;
  --muted: #60708a;
  --line: rgba(8, 31, 110, .14);
  --blue: var(--pw-royal);
  --blue-dark: var(--pw-blue);
  --shadow: 0 22px 60px rgba(6, 19, 58, .15);
}

body {
  background:
    radial-gradient(circle at 12% -8%, rgba(255, 201, 40, .30), transparent 20rem),
    radial-gradient(circle at 84% 0%, rgba(18, 56, 194, .32), transparent 30rem),
    linear-gradient(145deg, #f8fbff 0%, #eef4ff 36%, #f9fbff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 56%, rgba(6, 31, 143, .055) 56% 58%, transparent 58% 100%),
    linear-gradient(65deg, transparent 0 62%, rgba(255, 201, 40, .10) 62% 63.5%, transparent 63.5% 100%);
}

.hero {
  position: relative;
  margin-top: 14px;
  padding: 28px 22px 20px;
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(6, 19, 58, .97), rgba(6, 31, 143, .93) 58%, rgba(10, 30, 92, .96)),
    #06133a;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 28px 80px rgba(6, 19, 58, .28);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border: 3px solid rgba(255,255,255,.10);
  border-radius: 50%;
  transform: rotate(-18deg) scaleX(1.55);
  pointer-events: none;
}
.hero::before { right: -120px; top: -155px; }
.hero::after { left: -170px; bottom: -235px; border-color: rgba(255, 201, 40, .18); }

.hero .eyebrow {
  color: var(--pw-gold);
  text-shadow: 0 1px 0 rgba(0,0,0,.20);
}

.brand-title {
  position: relative;
  z-index: 1;
}
.brand-title img {
  width: clamp(96px, 15vw, 168px);
  padding: 8px;
  border-radius: 24px;
  background: rgba(255,255,255,.96);
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.85),
    0 18px 45px rgba(0, 0, 0, .22);
}
.brand-title h1 {
  color: #fff;
  text-transform: uppercase;
  letter-spacing: -.055em;
  text-shadow: 0 5px 0 rgba(0,0,0,.12), 0 18px 30px rgba(0,0,0,.22);
}
.brand-title h1::after {
  content: "";
  display: block;
  width: min(340px, 70%);
  height: 7px;
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pw-gold), #fff2a3, transparent);
}

.panel {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(6, 31, 143, .14);
  box-shadow: var(--shadow);
}

.workout-panel,
.calendar-panel {
  position: relative;
  overflow: hidden;
}
.workout-panel::before,
.calendar-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 7px;
  background: linear-gradient(90deg, var(--pw-blue), var(--pw-royal), var(--pw-gold));
}

.panel-head {
  align-items: center;
}
.ghost {
  background: linear-gradient(180deg, #fff, #f5f8ff);
  border-color: rgba(6, 31, 143, .18);
  color: var(--pw-blue);
  box-shadow: 0 8px 18px rgba(6, 31, 143, .08);
}
.ghost:hover {
  border-color: rgba(6, 31, 143, .35);
  transform: translateY(-1px);
}

.day-tab {
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  border-color: rgba(6, 31, 143, .16);
  box-shadow: 0 10px 22px rgba(6, 19, 58, .06);
  position: relative;
  overflow: hidden;
}
.day-tab::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -32px;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: rgba(255, 201, 40, .16);
}
.day-tab:hover {
  border-color: rgba(6, 31, 143, .36);
  box-shadow: 0 16px 28px rgba(6, 19, 58, .10);
}
.day-tab[aria-selected="true"] {
  background: linear-gradient(145deg, var(--pw-navy), var(--pw-blue) 62%, #0d2a82);
  border-color: rgba(255, 201, 40, .70);
  box-shadow: 0 18px 36px rgba(6, 31, 143, .32);
}
.day-tab[aria-selected="true"]::after {
  background: rgba(255, 201, 40, .26);
}
.tab-day { color: var(--pw-royal); }
.day-tab[aria-selected="true"] .tab-day { color: var(--pw-gold); }
.day-tab[aria-selected="true"] .tab-progress { color: rgba(255,255,255,.82); }

.day-detail {
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,255,.98));
  border-color: rgba(6, 31, 143, .14);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.day-meta {
  background: linear-gradient(135deg, #eaf1ff, #fff8db);
  color: var(--pw-blue);
  border: 1px solid rgba(255, 201, 40, .45);
}

.exercise-button {
  border-color: rgba(6, 31, 143, .13);
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: 0 8px 18px rgba(6, 19, 58, .045);
}
.exercise-button:hover {
  border-color: rgba(6, 31, 143, .32);
  box-shadow: 0 13px 24px rgba(6, 19, 58, .09);
}
.row-pill {
  color: var(--pw-blue);
  background: #fff5c2;
  border: 1px solid rgba(255, 201, 40, .55);
}
.complete-box {
  accent-color: var(--pw-blue);
}
.exercise-row.is-done .exercise-button {
  background: linear-gradient(180deg, #f0fdf4, #ecfdf5);
  border-color: rgba(22, 163, 74, .32);
}

.lock-note.unlocked {
  background: linear-gradient(135deg, #ecfdf5, #f8fffb);
}
.lock-note.locked {
  background: linear-gradient(135deg, #fff7ed, #fffdf5);
}

.calendar-day {
  border-color: rgba(6, 31, 143, .14);
  background: linear-gradient(180deg, #fff, #f9fbff);
  box-shadow: 0 8px 18px rgba(6, 19, 58, .045);
}
.calendar-day.today {
  border-color: var(--pw-gold);
  box-shadow: 0 0 0 3px rgba(255, 201, 40, .25), 0 12px 24px rgba(6, 19, 58, .08);
}
.calendar-day.complete {
  background: linear-gradient(145deg, #ecfdf5, #f8fff2);
  border-color: rgba(22, 163, 74, .40);
}
.calendar-day strong {
  background: #eaf1ff;
  color: var(--pw-blue);
}
.calendar-day.complete strong {
  background: linear-gradient(135deg, var(--pw-blue), var(--pw-royal));
  color: #fff;
}

.modal-shell {
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 34px 90px rgba(0,0,0,.45);
}
.modal-body {
  border-top: 7px solid var(--pw-gold);
}

@media (max-width: 680px) {
  .hero {
    margin: 8px 10px 0;
    padding: 20px 16px;
    border-radius: 24px;
  }
  .brand-title {
    gap: 12px;
  }
  .brand-title img {
    width: 82px;
    border-radius: 18px;
  }
  .brand-title h1 {
    font-size: clamp(2rem, 12vw, 3rem);
  }
  .brand-title h1::after {
    height: 5px;
    margin-top: 8px;
  }
}

/* iPad / touch optimization */
@media (hover: none), (pointer: coarse) {
  .day-tab,
  .exercise-button,
  .ghost,
  .complete-box,
  summary,
  .open-link {
    touch-action: manipulation;
  }

  .day-tab {
    min-height: 108px;
    padding: 15px 13px;
  }

  .exercise-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
  }

  .complete-box {
    width: 32px;
    height: 32px;
    margin-top: 15px;
  }

  .exercise-button {
    min-height: 64px;
    padding: 16px;
  }

  .row-name {
    font-size: 1.08rem;
  }

  .row-prescription {
    font-size: .95rem;
  }

  .ghost {
    min-height: 44px;
    padding-inline: 16px;
  }

  .modal-close {
    width: 48px;
    height: 48px;
  }
}

@media (min-width: 681px) and (max-width: 1180px) {
  main {
    width: min(100%, 980px);
  }

  .hero {
    width: min(calc(100% - 36px), 980px);
  }

  .day-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .calendar-day {
    min-height: 96px;
  }
}

@media (min-width: 681px) and (max-width: 900px) {
  .brand-title h1 {
    font-size: clamp(3.1rem, 9vw, 4.9rem);
  }

  .brand-title img {
    width: 118px;
  }

  .panel {
    padding: 24px;
  }
}
