:root {
  color-scheme: light;
  --ink: #101820;
  --muted: #5f6b63;
  --line: #d8ded4;
  --paper: #f5f7f2;
  --panel: #ffffff;
  --accent: #ff6f3c;
  --accent-dark: #d94f22;
  --mint: #c7ead7;
  --blue: #d7e7ff;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(16, 24, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.topbar,
.status-strip,
.progress-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow,
.label,
.control-label,
.task-type {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
  line-height: 1.15;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 22px;
}

.install-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 800;
}

.status-strip {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-strip > div {
  min-width: 0;
}

.status-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  white-space: nowrap;
}

.panel,
.notice,
.workout-view {
  margin-top: 14px;
}

.panel,
.notice {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.notice {
  border-color: #f5c2aa;
  background: #fff3ed;
}

.notice.is-info {
  border-color: #b8cdea;
  background: #edf5ff;
}

.section-heading {
  align-items: flex-start;
  margin-bottom: 16px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.control-group {
  margin-bottom: 18px;
}

.control-label {
  display: block;
  margin-bottom: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.segmented button,
.option-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.segmented button.is-selected,
.option-button.is-selected {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.option-list {
  display: grid;
  gap: 8px;
}

.option-button {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  text-align: left;
}

.option-button small {
  display: block;
  margin-top: 4px;
  color: inherit;
  font-weight: 500;
  opacity: 0.78;
}

.option-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 12px 14px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  background: var(--accent);
  color: #23120b;
}

.primary-action:hover {
  background: var(--accent-dark);
  color: #fff;
}

.secondary-action {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.danger-action {
  background: #fff2f0;
  border-color: #ffcdc7;
  color: var(--danger);
}

.workout-view {
  display: grid;
  gap: 14px;
}

.progress-row {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.task-card {
  position: relative;
  min-height: 280px;
  padding: 26px;
  overflow: hidden;
  border: 1px solid #cfd6cc;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(199, 234, 215, 0.55), rgba(215, 231, 255, 0.45)),
    var(--panel);
  box-shadow: var(--shadow);
}

.card-corner {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.task-card h2 {
  max-width: calc(100% - 54px);
  margin-top: 26px;
  margin-bottom: 12px;
  font-size: 36px;
  line-height: 1.02;
}

.task-meta {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 800;
}

.task-description {
  margin-bottom: 0;
  color: #27312b;
  font-size: 17px;
  line-height: 1.45;
}

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

.action-grid .primary-action {
  grid-column: 1 / -1;
}

.stats-grid,
.result-list {
  display: grid;
  gap: 10px;
}

.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-actions {
  display: grid;
  margin-top: 12px;
}

.stat-item,
.result-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.stat-item span,
.result-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-item strong,
.result-item strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.modal {
  width: min(92vw, 560px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(16, 24, 32, 0.46);
}

.modal-content {
  position: relative;
  padding: 22px;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
}

#helpContent {
  color: #27312b;
  line-height: 1.45;
}

#helpContent h3 {
  margin: 18px 0 8px;
  font-size: 15px;
}

#helpContent ol,
#helpContent ul {
  padding-left: 20px;
}

.hidden {
  display: none !important;
}

@media (max-width: 520px) {
  .app-shell {
    padding: 16px 12px 28px;
  }

  h1 {
    font-size: 26px;
  }

  .status-strip {
    gap: 8px;
  }

  .status-strip strong {
    font-size: 15px;
  }

  .option-list.compact,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .task-card {
    min-height: 250px;
    padding: 22px;
  }

  .task-card h2 {
    font-size: 30px;
  }
}
