/* One viewport, one page scroll surface. Kept last in the stylesheet cascade. */
:root {
  --app-viewport-height: 100vh;
  --app-visible-height: 100vh;
  --app-keyboard-inset: 0px;
  --app-nav-bottom: max(12px, env(safe-area-inset-bottom));
  --app-nav-height: 66px;
  --app-nav-clearance: calc(var(--app-nav-height) + var(--app-nav-bottom) + 24px);
}
@supports (height: 100dvh) {
  :root { --app-viewport-height: 100dvh; --app-visible-height: 100dvh; }
}
/* Safari pans its visual viewport above the keyboard. Keep the layout canvas
   full height so that pan never uncovers an unpainted strip beneath the page. */
html, body { height: var(--app-canvas-height, 100%); min-height: 100%; }
html { overflow: hidden; background: #0b132a; }
body { overflow: hidden; overscroll-behavior-y: none; background-color: #0b132a; }
/* Paint the decorative light inside viewport bounds rather than oversized boxes. */
.ambient-orb { position: fixed; top: 0; left: 0; right: auto; bottom: auto; width: 100%; height: 100%; border-radius: 0; filter: none; }
.orb-top { background: radial-gradient(ellipse at 0% 0%, rgba(142,73,255,.28), transparent 42%); }
.orb-bottom { background: radial-gradient(ellipse at 100% 100%, rgba(38,137,255,.23), transparent 44%); }

/* Individual pages scroll; the document behind them never adds a second bar. */
body > :is(main, section).screen-background {
  width: 100%;
  max-width: 100%;
  height: var(--app-viewport-height);
  min-height: 0;
  max-height: var(--app-viewport-height);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  scroll-padding-block: max(24px, env(safe-area-inset-top)) var(--app-nav-clearance);
}
body > #edit-profile-screen, body > #onboarding-screen {
  height: var(--app-viewport-height);
  min-height: 0;
  max-height: var(--app-viewport-height);
}
#edit-profile-screen { scroll-padding-bottom: 28px; }
.onboarding-shell { min-height: 100%; }

/* Safe centering also leaves the top of tall welcome content reachable. */
.welcome-screen { display: flex; flex-direction: column; }
.welcome-screen .welcome-content { flex: 0 0 auto; margin: auto; }

.home-screen, .services-screen, .ai-screen, .activity-screen, .profile-screen,
.cars-screen, .property-screen, .education-screen, .travel-screen, .jobs-screen,
.marketplace-screen, .government-screen, .translator-screen, .currency-screen,
.calculator-screen, .weather-screen, .scholarships-screen, .study-abroad-screen,
.advertise-screen {
  padding-block-start: max(24px, env(safe-area-inset-top));
  padding-inline-start: max(20px, env(safe-area-inset-left));
  padding-inline-end: max(20px, env(safe-area-inset-right));
  padding-block-end: var(--app-nav-clearance);
}

/* Replace the old double bottom spacing with one measured navigation reserve. */
.home-inner, .services-inner, .profile-inner, .jobs-inner, .cars-inner,
.education-inner, .marketplace-inner, .travel-inner, .government-inner,
.weather-inner, .currency-inner, .calculator-inner, .translator-inner {
  padding-bottom: 0 !important;
  min-width: 0;
}

/* These newer views own spacing in their shell, rather than in both layers. */
body > :is(.assistant-enabled, .workspace-screen, .fx-enabled),
body > .marketplace-screen:has(> .market-live-shell) { padding: 0; }
.assistant-shell, .workspace-shell, .fx-live-shell, .market-live-shell {
  min-height: 100%;
  padding-block-start: max(24px, env(safe-area-inset-top));
  padding-inline-start: max(20px, env(safe-area-inset-left));
  padding-inline-end: max(20px, env(safe-area-inset-right));
  padding-block-end: var(--app-nav-clearance);
}

#shared-app-navigation {
  width: calc(100% - max(28px, calc(env(safe-area-inset-left) + env(safe-area-inset-right) + 20px)));
  bottom: var(--app-nav-bottom);
}
#shared-app-navigation .nav-item { min-height: 44px; }
.tool-card { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
body[data-keyboard-open="true"] #shared-app-navigation { visibility: hidden; pointer-events: none; }
/* The keyboard is outside this surface. Reserving its full height again inside
   the page created an empty tail and clipped the composer above the keyboard. */
body[data-keyboard-open="true"] { --app-nav-clearance: 20px; }
body[data-keyboard-open="true"] > :is(main, section).screen-background {
  position: absolute !important;
  top: var(--app-viewport-offset, 0px);
  inset-inline: 0;
  height: var(--app-visible-height);
  min-height: 0;
  max-height: var(--app-visible-height);
  scroll-padding-block: 14px 20px;
  scroll-behavior: auto !important;
}
body[data-keyboard-open="true"] > :is(.auth-screen, #edit-profile-screen, #onboarding-screen) {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
/* A long draft scrolls inside the textarea in landscape; Send stays reachable. */
body[data-keyboard-open="true"] .assistant-composer { padding: 10px; }
body[data-keyboard-open="true"] .assistant-input {
  min-height: 52px;
  max-height: clamp(52px, calc(var(--app-visible-height) * .35), 160px);
  overflow-y: auto;
}

/* Text entry stays readable without iOS's automatic form-field zoom. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  textarea, select { font-size: 16px !important; }
}

/* Fixed sheets fit above the software keyboard and retain a reachable close action. */
.activity-modal, .professional-dialog, .country-picker, .account-delete-dialog,
.ad-editor-mode, .workspace-dialog, .market-live-dialog, .fx-admin-dialog,
.broadcast-dialog, .account-onboarding {
  top: var(--app-viewport-offset, 0px);
  bottom: auto;
  height: var(--app-visible-height);
  max-height: var(--app-visible-height);
  padding-block-start: max(18px, env(safe-area-inset-top));
  padding-block-end: max(18px, env(safe-area-inset-bottom));
}
.professional-dialog .activity-modal-panel,
.account-delete-dialog .account-dialog-panel,
.market-live-dialog-panel, .workspace-dialog-panel, .fx-admin-panel,
.ad-editor-panel, .country-panel, .broadcast-dialog-panel {
  max-height: calc(var(--app-visible-height) - max(18px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)));
}
.professional-dialog .activity-modal-content { max-height: none; overflow-y: visible; }
.professional-dialog .activity-modal-panel, .account-dialog-panel,
.market-live-dialog-panel, .workspace-dialog-panel, .fx-admin-panel,
.ad-editor-panel { overflow-y: auto; overscroll-behavior-y: contain; }
.country-list, .broadcast-dialog-content { min-height: 0; overscroll-behavior-y: contain; }

@media (min-width: 900px) {
  .assistant-shell, .workspace-shell, .fx-live-shell, .market-live-shell { padding-inline: 36px; padding-top: 32px; }
}
@media (max-height: 480px) {
  .identity-startup-logo { width: 68px; height: 68px; margin-bottom: 14px; border-radius: 21px; }
  .identity-startup-logo svg { width: 50px; height: 50px; }
  .identity-startup-name { font-size: 28px; }
  .identity-startup-tagline { margin-top: 8px; font-size: 12px; }
  .identity-startup-progress { bottom: max(57px, calc(env(safe-area-inset-bottom) + 46px)); }
  .identity-startup-status { bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px)); }
}
@media (max-width: 350px) {
  .home-screen, .services-screen, .profile-screen, .education-screen,
  .travel-screen, .government-screen, .translator-screen, .calculator-screen,
  .weather-screen, .advertise-screen { padding-inline: max(14px, env(safe-area-inset-left)); }
  .assistant-shell, .workspace-shell, .fx-live-shell, .market-live-shell { padding-inline: max(14px, env(safe-area-inset-left)); }
}
@media (prefers-reduced-motion: reduce) {
  body > :is(main, section).screen-background { scroll-behavior: auto; }
}
