/* AutoRep workout builder: looks like the UNA app's Configure screen, where
   the workouts get pasted (light mint page, white cards, grey pill fields). */
:root {
  --page: #eaf7f7;
  --page-top: #f3fbfb;
  --card: #fff;
  --ink: #1d4f57;       /* card titles, like the UNA app */
  --text: #2b3a3d;
  --muted: #66767a;
  --rule: #dfe9ea;
  --field: #f2f4f5;
  --accent: #2a8a8f;    /* UNA app's teal ("Reset") */
  --accent-ink: #fff;
  --chip: #eef3f4;
  --bad: #c62828;
  --good: #1f7a3a;
  --sig-f: #4d8dff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: linear-gradient(var(--page-top), var(--page) 320px) var(--page);
  color: var(--text);
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}
button, input { font: inherit; color: inherit; }

.page { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; }

/* Header */
.top { text-align: center; margin: 4px 0 8px; }
.top h1 { margin: 0; font-size: 34px; font-weight: 700; line-height: 1.15; color: var(--ink); }
.top .sig { font-size: 16px; font-weight: 600; color: var(--muted); }
.top .sig .r { color: var(--ink); }
.top .sig .f { color: var(--sig-f); }
.top .sub { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

.intro p { margin: 12px 4px 4px; color: var(--muted); font-size: 15px; }
.intro b { color: var(--ink); font-weight: 600; }

/* Cards, as in the UNA app */
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 20px 18px 16px;
  margin: 16px 0;
  box-shadow: 0 4px 18px rgba(29, 79, 87, .08);
  /* Quick taps on the chips and steppers would otherwise select their words
     (blue highlight on phones). The fields and the workout line stay selectable. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.card input, .card textarea {
  -webkit-user-select: text;
  user-select: text;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.desc { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.desc b { color: var(--text); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 14px 0; }

.link {
  border: 0; background: none; padding: 4px 0; cursor: pointer;
  color: var(--accent); font-weight: 600; font-size: 15px;
}

.field-l { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
.field-l:first-of-type { margin-top: 0; }

.pill {
  width: 100%;
  background: var(--field);
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 18px;
  text-align: center;
}
.pill:focus { outline: none; border-color: var(--accent); background: #fff; }
.pill.bad { border-color: var(--bad); }
.pill.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; text-align: left; }

.hint { margin: 6px 4px 0; font-size: 13px; color: var(--muted); text-align: right; min-height: 20px; }
.hint.bad { color: var(--bad); }
.hint.good { color: var(--good); }

/* Choices */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid transparent;
  background: var(--chip);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip.ghost { background: transparent; border-color: var(--rule); color: var(--muted); padding: 4px 12px; font-size: 14px; }
.chip.ghost:hover { border-color: var(--accent); color: var(--accent); }
.chip:focus-visible, .sb:focus-visible, .copy:focus-visible, .link:focus-visible, .add:focus-visible,
.add-ex:focus-visible, .block-title:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}

.starters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 2px; }
.starters .field-l { display: inline; margin: 0 4px 0 0; font-weight: 500; color: var(--muted); }

.mode-info { margin: 8px 2px 0; font-size: 14px; color: var(--muted); }

/* Options */
.opts { margin-top: 12px; border-top: 1px solid var(--rule); }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.opt-col { display: block; }
.opt-col .opt-l { display: block; margin-bottom: 8px; }
.opt-l { font-size: 15px; font-weight: 500; }
.step { display: inline-flex; align-items: center; gap: 4px; background: var(--field); border-radius: 999px; padding: 3px; }
.sb {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-size: 22px; font-weight: 600; line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  touch-action: manipulation;
}
.sb:disabled { color: #c3cdcf; box-shadow: none; cursor: default; }
.sv { min-width: 44px; text-align: center; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Result */
.result { margin-top: 16px; }
.sum { margin: 0 2px 8px; font-size: 15px; font-weight: 500; }
.sum .time { color: var(--muted); font-weight: 400; white-space: nowrap; }
.sum .time::before { content: '· '; }
.line {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  word-break: break-all;
  background: var(--field);
  border-radius: 14px;
  padding: 12px 16px;
  user-select: all;
  -webkit-user-select: all;
  -webkit-touch-callout: default;   /* long-press copy still works on the line */
}
.line.empty { color: var(--muted); font-family: inherit; user-select: none; -webkit-user-select: none; }

.copy {
  display: block;
  width: 100%;
  margin: 12px 0 0;
  padding: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.copy.done { background: var(--good); }
.copy:disabled { background: var(--rule); color: var(--muted); cursor: not-allowed; }

.hint.left { text-align: left; }

/* Several exercises in one workout (AutoRep 1.2). The one being edited is
   open; the others fold to one line. */
.blocks { margin-top: 4px; }
.block { border: 2px solid var(--rule); border-radius: 18px; padding: 4px 12px; margin-top: 10px; }
.block.open { border-color: var(--accent); padding-bottom: 12px; }
.block-head { display: flex; align-items: center; gap: 8px; }
.block-title {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  border: 0; background: none; padding: 8px 0; text-align: left; cursor: pointer;
}
.block-title .num {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--chip); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 26px; text-align: center;
}
.block.open .num { background: var(--accent); color: var(--accent-ink); }
.block-title .bsum { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.block-title .edit { color: var(--accent); font-size: 14px; font-weight: 600; }
.x {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: none; color: var(--muted); font-size: 15px; cursor: pointer;
}
.x:hover { background: var(--chip); color: var(--bad); }
.x:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.block .field-l:first-of-type { margin-top: 6px; }
.between { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0 0; }
.between .opt-l { font-size: 14px; color: var(--muted); }
.rest-sel {
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ink);
  background: var(--chip); border: 2px solid transparent; border-radius: 999px;
  padding: 4px 12px; cursor: pointer;
}
.rest-sel:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.add-ex {
  display: block; width: 100%; margin-top: 10px; padding: 10px;
  border: 2px dashed #b9d3d5; border-radius: 18px; background: transparent;
  color: var(--accent); font-size: 15px; font-weight: 600; cursor: pointer;
}
.add-ex:disabled { color: var(--muted); border-color: var(--rule); cursor: default; }

.note { margin: 0 2px 8px; font-size: 14px; color: var(--muted); }
.note::before { content: 'ⓘ '; color: var(--accent); }

.field + .field { margin-top: 16px; }
.field-n { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 2px 6px; }

.paste { margin-top: 14px; }
.paste summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 500; }
.paste .pill { margin-top: 8px; }
.paste textarea.pill { border-radius: 14px; resize: vertical; display: block; }

.add {
  display: block;
  width: 100%;
  padding: 14px;
  border: 2px dashed #b9d3d5;
  border-radius: 22px;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.add[hidden] { display: none; }

.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }
.foot p { margin: 4px 0; }
.foot a { color: var(--accent); }

/* Small phones: keep the four formats and five exercises on fewer lines. */
@media (max-width: 400px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .card { padding: 18px 14px 14px; }
  .chips { gap: 6px; }
  .chip { padding: 6px 11px; font-size: 14px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0f1d1f; --page-top: #13272a; --card: #182b2e; --ink: #bfe6e8; --text: #e4eeef;
    --muted: #9db0b3; --rule: #27403f; --field: #223a3d; --chip: #223a3d; --accent: #4fb7bc;
    --accent-ink: #062022; --bad: #ff7b7b; --good: #6fdc8c;
  }
  .sb { background: #2c474a; }
  .sb:disabled { color: #4b6466; }
  .pill:focus { background: var(--field); }
  .add, .add-ex { border-color: #2f5053; }
}
