/* ------------------------------------------------------------------
   Ascend - components
   Cards, buttons, chips, controls, progress, figure, toasts, modal.
   ------------------------------------------------------------------ */

/* ---------- Cards ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--raise);
  min-width: 0;
}
.card.pad-s { padding: 16px; }
.card.inset { box-shadow: var(--inset); }
.card.flat  { box-shadow: none; border: 1px solid var(--line); }
.card.ink {
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--ink-raise);
}
.card.ink .t-label, .card.ink .faint, .card.ink .t-small { color: var(--on-ink-2); }
.card.ink .muted, .card.ink .t-body { color: #c9ccd3; }
.card.clickable { cursor: pointer; transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.card.clickable:active { transform: scale(.985); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head .t-h2 { display: flex; align-items: center; gap: 8px; }
.card-head .t-h2 svg { width: 16px; height: 16px; color: var(--text-2); }
.card.ink .card-head .t-h2 svg { color: var(--on-ink-2); }

/* Pill badge used as a greeting / status */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: var(--raise-sm);
  font-size: 14px; font-weight: 500;
}
.pill.inset { box-shadow: var(--inset-sm); }
.pill svg { width: 16px; height: 16px; color: var(--text-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: var(--raise-sm);
  font-weight: 600; font-size: 14px;
  color: var(--text);
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), opacity var(--fast);
  user-select: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { box-shadow: var(--inset-sm); transform: none; }
.btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: var(--ink-raise); }
.btn.primary:active { box-shadow: inset 4px 4px 10px rgba(0,0,0,.5); }
.btn.ghost { box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { box-shadow: var(--raise-xs); color: var(--text); }
.btn.block { width: 100%; }
.btn.lg { padding: 16px 28px; font-size: 16px; }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn.icon.sm { width: 36px; height: 36px; }
.btn svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.card.ink .btn { background: var(--ink-2); color: var(--on-ink); box-shadow: 4px 4px 10px rgba(0,0,0,.4), -3px -3px 8px rgba(255,255,255,.06); }
.card.ink .btn.primary { background: var(--on-ink); color: var(--ink); }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--inset-xs);
  background: var(--bg);
}
.chip.on  { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.chip.soft{ box-shadow: none; border: 1px solid var(--line); }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .6; }
.card.ink .chip { background: var(--ink-2); color: #c9ccd3; box-shadow: none; }
.card.ink .chip.on { background: var(--on-ink); color: var(--ink); }
button.chip { cursor: pointer; }

/* ---------- Segmented control ---------- */
.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 5px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: var(--inset-sm);
}
.seg.block { display: grid; }
.seg button {
  padding: 9px 14px;
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600;
  color: var(--text-3);
  transition: all var(--fast) var(--ease);
  white-space: nowrap;
}
.seg button.on { background: var(--bg); color: var(--text); box-shadow: var(--raise-xs); }
.seg button.on.ink { background: var(--ink); color: var(--on-ink); }

/* ---------- Progress ---------- */
.bar {
  position: relative;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: var(--inset-xs);
  overflow: hidden;
}
.bar > i {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  border-radius: var(--r-pill);
  background: var(--ink);
  transition: width var(--slow) var(--ease);
}
.bar.thin { height: 6px; }
.bar.thick { height: 14px; }
.card.ink .bar { background: var(--ink-2); box-shadow: inset 2px 2px 5px rgba(0,0,0,.5); }
.card.ink .bar > i { background: var(--on-ink); }

.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--bg); filter: drop-shadow(1px 1px 1px var(--shadow-d)) drop-shadow(-1px -1px 1px var(--shadow-l)); }
.ring .fill  { stroke: var(--ink); stroke-linecap: round; transition: stroke-dashoffset var(--slow) var(--ease); }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.card.ink .ring .track { stroke: var(--ink-2); filter: none; }
.card.ink .ring .fill  { stroke: var(--on-ink); }

/* Segmented "ticks" bar like the Today Progress card in the reference */
.ticks { display: flex; gap: 3px; height: 22px; align-items: flex-end; }
.ticks i { flex: 1; height: 100%; border-radius: 2px; background: var(--fig-mute); }
.ticks i.on { background: var(--ink); }
.card.ink .ticks i { background: #3a3d44; }
.card.ink .ticks i.on { background: var(--on-ink); }

/* ---------- Checklist ---------- */
.check {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: box-shadow var(--fast) var(--ease);
}
.check:hover { box-shadow: var(--raise-xs); }
.check .box {
  width: 22px; height: 22px; flex: none;
  border-radius: 8px;
  box-shadow: var(--inset-sm);
  display: grid; place-items: center;
  transition: all var(--fast) var(--ease);
}
.check .box svg { width: 12px; height: 12px; opacity: 0; color: var(--on-ink); }
.check.done .box { background: var(--ink); box-shadow: none; }
.check.done .box svg { opacity: 1; }
.check.done .label { color: var(--text-3); text-decoration: line-through; }
.check .label { font-size: 14px; font-weight: 500; }
.check .meta { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  box-shadow: var(--inset-xs);
  background: var(--bg);
}
.list-item.raised { box-shadow: var(--raise-xs); }
.list-item .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; box-shadow: var(--raise-xs); flex: none; }
.list-item .ico svg { width: 18px; height: 18px; color: var(--text-2); }
.list-item .txt { flex: 1; min-width: 0; }
.list-item .txt .name { font-weight: 600; font-size: 14px; }
.list-item .txt .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.list-item .end { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.list-item.active { box-shadow: var(--raise-sm); }
.card.ink .list-item { background: var(--ink-2); box-shadow: none; }
.card.ink .list-item .ico { background: #30333a; box-shadow: none; }
.card.ink .list-item .ico svg { color: var(--on-ink-2); }
.card.ink .list-item .txt .sub, .card.ink .list-item .end { color: var(--on-ink-2); }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 0;
  background: var(--bg);
  box-shadow: var(--inset-sm);
  outline: none;
  font-size: 14px;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--text-3); }
