/* ===========================================================================
   GymDay - light, soft and friendly. Hebrew RTL, one-handed portrait.
   =========================================================================== */

/* --- Heebo, self-hosted variable font (offline safe) --------------------- */
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/heebo-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/heebo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/heebo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                 U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
                 U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Light palette (default) --------------------------------------------- */
:root {
  --bg:          #F7F4FE;
  --bg-2:        #FFFFFF;
  --surface:     #FFFFFF;
  --surface-2:   #F3EFFD;
  --surface-3:   #E7E0FA;
  --line:        #ECE6FA;

  --ink:         #241B3A;
  --dim:         #7B7291;
  --dim-2:       #A49CB8;

  --accent:      #6941F2;              /* primary / active            */
  --accent-ink:  #FFFFFF;
  --accent-soft: #EFEAFF;
  --accent-2:    #9B7BFF;              /* light partner, decorative   */

  /* Gradient for surfaces that carry --accent-ink text. Both stops are dark
     enough that white stays above 4.5:1 - a lighter partner like #9B7BFF
     drops the small print on the today card to 3.1:1. */
  --grad:      linear-gradient(135deg, #7B4DFF 0%, #5B2EE0 100%);
  --grad-veil: rgba(255,255,255,.22);
  /* Large text only (>=24px), so 3:1 is the bar here. */
  --grad-text: linear-gradient(160deg, #6941F2 15%, #8257FF 100%);

  --good:        #16C47F;              /* completed                   */
  --good-ink:    #05341F;
  --good-soft:   #DFF8ED;

  --burn:        #FF6B3D;              /* drop set / burnout          */
  --burn-ink:    #40160A;
  --burn-soft:   #FFEAE1;

  --sun:         #FFC53D;              /* celebration                 */
  --danger:      #E5484D;

  --sh-sm: 0 1px 2px rgba(36,27,58,.05), 0 2px 6px rgba(36,27,58,.04);
  --sh:    0 2px 4px rgba(36,27,58,.04), 0 8px 20px rgba(36,27,58,.07);
  --sh-lg: 0 10px 34px rgba(36,27,58,.14);
  --sh-accent: 0 6px 18px rgba(105,65,242,.32);

  --r-sm: 14px;
  --r:    20px;
  --r-lg: 28px;

  --tap:    48px;
  --tap-lg: 64px;

  --pad: 16px;
  --dock-h: 96px;

  --t: 150ms cubic-bezier(.34,1.4,.64,1);   /* a little bounce */
  --t-lin: 140ms cubic-bezier(.2,0,.2,1);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* --- Dark, still available from the header toggle ------------------------ */
[data-theme="dark"] {
  --bg:          #14101F;
  --bg-2:        #1B1630;
  --surface:     #1E1834;
  --surface-2:   #2A2246;
  --surface-3:   #382E5C;
  --line:        #2F2750;

  --ink:         #F4F1FF;
  --dim:         #A79FC4;
  --dim-2:       #7E7699;

  --accent:      #9B7BFF;
  --accent-ink:  #17092E;
  --accent-soft: #2C2350;
  --accent-2:    #C4AEFF;

  /* Inverted for dark: light gradient, dark ink on top. */
  --grad:      linear-gradient(135deg, #B49BFF 0%, #8A68FF 100%);
  --grad-veil: rgba(23,9,46,.18);
  --grad-text: linear-gradient(160deg, #C4AEFF 10%, #9B7BFF 100%);

  --good:        #2FD79A;
  --good-ink:    #04291A;
  --good-soft:   #123A2C;

  --burn:        #FF8A5C;
  --burn-ink:    #33110A;
  --burn-soft:   #3D2117;

  --sh-sm: 0 1px 2px rgba(0,0,0,.3);
  --sh:    0 4px 16px rgba(0,0,0,.34);
  --sh-lg: 0 12px 34px rgba(0,0,0,.48);
  --sh-accent: 0 6px 18px rgba(155,123,255,.3);
}

/* Drop-set skin: re-point the accent, every component follows. */
.burn-mode {
  --accent:      var(--burn);
  --accent-ink:  var(--burn-ink);
  --accent-soft: var(--burn-soft);
  --accent-2:    #FFA47D;
  --sh-accent:   0 6px 18px rgba(255,107,61,.34);
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: 'Heebo', system-ui, -apple-system, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; color: inherit; font-variant-numeric: inherit; }

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

h1, h2, h3, p { margin: 0; }

/* Numbers and latin runs inside RTL text. Without isolation the bidi
   algorithm renders "3 x 10" as "10 x 3" and "01:15" as "15:01". */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

/* --- App shell ----------------------------------------------------------- */
#app {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 8px) var(--pad) calc(var(--dock-h) + var(--safe-b) + 20px);
}

.view { animation: fade 200ms ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  margin-bottom: 12px;
}
.topbar .grow { flex: 1; min-width: 0; }

.iconbtn {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--sh-sm);
  font-size: 19px;
  transition: transform var(--t), background var(--t-lin);
}
.iconbtn:active { background: var(--surface-2); transform: scale(.9); }
.iconbtn[disabled] { opacity: .32; box-shadow: none; }

.eyebrow { font-size: 13px; color: var(--dim); font-weight: 600; }
.title-lg { font-size: 21px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; }

/* --- Session clock ------------------------------------------------------- */
.clock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.clock .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* --- Today card: the friendly anchor at the top of home ------------------ */
.today {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 14px;
  color: var(--accent-ink);
  background: var(--grad);
  box-shadow: var(--sh-accent);
}
.today .progress { background: var(--grad-veil); margin: 12px 0 0; height: 8px; }
.today .progress > i { background: currentColor; }
.today::after {            /* soft light blob, purely decorative */
  content: '';
  position: absolute;
  inset-inline-end: -30px;
  top: -50px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  pointer-events: none;
}
.today .today-body { flex: 1; min-width: 0; position: relative; }
.today h2 { font-size: 18px; font-weight: 800; line-height: 1.25; }
.today .today-meta { font-size: 13px; opacity: .9; margin-top: 3px; font-weight: 600; }
.today .today-msg {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  background: var(--grad-veil);
  border-radius: 999px;
  padding: 6px 12px;
  display: inline-block;
}

/* --- Streak / stat pills ------------------------------------------------- */
.pills { display: flex; gap: 8px; margin-bottom: 14px; }
.pill {
  flex: 1;
  background: var(--surface);
  border-radius: var(--r);
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--sh-sm);
}
.pill b { display: block; font-size: 19px; font-weight: 800; line-height: 1.15; }
.pill small { display: block; font-size: 11px; color: var(--dim); margin-top: 2px; font-weight: 600; }
.pill.hot b { color: var(--burn); }

/* --- Overall progress bar ------------------------------------------------ */
.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin: 4px 0 16px;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 320ms cubic-bezier(.34,1.3,.64,1);
}

/* --- Day picker ---------------------------------------------------------- */
.daypick {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.daypick::-webkit-scrollbar { display: none; }
.daypick .chip { min-height: var(--tap); padding: 0 16px; font-size: 14px; flex: none; }

/* --- Cards --------------------------------------------------------------- */
.card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: start;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--sh-sm);
  transition: transform var(--t), box-shadow var(--t-lin), border-color var(--t-lin);
}
.card:active { transform: scale(.978); }
.card.is-current { border-color: var(--accent); box-shadow: var(--sh); }
.card.is-done { background: var(--good-soft); box-shadow: none; }
.card.is-done .card-title { color: var(--dim); }

