/* Palette and type match simonsmind.com (generatepress-child/style.css). */
:root {
  --bg: #2e3440;
  --bg-raised: #3b4252;
  --bg-raised-hover: #434c5e;
  --bg-code: #262b36;
  --fg: #eceff4;
  --fg-secondary: #e5e9f0;
  --muted: #a9b6cc;
  --accent: #88c0d0;
  --accent-2: #a3be8c;
  --accent-glow: rgba(136, 192, 208, 0.35);
  --border: #4c566a;
  --orange: #d08770;
  --yellow: #ebcb8b;
  --red: #bf616a;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
::selection { background: var(--accent); color: var(--bg); }
html { scrollbar-color: var(--border) var(--bg); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  -webkit-tap-highlight-color: transparent;
}
/* same faint scanlines as the main site */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(0deg, rgba(136, 192, 208, 0.025) 0px, rgba(136, 192, 208, 0.025) 1px, transparent 1px, transparent 3px);
  opacity: 0.6;
}

main, .top { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.dim { color: var(--border); }
.center { text-align: center; }
.mono { font-family: var(--mono); }
.good { color: var(--accent-2); }
.warn { color: var(--orange); }
.bad { color: var(--red); }

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: calc(env(safe-area-inset-top) + 18px);
  padding-bottom: 14px;
}
.prompt { font-family: var(--mono); font-weight: 600; color: var(--fg); font-size: 1.05rem; white-space: nowrap; }
.prompt .tilde { color: var(--accent-2); margin-right: 2px; }
.prompt .path { color: var(--muted); font-weight: 400; }
.prompt .cursor { color: var(--accent); margin-left: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.rest {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  background: var(--bg-raised);
}

/* ---------- headings & cards ---------- */
h1, h2, h3 { font-family: var(--mono); font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.2rem; margin: 6px 0 14px; }
h2 { font-size: 1rem; margin: 26px 0 10px; }
h2::before { content: "> "; color: var(--accent-2); }
h3 { font-size: 0.95rem; margin: 0; }
.meta { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); letter-spacing: 0.02em; }
.meta::before { content: "// "; color: var(--border); }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.card.link { cursor: pointer; display: block; color: inherit; width: 100%; text-align: left; }
.card.link:hover, .card.link:focus-visible { border-color: var(--accent); box-shadow: 0 0 24px -6px var(--accent-glow); outline: none; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
  color: var(--fg);
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { border-color: var(--accent); color: var(--bg); background: var(--accent); font-weight: 600; }
.btn.primary:hover { box-shadow: 0 0 16px -2px var(--accent-glow); color: var(--bg); }
.btn.danger { color: var(--red); border-color: transparent; }
.btn.danger:hover { border-color: var(--red); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--accent); }
.btn.small { padding: 5px 10px; font-size: 0.8rem; }
.btn.block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], textarea {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  width: 100%;
  outline: none;
  font-family: var(--mono);
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }
textarea { resize: vertical; min-height: 44px; font-size: 0.85rem; }
label.field { display: block; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }

