:root {
  /* Layout: app de iPhone. Listas agrupadas (inset grouped) sobre cinza-claro, título grande que recolhe na barra, navegação em níveis */
  --bg: #F2F2F7;
  --cell: #FFFFFF;
  --label: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --tertiary: rgba(60, 60, 67, 0.3);
  --sep: rgba(60, 60, 67, 0.22);
  --press: #E5E5EA;
  --blue: #007AFF;
  --blue-tint: rgba(0, 122, 255, 0.12);
  --orange: #FF9500;
  --orange-tint: rgba(255, 149, 0, 0.15);
  --green-text: #248A3D;
  --green-tint: rgba(52, 199, 89, 0.16);
  --red: #FF3B30;
  --red-text: #D70015;
  --red-tint: rgba(255, 59, 48, 0.12);
  --bar: rgba(249, 249, 249, 0.94);
  /* No iPhone usa a fonte do sistema (SF Pro); fora da Apple usa Inter, a mais próxima */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light only;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.25px;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
.app { max-width: 520px; margin: 0 auto; }
.view[hidden] { display: none; }
:focus-visible { outline: 3px solid rgba(0, 122, 255, 0.45); outline-offset: 2px; }

/* Barra de navegação: transparente no topo, translúcida ao rolar */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 44px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 8px;
  background: transparent;
  border-bottom: 0.5px solid transparent;
  transition: background-color .2s ease, border-color .2s ease;
}
.nav.scrolled {
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--sep);
}
.nav { position: sticky; }
.nav-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 17px;
  font-weight: 600;
  max-width: calc(100% - 250px);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .2s ease;
}
.nav.scrolled .nav-title { opacity: 1; }
.back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  padding: 0 8px 0 4px;
  color: var(--blue);
  font-size: 17px;
  white-space: nowrap;
}
.back svg { width: 11px; height: 19px; margin-right: 1px; }
.back:active { opacity: .4; }

/* Título grande */
.lt { padding: 2px 20px 8px; }
.large-title {
  margin: 0;
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: 0.37px;
  text-wrap: balance;
}
.large-title.t2 { font-size: 28px; line-height: 34px; letter-spacing: 0.36px; }
.lt-sub { margin: 2px 0 0; font-size: 15px; line-height: 20px; letter-spacing: -0.24px; color: var(--secondary); }

/* Grupos (inset grouped) */
.g-head {
  margin: 26px 0 0;
  padding: 0 36px 7px;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: -0.08px;
  text-transform: uppercase;
  color: var(--secondary);
}
.g-foot {
  margin: 0;
  padding: 7px 36px 0;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: -0.08px;
  color: var(--secondary);
}
.group {
  margin: 0 16px;
  background: var(--cell);
  border-radius: 12px;
  overflow: hidden;
}
.spacer { height: 20px; }

