/* Nunito (SIL Open Font License, ver fonts/OFL.txt) — embutida, funciona offline */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("fonts/nunito-latin-wght-normal.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: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("fonts/nunito-latin-ext-wght-normal.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; }

/* Sem Trava — paleta: laranja papoula #FF4001 · azul marinho real #0A0F46 · branco #FFFFFF */
:root {
  /* nomes antigos mantidos: --black = marinho, --purple/--lime = laranja */
  --black: #0a0f46;
  --navy-2: #161d63;
  --purple: #ff4001;
  --purple-2: #ff7a3d;
  --purple-soft: #ffe1d4;
  --white: #ffffff;
  --lime: #ff4001;
  --tile: #f2f3f8;
  --text: #0a0f46;
  --muted: #6b6f93;
  --line: #e4e6f0;
  --danger: #e5484d;
  --nav-h: 84px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--black); color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.view { position: fixed; inset: 0; display: none; flex-direction: column; overflow-y: auto;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px); }
.view.active { display: flex; }
.view > *, .sheet > * { flex-shrink: 0; }
.view.light { background: var(--white); }

/* ---------- cabeçalho escuro ---------- */
.dark-head { display: flex; align-items: center; justify-content: space-between; color: var(--white);
  padding: calc(14px + var(--safe-t)) 18px 12px; }
.hello { display: flex; align-items: center; gap: 12px; }
.hello b { display: block; font-size: 18px; }
.hello small { color: #a9acd0; font-size: 13px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--purple); color: var(--white);
  display: grid; place-items: center; font-weight: 800; font-size: 16px; border: 3px solid var(--navy-2); }
.square-btn { width: 46px; height: 46px; border-radius: 14px; background: var(--navy-2); color: var(--white);
  display: grid; place-items: center; font-size: 20px; flex: none; }
.square-btn.light { background: var(--tile); color: var(--text); }
span.square-btn.light { background: none; }

.week-strip { display: flex; gap: 4px; margin: 2px 14px 14px; padding: 6px; background: var(--navy-2); border-radius: 18px; }
.week-strip button { flex: 1; padding: 8px 0 7px; border-radius: 13px; color: #c8cae6; display: flex; flex-direction: column;
  align-items: center; gap: 1px; position: relative; }
.week-strip b { font-size: 17px; font-weight: 700; }
.week-strip small { font-size: 10px; letter-spacing: .5px; }
.week-strip .today { background: var(--white); color: var(--black); }
.week-strip .today b { font-weight: 800; }
.week-strip .has::after { content: ""; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.week-strip .today.has::after { background: var(--purple); }

/* ---------- folha branca ---------- */
.sheet { background: var(--white); border-radius: 30px 30px 0 0; padding: 14px 14px 10px; flex: 1;
  display: flex; flex-direction: column; gap: 8px; }

.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 16px 18px 12px; color: var(--white);
  background: radial-gradient(circle at 92% 18%, rgba(255,255,255,.16) 0 70px, transparent 71px),
              radial-gradient(circle at 78% 120%, rgba(10,15,70,.16) 0 90px, transparent 91px),
              linear-gradient(135deg, var(--purple), var(--purple-2)); }
