/* ===================================================================
   Galil Elion Wellness: team colours #F2F2F2 and #BF0101
   =================================================================== */
:root {
  --bg: #F2F2F2;
  --surface: #FFFFFF;
  --surface-2: #E9E9E9;
  --ink: #141414;
  --ink-2: #4A4A4A;
  --muted: #8A8A8A;
  --line: rgba(20, 20, 20, 0.08);
  --red: #BF0101;
  --red-dark: #8F0000;
  --red-tint: rgba(191, 1, 1, 0.08);
  --green: #2FA866;
  --yellow: #E8A92E;
  --flag-red: #D93A3A;
  --radius: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --shadow: 0 2px 4px rgba(0,0,0,.04), 0 10px 28px rgba(0,0,0,.08);
  --shadow-lg: 0 6px 12px rgba(0,0,0,.06), 0 24px 48px rgba(0,0,0,.12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
input, textarea { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100dvh; }
.screen.is-active { display: block; }

.demo-banner {
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; text-align: center;
  padding: calc(5px + var(--safe-top)) 12px 5px;
}
body.in-flow .demo-banner { display: none; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-2); background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.92); }

/* ===================================================================
   HOME / PLAYER PICKER
   =================================================================== */
#home { padding: calc(14px + var(--safe-top)) 16px calc(40px + var(--safe-bottom)); max-width: 640px; margin: 0 auto; }
.home-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-team { font-weight: 800; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }

.home-hero { margin: 26px 0 6px; }
.home-hero h1 {
  margin: 0; font-size: clamp(40px, 12vw, 56px); line-height: .95; font-weight: 900; letter-spacing: -.04em;
}
.home-hero h1 span { color: var(--red); }
.home-hero p { margin: 10px 0 0; font-weight: 500; }
.pick-hint {
  margin: 22px 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2);
}

.player-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 520px) { .player-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; } }

