:root {
  --bg:           #0a0a0b;
  --panel:        #17171a;
  --panel-2:      #1f1f23;
  --hairline:     rgba(255,255,255,0.08);
  --text-primary: #ffffff;
  --text-secondary: #b6b3bd;
  --text-muted:   #77747f;
  --accent:       #ff2e88;
  --accent-dim:   #ff2e8822;
  --good:         #16d16a;
  --critical:     #e66767;
  --s-breaking:   #3987e5;
  --s-work:       #199e70;
  --s-finance:    #c98500;
  --s-coach:      #9085e9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.loading, .ci-loading {
  color: var(--text-muted);
  font-size: 14px;
  padding-top: 40px;
  text-align: center;
}

.screen { min-height: 100vh; padding-bottom: 20px; }

/* ===== Navbar ===== */
.navbar { display: flex; gap: 8px; padding: 14px 16px 0; }
.navbar-tab {
  flex: 1; text-align: center; padding: 9px 0; border-radius: 20px;
  font-size: 12.5px; font-weight: 700; color: var(--text-secondary);
  background: var(--panel); border: 1px solid var(--hairline); cursor: pointer;
}
.navbar-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== Nearest achievements ===== */
.nearest-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hairline); font-size: 12.5px; }
.nearest-item:last-child { border-bottom: none; }
.nearest-item .nearest-title { color: var(--text-secondary); }
.nearest-item .nearest-remaining { color: var(--accent); font-weight: 800; white-space: nowrap; margin-left: 10px; }

/* ===== Dashboard ===== */
.hero {
  position: relative;
  padding: 26px 18px 34px;
  background: linear-gradient(160deg, #1a0f16 0%, #0a0a0b 65%);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; top: -60px; right: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
}
.hero-eyebrow { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 800; margin-bottom: 6px; }
.hero-num { font-size: 44px; font-weight: 900; letter-spacing: -.03em; line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.hero-num small { font-size: 14px; color: var(--text-secondary); font-weight: 700; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; position: relative; z-index: 1; }
.hero-score { text-align: right; }
.hero-score-num { font-size: 24px; font-weight: 900; color: var(--good); }

.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  margin: 0 16px 14px;
  padding: 15px;
}
.card-title { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px; font-weight: 800; display: flex; justify-content: space-between; }

.filmstrip { display: flex; gap: 5px; position: relative; padding-top: 6px; }
.day-cell {
  flex: 1; aspect-ratio: .85; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 800; color: #fff; position: relative;
}
.day-cell.win { background: linear-gradient(145deg,#1de07f,#0fae5f); }
.day-cell.loss { background: linear-gradient(145deg,#ef7676,#c9403f); }
.day-cell.pending { background: var(--panel-2); color: var(--text-muted); }
.day-cell.today { box-shadow: 0 0 0 2px var(--accent); }
.day-labels { display: flex; gap: 5px; margin-top: 10px; }
.day-labels span { flex: 1; text-align: center; font-size: 9.5px; color: var(--text-muted); font-weight: 700; }

.sphere-row { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.sphere-row:last-child { margin-bottom: 0; }
.sphere-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.sphere-meta { flex: 1; }
.sphere-name { font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--text-secondary); }
.sphere-name b { color: var(--text-primary); font-weight: 800; }
.bar-track { height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; }

.cta {
  margin: 6px 16px 20px;
  background: var(--accent);
  color: #fff; text-align: center; padding: 15px; border-radius: 14px;
  font-weight: 800; font-size: 14px; letter-spacing: -.01em;
  box-shadow: 0 8px 20px var(--accent-dim);
  cursor: pointer;
}

.ci-wrap { padding: 20px 20px 26px; min-height: 100vh; display: flex; flex-direction: column; }
.ci-dots { display: flex; gap: 6px; margin-bottom: 22px; }
.ci-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--panel-2); }
.ci-dot.done { background: var(--accent); }
.ci-dot.active { background: var(--text-primary); }

.ci-icon { font-size: 34px; margin-bottom: 10px; }
.ci-title { font-size: 21px; font-weight: 900; letter-spacing: -.01em; margin-bottom: 3px; }
.ci-weight { font-size: 12px; color: var(--text-muted); margin-bottom: 30px; font-weight: 600; }
.ci-value { font-size: 58px; font-weight: 900; letter-spacing: -.03em; margin-bottom: 18px; }

input[type="range"].slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: 6px;
  background: var(--panel-2); outline: none; margin-bottom: 16px;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 5px solid var(--accent-color, var(--accent));
  box-shadow: 0 3px 10px rgba(0,0,0,.5); cursor: pointer;
}
input[type="range"].slider::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 50%; border: 5px solid var(--accent-color, var(--accent));
  background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.5); cursor: pointer;
}