.card-body { flex: 1; min-width: 0; }
.card-title { font-size: 17px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.card-meta {
  font-size: 13px; color: var(--dim); margin-top: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.card-sub { font-size: 15px; margin-top: 6px; font-weight: 700; }

/* --- Progress ring ------------------------------------------------------- */
.ring { flex: none; width: 52px; height: 52px; position: relative; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-track { stroke: var(--surface-3); }
.ring .ring-fill  { stroke: var(--accent); transition: stroke-dashoffset 380ms cubic-bezier(.34,1.3,.64,1); }
.ring .ring-label {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: var(--dim);
}
.ring.is-full .ring-fill { stroke: var(--good); }
.ring.is-full .ring-label { color: var(--good); font-size: 20px; }
.ring.big { width: 64px; height: 64px; }
/* on a gradient card the ring inherits the card's ink so it works in both themes */
.ring.on-accent .ring-track { stroke: var(--grad-veil); }
.ring.on-accent .ring-fill  { stroke: currentColor; }
.ring.on-accent .ring-label { color: currentColor; font-size: 14px; }

/* small ghost button that lives inside a card without triggering it */
.linkbtn {
  flex: none;
  width: 76px;
  min-height: var(--tap);
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  display: grid;
  place-items: center;
  transition: transform var(--t);
}
.linkbtn:active { transform: scale(.93); }

/* --- Chips --------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.burn   { background: var(--burn-soft); color: var(--burn); }
.chip.good   { background: var(--good-soft); color: var(--good); }

/* --- Exercise view ------------------------------------------------------- */
.view-ex { min-height: 100%; display: flex; flex-direction: column; }
.view-ex .spacer { flex: 1 1 auto; min-height: 10px; }
.view-ex .ref-block { margin-top: 12px; }

.ex-name {
  font-size: 26px; font-weight: 800; line-height: 1.18;
  letter-spacing: -.015em; overflow-wrap: anywhere;
}
.ex-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cue {
  font-size: 13.5px; color: var(--dim); margin-top: 12px; line-height: 1.45;
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  box-shadow: var(--sh-sm);
}
.lasttime { font-size: 13px; color: var(--dim-2); margin-top: 8px; font-weight: 600; }

/* --- Coach card: the always-on nudge ------------------------------------- */
.coach {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent-soft);
  border-radius: var(--r);
  padding: 11px 14px;
  margin-top: 12px;
  animation: pop 320ms cubic-bezier(.34,1.5,.64,1);
}
.coach .coach-emoji { font-size: 22px; flex: none; line-height: 1; }
.coach .coach-text { font-size: 14px; font-weight: 700; color: var(--accent); line-height: 1.35; }
.coach.good { background: var(--good-soft); }
.coach.good .coach-text { color: var(--good); }
.coach.burn { background: var(--burn-soft); }
.coach.burn .coach-text { color: var(--burn); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  direction: ltr;               /* universal stepper order: - number + */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 2px;
}
.hero-num { direction: rtl; min-width: 148px; text-align: center; }
.hero-num b {
  display: block;
  font-size: 90px; font-weight: 800; line-height: .92;
  letter-spacing: -.04em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-num small { display: block; font-size: 14px; font-weight: 700; color: var(--dim); margin-top: 8px; }
.hero.is-edited .hero-num small { color: var(--accent); }

.step {
  width: var(--tap-lg); height: var(--tap-lg);
  flex: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--sh-sm);
  font-size: 30px; line-height: 1;
  display: grid; place-items: center;
  transition: transform var(--t), background var(--t-lin), color var(--t-lin);
}
.step:active { background: var(--accent); color: var(--accent-ink); transform: scale(.88); }
.step[disabled] { opacity: .3; }

.reps-row {
  direction: ltr;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  margin: 8px 0 16px;
}
.reps-row .step { width: var(--tap); height: var(--tap); font-size: 23px; }
.reps-val {
  direction: rtl;
  min-width: 108px; text-align: center;
  font-size: 13px; color: var(--dim); font-weight: 700;
}
.reps-val b { display: block; font-size: 28px; color: var(--ink); font-weight: 800; line-height: 1.1; }
.reps-row.is-edited .reps-val b { color: var(--accent); }

/* --- Set chips ----------------------------------------------------------- */
.sets { display: flex; gap: 8px; margin-bottom: 12px; }
.setchip {
  flex: 1;
  min-height: 58px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 2px solid transparent;
  color: var(--dim);
  font-size: 13.5px; font-weight: 800;
  display: grid; place-items: center;
  line-height: 1.2; padding: 4px;
  box-shadow: var(--sh-sm);
  transition: transform var(--t), background var(--t-lin), border-color var(--t-lin), color var(--t-lin);
}
.setchip:active { transform: scale(.95); }
.setchip small { display: block; font-size: 11px; font-weight: 700; opacity: .8; }
.setchip.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.setchip.is-done   { background: var(--good); color: var(--good-ink); box-shadow: none; }
.setchip.is-drop   { border-style: dashed; border-color: var(--burn); }

/* --- Feedback ------------------------------------------------------------ */
.feedback {
  background: var(--surface);
  border-radius: var(--r);
  padding: 8px 10px 10px;
  margin-bottom: 10px;
  box-shadow: var(--sh-sm);
  animation: pop 300ms cubic-bezier(.34,1.5,.64,1);
}
.feedback p { font-size: 12.5px; color: var(--dim); margin-bottom: 7px; text-align: center; font-weight: 700; }
.feedback-row { display: flex; gap: 8px; }
.fb {
  flex: 1;
  min-height: var(--tap);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px; font-weight: 700;
  transition: transform var(--t), background var(--t-lin), color var(--t-lin);
}
.fb:active { transform: scale(.94); }
.fb.on { background: var(--accent); color: var(--accent-ink); }

/* --- Progression suggestion ---------------------------------------------- */
.suggest {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 12px;
  box-shadow: var(--sh-sm);
}
.suggest p { font-size: 15px; font-weight: 800; }
.suggest .why { font-size: 12.5px; color: var(--dim); font-weight: 600; margin: 3px 0 11px; }
.suggest-row { display: flex; gap: 8px; }
.suggest-row button {
  flex: 1; min-height: var(--tap);
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 800;
  transition: transform var(--t);
}
.suggest-row button:active { transform: scale(.95); }
.btn-accept { background: var(--accent); color: var(--accent-ink); box-shadow: var(--sh-accent); }
.btn-ignore { background: var(--surface-2); color: var(--dim); }

/* --- Disclosure ---------------------------------------------------------- */
details.disc {
  background: var(--surface);
  border-radius: var(--r);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
details.disc > summary {
  min-height: var(--tap);
  display: flex; align-items: center; gap: 8px;
  padding: 0 15px;
  font-size: 14px; font-weight: 700; color: var(--dim);
  cursor: pointer; list-style: none;
  user-select: none; -webkit-user-select: none;
}
details.disc > summary::-webkit-details-marker { display: none; }
details.disc > summary::after {
  content: "\2304";
  margin-inline-start: auto;
  font-size: 18px;
  transition: transform var(--t-lin);
}
details.disc[open] > summary::after { transform: rotate(180deg); }
details.disc .disc-body { padding: 0 15px 14px; font-size: 14px; line-height: 1.5; }

/* --- Drop set ------------------------------------------------------------ */
.dropbanner {
  background: var(--burn-soft);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 12px;
}
.dropbanner h3 { font-size: 15px; font-weight: 800; color: var(--burn); }
.dropbanner p { font-size: 13px; margin-top: 5px; line-height: 1.45; color: var(--ink); }
.dropbanner .steps { display: flex; gap: 6px; margin-top: 10px; }
.dropbanner .steps i { flex: 1; height: 7px; border-radius: 999px; background: rgba(255,107,61,.25); }
.dropbanner .steps i.on { background: var(--burn); }

/* --- Bottom dock --------------------------------------------------------- */
#dock {
  position: fixed;
  inset-inline: 0; bottom: 0;
  z-index: 40;
  padding: 10px var(--pad) calc(10px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 64%, rgba(247,244,254,0));
  pointer-events: none;
}
[data-theme="dark"] #dock { background: linear-gradient(to top, var(--bg) 64%, rgba(20,16,31,0)); }
#dock > * { pointer-events: auto; }

.primary {
  width: 100%;
  min-height: var(--tap-lg);
  border-radius: var(--r);
  background: var(--grad);
  color: var(--accent-ink);
  font-size: 19px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: var(--sh-accent);
  transition: transform var(--t), filter var(--t-lin);
}
.primary:active { transform: scale(.97); filter: brightness(.94); }
.primary.ghost {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--sh-sm);
}
.primary[disabled] { opacity: .45; }

.dock-row { display: flex; gap: 8px; }
.dock-row .primary { flex: 1; }
.dock-row .primary.narrow { flex: 0 0 34%; font-size: 16px; }

/* --- Rest timer bar ------------------------------------------------------ */
.rest {
  direction: ltr;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  padding: 6px;
  min-height: 70px;
  box-shadow: var(--sh);
}
.rest .fill {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  background: var(--accent-soft);
  transition: width 1s linear;
  pointer-events: none;
}
.rest > *:not(.fill) { position: relative; }
.rest-time {
  direction: rtl;
  flex: 1; text-align: center;
  font-size: 29px; font-weight: 800; color: var(--accent); line-height: 1;
}
.rest-time small { display: block; font-size: 11px; color: var(--dim); font-weight: 700; margin-top: 4px; }
.rest-btn {
  min-width: 58px; min-height: var(--tap);
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px; font-weight: 800;
  transition: transform var(--t);
}
.rest-btn:active { transform: scale(.92); }
.rest.is-over { box-shadow: 0 0 0 2px var(--good), var(--sh); }
.rest.is-over .rest-time { color: var(--good); animation: flash 700ms 3; }
@keyframes flash { 50% { opacity: .35; } }

/* --- Sheet --------------------------------------------------------------- */
#sheet {
  position: fixed; inset: 0; z-index: 60;
  display: none;
  background: rgba(36,27,58,.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#sheet.open { display: block; }
.sheet-panel {
  position: absolute;
  inset-inline: 0; bottom: 0;
  max-height: 88%;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 8px var(--pad) calc(var(--pad) + var(--safe-b));
  animation: rise 240ms cubic-bezier(.34,1.3,.64,1);
}
@keyframes rise { from { transform: translateY(18px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 42px; height: 5px; border-radius: 999px; background: var(--surface-3); margin: 6px auto 14px; }
.sheet-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.sheet-sub { font-size: 13px; color: var(--dim); margin-bottom: 14px; line-height: 1.45; }

.demo-svg {
  background: var(--surface);
  border-radius: var(--r);
  padding: 10px;
  margin-bottom: 12px;
  box-shadow: var(--sh-sm);
}
.demo-svg svg { display: block; width: 100%; height: auto; }

.sheet-btn {
  width: 100%;
  min-height: 58px;
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px; font-weight: 700;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  margin-bottom: 8px;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--sh-sm);
  transition: transform var(--t);
}
.sheet-btn:active { transform: scale(.98); }
.sheet-btn.danger { color: var(--danger); }
.sheet-btn small { font-weight: 500; color: var(--dim); font-size: 12px; }

/* --- Summary / history --------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat {
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 6px;
  text-align: center;
  box-shadow: var(--sh-sm);
}
.stat b { display: block; font-size: 23px; font-weight: 800; line-height: 1.1; color: var(--accent); }
.stat small { display: block; font-size: 11.5px; color: var(--dim); margin-top: 4px; font-weight: 600; }

/* Celebration header on the summary screen */
.celebrate {
  text-align: center;
  background: var(--grad);
  color: var(--accent-ink);
  border-radius: var(--r-lg);
  padding: 22px 18px;
  margin-bottom: 14px;
  box-shadow: var(--sh-accent);
}
.celebrate .big { font-size: 46px; line-height: 1; }
.celebrate h2 { font-size: 22px; font-weight: 800; margin-top: 8px; }
.celebrate p { font-size: 14px; opacity: .92; margin-top: 6px; font-weight: 600; }

.group {
  background: var(--surface);
  border-radius: var(--r);
  padding: 4px 14px;
  margin-bottom: 10px;
  box-shadow: var(--sh-sm);
}
.rowline {
  display: flex; align-items: baseline; gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.rowline:last-child { border-bottom: 0; }
.rowline .grow { flex: 1; min-width: 0; }
.rowline .planned { color: var(--dim-2); font-size: 12.5px; }
.rowline .actual  { color: var(--good); font-weight: 800; }
.rowline .miss    { color: var(--burn); font-weight: 800; }

.section-title {
  font-size: 13px; font-weight: 800; color: var(--dim);
  margin: 16px 0 8px; letter-spacing: .02em;
}

textarea.notes {
  width: 100%; min-height: 96px;
  background: var(--surface);
  border: 0;
  border-radius: var(--r);
  padding: 14px;
  resize: vertical;
  font-size: 15px; line-height: 1.5;
  color: var(--ink);
  box-shadow: var(--sh-sm);
}
textarea.notes:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.empty {
  text-align: center; color: var(--dim);
  font-size: 14.5px; padding: 40px 20px; line-height: 1.7;
}
.empty .big { font-size: 44px; display: block; margin-bottom: 10px; }

.banner {
  background: var(--surface);
  border: 2px solid var(--burn);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 12px;
  font-size: 13.5px; line-height: 1.45;
  box-shadow: var(--sh-sm);
}
.banner .banner-row { display: flex; gap: 8px; margin-top: 10px; }
.banner .banner-row button {
  flex: 1; min-height: var(--tap);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 14px; font-weight: 700;
}

/* --- Toast --------------------------------------------------------------- */
/* Top, not bottom: the whole lower half is the action zone, and a toast
   parked there covers the set chips exactly when they change. */
#toast {
  position: fixed;
  inset-inline: var(--pad);
  top: calc(var(--safe-t) + 10px);
  z-index: 70;
  display: grid; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  background: var(--ink);
  color: var(--bg-2);
  border-radius: var(--r);
  padding: 13px 16px;
  font-size: 14.5px; font-weight: 700;
  line-height: 1.35;
  box-shadow: var(--sh-lg);
  animation: toastIn 320ms cubic-bezier(.34,1.5,.64,1);
}
.toast .t-emoji { font-size: 20px; flex: none; }
.toast.cheer { background: var(--grad); color: var(--accent-ink); }
.toast.pr    { background: linear-gradient(135deg, #FF9B2F, var(--sun)); color: #3A2400; }
@keyframes toastIn { from { transform: translateY(-14px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- Confetti canvas ----------------------------------------------------- */
#confetti {
  position: fixed; inset: 0;
  z-index: 80;
  pointer-events: none;
}

/* --- Motion preferences -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --- Narrow phones ------------------------------------------------------- */
@media (max-width: 359px) {
  :root { --pad: 12px; }
  .hero-num b { font-size: 74px; }
  .hero-num { min-width: 112px; }
  .ex-name { font-size: 23px; }
  .stat b { font-size: 20px; }
}

/* --- Short screens ------------------------------------------------------- */
@media (max-height: 700px) {
  .hero { margin: 4px 0 0; }
  .hero-num b { font-size: 72px; }
  .reps-row { margin: 6px 0 12px; }
  .coach { padding: 9px 12px; }
}
