/* ════════════════════════════════════════════════════════════════════
   Gymhub — design system

   Deep-space black, glass panels with a specular top edge, and one
   hologram accent ramp (cyan → blue → violet → magenta) that also drives
   the muscle heatmap, so colour means the same thing everywhere.

   Rajdhani for every number and HUD label — it is condensed and
   technical, matches rlssboost.com, and reads at arm's length on a phone
   propped on a bench. Inter for everything you actually read.

   All motion is CSS. On this machine the OS has reduced-motion on, and
   JS animation libraries freeze elements at their start frame under that
   setting (invisible content). CSS still plays; the reduced-motion block
   at the bottom tones it down rather than removing feedback.
   ════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #04060b;
  --bg2: #070b14;
  --ink: #e6f1ff;
  --ink2: #9fb3cc;
  --ink3: #5d7089;
  --line: rgba(148, 196, 255, .10);
  --line2: rgba(148, 196, 255, .18);
  --glass: rgba(14, 24, 40, .55);
  --glass2: rgba(20, 34, 56, .62);
  --cy: #22d3ee;
  --bl: #3b82f6;
  --vi: #8b5cf6;
  --mg: #ec4899;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f43f5e;
  --brand: #0a74ff;
  --grad: linear-gradient(135deg, #22d3ee 0%, #3b82f6 48%, #8b5cf6 100%);
  --glow: 0 0 0 1px rgba(34, 211, 238, .25), 0 8px 40px -8px rgba(34, 211, 238, .45);
  --r: 20px;
  --r2: 14px;
  --hud: "Rajdhani", "Inter", system-ui, sans-serif;
  --txt: "Inter", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.5 var(--txt);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cy); }
::selection { background: rgba(34, 211, 238, .3); }

/* ── atmosphere: aurora + perspective floor grid ─────────────────── */
.atmos { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.atmos::before {
  content: ""; position: absolute; inset: -20% -10% auto;
  height: 80vh;
  background:
    radial-gradient(40% 50% at 20% 20%, rgba(34, 211, 238, .14), transparent 70%),
    radial-gradient(35% 45% at 85% 10%, rgba(139, 92, 246, .14), transparent 70%),
    radial-gradient(50% 60% at 50% 100%, rgba(59, 130, 246, .08), transparent 70%);
  animation: drift 24s ease-in-out infinite alternate;
}
.atmos::after {
  content: ""; position: absolute; left: -50%; right: -50%; bottom: -10%;
  height: 55vh;
  background-image:
    linear-gradient(rgba(34, 211, 238, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, .10) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(500px) rotateX(64deg);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 85%);
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(3%, 4%, 0) scale(1.08); }
}

/* ── type ───────────────────────────────────────────────────────── */
.hud { font-family: var(--hud); letter-spacing: .02em; }
.eyebrow {
  font: 600 11px/1 var(--hud); letter-spacing: .28em; text-transform: uppercase;
  color: var(--cy);
}
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
h1, h2, h3 { font-family: var(--hud); font-weight: 700; margin: 0; letter-spacing: .01em; }
.grad-text {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.num { font-family: var(--hud); font-variant-numeric: tabular-nums; font-weight: 700; }

/* ── glass ──────────────────────────────────────────────────────── */
.glass {
  position: relative;
  background: linear-gradient(180deg, rgba(28, 44, 70, .55), rgba(10, 18, 32, .55));
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, .8);
}
/* the specular edge: a hairline of light along the top of every panel */
.glass::before {
  content: ""; position: absolute; inset: 0 12% auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(186, 230, 253, .55), transparent);
  pointer-events: none;
}
.card { padding: 18px; }

/* ── buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px; border: 0;
  font: 700 15px/1 var(--hud); letter-spacing: .08em; text-transform: uppercase;
  color: #031018; background: var(--grad);
  box-shadow: 0 10px 30px -10px rgba(59, 130, 246, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .18s var(--ease), box-shadow .25s, filter .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.08); box-shadow: 0 14px 40px -10px rgba(59, 130, 246, .85), inset 0 1px 0 rgba(255,255,255,.35); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.lg { min-height: 58px; font-size: 17px; border-radius: 16px; }
.btn.ghost {
  background: rgba(148, 196, 255, .06); color: var(--ink);
  border: 1px solid var(--line2); box-shadow: none;
}
.btn.ghost:hover { background: rgba(148, 196, 255, .11); }
.btn.danger { background: linear-gradient(135deg, #fb7185, #e11d48); color: #fff; }
.btn.ok { background: linear-gradient(135deg, #6ee7b7, #10b981); color: #022c1e; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 11px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(148, 196, 255, .06); border: 1px solid var(--line); color: var(--ink);
  transition: background .2s, transform .15s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { background: rgba(148, 196, 255, .12); }

/* ── forms ──────────────────────────────────────────────────────── */
.field { display: grid; gap: 7px; }
.field > span {
  font: 600 11px/1 var(--hud); letter-spacing: .2em; text-transform: uppercase; color: var(--ink3);
}
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px;
  background: rgba(3, 8, 16, .6); border: 1px solid var(--line2); color: var(--ink);
  font-size: 16px; /* 16px stops iOS zooming into the field */
  transition: border-color .2s, box-shadow .2s, background .2s;
  outline: none;
}
textarea.input { padding: 14px 16px; min-height: 90px; resize: vertical; }
.input:focus { border-color: rgba(34, 211, 238, .6); box-shadow: 0 0 0 4px rgba(34, 211, 238, .12); background: rgba(3, 8, 16, .8); }
.input::placeholder { color: var(--ink3); }
select.input { appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink2) 50%), linear-gradient(135deg, var(--ink2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 40px; }

/* segmented control */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(3, 8, 16, .6); border: 1px solid var(--line); }
.seg button {
  flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink2); font: 700 13px/1 var(--hud); letter-spacing: .1em; text-transform: uppercase;
  transition: background .25s, color .25s;
}
.seg button.on { background: rgba(34, 211, 238, .14); color: var(--cy); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .35); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px;
  border-radius: 99px; font: 600 12px/1 var(--hud); letter-spacing: .08em; text-transform: uppercase;
  background: rgba(148, 196, 255, .07); border: 1px solid var(--line); color: var(--ink2);
}
.chip.cy { color: var(--cy); background: rgba(34, 211, 238, .1); border-color: rgba(34, 211, 238, .3); }
.chip.vi { color: #c4b5fd; background: rgba(139, 92, 246, .12); border-color: rgba(139, 92, 246, .35); }
.chip.ok { color: var(--ok); background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .3); }
.chip.warn { color: var(--warn); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .3); }
.chip.bad { color: #fda4af; background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .3); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { animation: pulse 1.6s ease-in-out infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── layout ─────────────────────────────────────────────────────── */
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hide { display: none !important; }
.center { text-align: center; }
.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* stat tile */
.stat { padding: 14px 14px 13px; }
.stat .k { font: 600 10.5px/1 var(--hud); letter-spacing: .22em; text-transform: uppercase; color: var(--ink3); }
.stat .v { font: 700 30px/1.05 var(--hud); margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 14px; color: var(--ink2); font-weight: 600; margin-left: 2px; }
.stat .d { font-size: 12px; color: var(--ink2); margin-top: 3px; }

/* ── body map ───────────────────────────────────────────────────── */
.body3d { width: 100%; height: 100%; overflow: visible; display: block; }
.body3d .bview { fill: rgba(125, 211, 252, .45); font: 600 8px var(--hud); letter-spacing: .4em; }
.body3d .bm { transition: fill-opacity .5s var(--ease), stroke-opacity .5s; }
.body3d.pick .bm { cursor: pointer; }
.body3d.pick .bm:hover { fill-opacity: .4; stroke-opacity: 1; }
.body3d .sweep { animation: sweep 4.5s linear infinite; }
.body3d .floor ellipse { transform-box: fill-box; transform-origin: center; animation: ring 3s ease-in-out infinite; }
.body3d .floor ellipse:nth-child(2) { animation-delay: .4s; }
.body3d .floor ellipse:nth-child(3) { animation-delay: .8s; }
@keyframes sweep { from { transform: translateY(0); } to { transform: translateY(560px); } }
@keyframes ring { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* ── toast ──────────────────────────────────────────────────────── */
.toasts { position: fixed; left: 0; right: 0; top: calc(12px + var(--safe-t)); z-index: 90;
  display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 14px; }
.toast {
  pointer-events: auto; max-width: 460px; width: 100%;
  padding: 13px 16px; border-radius: 16px; display: flex; gap: 12px; align-items: flex-start;
  background: rgba(10, 20, 36, .92); border: 1px solid var(--line2);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px -14px rgba(0, 0, 0, .9);
  animation: toastIn .45s var(--ease) both;
}
.toast.coach { border-color: rgba(34, 211, 238, .45); box-shadow: var(--glow); }
.toast.bad { border-color: rgba(244, 63, 94, .45); }
.toast.out { animation: toastOut .3s ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ── modal sheet (bottom on phone, centred on desktop) ──────────── */
.sheet-bg { position: fixed; inset: 0; z-index: 70; background: rgba(1, 4, 9, .72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .3s ease both; }
.sheet {
  position: fixed; z-index: 71; left: 0; right: 0; bottom: 0;
  max-height: 92dvh; overflow: auto; padding: 8px 18px calc(22px + var(--safe-b));
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #0d1828, #070c16);
  border: 1px solid var(--line2); border-bottom: 0;
  animation: sheetIn .5s var(--ease) both;
}
.sheet .grab { width: 42px; height: 5px; border-radius: 9px; background: var(--line2); margin: 6px auto 14px; }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(620px, 92vw);
    transform: translate(-50%, -50%); border-radius: 24px; border-bottom: 1px solid var(--line2);
    padding: 22px 24px; animation: popIn .4s var(--ease) both; }
  .sheet .grab { display: none; }
  @keyframes popIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }
}

/* skeleton shimmer while loading */
.skel { border-radius: 12px; background: linear-gradient(90deg, rgba(148,196,255,.05), rgba(148,196,255,.11), rgba(148,196,255,.05));
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* entrance */
.rise { animation: rise .6s var(--ease) both; }
.rise:nth-child(2) { animation-delay: .05s; } .rise:nth-child(3) { animation-delay: .1s; }
.rise:nth-child(4) { animation-delay: .15s; } .rise:nth-child(5) { animation-delay: .2s; }
.rise:nth-child(6) { animation-delay: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 196, 255, .14); border-radius: 9px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .atmos::before, .body3d .sweep, .body3d .floor ellipse, .dot.live, .skel { animation: none; }
  .rise, .toast, .sheet, .sheet-bg { animation-duration: .01s; }
}

/* Gymhub wordmark: white "Gym", black "hub" on a blue plate */
.logo { display: inline-flex; align-items: center; gap: .16em; font: 700 22px/1 "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -.025em; white-space: nowrap; user-select: none; }
.logo b { color: #fff; font-weight: 700; }
.logo i { font-style: normal; color: #000; background: var(--brand); border-radius: .16em; padding: .1em .17em .14em;
  box-shadow: 0 0 22px -6px rgba(10, 116, 255, .7); }
