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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body {
  font-size: 16px;
  line-height: 1.45;
  /* Evita o "duplo toque para dar zoom" atrapalhar durante o treino */
  touch-action: manipulation;
}

h1, h2, h3, h4 { margin: 0; font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; color: var(--text-2); }
a { color: var(--volt); text-decoration: none; }
small { font-size: 12.5px; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* 16px evita zoom automático no iOS */
  color: inherit;
}

ul, ol { margin: 0 0 10px; padding-left: 20px; }
li { margin-bottom: 5px; color: var(--text-2); }

img { max-width: 100%; display: block; }

::selection { background: var(--volt); color: #0A0B0D; }

/* Scrollbars discretos (desktop) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }

/* ---------- Layout do app ---------- */

#app-root { min-height: 100%; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: var(--sal);
  padding-right: var(--sar);
}

.app__main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--sat) + 8px) var(--pad) calc(var(--tabbar-h) + var(--sab) + 28px);
}

.app--focus .app__main { padding-bottom: calc(var(--sab) + 20px); }

/* ---------- Header ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  min-height: 44px;
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
}
.topbar__h1 { font-size: 24px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }

.iconbtn {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}
.iconbtn:active { transform: scale(0.95); }

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  display: grid;
  /* uma coluna por aba: acompanha a lista em shell.js sem número fixo aqui */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 1px;
  padding: 6px max(6px, var(--sal)) calc(var(--sab) + 6px) max(6px, var(--sar));
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line-soft);
}
.tabbar__item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 1px;
  border-radius: 14px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  /* nome de aba nunca quebra em duas linhas nem empurra as vizinhas */
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabbar__item > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabbar__icon { font-size: 19px; line-height: 1; }
@media (min-width: 420px) {
  .tabbar__item { font-size: 10.5px; }
  .tabbar__icon { font-size: 20px; }
}
.tabbar__item--active { color: var(--text); }
.tabbar__item--active .tabbar__icon { filter: drop-shadow(0 0 10px rgba(200, 255, 77, 0.35)); }

/* ---------- Boot ---------- */

.boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
}
.boot__logo {
  font-size: 34px; font-weight: 800; letter-spacing: 0.3em;
  color: var(--volt);
}
.boot__msg { color: var(--text-3); font-size: 14px; }

/* ---------- Utilitários ---------- */

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack--sm { gap: 8px; }
.stack--lg { gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; font-family: var(--num); }
.hide { display: none !important; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.section-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 750;
  margin: 4px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
