/* HR Core-MK · escala de cinza, mobile-first, adaptativo portrait/landscape */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #000;
  --fg: #fff;
  --fg-2: #ccc;
  --fg-3: #888;
  --mid: #1a1a1a;
  --line: #333;
  --muted: #888;
  --accent: #fff;
  --r: 10px;
}
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-feature-settings: "tnum";
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* TOP BAR */
.top {
  display: flex; flex-direction: column;
  padding: max(env(safe-area-inset-top), .4rem) .85rem .35rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  gap: .15rem;
}
.top-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem;
}
.top-creds {
  font-size: .68rem; color: var(--fg-3);
  letter-spacing: .02em; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-status {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end; gap: .55rem;
  margin-top: .2rem; min-height: 1.6rem;
}
.top-status-spacer { display: none; }
.clock { font-size: 1rem; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.top-status .meta { font-size: .76rem; color: var(--fg-3); }
.top-connect {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  border: 1.5px solid var(--fg);
  color: var(--fg);
  border-radius: 999px;
  padding: .5rem .95rem;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.top-connect.connected { background: var(--fg); color: var(--bg); }
.sync-badge {
  background: transparent;
  cursor: pointer;
}
.sync-badge.is-ok { border-color: rgba(72,187,120,.5); color: #4ade80; }
.sync-badge.is-busy { border-color: rgba(255,212,121,.45); color: #ffd479; }
.sync-badge.is-off { border-color: var(--line); color: var(--fg-3); }

.brand-mk {
  font-size: 1rem; font-weight: 800; letter-spacing: .1em;
  color: var(--fg);
  white-space: nowrap; user-select: none;
  cursor: pointer;
}
.recording-on .top-row .brand-mk { cursor: default; }
.brand-mk em {
  color: #ffd479; font-style: normal; font-weight: 900;
  text-shadow: 0 0 10px rgba(255,212,121,.3);
}

/* hamburger button */
.hamburger {
  background: transparent; border: 1px solid var(--line);
  border-radius: 8px;
  width: 40px; height: 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  padding: 0;
  transition: border-color .15s, background .15s;
}
.hamburger:active { background: rgba(255,255,255,.05); }
.hamburger:hover { border-color: var(--fg-2); }
.hamburger span {
  width: 18px; height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: all .2s;
}

/* during recording: hide creds + brand subtle, keep status visible */
.recording-on .top-creds { display: none; }
.recording-on .brand-mk { font-size: .82rem; color: var(--fg-2); }
.recording-on .brand-mk em { color: #ffd479; }

/* Header sanfona — colapsa em vertical durante recording pra liberar espaço pro FC + controles + lap */
.top { transition: padding .25s ease, gap .2s ease; }
.top-status, .top-creds, .brand-mk, .hamburger {
  transition: max-height .25s ease, opacity .2s ease, font-size .2s ease,
              width .2s ease, height .2s ease, margin .2s ease, padding .2s ease;
}
@media (orientation: portrait) {
  body.recording-on .top {
    padding-top: max(env(safe-area-inset-top), .15rem);
    padding-bottom: .1rem;
    gap: 0;
  }
  body.recording-on .top-status {
    max-height: 0; opacity: 0; overflow: hidden;
    margin: 0; padding: 0; min-height: 0;
    pointer-events: none;
  }
  body.recording-on .brand-mk { font-size: .68rem; letter-spacing: .14em; }
  body.recording-on .hamburger { width: 34px; height: 34px; }
  /* FC reduzida em portrait pra controles + lap caberem sem scroll em viewport curtos */
  body.recording-on .fc-num { font-size: clamp(5.5rem, 28vmin, 14rem); letter-spacing: -3px; }
  body.recording-on .fc-clock { font-size: clamp(1.5rem, 6vmin, 2.6rem); }
  body.recording-on .controls { gap: .35rem; }
  body.recording-on .controls .ctl { min-height: 54px; padding: .65rem .4rem; font-size: .9rem; }
  body.recording-on .top-connect { display: none; }
}
/* Celular deitado (landscape sem ser desktop): mesma sanfona */
@media (orientation: landscape) and (max-width: 900px) {
  body.recording-on .top {
    padding-top: max(env(safe-area-inset-top), .1rem);
    padding-bottom: .1rem;
    gap: 0;
  }
  body.recording-on .top-status,
  body.recording-on .top-creds {
    max-height: 0; opacity: 0; overflow: hidden;
    margin: 0; padding: 0; min-height: 0;
    pointer-events: none;
  }
  body.recording-on .brand-mk { font-size: .65rem; }
  body.recording-on .hamburger { width: 30px; height: 30px; }
  body.recording-on .top-connect { display: none; }
  /* Layout horizontal compacto: controls em coluna no canto direito */
  body.recording-on #screen-monitor.screen {
    grid-template-rows: 1fr auto auto;
    grid-template-columns: 1fr 96px;
    grid-template-areas:
      "fc       controls"
      "talk-row controls"
      "pse      controls";
    gap: .3rem;
  }
  body.recording-on #screen-monitor.screen .fc-display { grid-area: fc; }
  body.recording-on #screen-monitor.screen .talk-row   { grid-area: talk-row; }
  body.recording-on #screen-monitor.screen .pse        { grid-area: pse; }
  body.recording-on #screen-monitor.screen .controls   {
    grid-area: controls;
    grid-template-columns: 1fr;
    gap: .3rem;
    align-self: stretch;
  }
  body.recording-on #screen-monitor.screen .controls .ctl-mod { display: none; }
  body.recording-on #screen-monitor.screen .controls .ctl { min-height: 44px; padding: .35rem; font-size: .82rem; }
  body.recording-on #screen-monitor.screen .zones { display: none; }
  body.recording-on #screen-monitor.screen .stats { display: none; }
  body.recording-on .fc-num { font-size: clamp(5rem, 22vmin, 12rem); letter-spacing: -2px; }
  body.recording-on .fc-clock { font-size: clamp(1.2rem, 5vmin, 2rem); }
}

/* DRAWER */
.drawer-back {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 60;
  display: flex; justify-content: flex-end;
  opacity: 1; transition: opacity .2s;
}
.drawer-back.hide { opacity: 0; pointer-events: none; }
.drawer {
  width: min(320px, 86vw);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(0);
  transition: transform .25s ease-out;
  padding: max(env(safe-area-inset-top), 1rem) 0 max(env(safe-area-inset-bottom), 1rem);
}
.drawer-back.hide .drawer { transform: translateX(100%); }
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 1.1rem .9rem;
  border-bottom: 1px solid var(--line);
}
.drawer-head .x {
  background: transparent; border: 0; color: var(--fg-2);
  font-size: 1.4rem; cursor: pointer; padding: 0 .3rem;
}
.drawer-head .x:hover { color: var(--fg); }
.drawer-info {
  padding: .8rem 1.1rem .8rem;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .4rem;
  background: rgba(255,255,255,.02);
}
.drawer-info-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .82rem;
}
.drawer-info-row .lbl {
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-size: .68rem;
  font-weight: 600;
}
.drawer-info-row .val {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-info-row .val.muted { color: var(--fg-3); font-weight: 400; }
.drawer-info-row .val.live { color: #fbbf24; }
.drawer-info-row .val.ok { color: #4ade80; }
.drawer-nav {
  flex: 1; overflow-y: auto;
  padding: .6rem .5rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.drawer-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .85rem 1rem;
  background: transparent; border: 0;
  color: var(--fg);
  font-size: 1rem; font-weight: 600;
  text-align: left; cursor: pointer;
  border-radius: 10px;
  transition: background .15s;
}
.drawer-item:hover { background: rgba(255,255,255,.04); }
.drawer-item:active { background: rgba(255,255,255,.08); }
.drawer-item:disabled { opacity: .4; cursor: not-allowed; }
.drawer-item span { flex: 1; }
.drawer-item small {
  font-size: .7rem; color: var(--fg-3); font-weight: 400;
  margin-left: auto;
}
.drawer-item-sec { color: var(--fg-2); font-weight: 500; font-size: .92rem; }
.drawer-sep {
  border: 0; border-top: 1px solid var(--line);
  margin: .5rem .8rem;
}
.drawer-foot {
  border-top: 1px solid var(--line);
  padding: .9rem 1.1rem .2rem;
  display: flex; flex-direction: column; gap: .2rem;
}
.drawer-creds { font-size: .72rem; color: var(--fg-3); line-height: 1.35; }
.drawer-version { font-size: .68rem; color: var(--fg-3); }

/* ===== Athlete selector no header ===== */
.t-athlete-btn {
  background: rgba(255,212,121,.10);
  border: 1px solid rgba(255,212,121,.25);
  color: var(--fg); font-size: .82rem; font-weight: 700;
  padding: .35rem .7rem; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
  transition: all .15s;
}
.t-athlete-btn:active { transform: scale(.96); }
.t-athlete-btn.is-athlete {
  background: rgba(72,187,120,.15);
  border-color: rgba(72,187,120,.45);
  color: #4ade80;
}
.recording-on .t-athlete-btn { opacity: .5; pointer-events: none; }

/* ===== Modal Atletas ===== */
.ath-current {
  display: flex; justify-content: space-between; align-items: center;
  padding: .55rem .75rem;
  background: rgba(255,212,121,.07);
  border: 1px solid rgba(255,212,121,.22);
  border-radius: 8px;
  font-size: .92rem;
}
.ath-current .who { font-weight: 700; color: var(--fg); }
.ath-current .who em { color: #ffd479; font-style: normal; font-weight: 900; }
.ath-current button {
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  color: var(--fg-2); padding: .3rem .65rem; border-radius: 6px;
  font-size: .78rem; cursor: pointer;
}
.ath-list { display: flex; flex-direction: column; gap: .45rem; }
.ath-row {
  display: grid; grid-template-columns: 1fr auto auto auto;
  align-items: center; gap: .5rem;
  padding: .55rem .7rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.ath-row.active { border-color: #4ade80; background: rgba(72,187,120,.08); }
.ath-row .a-name { font-weight: 700; color: var(--fg); font-size: .96rem; }
.ath-row .a-meta { font-size: .76rem; color: var(--fg-3); margin-top: 2px; }
.ath-row .a-count {
  font-size: .72rem; color: var(--fg-3); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ath-row button {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; padding: 4px 6px; opacity: .5; color: var(--fg-2);
}
.ath-row button:active { opacity: 1; }
.ath-empty { color: var(--fg-3); font-size: .85rem; padding: .8rem; text-align: center; }

/* Setup card mostrando atleta atual */
.ath-pickline {
  display: flex; justify-content: space-between; align-items: center;
  padding: .6rem .8rem; margin-bottom: .8rem;
  background: rgba(72,187,120,.08); border: 1px solid rgba(72,187,120,.3);
  border-radius: 8px; font-size: .9rem;
}
.ath-pickline strong { color: #4ade80; }
.ath-pickline button {
  background: rgba(255,255,255,.08); border: 1px solid var(--line);
  color: var(--fg-2); padding: .3rem .65rem; border-radius: 6px;
  font-size: .78rem; cursor: pointer;
}
.meta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: .15rem .55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.live { color: var(--fg); border-color: var(--fg); }
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  width: 36px; height: 36px;
  border-radius: 8px;
  font-size: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:active { background: var(--mid); }

/* MAIN SCREEN */
.screen {
  height: calc(100vh - 50px);
  height: calc(100dvh - 50px);
  display: grid;
  grid-template-rows: 1fr auto auto auto auto;
  gap: .4rem;
  padding: .5rem .6rem max(env(safe-area-inset-bottom), .5rem);
  overflow-x: hidden;
  overflow-y: auto;
}

/* HOME — 4 cards (LIVRE/TESTE/ESTUDO/CAMPO) */
.screen-home {
  min-height: calc(100vh - 110px);
  min-height: calc(100dvh - 110px);
  padding: 1rem .8rem max(env(safe-area-inset-bottom), 1rem);
  display: flex; flex-direction: column;
  justify-content: center;
}
.screen-home.hide { display: none; }
.home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: .65rem;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  flex: 1;
  max-height: 580px;
}
.home-card {
  background: linear-gradient(135deg, #0e0e0e, #060606);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem .9rem;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: space-between;
  gap: .5rem;
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  font: inherit;
  transition: border-color .15s, transform .12s, background .15s;
  min-height: 130px;
}
.home-card:active { transform: scale(.98); }
.home-card:hover { border-color: var(--fg-2); background: linear-gradient(135deg, #141414, #080808); }
.home-card-emoji {
  font-size: 2.4rem; line-height: 1;
  filter: drop-shadow(0 0 12px rgba(255,255,255,.08));
}
.home-card-title {
  font-size: 1.15rem; font-weight: 800; letter-spacing: .12em;
  color: var(--fg);
}
.home-card-desc {
  font-size: .76rem; color: var(--fg-3); line-height: 1.35;
  font-weight: 400; letter-spacing: 0;
}
/* per-mode accents */
.home-card[data-mode="livre"] { border-top: 2px solid #4aaa6a; }
.home-card[data-mode="teste"] { border-top: 2px solid #a8d8ff; }
.home-card[data-mode="estudo"] { border-top: 2px solid #d88a3a; }
.home-card[data-mode="campo"]  { border-top: 2px solid #d84a4a; }
.home-card[data-mode="livre"] .home-card-title { color: #c4ecd2; }
.home-card[data-mode="teste"] .home-card-title { color: #d4ebff; }
.home-card[data-mode="estudo"] .home-card-title { color: #f3c8a0; }
.home-card[data-mode="campo"]  .home-card-title { color: #f3a8a8; }

@media (max-width: 380px) {
  .home-card-emoji { font-size: 2rem; }
  .home-card-title { font-size: 1rem; }
  .home-card-desc { font-size: .72rem; }
}

/* FC GIGANTE */
.fc-display {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  min-height: clamp(220px, 38vh, 420px);
}
.fc-clock {
  font-size: clamp(2rem, 8vmin, 3.4rem);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  color: var(--fg-3);
  line-height: 1;
  margin-bottom: .25rem;
}
body.recording-on .fc-clock { color: var(--fg); font-weight: 400; }
.fc-num {
  font-size: clamp(8rem, 38vmin, 22rem);
  font-weight: 900;
  line-height: .92;
  letter-spacing: -4px;
  font-variant-numeric: tabular-nums;
}
.fc-unit {
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-top: .2rem;
}
.fc-status {
  margin-top: .8rem;
  font-size: .85rem;
  color: var(--muted);
  min-height: 1.2em;
}

/* ZONAS — barras horizontais */
.zones {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .3rem;
}
.zone {
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: .35rem .25rem;
  text-align: center;
  background: transparent;
  transition: background .12s, border-color .12s;
}
.zone .zlbl { display: block; font-weight: 800; font-size: 1rem; letter-spacing: 1px; }
.zone .zrng { display: block; font-size: .68rem; color: var(--muted); margin-top: .15rem; font-variant-numeric: tabular-nums; }

/* Cores por zona — ativadas só quando .active. Hierarquia visual fisiológica:
   Z1 cinza claro · Z2 azul · Z3 verde · Z4 laranja · Z5 vermelho. */
.zone[data-z="1"] { --zc: 158,158,158; }
.zone[data-z="2"] { --zc:  60,140,220; }
.zone[data-z="3"] { --zc:  56,180,100; }
.zone[data-z="4"] { --zc: 232,150, 40; }
.zone[data-z="5"] { --zc: 220, 60, 60; }

.zone.active {
  background: rgb(var(--zc));
  color: #fff;
  border-color: rgb(var(--zc));
  box-shadow: 0 0 0 2px rgba(var(--zc), .35);
  transform: translateY(-1px);
  transition: background .18s, border-color .18s, box-shadow .18s, transform .18s;
}
.zone.active .zlbl { color: #fff; }
.zone.active .zrng { color: rgba(255,255,255,.92); }

/* FC display reage à zona ativa (cor sutil da borda inferior) */
.fc-display { position: relative; }
.fc-display::after {
  content: '';
  position: absolute; left: 50%; bottom: -2px;
  width: 0; height: 3px; background: transparent;
  transform: translateX(-50%);
  transition: width .35s ease, background .25s, opacity .25s;
  border-radius: 2px;
}
body.zone-1 .fc-display::after { width: 50%; background: rgb(158,158,158); }
body.zone-2 .fc-display::after { width: 60%; background: rgb(60,140,220); }
body.zone-3 .fc-display::after { width: 72%; background: rgb(56,180,100); }
body.zone-4 .fc-display::after { width: 84%; background: rgb(232,150,40); }
body.zone-5 .fc-display::after { width: 96%; background: rgb(220,60,60); animation: fcPulse 1.2s ease-in-out infinite; }
@keyframes fcPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

/* Pequeno tag colorido na FC durante zona ativa */
body.zone-2 .fc-num { text-shadow: 0 0 24px rgba(60,140,220, .25); }
body.zone-3 .fc-num { text-shadow: 0 0 24px rgba(56,180,100, .25); }
body.zone-4 .fc-num { text-shadow: 0 0 24px rgba(232,150, 40, .35); }
body.zone-5 .fc-num { text-shadow: 0 0 28px rgba(220, 60, 60, .45); }

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .3rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .45rem .3rem;
}
.stat { text-align: center; }
.stat .lbl { display: block; font-size: .65rem; color: var(--muted); letter-spacing: 1.2px; }
.stat .val { display: block; font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: .1rem; }

/* PSE — botões grandes */
.pse {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: .3rem;
  min-height: 56px;
}
.pse button {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--fg);
  border-radius: var(--r);
  font-size: 1.15rem;
  font-weight: 700;
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .25rem;
}
.pse button .pse-lbl {
  font-size: .58rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: .1rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pse button:active, .pse button.flash { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pse button:active .pse-lbl, .pse button.flash .pse-lbl { color: var(--bg); }
.pse button.pse-stop {
  border-color: #dc2626;
  color: #ff6b6b;
}
.pse button.pse-stop:active, .pse button.pse-stop.flash {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.pse button.pse-stop:active .pse-lbl, .pse button.pse-stop.flash .pse-lbl { color: #fff; }

/* TALK TEST 4 níveis (Respiração) — sessão LIVRE */
.talk-row {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .4rem;
}
.talk-row .talk-hint, .pse-wrap .pse-hint {
  font-size: .68rem;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.pse-wrap { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .4rem; }
.science-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(251, 191, 36, .12);
  color: #fbbf24;
  font-size: .68rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid rgba(251, 191, 36, .25);
  transition: background .15s, color .15s, border-color .15s, transform .15s;
  line-height: 1;
}
.science-tip:active, .science-tip:hover {
  background: #fbbf24;
  color: #000;
  border-color: #fbbf24;
  transform: scale(1.08);
}
.talk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .3rem;
}
.talk-grid button {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--fg);
  border-radius: var(--r);
  font-size: 1.02rem;
  font-weight: 800;
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .25rem .15rem;
  letter-spacing: 0;
  line-height: 1.05;
  word-spacing: -1px;
}
.talk-grid button .em {
  display: block;
  font-size: .58rem;
  font-weight: 500;
  color: var(--fg-3);
  margin-top: .2rem;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.talk-grid button:active, .talk-grid button.flash { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.talk-grid button:active .em, .talk-grid button.flash .em { color: var(--bg); }
.talk-grid button[data-tt="nariz"].is-active       { background: rgba(34,197,94,.20); border-color: #22c55e; color: #fff; }
.talk-grid button[data-tt="nariz-boca"].is-active  { background: rgba(132,204,22,.20); border-color: #84cc16; color: #fff; }
.talk-grid button[data-tt="boca"].is-active        { background: rgba(234,179,8,.20); border-color: #eab308; color: #fff; }
.talk-grid button[data-tt="ofegante"].is-active    { background: rgba(220,38,38,.20); border-color: #dc2626; color: #fff; }

/* CONTROLES */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .3rem;
}
.controls .ctl {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--fg);
  padding: .75rem .5rem;
  border-radius: var(--r);
  font-size: .92rem;
  font-weight: 600;
  min-height: 50px;
}
.controls .ctl:disabled { opacity: .35; }
.controls .ctl:active:not(:disabled) { background: var(--mid); }
.controls .ctl-mod { grid-column: 1 / -1; }
.controls .ctl-start { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.controls .ctl-start.recording {
  background: transparent;
  color: var(--fg);
  border-color: var(--fg);
  animation: recPulse 1.6s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); }
  50%      { box-shadow: inset 0 0 0 2px rgba(255,255,255,.45); }
}
.controls .ctl-pause:not(:disabled) { border-color: var(--fg-2); }
.controls .ctl-stop:not(:disabled)  { border-color: var(--fg-2); }
.controls .ctl-lap:not(:disabled)   { border-color: var(--fg-2); }

/* Badge no header esconde durante sessão pra liberar espaço */
.recording-on .top-c .badge { opacity: 0; pointer-events: none; transition: opacity .2s; }

/* DESKTOP REAL: layout amplo, não aplica em celular deitado */
@media (orientation: landscape) and (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .screen {
    grid-template-rows: minmax(280px, 1fr) auto auto auto;
    grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.7fr) minmax(220px, 1fr);
    grid-template-areas:
      "pse fc controls"
      "pse fc talk"
      "zones zones zones"
      "chart chart chart"
      "stats stats stats";
    gap: .75rem;
    padding: .8rem .9rem;
    align-items: stretch;
  }
  .fc-display {
    grid-area: fc;
    justify-content: center;
    align-items: center;
    padding: .6rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  }
  .talk-row {
    grid-area: talk;
    align-self: stretch;
    margin-bottom: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .7rem;
    background: rgba(255,255,255,.02);
  }
  .pse-wrap {
    grid-area: pse;
    align-self: stretch;
    margin-bottom: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .7rem;
    background: rgba(255,255,255,.02);
  }
  .talk-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(56px, 1fr);
  }
  .pse {
    grid-auto-flow: row;
    grid-auto-rows: minmax(72px, 1fr);
    height: 100%;
  }
  .controls {
    grid-area: controls;
    grid-template-columns: 1fr;
    align-content: start;
    gap: .45rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .7rem;
    background: rgba(255,255,255,.02);
  }
  .controls .ctl-mod { grid-column: auto; }
  .controls .ctl {
    min-height: 52px;
  }
  .zones {
    grid-area: zones;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .55rem;
    background: rgba(255,255,255,.02);
  }
  .zone {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 76px;
    padding: .55rem .35rem;
  }
  .live-chart {
    display: block;
    grid-area: chart;
    height: 220px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .35rem;
    background: rgba(255,255,255,.02);
  }
  .stats {
    grid-area: stats;
    border-radius: 14px;
    padding: .6rem .45rem;
  }
  .fc-num { font-size: clamp(8rem, 18vmin, 12rem); }
  .fc-clock { font-size: clamp(2rem, 4vmin, 2.8rem); }
  .fc-status { margin-top: .55rem; }
}

/* ============ MODAIS ============ */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-back.hide { display: none; }
.modal {
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  margin-top: max(env(safe-area-inset-top), .5rem);
  margin-bottom: 2rem;
  display: flex; flex-direction: column;
}
.modal.modal-sm { max-width: 440px; }
.m-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--line);
}
.m-head h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: .3px; }
.m-head .x {
  background: transparent; border: none; color: var(--muted);
  font-size: 1.2rem; padding: .3rem .5rem; border-radius: 6px;
}
.m-body { padding: 1rem; display: flex; flex-direction: column; gap: .85rem; }
.m-foot {
  display: flex; gap: .5rem; justify-content: flex-end;
  padding: .75rem 1rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.m-foot .btn-pri,
.m-foot .btn-sec,
.btn-pri,
.btn-sec {
  padding: .65rem 1.1rem;
  border-radius: 8px;
  font-size: .9rem; font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.m-foot .btn-pri,
.btn-pri { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-pri:hover, .btn-pri:active { opacity: .88; }
.btn-sec:hover { border-color: var(--fg-2); background: rgba(255,255,255,.04); }
.btn-sec:disabled, .btn-pri:disabled { opacity: .4; cursor: not-allowed; }
.sync-actions { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.sync-actions .btn-pri, .sync-actions .btn-sec { flex: 1; min-width: 110px; }

/* form rows */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.row label { display: flex; flex-direction: column; gap: .25rem; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.row label.span2 { grid-column: 1 / -1; }
.row label em { color: var(--muted); font-style: italic; text-transform: none; letter-spacing: 0; font-size: .68rem; }
.row input, .row select {
  background: var(--mid);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem .65rem;
  font-size: .95rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.row input:focus, .row select:focus { outline: 1px solid var(--fg); outline-offset: 1px; }
.row input[readonly] { background: #050505; color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: .8rem; }
.card h3 { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; margin-bottom: .15rem; }
.card .hint { font-size: .78rem; color: var(--muted); margin-bottom: .55rem; line-height: 1.4; }
.sync-card-row {
  margin-top: .7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
}
.sync-actions {
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: .55rem;
}

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; margin-top: .55rem; }
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 540px) { .kpis-4 { grid-template-columns: repeat(2, 1fr); } }
.kpi { border: 1px solid var(--line); border-radius: 8px; padding: .55rem; text-align: center; }
.kpi .lbl { display: block; font-size: .62rem; color: var(--muted); letter-spacing: .8px; }
.kpi .val { display: block; font-size: 1rem; font-weight: 700; margin-top: .1rem; font-variant-numeric: tabular-nums; }

/* modality grid */
.modality-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .5rem; }
.modality-grid button {
  background: var(--mid); color: var(--fg);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 1rem .5rem;
  font-size: 1rem;
}
.modality-grid button:active, .modality-grid button.sel { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* histórico */
.hist-list { display: flex; flex-direction: column; gap: .4rem; max-height: 60vh; overflow-y: auto; }
.hist-item {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: .65rem .75rem;
  cursor: pointer;
  display: flex; flex-direction: column; gap: .15rem;
  position: relative;
}
.hist-item:active { background: var(--mid); }
.hist-item .h-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding-right: 28px; }
.hist-item .h-date { font-weight: 700; font-size: .92rem; }
.hist-item .h-mod { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.hist-item .h-meta { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-item .h-ath {
  display: inline-block; font-size: .78rem; font-weight: 600;
  color: #4ade80; padding: 2px 6px;
  background: rgba(72,187,120,.10); border-radius: 4px;
  margin-top: 2px;
}
.hist-item .h-date strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.hist-filter {
  margin-bottom: .8rem; padding: .55rem .7rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
}
.hist-filter label { font-size: .85rem; color: var(--fg-2); }
.hist-filter select {
  background: var(--bg-2); color: var(--fg); border: 1px solid var(--line);
  padding: .35rem .5rem; border-radius: 6px; font-size: .9rem;
}
.hist-item .h-report,
.ft-hist-row .rep,
.hrv-hist-row .rep {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  text-decoration: none; font-size: 1rem; opacity: .55;
  padding: 4px 6px; border-radius: 6px; line-height: 1;
}
.hist-item .h-report { right: 8px; }
.hist-item .h-report:active,
.ft-hist-row .rep:active,
.hrv-hist-row .rep:active { opacity: 1; background: rgba(168,216,255,.12); }
.muted { color: var(--muted); font-size: .85rem; }

/* resumo */
.sum-class { font-size: .9rem; color: var(--fg); padding: .6rem .8rem; border: 1px dashed var(--line); border-radius: var(--r); }
.sum-zones { display: flex; flex-direction: column; gap: .35rem; }
.sum-zone-row { display: grid; grid-template-columns: 40px 1fr 70px; gap: .5rem; align-items: center; font-size: .82rem; }
.sum-zone-row .bar { background: var(--mid); height: 16px; border-radius: 4px; position: relative; overflow: hidden; }
.sum-zone-row .bar > span { display: block; height: 100%; background: var(--fg); }
.sum-zone-row .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.sum-zone-row .zk { font-weight: 700; }

.banner { padding: .7rem .9rem; border: 1px solid var(--fg); border-radius: var(--r); font-size: .9rem; }

.chart { width: 100%; height: 180px; background: var(--mid); border-radius: 6px; }
.live-chart { display: none; }

/* TOAST */
.toast {
  position: fixed; bottom: max(env(safe-area-inset-bottom), 1.5rem);
  left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg);
  padding: .7rem 1.1rem;
  border-radius: 999px;
  font-size: .9rem; font-weight: 600;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0,0,0,.5);
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}
.toast.hide { opacity: 0; transform: translate(-50%, 12px); transition: all .2s; pointer-events: none; }
.toast.show { opacity: 1; transition: all .2s; }

.hide { display: none !important; }

/* ============== HRV ============== */
.hrv-radio {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: .55rem; cursor: pointer; transition: border-color .15s, background .15s;
}
.hrv-radio:hover { border-color: var(--fg-3); background: rgba(255,255,255,.03); }
.hrv-radio input { accent-color: var(--fg); margin-top: .25rem; }
.hrv-radio div { flex: 1; }
.hrv-radio strong { display: block; font-size: .94rem; color: var(--fg); margin-bottom: .15rem; }
.hrv-radio span { font-size: .78rem; color: var(--fg-3); }
.hrv-radio:has(input:checked) { border-color: var(--fg); background: rgba(255,255,255,.06); }

.hrv-cta-row { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; flex-wrap: wrap; }
.hrv-cta-row .hint { font-size: .76rem; color: var(--fg-3); }

.hrv-history { display: flex; flex-direction: column; gap: .35rem; }
.hrv-hist-row {
  display: grid; grid-template-columns: 1fr auto 1fr auto; gap: .6rem; align-items: center;
  padding: .45rem .65rem; background: rgba(255,255,255,.03); border-radius: 6px;
  font-size: .82rem;
}
.hrv-hist-row .d { color: var(--fg-2); }
.hrv-hist-row .p { color: var(--fg-3); font-size: .75rem; }
.hrv-hist-row .m { text-align: right; color: var(--fg); }
.hrv-hist-row .x {
  background: none; border: none; color: var(--fg-3); cursor: pointer;
  font-size: .9rem; padding: .15rem .35rem; border-radius: 4px;
}
.hrv-hist-row .x:hover { color: #f87171; }

/* Acomodação countdown */
.hrv-center {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 240px; padding: 2rem;
}
.hrv-acomod-num {
  font-size: 8rem; font-weight: 200; line-height: 1; color: var(--fg);
  letter-spacing: -.05em; font-variant-numeric: tabular-nums;
}
.hrv-acomod-label {
  font-size: .92rem; color: var(--fg-2); margin-top: .8rem; text-align: center;
}

/* Recording */
#hrv-recording { padding: 1rem 0; text-align: center; }
.hrv-rec-label { font-size: .85rem; color: var(--fg-2); margin-bottom: .9rem; }
.hrv-rec-time {
  font-size: 5rem; font-weight: 200; line-height: 1; color: var(--fg);
  letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-bottom: 1rem;
}
.hrv-rec-bar-wrap {
  height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden;
  max-width: 420px; margin: 0 auto 1rem;
}
.hrv-rec-bar {
  height: 100%; width: 0%; background: var(--fg); transition: width .25s linear;
}
.hrv-rec-meta {
  display: flex; justify-content: center; gap: .5rem; align-items: center;
  font-size: .82rem; color: var(--fg-3); margin-bottom: .5rem;
  font-variant-numeric: tabular-nums;
}
.hrv-rec-tip { font-size: .76rem; color: var(--fg-3); margin-bottom: 1.4rem; font-style: italic; }
#b-hrv-cancel { margin-top: .4rem; }

/* Result */
.hrv-bignum {
  text-align: center; padding: 1.2rem 0 .8rem;
  display: flex; flex-direction: column; align-items: center;
}
.hrv-bignum-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .15em; color: var(--fg-3); margin-bottom: .15rem; }
.hrv-bignum-val { font-size: 5rem; font-weight: 200; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }
.hrv-bignum-unit { font-size: .9rem; color: var(--fg-3); margin-top: .25rem; }

.hrv-class {
  text-align: center; padding: .55rem .75rem; border-radius: 8px;
  background: rgba(255,255,255,.05); margin: .6rem 0 1rem;
  font-size: .88rem; color: var(--fg);
}
.hrv-class.fadiga { background: rgba(220,38,38,.12); }
.hrv-class.leve { background: rgba(234,179,8,.12); }
.hrv-class.recuperado, .hrv-class.pico { background: rgba(34,197,94,.12); }

.hrv-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem;
}
.hrv-grid > div {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .5rem .7rem; background: rgba(255,255,255,.03); border-radius: 6px;
}
.hrv-grid .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-3); }
.hrv-grid .val { font-size: 1.15rem; color: var(--fg); font-variant-numeric: tabular-nums; }
.hrv-grid .val small { font-size: .7rem; color: var(--fg-3); margin-left: .2rem; font-weight: normal; }

.hrv-meta { font-size: .72rem; color: var(--fg-3); margin-top: .6rem; text-align: center; }

.hrv-trend { margin-top: 1rem; padding: .7rem; background: rgba(255,255,255,.03); border-radius: 8px; }
.hrv-trend-title { font-size: .76rem; color: var(--fg-3); margin-bottom: .3rem; }

/* Ortostatismo lado-a-lado */
.hrv-side {
  text-align: center; padding: .8rem .6rem; background: rgba(255,255,255,.04); border-radius: 8px;
}
.hrv-side-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .15em; color: var(--fg-3); margin-bottom: .3rem; }
.hrv-side-num { font-size: 2.4rem; font-weight: 200; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }
.hrv-side-unit { font-size: .72rem; color: var(--fg-3); margin-top: .15rem; }
.hrv-side-meta { font-size: .72rem; color: var(--fg-2); margin-top: .35rem; }

/* ============== FIELD TEST ============== */
.ft-mod-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .5rem;
}
.ft-mod-grid button {
  padding: .85rem .6rem; border: 1.5px solid var(--line); background: transparent;
  color: var(--fg); font-family: inherit; font-size: .9rem; border-radius: 8px;
  cursor: pointer; transition: all .15s;
}
.ft-mod-grid button.sel { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.ft-mod-grid button:hover:not(.sel) { border-color: var(--fg-2); }

.ft-dur-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
}
.ft-dur-grid button {
  padding: .85rem .5rem; border: 1.5px solid var(--line); background: transparent;
  color: var(--fg); font-family: inherit; font-size: 1.1rem; font-weight: 600; border-radius: 8px;
  cursor: pointer; transition: all .15s; line-height: 1.1;
}
.ft-dur-grid button span { display: block; font-size: .68rem; font-weight: 400; color: var(--fg-3); margin-top: .25rem; }
.ft-dur-grid button.sel { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.ft-dur-grid button.sel span { color: var(--bg); opacity: .7; }

.ft-equip-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .55rem;
}
.ft-equip-form label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .72rem; color: var(--fg-3); text-transform: uppercase; letter-spacing: .1em;
}
.ft-equip-form input {
  padding: .55rem .65rem; background: rgba(255,255,255,.05);
  border: 1px solid var(--line); border-radius: 6px; color: var(--fg);
  font-family: inherit; font-size: 1rem; font-variant-numeric: tabular-nums;
}
.ft-equip-form input:focus { outline: none; border-color: var(--fg); }
.ft-equip-empty {
  font-size: .82rem; color: var(--fg-3); padding: .6rem 0; font-style: italic;
}

.ft-history { display: flex; flex-direction: column; gap: .3rem; }
.ft-hist-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: .5rem; align-items: center;
  padding: .5rem .65rem; background: rgba(255,255,255,.03); border-radius: 6px;
  font-size: .8rem;
}
.ft-hist-row .d { color: var(--fg-2); }
.ft-hist-row .m { color: var(--fg-3); }
.ft-hist-row .pk { text-align: right; color: var(--fg); font-variant-numeric: tabular-nums; }
.ft-hist-row .du { text-align: right; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.ft-hist-row .x { background: none; border: none; color: var(--fg-3); cursor: pointer; padding: .15rem .35rem; }
.ft-hist-row .x:hover { color: #f87171; }

/* Recording field test */
.ft-rec-top { text-align: center; margin-bottom: 1rem; }
.ft-rec-modlbl { font-size: .8rem; color: var(--fg-3); margin-bottom: .35rem; }
.ft-rec-time {
  font-size: 4rem; font-weight: 200; line-height: 1; color: var(--fg);
  letter-spacing: -.04em; font-variant-numeric: tabular-nums; margin-bottom: .8rem;
}
.ft-rec-bar-wrap {
  height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden;
  max-width: 480px; margin: 0 auto;
}
.ft-rec-bar { height: 100%; width: 0%; background: var(--fg); transition: width .25s linear; }
.ft-rec-fc {
  text-align: center; padding: .8rem 0;
  display: flex; align-items: baseline; justify-content: center; gap: .4rem;
}
.ft-rec-fc-num {
  font-size: 6rem; font-weight: 200; line-height: 1; color: var(--fg);
  font-variant-numeric: tabular-nums; letter-spacing: -.05em;
}
.ft-rec-fc-unit { font-size: 1rem; color: var(--fg-3); }
.ft-rec-equip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .5rem; margin: 1rem 0;
}
.ft-rec-equip label {
  display: flex; flex-direction: column; gap: .2rem;
  font-size: .68rem; color: var(--fg-3); text-transform: uppercase; letter-spacing: .1em;
  background: rgba(255,255,255,.03); padding: .45rem .6rem; border-radius: 6px;
}
.ft-rec-equip input {
  background: transparent; border: none; color: var(--fg);
  font-family: inherit; font-size: 1.1rem; font-variant-numeric: tabular-nums;
  padding: 0; outline: none;
}
.ft-rec-pse { text-align: center; }
.ft-rec-pse-prompt { font-size: .78rem; color: var(--fg-3); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .1em; }
.ft-rec-pse-prompt.urgent { color: #fbbf24; animation: ftPulse 1.2s ease-in-out infinite; }
@keyframes ftPulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.ft-rec-pse-row {
  display: flex; gap: .35rem; justify-content: center; flex-wrap: wrap;
}
.ft-rec-pse-row button {
  width: 44px; height: 44px; border: 1px solid var(--line); background: transparent;
  color: var(--fg); font-family: inherit; font-size: 1.05rem; font-weight: 600;
  border-radius: 50%; cursor: pointer; transition: all .15s;
}
.ft-rec-pse-row button:hover { border-color: var(--fg-2); }
.ft-rec-pse-row button.flash { background: var(--fg); color: var(--bg); transform: scale(1.1); }

/* Result */
.ft-result-hdr { text-align: center; margin-bottom: 1rem; }
.ft-result-mod { font-size: 1rem; color: var(--fg-2); }
.ft-result-dur { font-size: .82rem; color: var(--fg-3); }
.ft-bignum-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: .55rem; margin: .6rem 0;
}
.ft-bignum {
  background: rgba(255,255,255,.04); padding: .7rem .55rem; border-radius: 8px;
  text-align: center;
}
.ft-bignum .lbl { font-size: .66rem; color: var(--fg-3); text-transform: uppercase; letter-spacing: .12em; }
.ft-bignum .val { font-size: 1.6rem; color: var(--fg); font-weight: 300; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ft-bignum .val small { font-size: .68rem; color: var(--fg-3); }
.ft-pse-timeline { font-size: .8rem; color: var(--fg-2); padding: .5rem 0; }
.ft-pse-timeline .row { display: flex; justify-content: space-between; padding: .2rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.ft-equip-summary { font-size: .82rem; color: var(--fg-2); margin: .5rem 0; }
.ft-fcmax-suggest {
  background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3);
  border-radius: 8px; padding: .65rem .8rem; margin-top: .8rem; font-size: .85rem;
}
.ft-fcmax-suggest button { margin-left: .5rem; padding: .35rem .7rem; font-size: .78rem; }

/* ============== PROTOCOL PICKER ============== */
.proto-list { display: flex; flex-direction: column; gap: .55rem; }
.proto-item {
  display: grid; grid-template-columns: 44px 1fr auto; gap: .8rem; align-items: center;
  padding: .85rem .95rem;
  background: rgba(255,255,255,.03);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--fg);
  transition: border-color .12s, background .12s;
}
.proto-item:active, .proto-item:hover { border-color: var(--fg-2); background: rgba(255,255,255,.05); }
.proto-item.disabled { opacity: .45; cursor: not-allowed; }
.proto-item .ico { font-size: 1.6rem; line-height: 1; text-align: center; }
.proto-item .body strong { display: block; font-size: .98rem; font-weight: 700; margin-bottom: .15rem; }
.proto-item .body em { font-style: normal; font-size: .76rem; color: var(--fg-3); display: block; line-height: 1.4; }
.proto-item .arrow { color: var(--fg-3); font-size: 1.1rem; }

/* ============== LÉGER 20m ============== */
.leger-setup { display: flex; flex-direction: column; gap: .85rem; }
.leger-radio-list { display: flex; flex-direction: column; gap: .5rem; }
.leger-radio {
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.leger-radio:has(input:checked) { border-color: var(--fg); background: rgba(255,255,255,.06); }
.leger-radio input { accent-color: var(--fg); margin-top: .2rem; }
.leger-radio div { flex: 1; }
.leger-radio strong { display: block; font-size: .92rem; color: var(--fg); margin-bottom: .12rem; }
.leger-radio span { font-size: .76rem; color: var(--fg-3); }

.leger-rec {
  display: flex; flex-direction: column; gap: .8rem;
  text-align: center; padding: .4rem 0;
}
.leger-stage-row {
  display: flex; align-items: baseline; justify-content: center; gap: .8rem;
  font-variant-numeric: tabular-nums;
}
.leger-stage-num {
  font-size: 3.4rem; font-weight: 200; line-height: 1; color: var(--fg);
  letter-spacing: -.04em;
}
.leger-stage-vel {
  font-size: 1.1rem; color: var(--fg-2); font-weight: 600;
}
.leger-stage-bar-wrap {
  height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden;
  max-width: 460px; margin: .15rem auto 0;
}
.leger-stage-bar { height: 100%; width: 0%; background: var(--fg); transition: width .25s linear; }
.leger-fc-row {
  display: flex; align-items: baseline; justify-content: center; gap: .35rem;
  margin-top: .2rem;
}
.leger-fc-num {
  font-size: 5.5rem; font-weight: 200; line-height: 1; color: var(--fg);
  font-variant-numeric: tabular-nums; letter-spacing: -.04em;
}
.leger-fc-unit { font-size: .9rem; color: var(--fg-3); }
.leger-counts {
  display: flex; justify-content: center; gap: 1.4rem;
  font-size: .8rem; color: var(--fg-3); text-transform: uppercase; letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
}
.leger-counts strong { color: var(--fg); font-size: 1rem; font-weight: 700; }

.leger-talk-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .35rem; margin-top: .6rem;
}
.leger-talk-row button {
  padding: .55rem .35rem; border: 1.5px solid var(--line);
  background: transparent; color: var(--fg); border-radius: 8px;
  font-family: inherit; font-size: .82rem; font-weight: 600;
}
.leger-talk-row button .em { display: block; font-size: .65rem; color: var(--fg-3); margin-top: .1rem; font-weight: 400; }
.leger-talk-row button[data-tt="nasal"].active   { background: rgba(34,197,94,.18); border-color: #22c55e; color: #fff; }
.leger-talk-row button[data-tt="boca"].active    { background: rgba(234,179,8,.18); border-color: #eab308; color: #fff; }
.leger-talk-row button[data-tt="ofegante"].active{ background: rgba(220,38,38,.18); border-color: #dc2626; color: #fff; }

.leger-pse-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; margin-top: .35rem; }
.leger-pse-row button {
  padding: .65rem .25rem; border: 1.5px solid var(--line);
  background: transparent; color: var(--fg); border-radius: 8px;
  font-family: inherit; font-size: 1.1rem; font-weight: 700;
}
.leger-pse-row button[data-pse="4"], .leger-pse-row button[data-pse="5"] {
  font-size: 1.35rem;
  border-width: 2px;
}
.leger-pse-row button[data-pse="4"] { border-color: #eab308; }
.leger-pse-row button[data-pse="5"] { border-color: #dc2626; }
.leger-pse-row button.flash { background: var(--fg); color: var(--bg); transform: scale(1.06); }

.leger-fail-btn {
  margin-top: .8rem;
  width: 100%;
  padding: 1.05rem .5rem;
  border-radius: 12px;
  background: rgba(220,38,38,.12);
  border: 2px solid #dc2626;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  font-family: inherit;
}
.leger-fail-btn:active { background: rgba(220,38,38,.26); }

.leger-hint {
  font-size: .76rem; color: var(--fg-3); margin-top: .15rem;
}

/* Result Léger */
.leger-vo2 {
  text-align: center;
  padding: 1rem 0 .6rem;
}
.leger-vo2-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .15em; color: var(--fg-3); }
.leger-vo2-val { font-size: 4.2rem; font-weight: 200; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }
.leger-vo2-unit { font-size: .82rem; color: var(--fg-3); margin-top: .2rem; }
.leger-vo2-class {
  font-size: .9rem; color: var(--fg);
  padding: .55rem .85rem; border: 1px dashed var(--line); border-radius: 8px;
  margin: .6rem 0; text-align: center;
}

/* Multi-fórmula VO2máx — card transparente com principal + chevron */
.vo2-multi { padding: .8rem 0 .6rem; }
.vo2-principal { text-align: center; padding: .4rem 0 .6rem; }
.vo2-principal-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .15em; color: var(--fg-3); }
.vo2-principal-lbl .vo2-method { color: var(--fg-2); }
.vo2-principal-val {
  font-size: 4.2rem; font-weight: 200; line-height: 1;
  color: var(--fg); font-variant-numeric: tabular-nums;
  margin: .15rem 0;
}
.vo2-principal-unit { font-size: .82rem; color: var(--fg-3); }
.vo2-range {
  font-size: .76rem; color: var(--fg-3); margin-top: .35rem;
  font-style: italic;
}
.vo2-empty {
  padding: .8rem; border: 1px dashed var(--line); border-radius: 8px;
  font-size: .9rem; color: var(--fg-2); text-align: center;
}
.vo2-all {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0; margin-top: .6rem; background: rgba(255,255,255,.02);
}
.vo2-all > summary {
  padding: .65rem .85rem;
  font-size: .82rem; font-weight: 600;
  color: var(--fg-2); cursor: pointer;
  list-style: none;
  user-select: none;
}
.vo2-all > summary::-webkit-details-marker { display: none; }
.vo2-all[open] > summary { color: var(--fg); border-bottom: 1px solid var(--line); }
.vo2-all-list {
  padding: .6rem .85rem;
  display: flex; flex-direction: column; gap: .65rem;
}
.vo2-formula {
  padding: .5rem .65rem;
  border-left: 2px solid var(--line);
  background: transparent;
}
.vo2-formula.is-principal {
  border-left-color: #a8d8ff;
  background: rgba(168,216,255,.04);
}
.vo2-formula-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: .5rem;
}
.vo2-formula-name { font-size: .88rem; font-weight: 600; color: var(--fg); }
.vo2-formula.is-principal .vo2-formula-name { color: #a8d8ff; }
.vo2-formula-val {
  font-size: 1.3rem; font-weight: 700; color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.vo2-formula-form {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: .75rem; color: var(--fg-3);
  margin-top: .25rem; word-break: break-word;
}
.vo2-formula-req { font-size: .72rem; color: var(--fg-3); margin-top: .2rem; }
.vo2-formula-ref { font-size: .7rem; color: var(--fg-3); font-style: italic; margin-top: .2rem; }
.vo2-formula-note {
  font-size: .76rem; color: #ffd479; margin-top: .3rem;
  padding: .25rem .4rem; background: rgba(255,212,121,.06); border-radius: 4px;
}
.vo2-warn {
  font-size: .75rem; color: var(--fg-3);
  padding: .55rem .85rem .65rem; margin: 0;
  border-top: 1px solid var(--line);
}

/* CSV export button */
.btn-csv {
  background: transparent; color: var(--fg-2);
  border: 1px solid var(--line); border-radius: 8px;
  padding: .55rem .9rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.btn-csv:hover { color: var(--fg); border-color: var(--fg-2); }

/* ============== PWA / FULLSCREEN OPTIMIZATIONS ============== */
@media (display-mode: standalone), (display-mode: fullscreen) {
  body { overscroll-behavior: none; }
}

/* Estado "rodando" é aplicado no body pra esconder elementos opcionais */
body.recording-on .icon-btn[data-hide-rec="1"] { display: none; }

/* Telas estreitas: ajusta header pra caber */
@media (max-width: 380px) {
  .top { padding: max(env(safe-area-inset-top), .3rem) .4rem .3rem; gap: .3rem; }
  .top-r { gap: .3rem; }
  .brand-mk { font-size: .72rem; letter-spacing: .06em; margin-right: .35rem; }
  .icon-btn { width: 32px; height: 32px; font-size: .95rem; }
  .clock { font-size: .92rem; }
  .badge { font-size: .62rem; padding: .12rem .42rem; }
}

/* Reduz altura do header pra liberar tela em PWA */
@media (display-mode: standalone) {
  .top { padding-top: max(env(safe-area-inset-top), .25rem); padding-bottom: .25rem; }
  .screen { height: calc(100dvh - 46px); }
}

@media (max-width: 1023px), (hover: none) and (pointer: coarse) {
  .screen {
    grid-template-rows: auto auto auto auto auto;
  }
  .fc-display {
    min-height: clamp(240px, 42vh, 420px);
  }
}

/* Esconde scrollbar tosco em iOS Bluefy */
::-webkit-scrollbar { width: 0; height: 0; }

/* ============== CADÊNCIA — tabela preview ============== */
.cad-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .35rem;
}
.cad-table-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: .42rem .6rem;
  background: rgba(255,255,255,.04);
  border-radius: 6px;
  font-size: .82rem; color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.cad-table-row strong { color: var(--fg); font-size: .92rem; }

/* ============== GPS MARKER 20m ============== */
.gpsmark-acc-row {
  display:flex;justify-content:space-between;align-items:center;
  font-size:.85rem;color:var(--fg-2);
  padding:.4rem .6rem;background:rgba(255,255,255,.03);
  border-radius:6px;margin-bottom:.6rem;
}
.gpsmark-acc { font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:.02em; }
.gpsmark-acc.good { color:#4ade80; }
.gpsmark-acc.ok   { color:#fbbf24; }
.gpsmark-acc.bad  { color:#f87171; }
.gpsmark-status {
  font-size:1rem;color:var(--fg);text-align:center;
  margin:.8rem 0 .6rem;min-height:1.4em;line-height:1.3;
}
.gpsmark-status.go { color:#4ade80;font-weight:600; }
.gpsmark-status.done { color:#22d3ee;font-weight:700; }
.gpsmark-big {
  display:flex;align-items:baseline;justify-content:center;
  gap:.4rem;margin:.8rem 0 1rem;
}
.gpsmark-dist {
  font-size:4.2rem;font-weight:800;font-variant-numeric:tabular-nums;
  line-height:1;color:var(--fg);letter-spacing:-.02em;
}
.gpsmark-unit { color:var(--fg-2);font-size:1rem;font-weight:600; }
.gpsmark-bar-wrap {
  height:10px;background:rgba(255,255,255,.06);
  border-radius:5px;overflow:hidden;
}
.gpsmark-bar {
  height:100%;width:0%;
  background:linear-gradient(90deg,#22d3ee 0%,#4ade80 100%);
  transition:width .3s ease;
}

/* ============== UPDATE NUDGE — fita amarela direita→esquerda ============== */
.update-nudge {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 9999;
  pointer-events: none;
}
.update-nudge.show {
  animation: nudgeSlide 3.5s cubic-bezier(.22,.61,.36,1) forwards;
}
.update-nudge-inner {
  background: linear-gradient(90deg, #fbbf24 0%, #fcd34d 50%, #fbbf24 100%);
  color: #0a0a0a;
  padding: 14px 28px 14px 22px;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .3px;
  border-radius: 999px 0 0 999px;
  box-shadow: -4px 4px 24px rgba(251, 191, 36, .35), 0 0 0 1px rgba(0,0,0,.15) inset;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}
.update-nudge-icon {
  font-size: 1.15rem;
  display: inline-block;
  animation: nudgePulse 1.2s ease-in-out infinite;
}
.update-nudge-text strong {
  font-weight: 800;
}
@keyframes nudgeSlide {
  0%   { transform: translateY(-50%) translateX(100%); opacity: 0; }
  10%  { transform: translateY(-50%) translateX(0);    opacity: 1; }
  85%  { transform: translateY(-50%) translateX(0);    opacity: 1; }
  100% { transform: translateY(-50%) translateX(100%); opacity: 0; }
}
@keyframes nudgePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}
@media (prefers-reduced-motion: reduce) {
  .update-nudge.show { animation: nudgeFade 3.5s linear forwards; }
  .update-nudge-icon { animation: none; }
  @keyframes nudgeFade { 0%,100%{opacity:0} 10%,85%{opacity:1} }
}

/* ============== ONBOARDING ============== */
.onb {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  overflow-y: auto;
  padding: 32px 20px 100px;
  -webkit-overflow-scrolling: touch;
}
.onb.hidden { display: none; }
.onb-step {
  max-width: 520px;
  margin: 0 auto;
  padding-top: 16px;
  animation: onbFadeUp .35s ease;
}
.onb-step.hidden { display: none; }
@keyframes onbFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.onb-step h2 {
  font-size: 1.6rem; font-weight: 800;
  margin-bottom: .5rem;
  letter-spacing: -.01em;
  color: var(--fg);
}
.onb-lead {
  color: var(--fg-2);
  font-size: .95rem;
  line-height: 1.55;
  margin-bottom: 1.4rem;
}
.onb-art {
  position: relative;
  width: 140px; height: 140px;
  margin: 12px auto 24px;
}
.onb-art-circle {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  opacity: .95;
  animation: onbPulseLogo 2.2s ease infinite;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(251, 191, 36, .25);
}
.onb-art-logo {
  display: flex; flex-direction: column; align-items: center;
  color: #1a0a00;
  line-height: .9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  letter-spacing: -.04em;
  text-align: center;
}
.onb-art-hr {
  position: relative;
  font-size: 3.6rem;
  font-weight: 900;
  display: inline-block;
}
.onb-art-mk {
  position: absolute;
  top: -.05em;
  right: -1.2em;
  font-size: .17em;
  font-weight: 800;
  opacity: .82;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
}
.onb-art-mk sup {
  font-size: .65em;
  vertical-align: super;
  opacity: .75;
  margin-left: 1px;
}
.onb-art-core {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: .15rem;
  letter-spacing: .12em;
  text-transform: lowercase;
  opacity: .92;
}
.onb-art-pulse {
  position: absolute; inset: -16px;
  border: 2px solid #fbbf24;
  border-radius: 50%;
  opacity: .3;
  animation: onbRing 2.2s ease infinite;
}
@keyframes onbPulseLogo {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.06); }
}
@keyframes onbRing {
  0%   { transform: scale(.85); opacity: .5; }
  100% { transform: scale(1.15); opacity: 0; }
}
.onb-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1rem;
}
.onb-feat-grid { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.6rem; }
.onb-feat {
  display: flex; align-items: center; gap: .9rem;
  padding: .8rem 1rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.onb-feat span:first-child { font-size: 1.5rem; }
.onb-feat strong { display: block; font-size: .92rem; color: var(--fg); }
.onb-feat small { display: block; color: var(--fg-3); font-size: .78rem; margin-top: 2px; }

.onb-terms { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.2rem; }
.onb-term {
  background: rgba(255,255,255,.02);
  border-left: 3px solid #fbbf24;
  padding: .7rem .85rem;
  border-radius: 4px;
  font-size: .85rem;
  line-height: 1.55;
  color: var(--fg-2);
}
.onb-term strong { color: var(--fg); }

.onb-checkbox {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 1rem;
  cursor: pointer;
  font-size: .9rem;
  color: var(--fg);
}
.onb-checkbox input { width: 18px; height: 18px; accent-color: #fbbf24; }

.onb-form { display: flex; flex-direction: column; gap: .85rem; }
.onb-input-row { display: flex; gap: .7rem; }
.onb-input-row .onb-input-group { flex: 1; }
.onb-input-group { display: flex; flex-direction: column; gap: .3rem; }
.onb-input-group label { font-size: .78rem; color: var(--fg-2); font-weight: 600; }
.onb-input-group label small { color: var(--fg-3); font-weight: 400; margin-left: .3rem; }
.onb-input-group input,
.onb-input-group select {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: .7rem .85rem;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}
.onb-input-group input:focus,
.onb-input-group select:focus { outline: none; border-color: #fbbf24; }
.onb-hint { font-size: .75rem; color: var(--fg-3); margin-top: .2rem; }

.onb-actions { display: flex; flex-direction: column; gap: .55rem; margin-top: 1rem; }

.btn-onb {
  display: block;
  width: 100%;
  padding: .9rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-size: .95rem; font-weight: 700;
  cursor: pointer;
  transition: transform .12s, opacity .12s, box-shadow .15s;
  font-family: inherit;
  margin-top: .8rem;
}
.btn-onb:active { transform: scale(.98); }
.btn-onb:disabled { opacity: .35; cursor: not-allowed; }
.btn-onb-primary {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #0a0a0a;
}
.btn-onb-primary:not(:disabled):hover { box-shadow: 0 0 24px rgba(251,191,36,.3); }
.btn-onb-ghost {
  background: rgba(255,255,255,.04);
  color: var(--fg);
  border: 1px solid var(--line);
}

.onb-progress {
  position: fixed; bottom: 24px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px;
  pointer-events: none;
}
.onb-progress .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  transition: all .25s;
}
.onb-progress .dot.active { width: 24px; background: #fbbf24; border-radius: 4px; }
.onb-progress .dot.done { background: rgba(251,191,36,.5); }

/* PAR-Q questions */
.onb-parq { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.parq-q {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .9rem;
}
.parq-q-text {
  font-size: .85rem;
  line-height: 1.5;
  color: var(--fg);
  margin-bottom: .6rem;
}
.parq-q-actions { display: flex; gap: .5rem; }
.parq-btn {
  flex: 1;
  padding: .55rem;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--fg-2);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}
.parq-btn.no.selected  { background: rgba(74,222,128,.15); color: #4ade80; border-color: #4ade80; }
.parq-btn.yes.selected { background: rgba(251,146,60,.15); color: #fb923c; border-color: #fb923c; }

/* ============== BTN-DEL (excluir item de histórico) ============== */
/* Visualmente distinto do .x (fechar modal) — emoji 🗑️ + cor vermelha */
.btn-del {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .4rem;
  opacity: .55;
  transition: opacity .15s, background .15s, border-color .15s;
}
.btn-del:hover, .btn-del:focus {
  opacity: 1;
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .35);
}
.btn-del:active { background: rgba(239, 68, 68, .25); }

/* ============== DESKTOP RESPONSIVO ============== */
/* App nasceu mobile-first. Em desktop largo, evita esticar a UI infinitamente. */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  body {
    background: #0a0a0a;
  }
  /* Desktop ocupa a largura útil inteira */
  header.top,
  .screen-home,
  .screen,
  #screen-monitor,
  #screen-summary {
    width: 100%;
    max-width: none;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  /* Modal já tem max-width próprio mas garante centralização */
  .modal-back .modal {
    max-width: 760px;
  }
  /* Drawer não estica — é uma sidebar */
  .drawer {
    max-width: 360px;
  }
  /* Cards home ganham mais respiro lateral */
  .home-cards {
    max-width: 960px;
    margin: 0 auto;
  }
  /* Onboarding já tem max-width 520px no .onb-step */
}

@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  /* Tela bem larga — adiciona um leve gradient pras bordas não ficarem vazio absoluto */
  body {
    background: radial-gradient(ellipse at top, #111 0%, #000 70%);
  }
}

/* ============== PROTO HELP — briefing collapsible em setup de protocolo ============== */
.proto-help {
  margin: .8rem 0 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 191, 36, .04);
  overflow: hidden;
}
.proto-help summary {
  padding: .7rem .9rem;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  color: #fbbf24;
  list-style: none;
  user-select: none;
  display: flex; align-items: center; justify-content: space-between;
}
.proto-help summary::-webkit-details-marker { display: none; }
.proto-help summary::after {
  content: '▾';
  font-size: .85rem;
  transition: transform .2s;
}
.proto-help[open] summary::after { transform: rotate(180deg); }
.proto-help summary:hover { background: rgba(251, 191, 36, .08); }
.proto-steps {
  padding: .4rem .9rem 1rem;
  display: flex; flex-direction: column; gap: .55rem;
  border-top: 1px solid rgba(251, 191, 36, .15);
}
.proto-step {
  display: flex; gap: .7rem; align-items: flex-start;
  font-size: .85rem; line-height: 1.5;
  color: var(--fg-2);
}
.proto-step .n {
  flex: 0 0 24px; height: 24px;
  background: #fbbf24; color: #0a0a0a;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .78rem;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}
.proto-step strong { color: var(--fg); font-weight: 700; }

/* ============== EX-MET HIIT 4x1 ============== */
.extmet-targets {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .6rem;
  font-size: .82rem;
}
.extmet-target-cell {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem .7rem;
  text-align: center;
}
.extmet-target-cell .lbl {
  font-size: .65rem;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 3px;
}
.extmet-target-cell .pct {
  font-size: .7rem;
  color: var(--fg-2);
}
.extmet-target-cell .bpm {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.extmet-target-cell.warmup .bpm,
.extmet-target-cell.cooldown .bpm { color: #4ade80; }
.extmet-target-cell.hiit .bpm { color: #fbbf24; }

.extmet-phase-banner {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: .2rem;
  color: var(--fg);
  text-transform: uppercase;
}
body.extmet-warmup .extmet-phase-banner,
body.extmet-cooldown .extmet-phase-banner { color: #4ade80; }
body.extmet-hiit .extmet-phase-banner { color: #fbbf24; }
.extmet-phase-target {
  text-align: center;
  font-size: .82rem;
  color: var(--fg-2);
  margin-bottom: .8rem;
}

.extmet-time {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .3rem;
  margin-bottom: .4rem;
}
.extmet-elapsed {
  font-size: 2.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  letter-spacing: -.02em;
}
.extmet-remaining { font-size: 1rem; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.extmet-progress-wrap {
  height: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.extmet-progress {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #fbbf24);
  transition: width .3s linear;
}
body.extmet-hiit .extmet-progress { background: linear-gradient(90deg, #fbbf24, #f87171); }

.extmet-fc {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .4rem;
  margin: .8rem 0 .4rem;
}
.extmet-fc-num {
  font-size: 4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  letter-spacing: -.04em;
  line-height: 1;
}
.extmet-fc-unit { color: var(--fg-2); font-size: 1rem; font-weight: 600; }
.extmet-fc-pct {
  font-size: .85rem;
  color: var(--fg-3);
  margin-left: .4rem;
  font-variant-numeric: tabular-nums;
}

.extmet-zone-state {
  text-align: center;
  font-size: .92rem;
  font-weight: 600;
  padding: .6rem;
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  color: var(--fg-2);
  margin-bottom: .8rem;
  min-height: 1.4em;
}
.extmet-zone-state.in-zone { background: rgba(74,222,128,.14); color: #4ade80; }
.extmet-zone-state.below { background: rgba(99,102,241,.14); color: #818cf8; }
.extmet-zone-state.above { background: rgba(248,113,113,.14); color: #f87171; }

.extmet-bouts {
  display: flex;
  justify-content: space-between;
  gap: .4rem;
  margin: .8rem 0;
}
.extmet-bouts .bout {
  flex: 1;
  text-align: center;
  padding: .55rem .3rem;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.extmet-bouts .bout.active {
  background: rgba(251,191,36,.2);
  border-color: #fbbf24;
  color: #fbbf24;
  animation: extmetBoutPulse 1s ease-in-out infinite;
}
.extmet-bouts .bout.done {
  background: rgba(74,222,128,.14);
  border-color: rgba(74,222,128,.4);
  color: #4ade80;
}
@keyframes extmetBoutPulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.04); }
}

/* ============== RAMPA INDIVIDUALIZADA ============== */
.rampa-estimate {
  display: flex; align-items: baseline; justify-content: center; gap: .4rem;
  padding: .4rem 0;
}
.rampa-estimate .v {
  font-size: 2.4rem; font-weight: 800; color: var(--fg);
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.rampa-estimate .unit { color: var(--fg-2); font-size: .9rem; }
.rampa-estimate .mets {
  margin-left: .8rem; padding: .2rem .55rem; border-radius: 5px;
  background: rgba(74,222,128,.12); color: #4ade80;
  font-size: .82rem; font-weight: 700;
}

.rampa-preview {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
  font-size: .85rem;
}
.rampa-preview-row {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem .75rem;
}
.rampa-preview-row .lbl {
  font-size: .65rem; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.rampa-preview-row .v { font-size: 1rem; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
.rampa-preview-row.span2 { grid-column: 1 / -1; }

.rampa-instr {
  background: linear-gradient(135deg, rgba(251,191,36,.15), rgba(251,191,36,.06));
  border: 2px solid #fbbf24;
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0 .8rem;
  text-align: center;
  box-shadow: 0 0 24px rgba(251,191,36,.18);
}
.rampa-instr-label {
  font-size: .72rem;
  color: #fbbf24;
  font-weight: 800;
  letter-spacing: .14em;
  margin-bottom: .55rem;
}
.rampa-instr-vals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}
.rampa-instr-cell {
  display: flex; flex-direction: column; align-items: center;
}
.rampa-instr-cell .lbl {
  font-size: .65rem; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 4px;
}
.rampa-instr-cell .val {
  font-size: 2.4rem; font-weight: 800; color: var(--fg);
  font-variant-numeric: tabular-nums; letter-spacing: -.04em;
  line-height: 1;
}
.rampa-instr-cell .unit { font-size: .8rem; color: var(--fg-2); margin-top: 2px; }

.rampa-instr.changing {
  animation: rampaInstrFlash .8s ease;
}
@keyframes rampaInstrFlash {
  0%   { background: linear-gradient(135deg, rgba(251,191,36,.4), rgba(251,191,36,.2)); transform: scale(1.02); }
  100% { background: linear-gradient(135deg, rgba(251,191,36,.15), rgba(251,191,36,.06)); transform: scale(1); }
}

.rampa-next {
  text-align: center;
  font-size: .82rem;
  color: var(--fg-3);
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem;
  margin-top: .6rem;
  font-variant-numeric: tabular-nums;
}
.rampa-next strong { color: var(--fg); }

.rampa-hrr-info {
  text-align: center;
  margin-top: .8rem;
  padding: .6rem;
  background: rgba(34,211,238,.08);
  border: 1px solid rgba(34,211,238,.3);
  border-radius: 6px;
  color: #22d3ee;
  font-size: .9rem;
}
