:root {
  --paper: #f4f5f7;
  --paper-deep: #e4e7ec;
  --ink: #10182b;
  --muted: #667085;
  --line: rgba(16, 24, 43, 0.17);
  --green: #ff7a00;
  --green-dark: #10182b;
  --lime: #ff9d00;
  --orange: #ff7a00;
  --orange-dark: #c93b11;
  --red: #df3915;
  --custom-green: #18a058;
  --custom-green-dark: #0b5f37;
  --custom-green-soft: #e8f7ee;
  --white: #ffffff;
  --shadow: 0 18px 44px rgba(16, 24, 43, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Google Sans", Arial, sans-serif;
}

body::before {
  position: fixed;
  z-index: -1;
  top: -140px;
  right: -120px;
  width: 460px;
  height: 230px;
  background: var(--orange);
  content: "";
  transform: rotate(-28deg);
}

body::after {
  position: fixed;
  z-index: -1;
  bottom: -170px;
  left: -170px;
  width: 520px;
  height: 250px;
  background: var(--orange-dark);
  content: "";
  transform: rotate(-28deg);
}

main::before,
main::after {
  position: fixed;
  z-index: -1;
  background: var(--orange-dark);
  content: "";
  pointer-events: none;
  transform: rotate(-28deg);
}

main::before {
  top: 38%;
  right: -180px;
  width: 480px;
  height: 84px;
}

main::after {
  bottom: 12%;
  left: -200px;
  width: 440px;
  height: 64px;
}

button, input { font: inherit; }
.hidden { display: none !important; }

.view {
  min-height: 100vh;
  padding: 28px clamp(18px, 5vw, 72px) 56px;
}

.hero {
  display: grid;
  gap: 12px;
  max-width: 620px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1, h2 {
  font-family: "Google Sans", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(60px, 10vw, 124px);
  line-height: 0.88;
}

h1 span { color: var(--orange); }
h2 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 46px); }
.hero-copy, .selection-card p, .section-heading p, dialog p { color: var(--muted); line-height: 1.55; }
.hero-copy { max-width: 580px; font-size: 18px; }

.selection-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.selection-card .button { width: 100%; }
.selection-card h2 { margin: 5px 0 3px; font-size: 32px; }
.selection-card p { margin-bottom: 0; }

.selection-card.custom-selected {
  border-color: rgba(24, 160, 88, 0.44);
  background: var(--custom-green-soft);
  box-shadow: inset 6px 0 0 var(--custom-green), var(--shadow);
}

.selection-card.custom-selected .eyebrow,
.selection-card.custom-selected h2 {
  color: var(--custom-green-dark);
}

.selection-card.custom-selected .button-primary {
  background: var(--custom-green);
}

.selection-card.custom-selected .button-primary:hover:not(:disabled) {
  background: var(--custom-green-dark);
}

.selection-card.custom-selected .button-ghost {
  border-color: rgba(24, 160, 88, 0.34);
  color: var(--custom-green-dark);
  background: var(--white);
}

.selection-card.custom-selected .button-ghost:hover:not(:disabled) {
  color: var(--white);
  background: var(--custom-green);
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(30px, 6vw, 80px);
  max-width: 1500px;
  margin: 0 auto;
}

.plan-section { padding-top: 28px; }

.plan-sidebar {
  display: flex;
  position: sticky;
  top: 28px;
  align-self: start;
  flex-direction: column;
  gap: 30px;
  padding-top: clamp(34px, 7vw, 74px);
}

.button {
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-2px); }
.button:disabled { cursor: not-allowed; opacity: 0.38; }
.button-primary { color: var(--white); background: var(--orange); }
.button-primary:hover:not(:disabled) { background: var(--red); }
.button-ghost { color: var(--green-dark); border-color: var(--line); background: var(--white); }
.button-danger { color: var(--white); background: var(--orange); }
.button-wide { width: 100%; margin-top: 20px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 { margin: 5px 0 0; }
.section-heading p { margin-bottom: 7px; font-size: 14px; }
.progress-summary {
  max-width: 320px;
  margin: 5px 0 0 !important;
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 900;
  letter-spacing: 0.06em;
  opacity: 0.5;
  text-transform: uppercase;
}
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--lime); }

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 11px;
}

.day-card {
  position: relative;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  transition: border 160ms ease, transform 160ms ease, background 160ms ease;
}