.hero-top { display: flex; justify-content: space-between; align-items: center; font-size: 15px; opacity: .95; }
.hero-value { display: flex; align-items: baseline; gap: 6px; line-height: 1; margin-top: 6px; }
.hero-value span { font-size: 76px; font-weight: 800; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.hero-value small { font-size: 24px; font-weight: 800; color: var(--black); }
.hero.compact { margin: 10px 14px 0; }
.hero.compact .hero-value span { font-size: 60px; }
.hero-time { font-weight: 700; font-variant-numeric: tabular-nums; }

.gps-badge { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(10,15,70,.3); }
.gps-badge.ok { background: var(--white); color: var(--black); font-weight: 700; }
.gps-badge.bad { background: #ffd34d; color: var(--black); font-weight: 700; }

.tiles { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
#view-detail .tiles { padding: 8px 14px 0; }
.tile { background: var(--tile); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile span { font-size: 12px; color: var(--muted); }
.tile b { font-size: 21px; font-weight: 800; letter-spacing: -.3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.wide { grid-column: span 2; }
.tile.wide b { font-size: 16px; text-transform: capitalize; }

/* ---------- mapa ---------- */
.map-card { position: relative; border-radius: 22px; overflow: hidden; height: 25vh; min-height: 170px; flex: none; background: #eef0f6; }
.map-card.tall { height: 44vh; margin: 0 14px; }
.map { position: absolute; inset: 0; }
.leaflet-tile-pane { filter: grayscale(.85) brightness(1.05) contrast(.92); }
.leaflet-control-attribution { font-size: 9px; background: rgba(255,255,255,.7) !important; }
.map-tag { position: absolute; left: 12px; top: 12px; z-index: 500; background: rgba(10,15,70,.88); color: var(--white);
  padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.map-tag:empty { display: none; }
.map-recenter { position: absolute; right: 10px; bottom: 22px; z-index: 500; width: 38px; height: 38px; border-radius: 12px;
  background: var(--white); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(10,15,70,.15); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--black); border: 4px solid var(--lime);
  box-shadow: 0 0 0 6px rgba(255,64,1,.25); }

/* ---------- chips / botões ---------- */
.chips { display: flex; gap: 6px; }
.chips.scroll { overflow-x: auto; padding: 0 16px 12px; scrollbar-width: none; flex: none; }
.chips button { padding: 9px 16px; border-radius: 14px; background: var(--tile); color: #3d4170; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chips button.active { background: var(--purple); color: var(--white); }
.chips.locked button:not(.active) { display: none; }
#type-picker { justify-content: center; }

.controls { display: flex; gap: 10px; }
.btn { flex: 1; padding: 15px 18px; border-radius: 18px; font-weight: 800; font-size: 15px; letter-spacing: .4px; text-align: center; }
.btn.big { padding: 19px; font-size: 18px; letter-spacing: 1px; }
.btn.lime { background: var(--purple); color: var(--white); }
.btn.black { background: var(--black); color: var(--white); }
.btn.purple { background: var(--black); color: var(--white); }
.btn.ghost { background: var(--tile); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; }

/* ---------- meta semanal ---------- */
.goal { margin-top: 4px; }
.goal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.goal-head b { font-size: 17px; }
.tip { background: var(--black); color: var(--white); font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 8px; position: relative; }
.tip::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 8px; height: 8px; background: var(--black); transform: translateX(-50%) rotate(45deg); }
.goal-bar { height: 40px; border-radius: 14px; background: var(--purple-soft); overflow: hidden; }
.goal-fill { height: 100%; min-width: 54px; border-radius: 14px; background: var(--purple); color: var(--white); font-weight: 700;
  display: grid; place-items: center; font-size: 14px; transition: width .6s ease; }
.goal-fill.done { background: var(--black); color: var(--white); }



/* ---------- telas claras ---------- */
.light-head { display: flex; align-items: center; justify-content: space-between; padding: calc(12px + var(--safe-t)) 16px 12px; }
.light-head h1 { margin: 0; font-size: 20px; font-weight: 800; }
.card { background: var(--tile); border-radius: 20px; margin: 0 16px 12px; padding: 16px; }
.week-nav { display: flex; align-items: center; justify-content: space-between; }
.week-nav h2 { margin: 0; font-size: 20px; font-weight: 800; }
.week-nav button { width: 34px; height: 34px; border-radius: 10px; background: var(--white); font-size: 22px; line-height: 1; }
.week-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 14px; }
.week-summary div { padding: 0 8px; border-left: 1px solid #dadcea; }
.week-summary div:first-child { border-left: 0; padding-left: 0; }
.week-summary span { display: block; font-size: 12px; color: var(--muted); }
.week-summary b { font-size: 17px; font-weight: 700; white-space: nowrap; }

.chart-card { position: relative; padding: 30px 12px 12px; }
.chart-unit { position: absolute; left: 14px; top: 10px; font-weight: 700; font-size: 12px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 210px; padding-left: 4px;
  background: repeating-linear-gradient(to top, transparent 0 41px, #e2e4ef 41px 42px); }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar { position: relative; width: 100%; border-radius: 12px 12px 6px 6px; background: #ffc8b3; min-height: 6px; transition: height .5s ease; cursor: pointer; }
.bar-col.sel .bar { background: var(--purple); }
.bar-col.today .day { color: var(--purple); font-weight: 800; }
.bar-col .day { font-size: 11px; color: var(--muted); margin-top: 6px; }
.bar .tip { position: absolute; top: -36px; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 2; }

.rows { list-style: none; margin: 0; padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--tile); cursor: pointer; }
.rows li:first-child { background: var(--purple); color: var(--white); }
.rows li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--purple); flex: none; }
.rows li:first-child::before { background: var(--white); }
.rows .r-main { flex: 1; min-width: 0; }
.rows .r-main small { display: block; opacity: .7; font-size: 12px; }
.rows .r-km { font-weight: 800; font-variant-numeric: tabular-nums; }
.rows .empty { background: none !important; color: var(--muted) !important; justify-content: center; cursor: default; }
.rows .empty::before { display: none; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form input { padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--white); color: var(--text); font-size: 16px; }
.form input:focus { outline: 2px solid var(--purple); border-color: transparent; }
.file-btn { color: var(--text) !important; font-size: 15px !important; background: var(--white) !important; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.totals b { display: block; font-size: 20px; }
.totals span { font-size: 11px; color: var(--muted); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 14px 0; }
.actions .btn { padding: 13px; font-size: 14px; }
.gif-out { padding: 14px; text-align: center; }
.gif-out img { max-width: 100%; border-radius: 18px; }
.gif-out .row { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- navegação em pílula ---------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; padding: 10px 14px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--white) 70%, rgba(255,255,255,0)); }
.nav-pill { display: flex; padding: 6px; border-radius: 26px; background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(10,15,70,.08); }
.nav-pill button { flex: 1; padding: 14px 6px; border-radius: 20px; font-weight: 700; font-size: 15px; color: #2d3263; }
.nav-pill button.active { background: var(--black); color: var(--lime); }
.bottom-nav.locked button:not(.active) { opacity: .3; pointer-events: none; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--black); color: var(--white); padding: 11px 16px; border-radius: 14px; opacity: 0; transition: .25s; z-index: 2000;
  pointer-events: none; max-width: 90vw; text-align: center; font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; z-index: 3000; background: var(--black); color: var(--white); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 32px 28px calc(32px + var(--safe-b)); }
.login-art { width: 132px; height: 132px; border-radius: 40px; background: var(--navy-2); display: grid; place-items: center; margin-bottom: 22px;
  box-shadow: 0 0 0 10px rgba(255,64,1,.22); }
.login-art img { border-radius: 26px; }
.login h1 { margin: 0; font-size: 40px; font-weight: 900; letter-spacing: -1px; }
.login p { margin: 10px 0 34px; color: #b4b7da; font-size: 17px; line-height: 1.45; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; max-width: 340px; padding: 17px;
  border-radius: 18px; background: var(--white); color: var(--black); font-weight: 800; font-size: 17px; }
.google-btn:active { transform: scale(.98); }
.google-btn:disabled { opacity: .6; }
.login-note { margin-top: 22px; color: #7f83b0; font-size: 12px; line-height: 1.5; }
body.locked .view, body.locked .bottom-nav { visibility: hidden; }

.account { display: flex; align-items: center; gap: 12px; }
.account img { width: 52px; height: 52px; border-radius: 50%; background: var(--purple-soft); object-fit: cover; flex: none; }
.acc-main { flex: 1; min-width: 0; }
.acc-main b { display: block; font-size: 17px; }
.acc-main small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.acc-main .sync { color: var(--purple); font-weight: 700; margin-top: 2px; }
.account .btn { flex: none; padding: 10px 14px; font-size: 14px; background: var(--white); }
.avatar.photo { background-size: cover; background-position: center; color: transparent; }

/* ---------- tela de treino (sem mapa) + botões presos embaixo ---------- */
:root { --dock-h: 142px; }
#view-record { padding-bottom: calc(var(--nav-h) + var(--dock-h) + var(--safe-b)); }
#view-record .sheet { gap: 10px; }

.gps-line { display: flex; align-items: center; gap: 8px; align-self: center; padding: 7px 14px; border-radius: 99px;
  background: var(--tile); color: var(--muted); font-size: 13px; font-weight: 700; }
.gps-dot { width: 9px; height: 9px; border-radius: 50%; background: #b9bcd6; flex: none; }
.gps-line.ok { color: #0f7a3d; background: #e3f6ea; } .gps-line.ok .gps-dot { background: #1fb35a; animation: pulse 1.6s infinite; }
.gps-line.mid { color: #8a5a00; background: #fff3d6; } .gps-line.mid .gps-dot { background: #f2a900; animation: pulse 1.6s infinite; }
.gps-line.bad { color: #b4232b; background: #fde6e7; } .gps-line.bad .gps-dot { background: var(--danger); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } 0% { box-shadow: 0 0 0 0 rgba(31,179,90,.45); } }

.rec-state { font-size: 12px; font-weight: 900; letter-spacing: .8px; background: var(--black); color: var(--white);
  padding: 4px 10px; border-radius: 99px; }
.rec-state:empty { display: none; }
body.recording .hero-value span { font-size: 96px; }

.time-card { background: var(--black); color: var(--white); border-radius: 22px; padding: 12px 18px;
  display: flex; align-items: baseline; justify-content: space-between; }
.time-card span { color: #a9acd0; font-size: 15px; }
.time-card b { font-size: 46px; font-weight: 800; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.tiles.two .tile b { font-size: 30px; }

.splits { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.splits span { flex: none; background: var(--purple-soft); border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; }
.splits small { font-size: 11px; color: #a63306; font-weight: 700; }
.splits b { font-size: 17px; font-variant-numeric: tabular-nums; }

.dock { position: fixed; left: 0; right: 0; z-index: 900; bottom: calc(var(--nav-h) + var(--safe-b));
  padding: 10px 14px 8px; background: var(--white); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px; }
.dock .chips { justify-content: center; }
.dock .btn.big { padding: 20px; font-size: 19px; border-radius: 20px; }
#view-record:not(.active) .dock { display: none; }

/* durante o treino: some a navegação, a faixa da semana e a meta; botões vão pro rodapé */
body.recording .bottom-nav, body.recording .week-strip, body.recording .goal, body.recording .dark-head small { display: none; }
body.recording #view-record { padding-bottom: calc(110px + var(--safe-b)); }
body.recording .dock { bottom: 0; padding-bottom: calc(14px + var(--safe-b)); }
body.recording .dock .btn.big { padding: 24px; font-size: 20px; }

.countdown { position: fixed; inset: 0; z-index: 4000; background: var(--purple); color: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.countdown b { font-size: 180px; font-weight: 900; line-height: 1; animation: pop .9s ease-out; }
.countdown small { color: #ffe1d4; font-size: 15px; font-weight: 700; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }

.switch-row { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row b { display: block; color: var(--text); font-size: 15px; }
.switch-row small { display: block; font-weight: 500; margin-top: 2px; }
.switch-row input { appearance: none; width: 52px; height: 30px; border-radius: 99px; background: #d5d7e6; position: relative;
  flex: none; padding: 0; border: 0; transition: background .2s; cursor: pointer; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--white); transition: transform .2s; box-shadow: 0 1px 3px rgba(10,15,70,.3); }
.switch-row input:checked { background: var(--purple); }
.switch-row input:checked::after { transform: translateX(22px); }

/* ---------- modal do app ---------- */
.modal { position: fixed; inset: 0; z-index: 3500; background: rgba(10,15,70,.55); display: flex; align-items: flex-end;
  justify-content: center; padding: 12px 12px calc(12px + var(--safe-b)); animation: fade .18s ease-out; }
.modal-card { width: 100%; max-width: 440px; background: var(--white); border-radius: 30px; padding: 24px 20px 18px;
  text-align: center; animation: rise .25s cubic-bezier(.2,.9,.3,1.2); }
.modal-icon { width: 64px; height: 64px; margin: -4px auto 10px; border-radius: 22px; background: var(--purple-soft);
  display: grid; place-items: center; font-size: 32px; }
.modal-icon.danger { background: #fde6e7; }
.modal-icon:empty { display: none; }
.modal h2 { margin: 0 0 6px; font-size: 23px; font-weight: 900; color: var(--text); }
.modal-body { color: var(--muted); font-size: 15px; line-height: 1.45; }
.modal-body p { margin: 0; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.modal-actions .btn { max-width: none; padding: 17px; font-size: 16px; border-radius: 18px; }
.modal-actions .btn.link { background: none; color: var(--danger); padding: 10px; font-weight: 800; }
.btn.danger-fill { background: var(--danger); color: var(--white); }

.sum { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; }
.sum div { background: var(--tile); border-radius: 16px; padding: 12px 6px; }
.sum div:first-child { background: var(--purple); color: var(--white); }
.sum b { display: block; font-size: 24px; font-weight: 900; color: inherit; font-variant-numeric: tabular-nums; }
.sum span { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; opacity: .75; }
.sum div:not(:first-child) b { color: var(--text); }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
