/* Optimus Training — one stylesheet.
   Every colour is a token defined once here. Dark is the default because the
   app is used in a gym; light is a real alternative, not an afterthought.
   The lime reads fine on near-black but fails as text on white, so in light
   mode anything that is text or a hairline darkens to olive while filled
   buttons keep the bright lime with dark text on them. Same app either way. */

:root {
  --bg:        #131313;
  --surface:   #1c1b1a;
  --surface-2: #262523;
  --sunken:    #0d0d0d;
  --text:      #f2efea;
  --text-2:    #a29d95;
  --text-3:    #6f6a63;
  --text-4:    #56524c;
  --line:      rgba(255, 255, 255, 0.07);
  --line-2:    rgba(255, 255, 255, 0.13);

  --accent:      #c8f04a;   /* fills */
  --accent-ink:  #c8f04a;   /* text and hairlines */
  --accent-soft: rgba(200, 240, 74, 0.11);
  --accent-edge: rgba(200, 240, 74, 0.30);
  --on-accent:   #131313;

  --warn:      #ff8f86;
  --warn-soft: rgba(255, 107, 96, 0.13);
  --warn-edge: rgba(255, 107, 96, 0.32);
  --amber:     #f0a35e;
  --amber-soft: rgba(240, 163, 94, 0.12);

  --r-sm: 8px;
  --r:    11px;
  --r-lg: 16px;

  --font: Archivo, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="light"] {
  --bg:        #f7f6f3;
  --surface:   #ffffff;
  --surface-2: #f2f1ec;
  --sunken:    #efeee9;
  --text:      #1a1917;
  --text-2:    #6b6862;
  --text-3:    #918d85;
  --text-4:    #b3afa7;
  --line:      #e5e2da;
  --line-2:    #dedbd3;

  --accent:      #c8f04a;
  --accent-ink:  #4f6d10;
  --accent-soft: #f0f7dd;
  --accent-edge: #a9cc5c;
  --on-accent:   #1a1917;

  --warn:      #a83b30;
  --warn-soft: #fbe9e7;
  --warn-edge: #e8b3ad;
  --amber:     #8a5a12;
  --amber-soft: #f6e6d0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input {
  font: inherit;
  color: inherit;
}

.mono { font-family: var(--mono); }

/* ── layout ─────────────────────────────────────────────────────────────── */

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.pad { padding: 24px 20px; }

.centre {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
}

.grow { flex-grow: 1; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── type ───────────────────────────────────────────────────────────────── */

h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}

h2 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dim  { color: var(--text-2); font-size: 13px; }
.dim2 { color: var(--text-3); font-size: 12.5px; }

/* ── brand ──────────────────────────────────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand svg { stroke: var(--accent-ink); }

/* ── controls ───────────────────────────────────────────────────────────── */

.field {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  font-size: 16px;            /* 16px or iOS zooms the page on focus */
  outline: none;
}
.field:focus { border-color: var(--accent-edge); }
.field::placeholder { color: var(--text-4); }

.btn {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: var(--r);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-quiet {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text);
  min-height: 46px;
  font-weight: 600;
  font-size: 13.5px;
}

/* ── cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 17px 19px;
}

.card-tap {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.card-warn { border-color: var(--warn-edge); }
.card-live { border-color: var(--accent-edge); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-ink);
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-live { background: var(--accent-soft); color: var(--accent-ink); }

.bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--accent-ink);
  border-radius: 2px;
}

/* ── notices ────────────────────────────────────────────────────────────── */

.notice {
  padding: 14px 16px;
  border-radius: var(--r);
  font-size: 13.5px;
  line-height: 1.5;
  border: 1px solid transparent;
}
.notice-good { background: var(--accent-soft); border-color: var(--accent-edge); }
.notice-bad  { background: var(--warn-soft);   border-color: var(--warn-edge); color: var(--warn); }

/* ── header ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 20px 0;
}

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── wider screens ──────────────────────────────────────────────────────── */

@media (min-width: 760px) {
  .pad, .topbar { max-width: 820px; margin-left: auto; margin-right: auto; width: 100%; }
}

/* ── running a session ──────────────────────────────────────────────────── */

.pips { display: flex; gap: 5px; }
.pips > i {
  flex-grow: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-2);
}
.pips > i.on  { background: var(--accent-ink); }
.pips > i.now { background: var(--accent-ink); opacity: 0.45; }

.lasttime {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 15px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}

.nums {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.nums label { display: flex; flex-direction: column; gap: 6px; }

.num {
  height: 54px;
  width: 100%;
  padding: 0 10px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  outline: none;
  -moz-appearance: textfield;
}
.num::-webkit-outer-spin-button,
.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num:focus { border-color: var(--accent-edge); }

.tickdot {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.linky {
  background: none;
  border: none;
  padding: 6px 4px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.linky:hover { color: var(--text); }

.restbar {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  background: var(--amber-soft);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.restbar.done {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.pill-amber { background: var(--amber-soft); color: var(--amber); }

/* ── the session screen ─────────────────────────────────────────────────── */

.runbar {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 20px 14px;
}

.restpill {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-4);
  min-width: 34px;
  text-align: right;
}
.restpill.is-on { color: var(--amber); }
.restpill.is-up { color: var(--accent-ink); }

/* every exercise, always reachable, in any order */
.exstrip {
  display: flex;
  gap: 8px;
  padding: 0 20px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.exstrip::-webkit-scrollbar { display: none; }

.exchip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 168px;
  padding: 9px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.exchip.is-on   { border-color: var(--accent-edge); background: var(--accent-soft); color: var(--text); }
.exchip.is-done { color: var(--text-3); }
.exchip-n       { color: var(--text-4); font-family: var(--mono); }
.exchip.is-on .exchip-n { color: var(--accent-ink); }
.exchip-name    { overflow: hidden; text-overflow: ellipsis; }
.exchip-tick    { display: flex; color: var(--accent-ink); }
.exchip.is-done .exchip-n { display: none; }

/* the sets table */
.settable { margin-top: 20px; }

.setgrid {
  display: grid;
  grid-template-columns: 26px minmax(52px, 1fr) 1fr 1fr 0.72fr 40px;
  gap: 7px;
  align-items: center;
}

.sethead {
  padding: 0 2px 9px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.sethead > span:nth-child(n+3) { text-align: center; }

.setrow { padding: 5px 0; }
.setrow.is-done .cell { background: transparent; border-color: transparent; color: var(--text-2); }

.setno {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
}
.setno.extra { color: var(--text-4); }

.prev {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-3);
  white-space: pre-line;
}

.cell {
  width: 100%;
  height: 46px;
  padding: 0 4px;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 16px;         /* 16 or iOS zooms on focus */
  font-weight: 600;
  outline: none;
  -moz-appearance: textfield;
}
.cell::-webkit-outer-spin-button,
.cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cell:focus { border-color: var(--accent-edge); }
.cell::placeholder { color: var(--text-4); }
.cell:disabled { opacity: 1; }

.tick {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border-radius: 9px;
  border: 1.5px solid var(--line-2);
  background: transparent;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tick.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.addset {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.addset:hover { color: var(--text); }
.exchip-part {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-ink);
}

.setno.warm { color: var(--amber); }
.setrow.is-warm .cell { background: transparent; border-style: dashed; }
