:root {
  --bg: #0e1013;
  --surface: #171a1f;
  --surface-2: #1f232a;
  --line: #2a2f38;
  --text: #eef1f5;
  --muted: #8b94a3;
  --accent: #c6ff3d;
  --accent-ink: #11140a;
  --good: #3ddc84;
  --warn: #ffb547;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: max(10px, env(safe-area-inset-top)) 16px 8px; border-bottom: 1px solid var(--line);
}
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 960px; margin: 0 auto; }
.title-box { min-width: 0; }
.eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-btn {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px;
}
.info-btn.back { border-color: var(--accent); color: var(--accent); }

.chips, .tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 960px; margin: 8px auto 0;
}
.chips::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-width: 56px; min-height: 44px; padding: 4px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; line-height: 1.1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.chip b { font-size: 13px; }
.chip span { font-size: 10px; color: var(--muted); }
.chip.today { border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.active span { color: var(--accent-ink); opacity: .75; }
.tab {
  flex: none; min-height: 38px; padding: 0 12px; border-radius: 99px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 700; font-size: 13px;
}
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.ramp-banner {
  max-width: 960px; margin: 8px auto 0; padding: 5px 10px; border-radius: 10px; font-size: 12px; font-weight: 700;
  background: rgba(198,255,61,.1); border: 1px solid rgba(198,255,61,.35); color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

main { max-width: 960px; margin: 0 auto; padding: 12px 12px 0; }

/* Home: GIF grid, 2 columns on phone */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid.rest { grid-template-columns: 1fr; }
.tile {
  display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.tile:active { border-color: var(--accent); }
.tile-cap { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px 9px; }
.tile-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.tile-target { font-size: 12px; font-weight: 800; color: var(--accent); }
.tile-start { font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.25; }

.media { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); width: 100%; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; background: #111317; }
.placeholder {
  position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; padding: 10px;
  background: repeating-linear-gradient(135deg, #1b1f25 0 12px, #1e2229 12px 24px);
}
.placeholder .ph-name { font-weight: 700; font-size: 13px; color: var(--muted); }
.media .num {
  position: absolute; z-index: 2; top: 6px; left: 6px; background: var(--accent); color: var(--accent-ink);
  font-weight: 900; font-size: 13px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px;
  display: grid; place-content: center;
}

/* Cards (recovery, info) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-body { padding: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-head h3 { font-size: 17px; font-weight: 750; }
.target { font-weight: 800; color: var(--accent); white-space: nowrap; font-size: 15px; }
.target.big { font-size: 22px; }
.note { color: var(--muted); font-size: 14px; margin-top: 4px; }
.info-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.info-list li { padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-weight: 600; }
.rl-note { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

/* Muscle chips (primary = solid lime, secondary = outlined lime) */
.muscles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mchip { font-size: 12px; font-weight: 700; line-height: 1; padding: 5px 9px; border-radius: 99px; border: 1px solid var(--accent); }
.mchip.primary { background: var(--accent); color: var(--accent-ink); }
.mchip.secondary { background: rgba(198,255,61,.08); color: rgba(198,255,61,.8); border-color: rgba(198,255,61,.45); }

/* Detail sheet */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 18px 18px 0 0; padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.sheet-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.sheet-bar h2 { font-size: 17px; }
.close-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 18px; font-weight: 800; cursor: pointer;
}
.sheet .media { aspect-ratio: 4 / 3; }
.sheet .media img { object-fit: contain; }
.sheet-info { padding: 14px 16px 4px; }
.sheet-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin: 16px 0 6px; }
.sheet-sub.warn { color: var(--warn); }
.start-box { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.start-line { font-size: 15px; }
.start-line b { color: var(--accent); }
.start-rule { margin: 6px 0 0; color: var(--muted); }
.howto-tip { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.howto-steps, .howto-mistakes { margin: 0; padding-left: 20px; font-size: 15px; display: grid; gap: 5px; }
.howto-mistakes li::marker { color: var(--warn); }
.warmup { margin: 16px 0 8px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; color: var(--muted); }

/* Info pages */
#info { display: grid; gap: 12px; }
.tag {
  flex: none; font-size: 12px; font-weight: 800; line-height: 1.2; padding: 4px 9px; border-radius: 99px; text-align: right;
  background: rgba(198,255,61,.1); color: var(--accent); border: 1px solid rgba(198,255,61,.35); max-width: 55%;
}
.tag.buy { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag.maybe { background: rgba(255,181,71,.1); color: var(--warn); border-color: rgba(255,181,71,.4); }
.when { font-size: 13px; color: var(--muted); margin-top: 4px; }
.lead { margin: 8px 0 0; font-size: 15px; }
.info-card h3 + .gloss, .info-card .gloss + h3 { margin-top: 10px; }
.info-bullets { margin: 10px 0 0; padding-left: 20px; font-size: 15px; display: grid; gap: 6px; }
.info-bullets li::marker { color: var(--accent); }
.info-rows { margin: 10px 0 0; display: grid; }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.info-row:last-child { border-bottom: 0; }
.info-row dt { min-width: 0; }
.info-row dd { margin: 0; font-weight: 800; color: var(--accent); white-space: nowrap; }
.info-rows.stacked .info-row { display: block; }
.info-rows.stacked dt { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.info-rows.stacked dd { color: var(--text); font-weight: 500; white-space: normal; margin-top: 2px; }
.warn-note {
  margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 13px;
  background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.35); color: var(--warn);
}
.tiers .card-body { display: grid; gap: 10px; }
.tier { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.tier-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.tier-text { font-size: 14px; margin-top: 3px; }
.gloss { margin: 10px 0 16px; display: grid; gap: 8px; }
.gloss dt { font-weight: 800; color: var(--accent); font-size: 14px; }
.gloss dd { margin: 0; font-size: 14px; }

/* Goal */
.goal-media { aspect-ratio: 3 / 2; }
.goal-media.loaded { aspect-ratio: auto; }
.goal-media.loaded img { height: auto; object-fit: contain; }
.goal-stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stage { background: var(--surface-2); border-radius: 12px; padding: 10px; }
.stage-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.stage-val { font-weight: 800; font-size: 16px; margin-top: 4px; }
.stage-when { margin-top: 2px; }
.stage-detail { margin-top: 4px; }
@media (max-width: 420px) {
  .goal-stages { grid-template-columns: 1fr; }
  .stage { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; }
  .stage-label { grid-column: 1 / -1; } .stage-val { grid-row: 2; grid-column: 2; margin: 0; }
  .stage-when { grid-row: 2; grid-column: 1; } .stage-detail { grid-column: 1 / -1; }
}

.foot { text-align: center; padding: 18px 0 8px; }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .tile-name { font-size: 15px; } .tile-target { font-size: 14px; } .tile-start { font-size: 12px; }
  #info { grid-template-columns: 1fr 1fr; }
  #info .warn-note, #info .tiers, #info .goal-card { grid-column: 1 / -1; }
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 18px; max-height: 92vh; }
  h1 { font-size: 26px; }
}
