/* Cabeçalho de marca no topo e navegação principal fixa no rodapé em telas móveis. */
.mobile-brand-bar { display: none; }
.mobile-navigation-shell { display: none; }
@media (max-width: 850px) {
  .mobile-navigation-shell {
    position: sticky;
    z-index: 41;
    top: 0;
    display: block;
    background: #24543A;
    box-shadow: 0 4px 16px #30291F1A;
  }

  .mobile-brand-bar {
    position: relative;
    display: flex;
    height: calc(70px + env(safe-area-inset-top));
    min-height: calc(70px + env(safe-area-inset-top));
    box-sizing: border-box;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: calc(6px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
    background: #24543A;
    color: #FFFDF8;
  }

  .mobile-brand {
    display: flex !important;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    width: max-content;
    min-width: 0;
    min-height: 34px !important;
    padding: 0 !important;
    color: #FFFDF8 !important;
    text-decoration: none;
  }

  .mobile-brand > span {
    flex: 0 0 auto;
    font: 700 31px/1 "Dancing Script", cursive;
    letter-spacing: -.03em;
    white-space: nowrap;
  }

  .mobile-brand em { color: #E58C45; font-style: normal; }
  .mobile-brand small {
    color: #FFFDF8;
    font: 700 8px/1.2 "DM Sans", system-ui, sans-serif;
    letter-spacing: .7px;
    white-space: nowrap;
  }

  .mobile-more { position: relative; flex: 0 0 auto; }
  .mobile-more summary {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid #FFFDF866;
    border-radius: 0;
    color: #FFFDF8;
    cursor: pointer;
    font: 600 12px/1 "DM Sans", system-ui, sans-serif;
    list-style: none;
  }
  .mobile-more summary svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .mobile-more summary::-webkit-details-marker { display: none; }
  .mobile-more summary::after { content: "⌄"; font-size: 14px; line-height: 1; }
  .mobile-more summary:focus-visible,
  .mobile-more a:focus-visible { outline: 2px solid #FFFDF8; outline-offset: 2px; }
  .mobile-more[open] summary { background: #F4EBDD; color: #24543A; }
  .mobile-more-links {
    position: absolute;
    z-index: 42;
    display: flex;
    flex-direction: column;
    top: calc(100% + 7px);
    right: 0;
    width: 216px;
    gap: 0;
    margin: 0;
    padding: 5px 0;
    overflow: visible;
    border: 1px solid #E5D8C6;
    background: #FFFDF8;
    box-shadow: 0 8px 24px #30291F24;
  }
  .mobile-more-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 13px;
    color: #30291F;
    font: 500 13px/1.2 "DM Sans", system-ui, sans-serif;
    text-decoration: none;
  }
  .mobile-more-links a + a { border-top: 1px solid #E5D8C6; }
  .mobile-more-links a:hover,
  .mobile-more-links a[aria-current="page"] { background: #F4EBDD; color: #24543A; }
  .mobile-more-links svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .mobile-nav,
  .app-pages-page .mobile-nav,
  .courses-page .mobile-nav {
    position: relative;
    z-index: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 max(8px, env(safe-area-inset-right)) 7px max(8px, env(safe-area-inset-left));
    border: 0;
    border-top: 0;
    border-radius: 0;
    background: #24543A;
    box-shadow: none;
  }

  .mobile-nav-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    min-width: 0;
  }

  .mobile-nav .mobile-nav-links a,
  .app-pages-page .mobile-nav .mobile-nav-links a,
  .courses-page .mobile-nav .mobile-nav-links a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 54px;
    padding: 3px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #FFFDF8;
    font-family: "DM Sans", system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-nav .mobile-nav-links a[aria-current="page"],
  .app-pages-page .mobile-nav .mobile-nav-links a[aria-current="page"],
  .courses-page .mobile-nav .mobile-nav-links a[aria-current="page"] {
    background: #F4EBDD;
    color: #24543A;
    box-shadow: inset 3px 0 #24543A;
  }

  .mobile-nav .mobile-nav-links a:focus-visible,
  .mobile-brand:focus-visible {
    outline: 2px solid #FFFDF8;
    outline-offset: -2px;
  }

  .mobile-nav .mobile-nav-links svg {
    display: block;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .app-pages-page .app-main,
  .courses-page .app-main { padding-top: 0; }

  /* Mobile navigation is the app shell; avoid a second floating account control
     and give each page title a clear, full-width starting point. */
  .app-pages-page .header-actions { display: none; }

  .app-pages-page .courses-header {
    display: block;
    min-height: 0;
    padding: 19px 0 17px;
  }

  .courses-page .courses-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 0;
    padding: 19px 0 17px;
  }

  .courses-page .header-actions { display: flex; gap: 6px; }
  .courses-page .header-actions .profile-chip { display: none; }
  .courses-page .header-actions .icon-button { width: 36px; height: 36px; }

  .app-pages-page .header-copy,
  .courses-page .header-copy { min-width: 0; }

  .app-pages-page .header-copy .eyebrow,
  .courses-page .header-copy .eyebrow {
    margin: 0 0 4px;
    font-size: 10px;
    letter-spacing: 1.1px;
  }

  .app-pages-page .header-copy h1,
  .courses-page .header-copy h1 {
    margin: 0;
    font-size: clamp(25px, 6.7vw, 30px);
    line-height: 1.18;
  }

  .app-pages-page .header-subtitle,
  .courses-page .header-subtitle {
    max-width: 100%;
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.45;
  }

  .app-pages-page .app-pages-frame,
  .courses-page .app-frame {
    overflow: visible;
    padding-top: 0;
    padding-bottom: 18px;
  }
}

@media (max-width: 440px) {
  .mobile-brand-bar { padding-right: max(12px, env(safe-area-inset-right)); padding-left: max(12px, env(safe-area-inset-left)); }
  .mobile-brand { gap: 5px; }
  .mobile-brand > span { font-size: 29px; }
  .mobile-brand small { font-size: 7px; letter-spacing: .5px; }
  .mobile-more summary { min-height: 36px; padding: 0 8px; }
}

@media (max-width: 350px) {
  .mobile-brand { flex-direction: column; align-items: flex-start; gap: 0; }
  .mobile-brand > span { font-size: 25px; }
  .mobile-brand small { font-size: 7px; letter-spacing: .55px; }
  .mobile-more summary { gap: 4px; padding: 0 6px; font-size: 11px; }
  .mobile-nav { padding-right: max(5px, env(safe-area-inset-right)); padding-left: max(5px, env(safe-area-inset-left)); }
  .mobile-nav .mobile-nav-links a { min-height: 50px; font-size: 9px; }
  .mobile-nav .mobile-nav-links svg { width: 18px; height: 18px; flex-basis: 18px; }
  .app-pages-page .courses-header,
  .courses-page .courses-header { padding-top: 16px; padding-bottom: 14px; }
  .app-pages-page .header-copy .eyebrow,
  .courses-page .header-copy .eyebrow { font-size: 9px; }
  .app-pages-page .header-subtitle,
  .courses-page .header-subtitle { font-size: 13px; }
}

/* Toda a navegação principal fica no cabeçalho, em telas pequenas e grandes. */
.mobile-navigation-shell {
  position: sticky;
  z-index: 100;
  top: 0;
  display: block;
  margin: -30px -34px 0;
  background: #24543A;
  box-shadow: 0 3px 12px #30291F12;
}

.mobile-brand-bar {
  position: relative;
  z-index: 1;
  display: flex;
  height: 84px;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px max(24px, calc((100vw - 1480px) / 2));
  border: 0;
  border-radius: 0;
  background: #24543A;
  color: #FFFDF8;
}

.mobile-brand {
  display: flex !important;
  flex: 0 1 auto;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  width: max-content;
  min-width: 0;
  min-height: 40px !important;
  padding: 0 !important;
  color: #FFFDF8 !important;
  text-decoration: none;
}

.mobile-brand > span {
  flex: 0 0 auto;
  font: 700 36px/1 "Dancing Script", cursive;
  letter-spacing: -.03em;
  white-space: nowrap;
}

.mobile-brand em { color: #E58C45; font-style: normal; }
.mobile-brand small {
  color: #FFFDF8;
  font: 700 10px/1.2 "DM Sans", system-ui, sans-serif;
  letter-spacing: 1px;
  white-space: nowrap;
}

.mobile-more { position: relative; z-index: 101; flex: 0 0 auto; }
.mobile-more summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 92px;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #FFFDF866;
  border-radius: 0;
  color: #FFFDF8;
  cursor: pointer;
  font: 600 14px/1 "DM Sans", system-ui, sans-serif;
  list-style: none;
}
.mobile-more summary svg {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile-more summary::-webkit-details-marker { display: none; }
.mobile-more[open] summary { background: #F4EBDD; color: #24543A; }
.mobile-more[open] summary::after {
  content: "×";
  display: inline-block;
  margin-left: 1px;
  font: 400 21px/1 "DM Sans", system-ui, sans-serif;
}
.mobile-more summary:focus-visible,
.mobile-more a:focus-visible { outline: 2px solid #FFFDF8; outline-offset: 2px; }

.mobile-more-links {
  position: absolute;
  z-index: 102;
  top: calc(100% + 8px);
  right: 0;
  display: flex;
  width: 280px;
  max-height: calc(100dvh - 104px);
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 5px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #E5D8C6;
  border-radius: 0;
  background: #FFFDF8;
  box-shadow: 0 10px 28px #30291F30;
}
.mobile-more-links a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 0 16px;
  color: #30291F;
  font: 500 14px/1.2 "DM Sans", system-ui, sans-serif;
  text-decoration: none;
}
.mobile-more-links a + a { border-top: 1px solid #E5D8C6; }
.mobile-more-links a:hover,
.mobile-more-links a[aria-current="page"] { background: #F4EBDD; color: #24543A; }
.mobile-more-links a[aria-current="page"] { font-weight: 700; box-shadow: inset 3px 0 #24543A; }
.mobile-more-links svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.courses-sidebar { display: none !important; }
.courses-page .app-frame,
.app-pages-page .app-pages-frame {
  grid-template-columns: minmax(0, 1fr) !important;
}
.app-pages-page .app-pages-frame {
  background: #FFFDF8 !important;
}

@media (max-width: 1250px) {
  .mobile-navigation-shell { margin: -20px -20px 0; }
  .mobile-brand-bar { padding-right: 24px; padding-left: 24px; }
}

@media (max-width: 850px) {
  .mobile-navigation-shell { margin: 0; }
  .mobile-brand-bar {
    height: calc(76px + env(safe-area-inset-top));
    min-height: calc(76px + env(safe-area-inset-top));
    padding: calc(6px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  }
  .mobile-brand { gap: 6px; min-height: 34px !important; }
  .mobile-brand > span { font-size: 31px; }
  .mobile-brand small { font-size: 8px; letter-spacing: .7px; }
  .mobile-more summary { min-width: 78px; min-height: 42px; padding: 0 10px; font-size: 12px; }
  .mobile-more-links { width: min(360px, calc(100vw - 24px)); max-height: calc(100dvh - 100px - env(safe-area-inset-top)); }
}

@media (max-width: 440px) {
  .mobile-brand-bar { gap: 6px; }
  .mobile-brand { flex-direction: column; align-items: center; gap: 0; }
  .mobile-brand > span { font-size: 27px; }
  .mobile-brand small { font-size: 6px; letter-spacing: .45px; }
}

/* Ordem do cabeçalho: navegação à esquerda, marca central e perfil à direita. */
.mobile-brand-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-content: stretch;
}
.mobile-more { grid-column: 1; grid-row: 1; justify-self: start; }
.mobile-brand { grid-column: 2; grid-row: 1; justify-self: center; }
.mobile-profile {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #FFFDF8;
  border-radius: 50%;
  background: #FFFDF8;
  color: #24543A;
  text-decoration: none;
}
.mobile-profile:focus-visible { outline: 2px solid #FFFDF8; outline-offset: 3px; }
.mobile-more-links { right: auto; left: 0; }
.app-pages-page .courses-header .header-actions .profile-chip,
.courses-page .courses-header .header-actions .profile-chip { display: none !important; }

@media (max-width: 850px) {
  .mobile-brand-bar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .mobile-profile { width: 40px; height: 40px; }
}

@media (max-width: 440px) {
  .mobile-profile { width: 36px; height: 36px; }
  .mobile-profile-icon { width: 20px; height: 20px; }
  .mobile-more summary { min-width: 72px; }
}

.mobile-brand {
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mobile-brand small {
  margin-top: 4px;
  font-size: 9px;
  line-height: 1.2;
  letter-spacing: .8px;
}
.mobile-profile-icon {
  display: block;
  width: 23px;
  height: 23px;
  fill: none !important;
  stroke: #24543A !important;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 850px) {
  .mobile-brand { gap: 0; }
  .mobile-brand small { margin-top: 4px; font-size: 7px; letter-spacing: .55px; }
  .mobile-profile-icon { width: 21px; height: 21px; }
}

@media (max-width: 440px) {
  .mobile-brand small { margin-top: 4px; font-size: 6px; letter-spacing: .45px; }
}

/* Cantos ligeiramente mais suaves, mantendo círculos e elementos deliberadamente pill-shaped. */
.app-pages-page .app-pages-frame,
.courses-page .app-frame {
  border-radius: 30px;
}

.app-pages-page .app-content > section:not(#inicio),
.app-pages-page #inicio.hero,
.app-pages-page .welcome-banner,
.app-pages-page .start-checklist,
.app-pages-page .welcome-note,
.app-pages-page .help-faq,
.app-pages-page .account-state,
.app-pages-page .saved-sheets,
.app-pages-page .data-tools,
.app-pages-page .calculator,
.app-pages-page .ingredient,
.app-pages-page .stale,
.app-pages-page .resources button,
.courses-page .upgrade-banner,
.courses-page .shop-card,
.courses-page .complete-offer,
.courses-page .saved-sheet,
.courses-page .saved-scenarios,
.courses-page .lesson-steps,
.courses-page .save-warning,
.courses-page .next-step,
.courses-page .panel,
.courses-page .player-progress,
.courses-page .resume-card,
.courses-page .course-card,
.courses-page .tool-card,
.courses-page .course-heading,
.courses-page .course-lesson,
.courses-page .course-outline,
.courses-page .outline-toggle,
.courses-page .reading-content,
.courses-page .lesson-visual-frame {
  border-radius: 18px;
}

.app-pages-page .card,
.app-pages-page .app-content > section .card,
.courses-page .card,
.courses-page .course-card,
.courses-page .tool-card {
  border-radius: 16px;
}

.courses-page .outline-lesson,
.courses-page .save-warning { border-radius: 9px; }
.courses-page .lesson-steps,
.courses-page .next-step,
.courses-page .notices-dialog { border-radius: 12px; }
.courses-page .player-progress { border-radius: 14px; }
.app-pages-page .notice,
.courses-page .notice { border-radius: 8px; }

.app-pages-page .button,
.app-pages-page .secondary,
.app-pages-page .card-link,
.app-pages-page .sidebar-nav a,
.app-pages-page .sidebar-bottom a,
.app-pages-page input,
.app-pages-page select,
.app-pages-page textarea,
.courses-page .button,
.courses-page .secondary,
.courses-page .resume-action,
.courses-page .card-link,
.courses-page .sidebar-nav a,
.courses-page .sidebar-bottom a,
.courses-page input,
.courses-page select,
.courses-page textarea,
.courses-page .search-field,
.courses-page .sort-field select,
.courses-page .lesson-navigation button {
  border-radius: 11px;
}

.app-pages-page .filter-pill,
.courses-page .filter-pill,
.app-pages-page .badge,
.courses-page .badge {
  border-radius: 999px;
}

.app-pages-page .mobile-nav,
.courses-page .mobile-nav { border-radius: 0; }

@media (max-width: 850px) {
  .app-pages-page .app-pages-frame,
  .courses-page .app-frame {
    border-radius: 0;
  }
}

/* Mobile shell uses one conventional top menu for every destination. */
@media (max-width: 850px) {
  .mobile-navigation-shell {
    position: sticky;
    z-index: 100;
    top: 0;
    display: block;
    background: #24543A;
    box-shadow: none;
  }

  .mobile-brand-bar {
    position: relative;
    z-index: 1;
    height: calc(76px + env(safe-area-inset-top));
    min-height: calc(76px + env(safe-area-inset-top));
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
    box-shadow: 0 3px 12px #30291F12;
  }

  .mobile-more { z-index: 101; }

  .mobile-more summary {
    justify-content: center;
    gap: 8px;
    min-width: 78px;
    min-height: 42px;
    padding: 0 10px;
  }

  .mobile-more summary svg {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    stroke-width: 2;
  }

  .mobile-more summary::after { content: none; }
  .mobile-more[open] summary::after {
    content: "×";
    display: inline-block;
    margin-left: 1px;
    font: 400 21px/1 "DM Sans", system-ui, sans-serif;
  }

  .mobile-more-links {
    position: absolute;
    z-index: 102;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100dvh - 100px - env(safe-area-inset-top));
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 5px 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #E5D8C6;
    border-radius: 0;
    background: #FFFDF8;
    box-shadow: 0 10px 28px #30291F30;
  }

  .mobile-more-links a {
    min-height: 48px;
    padding: 0 15px;
    color: #30291F;
    font-size: 14px;
  }

  .mobile-more-links a + a { border-top: 1px solid #E5D8C6; }
  .mobile-more-links a:hover { background: #F4EBDD; color: #24543A; }
  .mobile-more-links a[aria-current="page"] {
    background: #F4EBDD;
    color: #24543A;
    font-weight: 700;
    box-shadow: inset 3px 0 #24543A;
  }

  .mobile-nav,
  .app-pages-page .mobile-nav,
  .courses-page .mobile-nav { display: none !important; }

  .mobile-more summary:focus-visible,
  .mobile-more-links a:focus-visible { outline: 2px solid #E5D8C6; outline-offset: -2px; }

  .app-pages-page .courses-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .app-pages-page .header-actions {
    display: flex;
    align-self: center;
  }

  .app-pages-page .header-actions .profile-chip {
    display: flex;
    padding: 0;
  }

  .app-pages-page .header-actions .profile-avatar {
    width: 44px;
    height: 44px;
    font-size: 13px;
  }

  .app-pages-page .app-pages-frame,
  .courses-page .app-frame {
    padding-bottom: 18px;
  }
}

@media (max-width: 350px) {
  .mobile-brand-bar {
    height: calc(76px + env(safe-area-inset-top));
    min-height: calc(76px + env(safe-area-inset-top));
  }

  .mobile-nav .mobile-nav-links a,
  .app-pages-page .mobile-nav .mobile-nav-links a,
  .courses-page .mobile-nav .mobile-nav-links a {
    min-height: 50px;
    font-size: 9px;
  }
}