.input:focus { box-shadow: var(--inset-sm), 0 0 0 2px var(--line); }
textarea.input { min-height: 76px; resize: vertical; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .unit { font-size: 12px; color: var(--text-3); width: 32px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-grid { grid-template-columns: 1fr; } }

.toggle {
  width: 46px; height: 26px; flex: none;
  border-radius: var(--r-pill);
  box-shadow: var(--inset-sm);
  position: relative;
  transition: background var(--fast);
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg); box-shadow: var(--raise-xs);
  transition: transform var(--fast) var(--ease), background var(--fast);
}
.toggle.on::after { transform: translateX(20px); background: var(--ink); }

/* Stepper */
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper .val { min-width: 48px; text-align: center; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }

/* ---------- "System" text (Solo Leveling style, kept calm) ---------- */
.sys {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
}
.sys b { color: var(--text); font-weight: 500; }
.sys .k { color: var(--text-3); }
.card.ink .sys { color: #c9ccd3; }
.card.ink .sys b { color: var(--on-ink); }
.card.ink .sys .k { color: var(--on-ink-2); }
.sys-tag {
  display: inline-block;
  font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text-2);
}
.card.ink .sys-tag { border-color: rgba(255,255,255,.14); color: var(--on-ink-2); }

/* Rank glyph */
.rank {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 30px; letter-spacing: -.04em;
  background: var(--bg);
  box-shadow: var(--raise-sm);
}
.card.ink .rank { background: var(--ink-2); color: var(--on-ink); box-shadow: 4px 4px 10px rgba(0,0,0,.4), -3px -3px 8px rgba(255,255,255,.06); }

/* ---------- Figure (SVG placeholder for the Blender model) ---------- */
.figure-wrap {
  position: relative;
  display: grid; place-items: center;
  padding: 8px;
  min-height: 160px;
}
.figure-wrap .aura {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,255,255,.5) 35%, rgba(255,255,255,0) 70%);
  opacity: .9;
  pointer-events: none;
  transition: opacity var(--slow);
}
.figure-wrap .aura-ring {
  position: absolute; inset: 0; margin: auto;
  width: 62%; aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(28,29,33,.12);
  opacity: 0;
  pointer-events: none;
}
.figure-wrap.live .aura-ring { animation: aura-pulse 2.4s var(--ease) infinite; }
@keyframes aura-pulse {
  0%   { transform: scale(.85); opacity: 0; }
  30%  { opacity: .9; }
  100% { transform: scale(1.25); opacity: 0; }
}
.figure-wrap svg { position: relative; width: 100%; height: auto; max-height: 100%; }
.figure-wrap.sm svg { max-width: 120px; }
.figure-wrap.md svg { max-width: 190px; }
.figure-wrap.lg svg { max-width: 260px; }