.day-card:hover { transform: translateY(-3px); border-color: var(--orange); }
.day-card.selected { border-color: var(--orange); background: #fff5ec; box-shadow: inset 5px 0 0 var(--orange), 0 9px 22px rgba(16, 24, 43, 0.12); }
.day-card.completed { background: #fff0df; }
.day-card.last-completed::after {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--red);
  content: "ostatni";
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.day-card strong { display: block; margin-bottom: 10px; font-size: 25px; font-weight: 900; letter-spacing: -0.04em; text-transform: uppercase; }
.day-card span { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; }
.day-meta { white-space: nowrap; }

.custom-workout-card {
  border-color: rgba(24, 160, 88, 0.42);
  background: var(--custom-green-soft);
}

.custom-workout-card:hover {
  border-color: var(--custom-green);
}

.custom-workout-card.selected {
  border-color: var(--custom-green);
  background: var(--custom-green-soft);
  box-shadow: inset 5px 0 0 var(--custom-green), 0 9px 22px rgba(16, 24, 43, 0.12);
}

.custom-workout-card strong {
  color: var(--custom-green-dark);
}

.day-check {
  display: flex !important;
  align-items: center;
  gap: 7px;
  margin-top: 13px;
  cursor: pointer;
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.day-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  display: block;
  position: relative;
  width: 36px;
  height: 19px;
  border-radius: 999px;
  background: #c8ced8;
  transition: background 160ms ease;
}

.switch-thumb {
  display: block;
  position: absolute;
  top: 3px;
  left: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(16, 24, 43, 0.3);
  transition: transform 160ms ease;
}

.day-check input:checked + .switch-track { background: var(--orange); }
.day-check input:checked + .switch-track .switch-thumb { transform: translateX(17px); }
.day-check input:focus-visible + .switch-track { outline: 3px solid rgba(255, 122, 0, 0.35); outline-offset: 2px; }
.switch-label { color: var(--green-dark) !important; }

.workout-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--green-dark);
  color: var(--white);
}

.workout-view.custom-workout-active {
  background: #073b2a;
}

.workout-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 26px;
}