/* ---------- bottom tabs ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 4px;
  background: rgba(46, 52, 64, 0.94);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs button {
  flex: 1;
  max-width: 180px;
  height: 44px;
  background: none;
  border: none;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.9rem;
}
.tabs button::before { content: "["; color: var(--border); }
.tabs button::after { content: "]"; color: var(--border); }
.tabs button.on { color: var(--accent); text-shadow: 0 0 8px var(--accent-glow); }

/* ---------- workout logging ---------- */
.ex-card h3 { color: var(--accent); }
.ex-card h3 .group { color: var(--muted); font-weight: 400; font-size: 0.75rem; margin-left: 6px; }
.sets { width: 100%; border-collapse: collapse; margin-top: 10px; font-family: var(--mono); font-size: 0.85rem; }
.sets th { font-weight: 400; color: var(--muted); font-size: 0.7rem; text-align: center; padding: 0 2px 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.sets td { padding: 3px 2px; text-align: center; vertical-align: middle; }
.sets td.n { width: 34px; }
.sets td.prev { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.sets td.prev button { background: none; border: none; color: inherit; padding: 6px 2px; font-family: var(--mono); font-size: 0.75rem; }
.sets td.w, .sets td.r { width: 72px; }
.sets td input { padding: 8px 4px; text-align: center; min-width: 0; font-size: 1rem; }
.sets tr.done td input { border-color: transparent; background: rgba(163, 190, 140, 0.12); }
.sets td.ok, .sets td.x { width: 40px; }
.setno {
  width: 30px; height: 30px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: none;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg);
}
.setno.wu { color: var(--yellow); }
.setno:hover { border-color: var(--border); }
.tick {
  width: 38px; height: 38px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-code);
  color: var(--muted);
  font-size: 1rem;
}
tr.done .tick { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); font-weight: 700; }
.xbtn { background: none; border: none; color: var(--border); width: 30px; height: 30px; font-size: 1rem; }
.xbtn:hover { color: var(--red); }
.pr { color: var(--yellow); font-size: 0.8rem; margin-left: 2px; }
.ex-foot { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

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

/* ---------- bottom sheet (exercise picker etc.) ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 23, 30, 0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  width: 100%;
  max-width: 700px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
}
.sheet-scroll { overflow-y: auto; margin: 10px -16px 0; padding: 0 16px; }
.sheet-body > * { flex: none; }
.sheet-body > .sheet-scroll { flex: 1 1 auto; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chip {
  flex: none;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
}
.chip.on { border-color: var(--accent); color: var(--accent); }
.pick {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(76, 86, 106, 0.5);
  padding: 12px 2px;
  text-align: left;
}
.pick:hover { color: var(--accent); }
.pick .meta::before { content: none; }
.pick.added { opacity: 0.45; }
.group-label { font-family: var(--mono); color: var(--accent-2); font-size: 0.75rem; margin: 14px 0 0; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- stats ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.tile { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.tile .k { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tile .v { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; margin-top: 2px; }
.tile .v small { font-size: 0.75rem; color: var(--muted); font-weight: 400; margin-left: 2px; }

.month-nav { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.month-nav span { font-family: var(--mono); font-weight: 600; }

.chart { width: 100%; display: block; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.chart .grid { stroke: #434c5e; stroke-width: 1; }
.chart .bar { fill: var(--accent); opacity: 0.55; }
.chart .bar.hi { opacity: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); stroke: var(--bg-raised); stroke-width: 2; }
.chart .goal { stroke: var(--accent-2); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hl { opacity: 1; filter: drop-shadow(0 0 6px var(--accent-glow)); }

.hbars { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 10px; align-items: center; font-family: var(--mono); font-size: 0.8rem; }
.hbars .track { height: 14px; background: var(--bg-code); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbars .fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbars .val { color: var(--fg); text-align: right; white-space: nowrap; }
.hbars .val small { color: var(--muted); }

.tbl-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.8rem; }
.tbl th { text-align: left; font-weight: 400; color: var(--muted); font-size: 0.7rem; padding: 6px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 8px 6px; border-bottom: 1px solid rgba(76, 86, 106, 0.4); white-space: nowrap; }
.tbl td.name { white-space: normal; min-width: 130px; color: var(--fg); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(136, 192, 208, 0.06); }
.tbl tr.grp td { color: var(--accent-2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 14px; border-bottom: none; }
.tbl .num { text-align: right; }

.since { display: inline-flex; align-items: center; gap: 5px; }
.since::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.progress { height: 8px; background: var(--bg-code); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress div { height: 100%; background: var(--accent-2); border-radius: 4px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.seg button { background: none; border: none; font-family: var(--mono); font-size: 0.75rem; padding: 5px 10px; color: var(--muted); }
.seg button.on { background: var(--bg-raised-hover); color: var(--accent); }

/* ---------- history ---------- */
.w-sets { font-family: var(--mono); font-size: 0.8rem; color: var(--fg-secondary); margin: 2px 0 10px; }
.w-sets .wu { color: var(--yellow); }

/* ---------- toast & tooltip ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  z-index: 50;
  background: var(--bg-raised);
  border: 1px solid var(--accent);
  box-shadow: 0 0 24px -6px var(--accent-glow);
  border-radius: 6px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 0.85rem;
  max-width: calc(100vw - 32px);
}
.toast.err { border-color: var(--red); }
.tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px));
}
.tip b { color: var(--accent); font-weight: 600; }

/* ---------- login ---------- */
.login { max-width: 360px; margin: 12vh auto 0; }
.login p { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; }

@media (min-width: 600px) {
  .sheet { align-items: center; }
  .sheet-body { border-radius: 10px; border-bottom: 1px solid var(--border); }
}