.pcard {
  position: relative; text-align: left; background: var(--surface); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .2s;
  animation: rise .5s var(--ease) both;
}
.pcard:active { transform: scale(.96); }
.pcard-photo { position: relative; aspect-ratio: 4 / 5; background: linear-gradient(180deg, #ECECEC, #E2E2E2); overflow: hidden; }
.pcard-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; }
.pcard-photo .avatar-initials { width: 100%; height: 100%; border-radius: 0; font-size: 30px; }
.pcard-num {
  position: absolute; top: 6px; left: 8px; font-weight: 900; font-size: 18px; color: var(--red);
  letter-spacing: -.03em; text-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.pcard-done {
  position: absolute; top: 7px; right: 7px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.pcard-name { padding: 8px 10px 10px; line-height: 1.1; }
.pcard-first { display: block; font-weight: 800; font-size: 14px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-last { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar-initials {
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark)); letter-spacing: .02em;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===================================================================
   FLOW: greeting + questions
   =================================================================== */
#flow { position: relative; min-height: 100dvh; overflow-x: clip; display: none; flex-direction: column; }
#flow.is-active { display: flex; }

.greet {
  position: fixed; inset: 0; z-index: 5; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  padding: 24px; text-align: center;
}
.greet.is-leaving { animation: greetOut .5s var(--ease) forwards; }
@keyframes greetOut { to { opacity: 0; transform: scale(1.04); visibility: hidden; } }
.greet-glow {
  position: absolute; width: 120vmax; height: 120vmax; border-radius: 50%; left: 50%; top: 42%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(191,1,1,.14) 0%, rgba(191,1,1,.05) 35%, transparent 62%);
  animation: glow 1.1s var(--ease) .1s forwards;
}
@keyframes glow { to { transform: translate(-50%, -50%) scale(1); } }
.greet-photo {
  position: relative; width: min(58vw, 250px); aspect-ratio: 4 / 5; border-radius: 28px; overflow: hidden;
  background: linear-gradient(180deg, #ECECEC, #E0E0E0); box-shadow: var(--shadow-lg); will-change: transform;
}
.greet-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; }
.greet-photo .avatar-initials { width: 100%; height: 100%; border-radius: 0; font-size: 64px; }
.greet-hey {
  position: relative; margin: 26px 0 6px; font-size: clamp(34px, 10vw, 46px); font-weight: 900; letter-spacing: -.035em; line-height: 1;
  opacity: 0; animation: rise .6s var(--spring) .38s forwards;
}
.greet-hey span { color: var(--red); }
.greet-sub { position: relative; margin: 0; color: var(--ink-2); font-weight: 500; opacity: 0; animation: rise .6s var(--ease) .55s forwards; }

.flow-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 16px 10px; max-width: 560px; width: 100%; margin: 0 auto;
}
.flow-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.flow-who .avatar { width: 42px; height: 42px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--red); }
.flow-name { font-weight: 800; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-step { font-size: 12px; color: var(--muted); font-weight: 600; }

.progress { height: 4px; margin: 0 16px; border-radius: 4px; background: rgba(20,20,20,.07); overflow: hidden; max-width: 528px; width: calc(100% - 32px); align-self: center; }
.progress-bar { height: 100%; width: 0; background: var(--red); border-radius: 4px; transition: width .45s var(--ease); }

.stage { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; max-width: 560px; width: 100%; margin: 0 auto; }
/* Steps flow in the normal page (no nested scroll box): typing in the comment box stays smooth on iPhone. */
.step {
  position: relative; flex: 1 0 auto; padding: 22px 16px 16px;
  display: flex; flex-direction: column;
}
.step > * { flex-shrink: 0; }
.step.leave-fwd, .step.leave-back { position: absolute; top: 0; left: 0; right: 0; }
.step.enter-fwd { animation: inRight .42s var(--ease) both; }
.step.enter-back { animation: inLeft .42s var(--ease) both; }
.step.leave-fwd { animation: outLeft .32s var(--ease) both; pointer-events: none; }
.step.leave-back { animation: outRight .32s var(--ease) both; pointer-events: none; }
@keyframes inRight { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@keyframes inLeft { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
@keyframes outLeft { to { opacity: 0; transform: translateX(-48px); } }
@keyframes outRight { to { opacity: 0; transform: translateX(48px); } }

.q-kicker { font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.q-title { margin: 6px 0 4px; font-size: clamp(26px, 7.4vw, 32px); font-weight: 900; letter-spacing: -.03em; line-height: 1.08; }
.q-help { margin: 0 0 16px; color: var(--muted); font-size: 14px; font-weight: 500; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; text-align: left;
  padding: 12px 16px 12px 12px; background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow); border: 2px solid transparent;
  transition: transform .16s var(--ease), border-color .2s, background .2s, box-shadow .2s;
  animation: floatIn .5s var(--spring) both;
}
.opt:active { transform: scale(.97); }
.opt-num {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 900; font-size: 18px; color: #fff; background: var(--c);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.opt-label { flex: 1; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.opt-check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(20,20,20,.12); display: grid; place-items: center; transition: all .2s; }
.opt-check svg { opacity: 0; transform: scale(.5); transition: all .2s var(--spring); }
.opt.is-selected { border-color: var(--red); background: #FFF8F8; box-shadow: 0 8px 26px rgba(191,1,1,.14); }
.opt.is-selected .opt-check { background: var(--red); border-color: var(--red); color: #fff; }
.opt.is-selected .opt-check svg { opacity: 1; transform: none; }
.opt.is-picked { animation: pick .32s var(--spring); }
@keyframes pick { 40% { transform: scale(1.03); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

/* chips: sore areas */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  padding: 11px 15px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow-sm);
  font-weight: 650; font-size: 15px; border: 2px solid transparent; transition: all .18s var(--ease);
  animation: floatIn .45s var(--spring) both;
}
.chip:active { transform: scale(.95); }
.chip.is-selected { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(191,1,1,.25); }

.step-actions { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 54px; border-radius: 16px; font-weight: 800; font-size: 16px; letter-spacing: -.01em;
  transition: transform .15s var(--ease), opacity .2s, background .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 10px 24px rgba(191,1,1,.25); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-ghost { color: var(--ink-2); min-height: 46px; font-weight: 700; }
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

textarea.comment {
  display: block; width: 100%; height: 150px; min-height: 150px; flex-shrink: 0; resize: none; padding: 14px 16px; border-radius: 18px;
  border: 2px solid #E2E2E2; background: #fff; font-size: 16px; line-height: 1.4; outline: none;
  -webkit-appearance: none; appearance: none;
}
textarea.comment:focus { border-color: var(--red); }
.char-count { text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; }

.flow-bottom {
  position: sticky; bottom: 0; z-index: 3; display: flex; justify-content: center;
  padding: 8px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 55%, rgba(242,242,242,0));
}
.back-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 48px; padding: 0 20px 0 14px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow); font-weight: 700; color: var(--ink-2);
  transition: opacity .25s, transform .15s var(--ease);
}
.back-btn:active { transform: scale(.95); }
.back-btn.is-hidden { opacity: 0; pointer-events: none; }

/* done */
.done { align-items: center; justify-content: center; text-align: center; }
.done-badge {
  width: 112px; height: 112px; border-radius: 50%; background: var(--red); display: grid; place-items: center;
  box-shadow: 0 18px 40px rgba(191,1,1,.3); animation: pop .6s var(--spring) both;
}
.done-badge svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s var(--ease) .35s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.done h2 { margin: 26px 0 6px; font-size: 34px; font-weight: 900; letter-spacing: -.035em; animation: rise .5s var(--ease) .25s both; }
.done p { margin: 0; color: var(--ink-2); font-weight: 500; animation: rise .5s var(--ease) .35s both; }
.done-summary { display: flex; gap: 6px; justify-content: center; margin: 22px 0 0; animation: rise .5s var(--ease) .45s both; }
.done-pill { min-width: 56px; padding: 8px 6px 7px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.done-pill b { display: block; font-size: 18px; font-weight: 900; }
.done-pill small { display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.done .step-actions { width: 100%; max-width: 360px; margin-top: 34px; animation: rise .5s var(--ease) .55s both; }
.error-box { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: #FFF1F1; color: var(--red-dark); font-weight: 600; font-size: 14px; }

/* ===================================================================
   SHEET (coach login) + TOAST
   =================================================================== */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10,10,10,.38); animation: fadeIn .25s both; backdrop-filter: blur(2px); }
.sheet {
  position: relative; width: 100%; max-width: 480px; background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(18px + var(--safe-bottom)); animation: sheetUp .38s var(--ease) both;
  display: flex; flex-direction: column; gap: 10px;
}
@media (min-width: 560px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 26px; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 40px; height: 5px; border-radius: 5px; background: rgba(0,0,0,.15); margin: 0 auto 6px; }
.sheet h3 { margin: 4px 0 0; font-size: 24px; font-weight: 900; letter-spacing: -.03em; }
.sheet p { margin: 0 0 4px; }
.sheet input {
  height: 54px; padding: 0 16px; border-radius: 16px; border: 2px solid transparent; background: var(--surface);
  box-shadow: var(--shadow-sm); font-size: 17px; outline: none;
}
.sheet input:focus { border-color: var(--red); }
.form-error { color: var(--red); font-weight: 700; font-size: 14px; margin: 0; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: rise .3s var(--ease) both; max-width: calc(100vw - 32px);
}

/* ===================================================================
   COACH DASHBOARD
   =================================================================== */
#coach { padding: calc(12px + var(--safe-top)) 16px calc(40px + var(--safe-bottom)); max-width: 1100px; margin: 0 auto; }
.c-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.c-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.c-title h1 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.c-title small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.c-actions { display: flex; gap: 8px; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }

.c-dates { display: flex; gap: 8px; overflow-x: auto; margin: 16px -16px 0; padding: 2px 16px 6px; scrollbar-width: none; }
.c-dates::-webkit-scrollbar { display: none; }
.date-chip {
  flex: none; padding: 8px 13px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm);
  text-align: center; line-height: 1.1; transition: all .2s;
}
.date-chip b { display: block; font-size: 14px; font-weight: 800; }
.date-chip small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.date-chip.is-active { background: var(--ink); color: #fff; }
.date-chip.is-active small { color: rgba(255,255,255,.7); }

.tabs { display: flex; gap: 4px; margin: 14px 0 0; padding: 4px; background: rgba(20,20,20,.06); border-radius: 14px; }
.tab { flex: 1; height: 38px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: all .2s; }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border-radius: 18px; padding: 14px 14px 12px; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-size: 28px; font-weight: 900; letter-spacing: -.03em; margin-top: 4px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.kpi-sub { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.delta-up { color: var(--green); } .delta-down { color: var(--flag-red); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: -.02em; }
.section-title span { font-size: 12px; color: var(--muted); font-weight: 600; }

.card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm); }
.card-pad { padding: 14px; }

.prow-list { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 760px) { .prow-list { display: grid; grid-template-columns: 1fr 1fr; } }
.prow {
  display: flex; gap: 12px; padding: 12px; text-align: left; width: 100%; align-items: flex-start;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .15s var(--ease); animation: rise .4s var(--ease) both;
}
.prow:active { transform: scale(.985); }
.prow::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--flag); }
.prow .avatar { width: 46px; height: 46px; }
.prow-main { flex: 1; min-width: 0; }
.prow-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prow-name { font-weight: 800; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-name small { color: var(--muted); font-weight: 700; margin-left: 4px; }
.prow-total { font-weight: 900; font-size: 20px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.prow-total small { font-size: 12px; color: var(--muted); font-weight: 700; }
.bars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 8px; }
.bar { text-align: center; }
.bar i { display: block; height: 6px; border-radius: 3px; background: var(--c); }
.bar span { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.bar b { color: var(--ink); }
.prow-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.tag-red { background: #FDECEC; color: #B32020; }
.tag-yellow { background: #FDF4E1; color: #9A6A00; }
.tag-sore { background: var(--red-tint); color: var(--red); }
.prow-comment { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); font-style: italic; line-height: 1.35; }
.prow.missing { opacity: .62; }
.prow.missing .prow-total { font-size: 13px; color: var(--muted); font-weight: 700; }
.flag-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--flag); display: inline-block; flex: none; }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); font-weight: 600; }

/* heatmap */
.heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 12px; min-width: 100%; }
.heat th { font-weight: 700; color: var(--muted); font-size: 10.5px; padding: 2px 0 4px; white-space: nowrap; }
.heat td.hname { white-space: nowrap; padding-right: 6px; font-weight: 700; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.heat td.hcell { width: 34px; min-width: 34px; height: 30px; text-align: center; border-radius: 8px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.heat td.hcell.none { background: var(--surface-2); color: transparent; }

/* charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--muted); font-weight: 600; }
.chart .grid { stroke: rgba(20,20,20,.07); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* load table */
.ltable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ltable th { text-align: right; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 0 6px 8px; white-space: nowrap; }
.ltable th:first-child, .ltable td:first-child { text-align: left; }
.ltable td { text-align: right; padding: 8px 6px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ltable td:first-child { font-weight: 800; }
.ltable tr { cursor: pointer; }
.acwr { display: inline-block; min-width: 44px; padding: 3px 7px; border-radius: 8px; font-weight: 800; text-align: center; }

/* player detail sheet */
.detail-wrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.detail {
  position: relative; width: 100%; max-width: 720px; max-height: 92dvh; overflow-y: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 10px 16px calc(24px + var(--safe-bottom)); animation: sheetUp .38s var(--ease) both;
}
@media (min-width: 760px) { .detail-wrap { align-items: center; } .detail { border-radius: 26px; } }
.detail-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.detail-head .avatar { width: 64px; height: 64px; }
.detail-head h3 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.detail-head p { margin: 2px 0 0; color: var(--muted); font-weight: 600; font-size: 13px; }
.detail-close { position: absolute; top: 12px; right: 12px; }
.comments { display: flex; flex-direction: column; gap: 8px; }
.comment-item { font-size: 14px; }
.comment-item small { display: block; color: var(--muted); font-weight: 700; font-size: 11px; }

.c-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 26px; font-size: 12px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.link-btn { color: var(--red); font-weight: 800; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ===================================================================
   BODY MAP
   =================================================================== */
.bm { margin-top: 4px; }
.bm-panel { position: relative; background: #1C1C1E; border-radius: 24px; padding: 14px 10px 12px; box-shadow: var(--shadow); animation: floatIn .5s var(--spring) both; }
.bm-viewport { position: relative; overflow: hidden; border-radius: 16px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.bm-viewport.is-zoomed { touch-action: none; }
.bm-canvas { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; transform-origin: 0 0; will-change: transform; }
.bm-fig { display: flex; flex-direction: column; align-items: center; }
.bm-fig span { color: #9A9AA0; font-size: 14px; font-weight: 500; margin-top: 4px; }
.bm-svg { width: 100%; max-height: 46dvh; display: block; }
.bm-m { fill: #3A3A3D; stroke: #1C1C1E; stroke-width: 1.2; stroke-linejoin: round; cursor: pointer; transition: fill .18s; -webkit-tap-highlight-color: transparent; }
.bm-m.is-on { fill: var(--red); }
@media (hover: hover) { .bm-m:hover { fill: #4A4A4E; } .bm-m.is-on:hover { fill: #D40A0A; } }
.bm-face { fill: #C6C6C8; pointer-events: none; }
.bm-hair { fill: #3A3A3D; pointer-events: none; }
.bm-line { stroke: #1C1C1E; stroke-width: 1.4; fill: none; pointer-events: none; }
.bm-hint { margin: 10px 0 0; text-align: center; color: #8E8E93; font-size: 13px; font-weight: 500; }
.bm-unzoom {
  position: absolute; top: 18px; right: 16px; z-index: 2; width: 44px; height: 44px; border-radius: 50%;
  background: #3A3A3D; color: #fff; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.4);
  animation: pop .25s var(--spring) both;
}
.bm-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.bm-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px 8px 14px; border-radius: 99px;
  background: var(--red); color: #fff; font-weight: 650; font-size: 14.5px; animation: pop .25s var(--spring) both;
}

/* ===================================================================
   PASSWORD EYE, GREETING "NOT YOU", LOGS, CONFIRM
   =================================================================== */
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 54px; }
.pass-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.pass-eye:active { background: var(--surface-2); }

.greet-notyou {
  position: relative; margin-top: 22px; padding: 10px 18px; border-radius: 99px; background: var(--surface);
  box-shadow: var(--shadow-sm); font-weight: 700; font-size: 14px; color: var(--ink-2);
  opacity: 0; animation: rise .5s var(--ease) .7s forwards;
}
.greet-notyou:active { transform: scale(.96); }

.logs-head { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.logs-head h2 { margin: 0; font-size: 22px; font-weight: 900; letter-spacing: -.03em; }
.logs-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.log-player { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; animation: rise .35s var(--ease) both; }
.log-player-head { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; }
.log-player-head .avatar { width: 42px; height: 42px; }
.log-player-name { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; }
.log-player-name small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.chev { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); transition: transform .25s var(--ease); flex: none; }
.log-player.is-open .chev { transform: rotate(180deg); }
.log-entries { border-top: 1px solid var(--line); }
.log-entry { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); animation: fadeIn .25s both; }
.log-entry:last-child { border-bottom: 0; }
.log-entry-main { flex: 1; min-width: 0; }
.log-entry-date { font-weight: 800; font-size: 14px; }
.log-entry-vals { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-entry-total { font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; }
.trash-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--red); background: var(--red-tint); flex: none; }
.trash-btn:active { transform: scale(.92); }
.log-empty { padding: 14px 16px; color: var(--muted); font-weight: 600; font-size: 14px; }

.confirm-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; }
.confirm { position: relative; width: 100%; max-width: 340px; background: var(--surface); border-radius: 24px; padding: 22px 18px 16px; text-align: center; box-shadow: var(--shadow-lg); animation: pop .3s var(--spring) both; }
.confirm h3 { margin: 0 0 6px; font-size: 19px; font-weight: 900; letter-spacing: -.02em; }
.confirm p { margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-danger { background: var(--red); color: #fff; }
.btn-light { background: var(--surface-2); color: var(--ink); }
.icon-btn.is-on { background: var(--ink); color: #fff; }
.c-title h1 { white-space: nowrap; font-size: clamp(16px, 4.8vw, 20px); }
.c-title small { white-space: nowrap; }
.c-actions { gap: 6px; flex: none; }
.c-actions .icon-btn { width: 40px; height: 40px; }
.c-top .c-title { text-align: left; }
.c-top .brand-logo { width: 38px; height: 38px; flex: none; }

/* ===================================================================
   REMINDERS
   =================================================================== */
.remind-slot { margin-top: 14px; min-height: 0; }
.remind-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 12px; border-radius: 99px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; box-shadow: var(--shadow-sm);
  animation: rise .4s var(--ease) both;
}
.remind-pill svg { width: 18px; height: 18px; }
.remind-pill.is-on { background: var(--surface); color: var(--ink-2); }
.remind-pill.is-on svg { color: var(--green); }
.remind-pill:active { transform: scale(.96); }

.done .remind-card {
  width: 100%; max-width: 360px; margin-top: 26px; padding: 16px; border-radius: 20px; background: var(--surface);
  box-shadow: var(--shadow); text-align: left; animation: rise .5s var(--ease) .55s both;
}
.remind-card p { margin: 6px 0 12px; color: var(--ink-2); font-size: 14px; font-weight: 500; animation: none; }
.remind-head { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.remind-head svg { color: var(--red); flex: none; }
.remind-card .btn { min-height: 48px; }
.remind-card .btn-ghost { min-height: 40px; margin-top: 4px; }
.remind-on { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; font-weight: 700; color: var(--ink-2); font-size: 14px; animation: rise .5s var(--ease) .55s both; }
.remind-on svg { color: var(--green); width: 18px; height: 18px; }
.done .step-actions { margin-top: 18px; }

.ios-steps { list-style: none; padding: 0; margin: 4px 0 12px; display: flex; flex-direction: column; gap: 10px; }
.ios-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.35; color: var(--ink); }
.ios-steps svg { vertical-align: -3px; }
.step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }

.who-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 4px; max-height: 50dvh; overflow-y: auto; }
.who-grid.is-busy { opacity: .5; pointer-events: none; }
.who { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border-radius: 14px; font-size: 12.5px; font-weight: 700; }
.who:active { background: var(--surface-2); }
.who .avatar { width: 54px; height: 54px; }

/* coach: reminders switch */
.remind-switch { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px; }
.remind-switch .rs-text { flex: 1; min-width: 0; }
.remind-switch b { display: block; font-size: 15px; }
.remind-switch small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; margin-top: 2px; line-height: 1.35; }
.switch { position: relative; width: 52px; height: 32px; border-radius: 99px; background: #D6D6D6; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s var(--spring); }
.switch.is-on { background: var(--green); }
.switch.is-on::after { transform: translateX(20px); }
.switch[disabled] { opacity: .6; }
/* centre the done screen, but let it scroll from the top when the reminder card makes it taller than the phone */
.step.done { justify-content: flex-start; padding-top: 28px; padding-bottom: 28px; }
.step.done > :first-child { margin-top: auto; }
.step.done > :last-child { margin-bottom: auto; }
.step.done > * { flex-shrink: 0; }
body.typing .flow-bottom { display: none; }
