* { box-sizing: border-box; }
html { width: 100%; max-width: 100%; min-height: 100%; overflow-x: hidden; overflow-x: clip; background: var(--bg); touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-x: clip;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
button, input, textarea, select { color: inherit; font: inherit; }
button, a, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 24px; height: 24px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }

.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, var(--page-width));
  min-height: calc(58px + env(safe-area-inset-top));
  margin: auto;
  padding: calc(10px + env(safe-area-inset-top)) 20px 4px;
}
.topbar-side { min-width: 44px; }
.wordmark { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; font-size: 22px; font-weight: 760; letter-spacing: -.7px; }
.wordmark img { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; }
.wordmark small { margin-left: 1px; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.avatar, .round-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  background: var(--glass);
  box-shadow: inset 0 .5px 0 rgba(255,255,255,.45), 0 3px 10px rgba(0,0,0,.04);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}
.avatar { color: var(--accent); font-size: 15px; font-weight: 800; }
.round-button svg { width: 22px; height: 22px; }

.page {
  position: relative;
  z-index: 1;
  width: min(100%, var(--page-width));
  max-width: 100%;
  min-height: calc(100dvh - 58px);
  overflow-x: hidden;
  overflow-x: clip;
  margin: auto;
  padding: 20px 18px calc(var(--tab-height) + 38px + env(safe-area-inset-bottom));
}
.page-without-heading { padding-top: 12px; }
.page-heading { margin: 0 2px 22px; }
.page-heading h1, .today-intro h1, .exercise-page > header h1, .lesson-hero h1 { margin: 3px 0 0; font-size: clamp(34px, 9vw, 46px); line-height: 1.04; letter-spacing: -1.7px; }
.eyebrow, .meta-label, .section-kicker { color: var(--accent); font-size: 11px; font-weight: 780; letter-spacing: .1em; text-transform: uppercase; }
.page-lead { max-width: 540px; margin: -10px 2px 22px; color: var(--muted); font-size: 17px; line-height: 1.5; }

.tabbar {
  position: fixed;
  z-index: 30;
  right: 12px;
  bottom: calc(9px + env(safe-area-inset-bottom));
  left: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(calc(100% - 24px), 500px);
  height: var(--tab-height);
  margin: auto;
  padding: 7px;
  border: 1px solid var(--stroke);
  border-radius: 27px;
  background: color-mix(in srgb, var(--glass-strong) 86%, transparent);
  box-shadow: 0 7px 24px rgba(0, 0, 0, .12), inset 0 .5px 0 rgba(255,255,255,.48);
  -webkit-backdrop-filter: blur(30px) saturate(175%);
  backdrop-filter: blur(30px) saturate(175%);
}
.tabbar a { position: relative; display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 21px; color: var(--faint); font-size: 10px; font-weight: 650; transition: color .2s ease, background .2s ease, transform .2s ease; }
.tabbar a:active { transform: scale(.94); }
.tabbar a.active { color: var(--accent); background: var(--accent-soft); }
.tabbar .tab-icon { display: grid; place-items: center; height: 29px; }
.tabbar svg { width: 23px; height: 23px; }

.auth-page { display: grid; place-items: center; min-height: 100dvh; padding: calc(28px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom)); }
.auth-card { position: relative; z-index: 2; width: min(100%, 410px); padding: 30px 26px; }
.auth-card h1 { margin: 12px 0 8px; font-size: 40px; line-height: 1.06; letter-spacing: -1.5px; }
.auth-card > p:not(.eyebrow) { margin: 0 0 26px; color: var(--muted); }
.logo-mark { display: block; width: 64px; height: 64px; margin-bottom: 26px; border-radius: 18px; object-fit: cover; }
.auth-remember { padding: 2px 1px; }
.auth-remember > span { min-width: 0; }

.update-notice { position: fixed; z-index: 80; right: 14px; bottom: calc(var(--tab-height) + 22px + env(safe-area-inset-bottom)); left: 14px; display: flex; width: min(calc(100% - 28px), 500px); min-height: 68px; align-items: center; gap: 14px; margin: auto; padding: 11px 12px 11px 16px; border: 1px solid var(--stroke); border-radius: 19px; background: var(--glass-strong); box-shadow: 0 10px 32px rgba(0,0,0,.14); -webkit-backdrop-filter: blur(28px) saturate(160%); backdrop-filter: blur(28px) saturate(160%); animation: notice-in .24s ease both; }
.update-notice > div { display: grid; min-width: 0; flex: 1; gap: 2px; }
.update-notice strong { font-size: 14px; }
.update-notice span { color: var(--muted); font-size: 12px; }
.update-notice button { min-height: 40px; padding: 0 13px; border: 0; border-radius: 12px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 700; }
.auth-page .update-notice { bottom: calc(14px + env(safe-area-inset-bottom)); }
@keyframes notice-in { from { opacity: 0; transform: translateY(12px); } }

@view-transition { navigation: auto; }
.topbar { view-transition-name: impulso-header; }
.page { view-transition-name: impulso-content; }
.tabbar, .admin-nav { view-transition-name: impulso-navigation; }
::view-transition-old(impulso-content) { animation: page-out .12s ease both; }
::view-transition-new(impulso-content) { animation: page-in .2s ease both; }
::view-transition-old(impulso-header), ::view-transition-new(impulso-header), ::view-transition-old(impulso-navigation), ::view-transition-new(impulso-navigation) { animation-duration: .16s; }
@keyframes page-out { to { opacity: 0; transform: translateY(-3px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

@supports not (view-transition-name: none) {
  .page { animation: page-in .18s ease-out both; }
}

@media (min-width: 760px) {
  .page { padding-right: 28px; padding-left: 28px; }
  .tabbar { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