.ci-presets { display: flex; gap: 8px; margin-bottom: auto; }
.ci-chip { flex: 1; text-align: center; padding: 9px 0; border-radius: 10px; background: var(--panel); border: 1px solid var(--hairline); font-size: 12px; font-weight: 700; color: var(--text-secondary); cursor: pointer; }

.ci-nav { display: flex; gap: 10px; margin-top: 20px; }
.ci-btn { flex: 1; text-align: center; padding: 14px; border-radius: 12px; font-weight: 800; font-size: 14px; cursor: pointer; }
.ci-btn.primary { background: var(--accent); color: #fff; }
.ci-btn.ghost { background: var(--panel); color: var(--text-secondary); border: 1px solid var(--hairline); }
.ci-btn.disabled { opacity: .5; pointer-events: none; }

.toggle-wrap { display: flex; gap: 10px; margin-bottom: auto; margin-top: 20px; }
.toggle-opt { flex: 1; padding: 22px 0; text-align: center; border-radius: 14px; border: 2px solid var(--hairline); font-weight: 800; font-size: 15px; color: var(--text-secondary); cursor: pointer; }
.toggle-opt.selected.yes { border-color: var(--good); color: var(--good); background: #16d16a15; }
.toggle-opt.selected.no { border-color: var(--critical); color: var(--critical); background: #e6676715; }

.ci-summary-num { font-size: 64px; font-weight: 900; letter-spacing: -.03em; }
.ci-summary-verdict { font-size: 15px; font-weight: 800; padding: 8px 14px; border-radius: 10px; display: inline-block; margin-top: 10px; }
.ci-breakdown { margin-top: 24px; }
.ci-breakdown-row { display: flex; justify-content: space-between; font-size: 13px; padding: 9px 0; border-bottom: 1px solid var(--hairline); color: var(--text-secondary); }
.ci-breakdown-row b { color: var(--text-primary); }

.ci-error { color: var(--critical); font-size: 13px; margin-top: 12px; text-align: center; }

.ci-backfill {
  background: var(--panel); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; color: var(--text-secondary);
  margin-bottom: 16px; line-height: 1.5;
}

/* ===== Stats ===== */
.seg { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; margin: 16px 16px 14px; }
.seg-btn { flex: 1; text-align: center; padding: 8px; font-size: 12px; font-weight: 800; border-radius: 8px; color: var(--text-muted); cursor: pointer; }
.seg-btn.active { background: var(--panel); color: var(--text-primary); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ===== Achievements ===== */
.ach-top { padding: 20px 16px 4px; }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 16px 16px; }
.cat-tile { background: var(--panel); border: 1px solid var(--hairline); border-radius: 14px; padding: 13px; position: relative; overflow: hidden; cursor: pointer; text-align: left; }
.cat-tile.active { border-color: var(--accent); }
.cat-tile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.cat-icon { font-size: 18px; }
.cat-count { font-size: 10.5px; color: var(--text-muted); font-weight: 800; }
.cat-name { font-size: 12.5px; font-weight: 800; margin-bottom: 9px; }
.mini-track { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.mini-fill { height: 100%; border-radius: 3px; background: var(--accent); }

.ladder-title { font-size: 11px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 16px 8px; }
.ladder { margin: 0 16px 16px; }
.step { display: flex; align-items: center; gap: 11px; padding: 7px 0; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10.5px; flex-shrink: 0; font-weight: 800; }
.step-dot.done { background: var(--good); color: #04170c; }
.step-dot.next { background: var(--bg); border: 2px solid var(--accent); color: var(--accent); }
.step-dot.locked { background: var(--panel-2); color: var(--text-muted); }
.step-name { font-size: 12.5px; font-weight: 600; }
.step-name.locked { color: var(--text-muted); }
.step-line { width: 2px; background: var(--panel-2); height: 14px; margin-left: 22px; }
