/* VoiceNote app chrome: shell, titlebar, native window controls, safe areas. */
.app-shell { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.app-shell__device-mode { align-self: center; margin-right: 8px; padding: 5px 8px; border: 1px solid rgb(var(--theme-accent-rgb) / .3); border-radius: 4px; background: var(--app-surface); color: var(--app-text); font: inherit; font-size: 12px; }

html[data-device-kind="desktop"] .app-shell { padding-bottom: 0; }

/* The bottom nav is fixed on touch layouts. Keep its size available to the
   individual scroll roots instead of padding the shell itself: shell padding
   would render as a permanent strip above the fixed nav. */
html[data-device-kind="mobile"] .app-shell,
html[data-device-kind="tablet"] .app-shell {
  --voice-note-bottom-nav-content-height: clamp(46px, 6vh, 56px);
  --voice-note-safe-area-bottom: max(var(--voice-note-telegram-safe-area-bottom, 0px), env(safe-area-inset-bottom, 0px));
  --voice-note-bottom-nav-height: calc(var(--voice-note-bottom-nav-content-height) + var(--voice-note-safe-area-bottom));
  padding-bottom: 0;
}

html[data-device-kind="mobile"] .project-card-grid,
html[data-device-kind="tablet"] .project-card-grid,
html[data-device-kind="mobile"] .lesson-grid,
html[data-device-kind="tablet"] .lesson-grid {
  padding-bottom: calc(12px + var(--voice-note-bottom-nav-height));
  scroll-padding-bottom: var(--voice-note-bottom-nav-height);
}

html[data-device-kind="mobile"] .settings-page,
html[data-device-kind="tablet"] .settings-page {
  padding-bottom: calc(12px + var(--voice-note-bottom-nav-height));
  scroll-padding-bottom: var(--voice-note-bottom-nav-height);
}

html[data-device-kind="mobile"],
html[data-device-kind="tablet"] {
  body { background: #000; }
  body::before { position: fixed; z-index: 2100; top: 0; right: 0; left: 0; height: env(safe-area-inset-top, 0px); content: ""; background: color-mix(in srgb, var(--app-surface) 96%, transparent); pointer-events: none; }
  .app-shell { height: calc(100% - env(safe-area-inset-top, 0px)); margin-top: env(safe-area-inset-top, 0px); }
  .auth-gate, .launch-flow { top: env(safe-area-inset-top, 0px); bottom: 0; height: auto; }
  .titlebar__actions { display: none; }
  .app-shell__device-mode { display: none; }
}

/* The bottom navigation is fixed, so touch pages must end above it instead of
   scrolling into the same pixels underneath it. */
html[data-device-kind="mobile"] #projects-page,
html[data-device-kind="mobile"] #profile-page,
html[data-device-kind="mobile"] #settings-page,
html[data-device-kind="tablet"] #projects-page,
html[data-device-kind="tablet"] #profile-page,
html[data-device-kind="tablet"] #settings-page {
  align-self: start;
  box-sizing: border-box;
  height: calc(100% - var(--voice-note-bottom-nav-height));
  max-height: calc(100% - var(--voice-note-bottom-nav-height));
}

html[data-device-kind="mobile"] .pitch-app,
html[data-device-kind="tablet"] .pitch-app {
  align-self: start;
  box-sizing: border-box;
  height: calc(100% - var(--voice-note-bottom-nav-height));
  max-height: calc(100% - var(--voice-note-bottom-nav-height));
}

html[data-device-kind="mobile"] .titlebar__actions,
html[data-device-kind="tablet"] .titlebar__actions { display: flex; }
