:root {                    /* default: Royal — royal blue & gold */
  --bg: #0d1322; --panel: #15203a; --panel2: #1d2b4e; --line: #2b3c66;
  --text: #e9ecf5; --muted: #96a2c4; --accent: #d9b45b;
  --up: #66c98a; --down: #e0716f;
}
html[data-theme="ember"] {
  --bg: #111318; --panel: #191c24; --panel2: #222633; --line: #2a2f3c;
  --text: #eae7e0; --muted: #9298a8; --accent: #e5a558;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="ice"] {
  --bg: #0d1418; --panel: #141d23; --panel2: #1c2830; --line: #263540;
  --text: #e4ebee; --muted: #8fa3ad; --accent: #56c3dc;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="nocturne"] {
  --bg: #141020; --panel: #1c1730; --panel2: #262040; --line: #322a52;
  --text: #eae6f2; --muted: #9d94b8; --accent: #a78bda;
  --up: #69c98a; --down: #e0716f;
}
html[data-theme="paper"] { /* light */
  --bg: #f5f2ec; --panel: #fdfbf7; --panel2: #ece6d8; --line: #d8d1c0;
  --text: #29261f; --muted: #7a7468; --accent: #8a6d1d;
  --up: #1a8f4a; --down: #c04543;
}
:root {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --up-soft: color-mix(in srgb, var(--up) 14%, transparent);
  --down-soft: color-mix(in srgb, var(--down) 14%, transparent);
  --radius: 14px;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px)
           calc(env(safe-area-inset-right) + 16px)
           calc(env(safe-area-inset-bottom) + 28px)
           calc(env(safe-area-inset-left) + 16px);
  -webkit-tap-highlight-color: transparent;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.theme-row { margin-top: 26px; display: flex; align-items: center; gap: 12px; justify-content: center; }
.theme-label { color: var(--muted); font-size: 0.75rem; }
.theme-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.theme-dot.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.foot-note { color: var(--muted); font-size: 0.72rem; text-align: center; margin-top: 8px; line-height: 1.5; }

/* ------------------------------------------------------------------ app */
.app-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 2px 10px; }
.app-title { font-size: 0.95rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.sec-label { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 10px; }

/* target row */
.target { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.target-label { color: var(--muted); font-size: 0.78rem; margin-bottom: 2px; }
.target-time { display: block; font-size: 2.7rem; line-height: 1.05; padding: 0; text-align: left; }
.target-input {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 1.7rem; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 4px 8px; width: 156px;
}
.nudges { display: flex; gap: 8px; flex: none; }
.nudge {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 10px;
  padding: 10px 11px; font-size: 0.8rem;
}
.nudge:active { border-color: var(--accent); }

/* the chain */
.chain { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cue {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
}
.c-name { flex: 1; font-size: 0.95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-time { color: var(--muted); font-size: 0.9rem; flex: none; }
.c-count { font-size: 0.95rem; min-width: 88px; text-align: right; flex: none; }
.cue.primary { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); padding: 17px 14px; }
.cue.primary .c-name { font-size: 1.15rem; font-weight: 600; }
.cue.primary .c-count { font-size: 1.15rem; font-weight: 600; color: var(--accent); }
.cue.passed {
  background: transparent; border-color: transparent;
  padding: 2px 14px; gap: 6px;
  color: var(--muted); font-size: 0.82rem;
}
.chain-note { color: var(--muted); font-size: 0.75rem; text-align: center; padding: 6px 0 0; }
.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 0.85rem; text-align: center; padding: 18px 14px;
}

/* small links row */
.link-row { display: flex; justify-content: space-between; margin-top: 12px; padding: 0 2px; }
.link { color: var(--muted); font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px; padding: 4px 2px; }
.link:active { color: var(--accent); }

/* cue editor */
.edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.chk {
  width: 26px; height: 26px; flex: none;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2);
  color: transparent; font-size: 0.85rem; line-height: 1;
}
.chk.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.name-input {
  flex: 1 1 200px; min-width: 0;
  font-size: 16px; color: var(--text);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 9px;
}
.name-input::placeholder { color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; }
.step {
  width: 30px; height: 30px; flex: none;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2);
  font-size: 1rem; line-height: 1;
}
.step:active { border-color: var(--accent); }
.off-label { min-width: 66px; text-align: center; color: var(--muted); font-size: 0.85rem; }
.del { margin-left: auto; color: var(--muted); font-size: 0.8rem; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.del.arm { color: var(--down); }
.add-cue {
  margin-top: 10px; width: 100%;
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px;
  color: var(--muted); font-size: 0.85rem;
}
.add-cue:active { color: var(--accent); border-color: var(--accent); }

/* morning */
.m-row { display: flex; flex-direction: column; gap: 8px; padding: 5px 0; }
.m-q { font-size: 0.92rem; }
.m-btns { display: flex; gap: 8px; }
.m-btn {
  flex: 1; border: 1px solid var(--line); background: var(--panel2);
  border-radius: 10px; padding: 10px 0; font-size: 0.92rem;
}
.m-btn:active { border-color: var(--accent); }
.m-btn.q-good { color: var(--up); }
.m-btn.q-meh { color: var(--accent); }
.m-btn.q-rough { color: var(--down); }
.m-done { color: var(--muted); font-size: 0.88rem; }

/* fourteen-day strip */
.strip { display: flex; gap: 5px; justify-content: space-between; }
.day { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sq { width: 100%; max-width: 22px; aspect-ratio: 1 / 1; border: 1px solid var(--line); border-radius: 5px; }
.sq.q-good { background: var(--up); border-color: var(--up); }
.sq.q-meh { background: var(--accent); border-color: var(--accent); }
.sq.q-rough { background: var(--down); border-color: var(--down); }
.dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.dot.show { background: var(--muted); }
.dl { font-size: 0.6rem; color: var(--muted); }
.strip-count { margin-top: 10px; color: var(--muted); font-size: 0.75rem; text-align: center; }