.fig-body   { fill: var(--fig-body); }
.fig-muscle { fill: var(--fig-mute); stroke: var(--bg); stroke-width: 1.2; transition: fill var(--slow) var(--ease); }
.fig-muscle.hot  { fill: var(--fig-hot); }
.fig-muscle.warm { fill: var(--fig-warm); }
.fig-muscle.selectable { cursor: pointer; }
.fig-muscle.selectable:hover { fill: var(--fig-warm); }
.figure-wrap.rep .fig-root { animation: rep-bob var(--rep-ms, 1400ms) var(--ease); }
@keyframes rep-bob {
  0%   { transform: translateY(0) scale(1); }
  45%  { transform: translateY(6px) scale(.985); }
  100% { transform: translateY(0) scale(1); }
}
.card.ink .fig-body   { fill: #2e3137; }
.card.ink .fig-muscle { fill: #3c3f46; stroke: var(--ink); }
.card.ink .fig-muscle.hot  { fill: var(--on-ink); }
.card.ink .fig-muscle.warm { fill: #9a9ea7; }
.card.ink .figure-wrap .aura { background: radial-gradient(circle, rgba(255,255,255,.22) 0%, rgba(255,255,255,.08) 35%, rgba(255,255,255,0) 70%); }
.card.ink .figure-wrap .aura-ring { border-color: rgba(255,255,255,.25); }

.figure-note {
  position: absolute; bottom: 6px; left: 0; right: 0;
  text-align: center;
  font-family: var(--mono); font-size: 10px; color: var(--text-3); letter-spacing: .02em;
  pointer-events: none;
}

/* ---------- Session (train) screen specifics ---------- */
.stage-steps { display: flex; gap: 8px; }
.stage-steps .step {
  flex: 1; display: flex; flex-direction: column; gap: 8px; align-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.stage-steps .step i { width: 100%; height: 6px; border-radius: var(--r-pill); background: var(--bg); box-shadow: var(--inset-xs); overflow: hidden; position: relative; }
.stage-steps .step i::after { content: ""; position: absolute; inset: 0; width: 0; background: var(--ink); border-radius: inherit; transition: width var(--slow) var(--ease); }
.stage-steps .step.done i::after { width: 100%; }
.stage-steps .step.on { color: var(--text); }
.stage-steps .step.on i::after { width: 50%; }

.counter { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.counter .big { font-size: clamp(56px, 14vw, 96px); font-weight: 800; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.counter .goal { font-size: 22px; font-weight: 600; color: var(--text-3); letter-spacing: -.02em; }
.counter .unit { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 4px; }

.controls { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }

.pause-panel {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  box-shadow: var(--inset-sm);
}
.pause-panel .ring .label { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }

/* Cues list */
.cues { display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; }
.cues li { list-style: none; display: flex; gap: 10px; font-size: 13px; color: var(--text-2); }
.cues li::before { content: "\2014"; color: var(--text-3); }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  box-shadow: var(--raise-xs);
  font-size: 11px; font-weight: 600; color: var(--text-3);
  transition: all var(--fast) var(--ease);
}
.week button .d { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.week button .k { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.week button.on { background: var(--ink); color: var(--on-ink-2); box-shadow: var(--ink-raise); }
.week button.on .d { color: var(--on-ink); }
.week button.today { outline: 1px solid var(--text-3); outline-offset: 2px; }
.week button.rest { opacity: .7; }

/* Muscle grid (body screen) */
.muscle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.muscle-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  box-shadow: var(--inset-xs); cursor: pointer;
  transition: box-shadow var(--fast) var(--ease);
}
.muscle-row.on { box-shadow: var(--raise-sm); }
.muscle-row .name { font-weight: 600; font-size: 13px; flex: 1; }
.muscle-row .bar { width: 48px; }

/* Macro row */
.macro { display: grid; grid-template-columns: 60px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; }
.macro .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Toasts (System notifications) ---------- */
.toasts {
  position: fixed;
  left: 50%; top: 16px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--ink-raise);
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  animation: toast-in var(--slow) var(--ease);
}
.toast .tag { color: var(--on-ink-2); }
.toast.out { animation: toast-out var(--slow) var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* Level-up flash: a soft monochrome bloom, not a strobe */
.aura-flash {
  position: fixed; inset: 0; z-index: 55; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(255,255,255,1) 0%, rgba(255,255,255,.6) 30%, rgba(255,255,255,0) 70%);
  opacity: 0;
}
.aura-flash.go { animation: bloom 1.3s var(--ease); }
@keyframes bloom { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Modal / sheet ---------- */
.modal-root:empty { display: none; }
.modal-root {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: end center;
  background: rgba(232,233,237,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade var(--fast);
}
@media (min-width: 700px) { .modal-root { place-items: center; } }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(560px, 100vw);
  max-height: 88dvh;
  overflow: auto;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--bg);
  box-shadow: var(--raise);
  display: flex; flex-direction: column; gap: 14px;
  animation: sheet-in var(--slow) var(--ease);
}
@media (min-width: 700px) { .sheet { border-radius: var(--r-xl); margin: 16px; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--fig-mute); margin: -6px auto 2px; }

/* Empty state */
.empty { padding: 18px; text-align: center; color: var(--text-3); font-size: 13px; border-radius: var(--r-md); box-shadow: var(--inset-xs); }

/* Quote */
.quote { font-size: 15px; font-weight: 500; line-height: 1.5; letter-spacing: -.01em; }
.quote::before { content: "\201C"; font-size: 34px; line-height: 0; vertical-align: -14px; color: var(--text-3); margin-right: 4px; }

/* Divider */
.hr { height: 1px; background: var(--line); margin: 4px 0; }
.card.ink .hr { background: rgba(255,255,255,.08); }

/* Status dot */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.status.good::before { background: var(--ink); }

/* ---------- late additions ---------- */
.fig-limb { fill: none; stroke: var(--fig-body); stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }
.fig-limb.leg { stroke-width: 30; }
.card.ink .fig-limb { stroke: #2e3137; }
.fig-root { transform-box: fill-box; transform-origin: 50% 50%; }
.figure-wrap .svg-host { position: relative; width: 100%; display: grid; place-items: center; }
.ico-w { display: inline-flex; }
.ico-w svg { width: 18px; height: 18px; }
.btn > span:first-child:not(:only-child) { display: inline-flex; }
.btn.icon > span { display: inline-flex; }
.screen-head .seg { flex: none; }
.grow.btn { flex: 1; }
