:root {
  --green-900: #1f5d27;
  --green-800: #2e7d32;
  --green-700: #3f9a35;
  --green-500: #64c942;
  --lime: #d9eb36;
  --yellow: #ffd400;
  --salmon: #ff8179;
  --ink: #121518;
  --muted: #65707c;
  --soft: #f5f7f8;
  --line: #e7eaee;
  --card: #ffffff;
  --shadow: 0 18px 45px rgba(16, 24, 40, .12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(125, 210, 83, .24), transparent 34rem),
    linear-gradient(180deg, #ffffff, #f8fafb 55%, #eef4ee);
  min-height: 100vh;
}
button, input { font: inherit; }
button { cursor: pointer; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #8de16b, #e8f7c9 55%, #ffffff);
  transition: opacity .45s ease, visibility .45s ease, transform .45s ease;
}
.splash.hidden { opacity: 0; visibility: hidden; transform: scale(1.02); pointer-events: none; }
.splash-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(120deg, transparent 10%, rgba(255,255,255,.45) 38%, transparent 39%),
    repeating-linear-gradient(105deg, rgba(24, 84, 31, .08) 0 8px, transparent 8px 92px);
  opacity: .85;
}
.splash-card {
  position: relative;
  width: min(92vw, 520px);
  min-height: 520px;
  padding: 48px 30px 34px;
  border-radius: 42px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.85);
  text-align: center;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
}
.splash-mark {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--green-500), var(--yellow));
  font-size: 46px;
  box-shadow: 0 18px 35px rgba(72, 160, 45, .28);
}
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--green-800);
  font-weight: 850;
  font-size: 12px;
}
.splash h1 {
  margin: 0;
  font-size: clamp(42px, 12vw, 74px);
  line-height: .9;
  letter-spacing: -.06em;
}
.splash-copy { margin: 0 0 10px; color: var(--muted); font-size: 18px; }
.primary-btn {
  border: 0;
  color: white;
  background: #111;
  border-radius: 999px;
  padding: 18px 28px;
  font-weight: 850;
  min-width: 210px;
  box-shadow: 0 16px 28px rgba(0,0,0,.18);
}
.primary-btn:active { transform: translateY(1px); }

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px 16px 96px;
}
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 0 0 34px 34px;
  margin: -16px -16px 20px;
  padding: max(22px, env(safe-area-inset-top)) 18px 26px;
  background: linear-gradient(145deg, #89d971 0%, #f7fbf5 54%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
}
.hero-pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 12%, rgba(255,255,255,.75), transparent 18rem),
    repeating-linear-gradient(104deg, rgba(37, 117, 42, .08) 0 9px, transparent 9px 100px);
  pointer-events: none;
}
.topbar, .summary-grid, .progress-wrap { position: relative; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-top: 16px;
}
.topbar h1 {
  margin: 6px 0 0;
  font-size: clamp(36px, 9vw, 62px);
  line-height: .93;
  letter-spacing: -.055em;
}
.icon-btn {
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.72);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(16,24,40,.08);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}
.summary-grid article {
  background: rgba(255,255,255,.74);
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 22px;
  padding: 14px 12px;
  box-shadow: 0 12px 28px rgba(16,24,40,.08);
}
.summary-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; }
.summary-grid strong { display: block; margin-top: 6px; font-size: 22px; letter-spacing: -.03em; }
.progress-wrap {
  margin-top: 18px;
  background: rgba(255,255,255,.55);
  border-radius: 999px;
  padding: 12px;
}
.progress-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 850; color: #253137; margin-bottom: 8px; }
.progress-track { height: 10px; border-radius: 999px; background: rgba(31, 93, 39, .12); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--green-500), var(--yellow)); transition: width .35s ease; }

.controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248,250,251,.86);
  backdrop-filter: blur(16px);
  margin: 0 -16px;
  padding: 10px 16px 12px;
  border-bottom: 1px solid rgba(231,234,238,.65);
}
.week-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.week-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  border: 1px solid var(--line);
  background: white;
  color: #4b5561;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 850;
  white-space: nowrap;
}
.tab-btn.active {
  border-color: transparent;
  color: white;
  background: #111;
}
.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: 0 8px 24px rgba(16,24,40,.05);
}
.search-box span { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.search-box input { border: 0; outline: 0; min-width: 0; font-weight: 700; color: var(--ink); }

.next-card {
  display: none;
  margin: 18px 0;
  padding: 18px;
  border-radius: 28px;
  background: #111;
  color: white;
  box-shadow: var(--shadow);
}
.next-card.visible { display: block; }
.next-card .meta { color: rgba(255,255,255,.68); }
.next-card h2 { margin: 5px 0 6px; font-size: 28px; letter-spacing: -.04em; }
.next-card button { margin-top: 12px; background: white; color: #111; border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 850; }

.week-heading {
  margin: 24px 0 12px;
  font-size: 24px;
  letter-spacing: -.04em;
}
.workout-list { display: grid; gap: 14px; }
.workout-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 12px 30px rgba(16,24,40,.07);
}
.workout-card.completed { border-color: rgba(91, 197, 69, .65); }
.workout-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: linear-gradient(180deg, var(--green-500), var(--yellow));
}
.card-main {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 18px 10px 18px 20px;
  display: grid;
  gap: 10px;
}
.card-row { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.card-date { color: var(--muted); font-weight: 850; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.card-title { font-size: 24px; line-height: 1; letter-spacing: -.04em; font-weight: 900; }
.card-type { color: #35414a; font-weight: 800; }
.card-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { border-radius: 999px; background: var(--soft); border: 1px solid var(--line); padding: 7px 10px; color: #4d5863; font-size: 12px; font-weight: 850; }
.done-toggle {
  align-self: center;
  justify-self: end;
  margin-right: 14px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 2px solid #d6dce3;
  background: #fff;
  color: white;
  font-weight: 950;
}
.workout-card.completed .done-toggle {
  border-color: var(--green-500);
  background: var(--green-500);
}
.workout-card.completed .done-toggle::after { content: "✓"; color: white; font-size: 22px; }
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  background: #fff;
  border-radius: 26px;
  border: 1px solid var(--line);
}

.detail-dialog {
  width: min(760px, calc(100% - 20px));
  max-height: min(900px, calc(100dvh - 20px));
  padding: 0;
  border: 0;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.32);
}
.detail-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); }
.dialog-inner { position: relative; background: white; max-height: inherit; overflow: auto; }
.close-btn {
  position: sticky;
  z-index: 3;
  top: 14px;
  float: right;
  margin: 14px 14px 0 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(17,17,17,.92);
  color: white;
  font-size: 28px;
  line-height: 1;
}
.detail-hero {
  padding: 42px 20px 24px;
  background: linear-gradient(135deg, #8edb72, #fff 75%);
  border-bottom: 1px solid var(--line);
}
.detail-hero .date { font-weight: 900; color: #27313b; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.detail-hero h2 { margin: 8px 0 8px; font-size: clamp(38px, 10vw, 62px); line-height: .9; letter-spacing: -.06em; }
.detail-hero p { margin: 0; font-size: 20px; color: #26313a; font-weight: 750; }
.detail-body { padding: 20px; }
.action-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.action-pill {
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 6px;
  background: #fafbfb;
  font-weight: 900;
  color: #626c78;
  font-size: 11px;
  text-transform: uppercase;
}
.action-pill span { display: block; font-size: 24px; margin-bottom: 4px; }
.section-title { margin: 20px 0 12px; font-size: 24px; letter-spacing: -.03em; }
.step-block { border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 12px 24px rgba(16,24,40,.06); margin-bottom: 14px; background: #fff; }
.step-head { color: white; padding: 9px 14px; font-weight: 900; background: linear-gradient(90deg, #555, #9a9a9a); }
.step-head.session { background: linear-gradient(90deg, var(--green-700), var(--green-500), var(--yellow)); }
.step-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 16px 14px; }
.step-number { font-size: 30px; font-style: italic; color: #5e6b75; font-weight: 900; text-align: center; border-right: 3px solid #edf0f3; }
.step-lines { display: grid; gap: 8px; }
.step-line { font-size: 18px; font-weight: 850; }
.step-line small { color: var(--muted); font-weight: 800; }
.step-kind { font-size: 13px; font-weight: 950; display: flex; align-items: center; gap: 6px; }
.coach-note { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 22px; display: grid; grid-template-columns: 54px 1fr; gap: 14px; align-items: start; }
.coach-avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--green-500), var(--yellow)); font-size: 27px; }
.coach-note h3 { margin: 0; font-size: 21px; }
.coach-note p { margin: 3px 0 0; color: #313b45; line-height: 1.45; }
.bottom-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 24px; }
.start-btn, .complete-btn { border: 0; border-radius: 999px; padding: 16px 18px; font-weight: 950; }
.start-btn { background: #111; color: white; }
.complete-btn { background: #ebf8e9; color: var(--green-800); }
.timer-panel { display: none; margin-top: 14px; border-radius: 22px; background: #111; color: white; padding: 16px; }
.timer-panel.visible { display: block; }
.timer-panel .timer-title { color: rgba(255,255,255,.65); font-weight: 850; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.timer-panel .timer-main { font-size: 28px; font-weight: 950; margin-top: 4px; }
.timer-panel .timer-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.timer-panel button { border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 850; }
.timer-panel button.secondary { background: rgba(255,255,255,.13); color: white; }

@media (min-width: 760px) {
  .app-shell { padding-inline: 26px; }
  .hero { margin-inline: -26px; padding-inline: 28px; }
  .controls { margin-inline: -26px; padding-inline: 26px; display: grid; grid-template-columns: 1fr 330px; gap: 14px; align-items: center; }
  .week-tabs { padding-bottom: 0; }
  .workout-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-heading { grid-column: 1 / -1; }
  .next-card { display: block; }
}

@media (max-width: 420px) {
  .summary-grid article { padding: 12px 9px; }
  .summary-grid strong { font-size: 20px; }
  .action-row { grid-template-columns: repeat(2, 1fr); }
  .step-row { grid-template-columns: 42px 1fr; }
  .step-kind { grid-column: 2; }
  .bottom-actions { grid-template-columns: 1fr; }
}