.workout-view .eyebrow { color: var(--lime); }
.workout-view.custom-workout-active .eyebrow { color: #79e5a5; }
.workout-content {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(270px, 0.85fr) minmax(330px, 1.15fr);
  align-items: center;
  gap: clamp(32px, 7vw, 100px);
  max-width: 1180px;
  width: 100%;
  margin: auto;
}

.exercise-frame {
  display: grid;
  min-height: min(62vw, 620px);
  overflow: hidden;
  place-items: center;
  border: 8px solid var(--orange);
  border-radius: 2px;
  background: #dfeee0;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.22);
}

.workout-view.custom-workout-active .exercise-frame {
  border-color: var(--custom-green);
  background: var(--custom-green-soft);
}

.exercise-image {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(88%, 720px) auto;
}

.exercise-1 { background-image: url("assets/exercises/exercise-1.png"); }
.exercise-2 { background-image: url("assets/exercises/exercise-2.png"); }
.exercise-3 { background-image: url("assets/exercises/exercise-3.png"); }
.exercise-4 { background-image: url("assets/exercises/exercise-4.png"); }
.exercise-5 { background-image: url("assets/exercises/exercise-5.png"); }
.exercise-6 { background-image: url("assets/exercises/exercise-6.png"); }

.timer-panel {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  margin: 30px 0 16px;
  padding: 16px 19px;
  border: 1px solid rgba(255, 253, 248, 0.2);
  border: 1px solid rgba(255, 157, 0, 0.46);
  border-radius: 2px;
  background: rgba(255, 253, 248, 0.08);
}

.workout-view.custom-workout-active .timer-panel {
  border-color: rgba(121, 229, 165, 0.52);
  background: rgba(121, 229, 165, 0.1);
}

.timer-panel p { min-height: 1.2em; margin-bottom: 0; color: rgba(255, 253, 248, 0.72); font-weight: 700; text-align: center; }
.timer-value { color: var(--lime) !important; font-family: "Google Sans", Arial, sans-serif; font-size: 105px; line-height: 0.8; }
.workout-view.custom-workout-active .timer-value { color: #79e5a5 !important; }
.timer-caption { margin-top: 0; }

.workout-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.workout-stats div {
  padding: 12px;
  border-bottom: 5px solid var(--orange);
  border-radius: 2px;
  background: rgba(255, 253, 248, 0.08);
  text-align: center;
}

.workout-view.custom-workout-active .workout-stats div {
  border-bottom-color: var(--custom-green);
  background: rgba(121, 229, 165, 0.1);
}

.workout-stats span { display: block; margin-bottom: 10px; color: var(--white); font-size: clamp(13px, 1.35vw, 19px); font-weight: 900; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }
.workout-stats strong { color: var(--lime); font-size: clamp(63px, 7.5vw, 108px); line-height: 0.95; text-align: center; }
.workout-view.custom-workout-active .workout-stats strong { color: #79e5a5; }

.workout-view.custom-workout-active .button-primary {
  background: var(--custom-green);
}

.workout-view.custom-workout-active .button-primary:hover:not(:disabled) {
  background: #0d7d47;
}

.workout-view.custom-workout-active .button-ghost {
  border-color: rgba(121, 229, 165, 0.38);
  color: #dffbea;
  background: rgba(121, 229, 165, 0.09);
}

.workout-view.custom-workout-active .button-ghost:hover:not(:disabled) {
  background: var(--custom-green);
}

.settings-view { display: grid; place-items: center; }

.settings-card {
  position: relative;
  overflow: hidden;
  max-width: 1000px;
  width: 100%;
  padding: clamp(22px, 5vw, 46px);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.settings-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
}

.settings-heading h1 { margin: 6px 0 0; font-size: clamp(54px, 8vw, 92px); }
.settings-section + .settings-section { margin-top: 30px; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.setting-field, .setting-toggle {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--paper);
}

.setting-field span, .setting-toggle span { font-weight: 800; }
.setting-field small { color: var(--muted); }

.setting-field input[type="number"] {
  min-width: 0;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.setting-toggle {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 10px;
}

.setting-toggle input { width: 20px; height: 20px; accent-color: var(--green); }
.settings-actions { display: flex; justify-content: end; gap: 10px; margin-top: 32px; }

.settings-actions-split {
  align-items: center;
  justify-content: space-between;
}

.settings-save-actions {
  display: flex;
  gap: 10px;
}

.settings-custom-link {
  min-height: 48px;
  padding: 0;
  border: 0;
  color: var(--custom-green-dark);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(24, 160, 88, 0.35);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.settings-custom-link:hover {
  color: var(--custom-green);
}

.custom-editor-card {
  border-top: 8px solid var(--custom-green);
}

.custom-editor-card .eyebrow {
  color: var(--custom-green);
}

.custom-setting-field {
  background: var(--custom-green-soft);
}

.button-custom-save {
  background: var(--custom-green);
}

.button-custom-save:hover:not(:disabled) {
  background: var(--custom-green-dark);
}

.complete-view { display: grid; min-height: 100vh; place-items: center; }
.complete-card { max-width: 720px; width: 100%; padding: 34px; border-top: 10px solid var(--orange); border-radius: 3px; background: var(--white); box-shadow: var(--shadow); }
.complete-card h1 { margin: 8px 0 16px; }
.complete-card > p:not(.eyebrow) { color: var(--muted); font-size: 18px; line-height: 1.5; }
.complete-stats { display: flex; flex-wrap: wrap; gap: 9px; margin: 23px 0; }
.complete-stats span { padding: 9px 12px; border-radius: 999px; background: var(--paper); color: var(--green-dark); font-weight: 800; }

dialog {
  max-width: 460px;
  padding: 26px;
  border: 0;
  border-radius: 3px;
  background: var(--white);
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(21, 35, 31, 0.58); }
dialog h2 { margin: 7px 0 5px; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 22px; }

@media (max-width: 760px) {
  .view { padding: 14px 12px 28px; }
  body::before { top: -110px; right: -180px; }
  body::after { bottom: -210px; left: -250px; }
  main::before { top: 42%; right: -260px; height: 54px; }
  main::after { bottom: 18%; left: -260px; height: 44px; }
  body::before, body::after, main::before, main::after { opacity: 0.5; }
  .plan-layout { display: flex; flex-direction: column-reverse; }
  .plan-sidebar { position: static; gap: 18px; padding-top: 22px; }
  .hero { gap: 7px; }
  h1 { font-size: clamp(56px, 17vw, 82px); }
  .hero-copy { margin-bottom: 0; font-size: 15px; }
  .selection-card { align-items: stretch; flex-direction: column; gap: 14px; padding: 18px; }
  .selection-card h2 { font-size: 27px; }
  .section-heading { align-items: start; flex-direction: column; gap: 4px; margin-bottom: 12px; }
  .section-heading h2 { font-size: 34px; }
  .progress-summary { font-size: 11px !important; }
  .day-grid { grid-template-columns: repeat(2, 1fr); }
  .day-card { min-width: 0; padding: 12px; }
  .day-card strong { margin-bottom: 7px; font-size: 20px; }
  .day-meta { font-size: 10px !important; white-space: normal; }
  .day-check { gap: 5px; margin-top: 9px; font-size: 9px !important; }
  .workout-topbar { padding-bottom: 10px; }
  .workout-content { display: flex; flex-direction: column; justify-content: center; gap: 12px; }
  .exercise-frame { min-height: 178px; width: min(100%, 320px); border-width: 5px; }
  .workout-copy { width: 100%; }
  .timer-panel { gap: 5px; margin: 8px 0; padding: 11px; }
  .timer-value { font-size: 74px; }
  .workout-stats { grid-template-columns: 1fr; }
  .workout-stats div { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; }
  .workout-stats span { margin-bottom: 0; font-size: 13px; text-align: left; }
  .workout-stats strong { font-size: 46px; text-align: right; }
  .button-wide { margin-top: 10px; }
  .settings-heading { flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; }
  .settings-actions-split { flex-direction: column; }
  .settings-save-actions { flex-direction: column-reverse; }
  .settings-custom-link { text-align: center; }
}
