/* ============================================================
   Coach — dark, mobile-first, big-tap-target design system
   ============================================================ */
:root {
    --bg:        #0b0f14;
    --bg-2:      #0e141b;
    --card:      #151c25;
    --card-2:    #1b2430;
    --line:      #243040;
    --text:      #e6edf3;
    --muted:     #8b98a5;
    --faint:     #5b6675;

    --accent:    #34e89e;   /* primary energy */
    --accent-2:  #18b88a;
    --accent-ink:#04150f;

    --heavy:     #ff6b5e;   /* too heavy → reduce */
    --heavy-bg:  #2a1512;
    --easy:      #3fd07a;   /* too easy → increase */
    --easy-bg:   #102417;

    --warn:      #ffcc66;
    --radius:    16px;
    --radius-lg: 22px;
    --tap:       58px;       /* min tap target */
    --maxw:      560px;
    --safe-b:    env(safe-area-inset-bottom, 0px);

    --shadow:    0 8px 28px rgba(0,0,0,.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: contain;
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.tiny  { font-size: 12.5px; }
.center { text-align: center; }

/* ---- App shell -------------------------------------------------------- */
.app {
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: linear-gradient(180deg, var(--bg) 70%, rgba(11,15,20,.0));
    backdrop-filter: blur(8px);
    padding: max(env(safe-area-inset-top), 14px) 18px 8px;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-title { font-size: 26px; margin: 0; }
.topbar-sub { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--card-2); border: 1px solid var(--line);
    display: grid; place-items: center; overflow: hidden; flex: 0 0 auto;
    font-weight: 700; color: var(--accent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content {
    flex: 1;
    padding: 8px 16px calc(96px + var(--safe-b));
}

/* ---- Bottom nav ------------------------------------------------------- */
.bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    max-width: var(--maxw); margin: 0 auto;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(14,20,27,.92);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 8px 6px calc(8px + var(--safe-b));
}
.navitem {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--faint); font-size: 11px; font-weight: 600;
    padding: 4px 0; border-radius: 12px;
}
.navitem.active { color: var(--accent); }
.navicon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Cards ------------------------------------------------------------ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}
.card.tight { padding: 14px; }
.card-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--tap); width: 100%;
    padding: 0 18px;
    border: none; border-radius: 14px;
    font-size: 17px; font-weight: 700; color: var(--accent-ink);
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    cursor: pointer; transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.985); }
.btn.secondary { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: linear-gradient(180deg, #ff7a6e, #e85042); color: #200a08; }
.btn.ghost.danger { background: transparent; color: var(--heavy); border-color: transparent; }
.btn:disabled { opacity: .5; }
.btn-sm { min-height: 44px; width: auto; padding: 0 14px; font-size: 14px; border-radius: 11px; }

/* ---- Big feedback buttons (the core differentiator) ------------------- */
.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fb-btn {
    min-height: 84px; border-radius: 18px; border: 1.5px solid;
    font-size: 18px; font-weight: 800; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    transition: transform .06s ease;
}
.fb-btn small { font-size: 12px; font-weight: 600; opacity: .8; }
.fb-btn:active { transform: scale(.97); }
.fb-heavy { background: var(--heavy-bg); border-color: var(--heavy); color: var(--heavy); }
.fb-easy  { background: var(--easy-bg);  border-color: var(--easy);  color: var(--easy); }

/* ---- Pills / chips ---------------------------------------------------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px; border-radius: 999px;
    background: var(--card-2); border: 1px solid var(--line);
    font-size: 13.5px; font-weight: 600; color: var(--text);
    cursor: pointer; user-select: none;
}
.chip.on { background: rgba(52,232,158,.14); border-color: var(--accent); color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display:inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
    background: var(--accent); color: var(--accent-ink); }
.badge.green { background: rgba(63,208,122,.16); color: var(--easy); }
.badge.amber { background: rgba(255,204,102,.16); color: var(--warn); }

/* ---- Inputs ----------------------------------------------------------- */
input, textarea, select {
    width: 100%; background: var(--bg-2); color: var(--text);
    border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 14px; font-size: 16px; font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
label.field { display:block; }
label.field .lab { display:block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
    width: 56px; height: 56px; font-size: 26px; font-weight: 700;
    background: var(--card-2); color: var(--text); border: 1px solid var(--line); cursor: pointer;
}
.stepper button:first-child { border-radius: 12px 0 0 12px; }
.stepper button:last-child  { border-radius: 0 12px 12px 0; }
.stepper .val { flex: 1; text-align: center; font-size: 30px; font-weight: 800; padding: 0 8px; }

/* ---- Set list --------------------------------------------------------- */
.setrow {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 12px; background: var(--card-2);
    border: 1px solid var(--line); margin-bottom: 8px;
}
.setrow.done { opacity: .6; }
.setrow .snum { width: 28px; height: 28px; border-radius: 8px; background: var(--bg-2);
    display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--muted); }
.setrow .sw { font-weight: 800; font-size: 18px; }
.setrow .sx { color: var(--muted); }

/* ---- Big weight display ----------------------------------------------- */
.bigweight { text-align: center; padding: 8px 0 4px; }
.bigweight .n { font-size: 64px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.bigweight .u { font-size: 20px; color: var(--muted); font-weight: 700; }
.bigweight .sub { color: var(--muted); margin-top: 6px; }

/* Tap-to-edit working weight */
.weight-edit { background: none; border: 0; cursor: pointer; padding: 0; display: inline-flex; align-items: baseline; gap: 8px; color: inherit; }
.weight-edit:active { transform: scale(.98); }
.weight-edit .u { font-size: 20px; }
.weight-editor { margin-top: 10px; }
.weight-editor input { width: 100%; font-size: 40px; font-weight: 800; text-align: center; letter-spacing: -.02em;
  padding: 10px 12px; border-radius: 14px; border: 2px solid var(--accent); background: var(--card); color: var(--ink); }

/* Plate calculator (live session) */
.plates { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; min-height: 22px; }
.plate { font-size: 13px; font-weight: 800; padding: 4px 9px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.plate-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-right: 2px; }

/* Session plan strip (multi-exercise days) */
.sessplan { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sp-item { font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.sp-item.cur  { background: rgba(52,232,158,.14); border-color: var(--accent); color: var(--accent); }
.sp-item.done { opacity: .6; text-decoration: line-through; }
.chip small { display: block; font-weight: 400; font-size: 11px; opacity: .75; margin-top: 2px; }

/* Recovery heatmap + progress charts */
.recov-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.recov-name { flex: 0 0 88px; font-size: 13.5px; font-weight: 600; }
.recov-bar { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.recov-fill { height: 100%; border-radius: 999px; }
.recov-fill.low  { background: var(--heavy); }
.recov-fill.mid  { background: var(--warn); }
.recov-fill.high { background: var(--easy); }
.recov-pct { flex: 0 0 38px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.chart-wrap { position: relative; width: 100%; height: 180px; }
.pr-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* Profile + targets (Settings) */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bignum { display: flex; align-items: baseline; gap: 8px; }
.bignum .n { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--accent); }
.bignum .u { font-size: 15px; color: var(--muted); font-weight: 700; }
.target-row + .target-row { border-top: 1px solid var(--line); padding-top: 12px; }
.vol-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.vol-chip { font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); }
.vol-chip.ok    { background: rgba(52,232,158,.14); border-color: var(--accent); color: var(--accent); }
.vol-chip.under { background: rgba(255,122,122,.12); border-color: var(--heavy); color: var(--heavy); }

/* ---- Coach chat ------------------------------------------------------- */
.chat { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.bubble { max-width: 86%; padding: 12px 15px; border-radius: 18px; font-size: 15.5px; line-height: 1.45; white-space: pre-wrap; }
.bubble.assistant { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; }
.bubble.user { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-bottom-right-radius: 6px; align-self: flex-end; font-weight: 600; }
.chat-input-bar {
    position: fixed; left: 0; right: 0; bottom: calc(72px + var(--safe-b));
    max-width: var(--maxw); margin: 0 auto; padding: 10px 14px;
    display: flex; gap: 10px; align-items: flex-end;
    background: linear-gradient(0deg, var(--bg) 70%, transparent);
}
.chat-input-bar textarea { resize: none; max-height: 120px; min-height: 52px; }
.mic-btn, .send-btn {
    flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center; border: 1px solid var(--line);
    background: var(--card-2); color: var(--text); cursor: pointer;
}
.send-btn { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border: none; }
.mic-btn.listening { background: var(--heavy); color: #fff; border-color: var(--heavy); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,107,94,.5);} 50% { box-shadow: 0 0 0 10px rgba(255,107,94,0);} }
.typing span { display:inline-block; width:7px; height:7px; margin:0 2px; border-radius:50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2){ animation-delay:.2s } .typing span:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,100%{ opacity:.3 } 50%{ opacity:1 } }

/* ---- Exercise library ------------------------------------------------- */
.exlist { display: flex; flex-direction: column; gap: 10px; }
.excard { display: flex; gap: 14px; align-items: center; }
.exthumb { width: 64px; height: 64px; border-radius: 12px; background: var(--card-2);
    object-fit: cover; flex: 0 0 auto; border: 1px solid var(--line); }
.exmeta { flex: 1; min-width: 0; }
.exmeta .nm { font-weight: 700; }
.exmeta .mg { color: var(--muted); font-size: 13px; }
.demo-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.demo-imgs img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); }

/* ---- Progress bars / stats ------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.review-grid .v { font-size: 23px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .k { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 4px; }
.trend { height: 8px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.trend > i { display:block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }

/* ---- Misc ------------------------------------------------------------- */
.alert { background: var(--heavy-bg); border: 1px solid var(--heavy); color: #ffd9d4;
    padding: 12px 14px; border-radius: 12px; margin: 12px 0; font-size: 14px; }
.toast {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + var(--safe-b));
    background: var(--card-2); border: 1px solid var(--line); color: var(--text);
    padding: 12px 18px; border-radius: 999px; font-weight: 600; z-index: 50;
    box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 14px 0; }
.section-h { display:flex; align-items:center; justify-content: space-between; margin: 18px 2px 10px; }
.section-h h2 { font-size: 18px; margin: 0; }
.link { color: var(--accent); font-weight: 600; }

/* ---- Public landing ---------------------------------------------------- */
.landing-body { min-height: 100dvh; padding: 0; background:
    radial-gradient(120% 70% at 50% -10%, #16335c 0%, #0b1020 45%, var(--bg) 80%); }
.landing { max-width: 480px; margin: 0 auto; padding: 44px 24px 28px; }
.landing-hero { text-align: center; }
.brand-logo { width: 116px; height: 116px; border-radius: 26px; box-shadow: 0 14px 44px rgba(33,86,190,.45); }
.brand-name { font-size: 31px; font-weight: 800; letter-spacing: -.02em; margin: 16px 0 6px;
    background: linear-gradient(90deg, #3aa0ff, #ff6a3d); -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent; }
.brand-tag { color: var(--muted); font-size: 16px; line-height: 1.45; margin: 0 auto 24px; max-width: 30ch; }
.btn-google {
    margin: 6px 0 10px; width: 100%; min-height: var(--tap);
    display: inline-flex; align-items: center; justify-content: center; gap: 12px;
    background: #fff; color: #1f1f1f; border-radius: 14px; font-weight: 700; font-size: 16px;
}
.btn-google:active { transform: scale(.99); }
.landing-features { display: grid; gap: 12px; margin-top: 34px; }
.feat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; text-align: left; }
.feat-ic { font-size: 26px; line-height: 1; }
.feat h3 { margin: 8px 0 4px; font-size: 17px; }
.feat p { margin: 0; font-size: 14.5px; line-height: 1.45; }
.landing-foot { text-align: center; margin-top: 30px; }