.cell {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 10px 16px;
  position: relative;
  cursor: pointer;
}
.cell + .cell::before {
  content: "";
  position: absolute;
  top: 0; left: 72px; right: 0;
  border-top: 0.5px solid var(--sep);
}
.cell:active { background: var(--press); }
.thumb {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2E91FF 0%, #007AFF 100%);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}
.thumb.orange { background: linear-gradient(180deg, #FFAA33 0%, #FF9500 100%); }
.thumb.soft { background: var(--blue-tint); color: var(--blue); box-shadow: none; }
.thumb svg { width: 26px; height: 26px; }
.badge {
  position: absolute;
  right: -5px; bottom: -5px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #34C759;
  color: #FFFFFF;
  border: 2px solid var(--cell);
  display: grid;
  place-items: center;
}
.badge svg { width: 10px; height: 10px; }
.cell-main { min-width: 0; }
.cell-title { display: block; font-size: 17px; line-height: 22px; }
.cell-sub {
  display: block;
  margin-top: 1px;
  font-size: 15px;
  line-height: 20px;
  letter-spacing: -0.24px;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}
.cell-sub .prog { color: var(--blue); }
.chev { color: var(--tertiary); display: grid; place-items: center; }
.chev svg { width: 8px; height: 14px; }
.ext { color: var(--tertiary); display: grid; place-items: center; }
.ext svg { width: 13px; height: 13px; }

.cell-btn {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  min-height: 48px;
  font-size: 17px;
  color: var(--red);
  cursor: pointer;
}
.cell-btn:active { background: var(--press); }

/* Tela do exercício */
.video { display: block; }
.video-media {
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 1;
  background: linear-gradient(180deg, #F1F7FF 0%, #E2EDFF 100%);
}
.play {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--blue);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.28);
}
.play svg { width: 24px; height: 24px; }
.video:active .play { transform: scale(.96); }
.video-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  color: var(--blue);
  font-size: 17px;
}
.video-row .ext { color: var(--blue); }
.video-row { position: relative; }
.video-row + .video-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
button.video-row { appearance: none; border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer; font: inherit; letter-spacing: inherit; }
.video-row:active { background: var(--press); }
.jump-r { display: inline-flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 15px; font-variant-numeric: tabular-nums; }
.jump-r svg { width: 13px; height: 8px; color: var(--tertiary); }
#alts { scroll-margin-top: 56px; }
.group.flash { animation: flash 1.1s ease; }
@keyframes flash { 0%, 30% { background: #E8F1FF; } 100% { background: var(--cell); } }

/* Carrossel de vídeos */
.carousel { position: relative; background: #000; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 16 / 9; }
.slide video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 7px; pointer-events: none; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); transition: background-color .2s ease; }
.dots span.on { background: #FFFFFF; }
a.video-media { display: grid; }

.note { padding: 12px 16px 13px; position: relative; }
.note + .note::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.note-h { display: flex; align-items: center; gap: 7px; font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -0.24px; margin-bottom: 4px; }
.note-h svg { width: 18px; height: 18px; flex: none; }
.note.ombro .note-h svg { color: var(--orange); }
.note.dica .note-h svg { color: var(--blue); }
.note ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.note li, .note p { font-size: 15px; line-height: 20px; letter-spacing: -0.24px; }
.note p { margin: 0; }

.set {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  position: relative;
  cursor: pointer;
}
.set + .set::before {
  content: "";
  position: absolute;
  top: 0; left: 52px; right: 0;
  border-top: 0.5px solid var(--sep);
}
.set:active { background: var(--press); }
.circle {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid #C7C7CC;
  display: grid;
  place-items: center;
  color: transparent;
  transition: background-color .15s ease, border-color .15s ease;
}
.circle svg { width: 13px; height: 13px; }
.set[aria-pressed="true"] .circle { background: var(--blue); border-color: var(--blue); color: #FFFFFF; }
.set-detail { color: var(--secondary); font-variant-numeric: tabular-nums; }
.set-all { display: flex; align-items: center; width: 100%; appearance: none; border: 0; background: none;
  min-height: 44px; padding: 11px 16px; color: var(--blue); font-size: 17px; letter-spacing: -0.4px;
  text-align: left; position: relative; cursor: pointer; }
.set-all::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--sep); }
.set-all:active { background: var(--press); }

/* Peso usado */
.w-row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 16px; font-size: 17px; letter-spacing: -0.4px; }
.w-val { display: flex; align-items: baseline; gap: 4px; }
.w-input { width: 72px; border: 0; background: none; text-align: right; font: inherit; font-size: 17px; color: var(--blue); padding: 11px 0; outline: none; }
.w-unit { color: var(--secondary); }

/* Escala de dor */
.scale { padding: 14px 16px; }
.scale-bar { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; }
.scale-bar span {
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.scale-bar .g { background: var(--green-tint); color: var(--green-text); }
.scale-bar .r { background: var(--red-tint); color: var(--red-text); }
.scale-cap { display: flex; justify-content: space-between; margin-top: 7px; font-size: 13px; line-height: 18px; color: var(--secondary); }
.rule { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: start; padding: 12px 16px; position: relative; font-size: 15px; line-height: 20px; letter-spacing: -0.24px; }
.rule + .rule::before { content: ""; position: absolute; top: 0; left: 38px; right: 0; border-top: 0.5px solid var(--sep); }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.dot.g { background: #34C759; }
.dot.r { background: var(--red); }
.avoid { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; padding: 12px 16px; position: relative; font-size: 17px; line-height: 22px; }
.avoid + .avoid::before { content: ""; position: absolute; top: 0; left: 50px; right: 0; border-top: 0.5px solid var(--sep); }
.avoid svg { width: 22px; height: 22px; color: var(--red); }

/* Menu de confirmação (action sheet) */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; }
.sheet-wrap[hidden] { display: none; }
.dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.sheet { position: relative; max-width: 520px; width: 100%; margin: 0 auto; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.sheet-group { background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px; overflow: hidden; }
.sheet-msg { padding: 14px 16px; text-align: center; font-size: 13px; line-height: 18px; color: var(--secondary); border-bottom: 0.5px solid var(--sep); }
.sheet button { appearance: none; border: 0; background: transparent; width: 100%; height: 57px; font-size: 20px; letter-spacing: 0.38px; cursor: pointer; }
.sheet button:active { background: rgba(0, 0, 0, 0.06); }
.sheet .destructive { color: var(--red); }
.sheet .cancel { color: var(--blue); font-weight: 600; background: #FFFFFF; }

@media (prefers-reduced-motion: no-preference) {
  .view.push { animation: push .32s cubic-bezier(.2, .8, .2, 1); }
  @keyframes push { from { transform: translateX(36px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-wrap:not([hidden]) .dim { animation: fade .2s ease; }
  .sheet-wrap:not([hidden]) .sheet { animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
  @keyframes fade { from { opacity: 0; } }
  @keyframes rise { from { transform: translateY(100%); } }
}
.dot.o { background: var(--orange); }
.err-row { display: grid; grid-template-columns: 20px 1fr; gap: 12px; align-items: start; padding: 12px 16px; position: relative; font-size: 15px; line-height: 20px; letter-spacing: -0.24px; }
.err-row + .err-row::before { content: ""; position: absolute; top: 0; left: 48px; right: 0; border-top: 0.5px solid var(--sep); }
.err-row svg { width: 20px; height: 20px; color: var(--red); margin-top: 0; }

/* Página inicial */
.thumb.green  { background: linear-gradient(180deg, #4CD964 0%, #34C759 100%); }
.thumb.orange { background: linear-gradient(180deg, #FFAA33 0%, #FF9500 100%); }
.thumb.red    { background: linear-gradient(180deg, #FF6A61 0%, #FF3B30 100%); }
.thumb.purple { background: linear-gradient(180deg, #C77DFF 0%, #AF52DE 100%); }
.thumb.teal   { background: linear-gradient(180deg, #5AC8FA 0%, #30B0C7 100%); }
.thumb.indigo { background: linear-gradient(180deg, #7D7AFF 0%, #5856D6 100%); }
.thumb.pink   { background: linear-gradient(180deg, #FF6482 0%, #FF2D55 100%); }
.thumb-l { font-size: 21px; line-height: 1; font-weight: 600; letter-spacing: 0; }
.cell.off { cursor: default; }
.cell.off:active { background: transparent; }
.cell.off .thumb { opacity: 0.4; }
.cell.off .cell-title { color: var(--secondary); }
.cell.off .chev { visibility: hidden; }

/* Firefox no Android (classe posta pelo script): barras sólidas, sem desfoque */
html.ff-android { --bar: #F9F9F9; }
html.ff-android .nav.scrolled,
html.ff-android .sheet-group { backdrop-filter: none; -webkit-backdrop-filter: none; }
html.ff-android .sheet-group { background: #FFFFFF; }
