:root {
  --app-height: 100dvh;
  --keyboard-offset: 0px;
  --app-safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --app-safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --app-safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --app-safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --app-bg: #07090f;
  --surface-1: #10141d;
  --surface-2: #171c27;
  --surface-3: #202735;
  --text-1: #f7f9fc;
  --text-2: #aeb8c8;
  --brand: #2b8cff;
  --brand-strong: #176fe8;
  --danger: #ff5c6c;
  --success: #25cf91;
  --warning: #ffbf47;
  --line: rgba(255, 255, 255, .10);
  --shadow: 0 18px 50px rgba(0, 0, 0, .42);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --content-max: 1180px;
  --font-main: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

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

html, body, #app, .view, .page { width: 100%; min-height: 100%; }

#app, .view, .page { height: var(--app-height); }

html, body {
  margin: 0;
  background: var(--app-bg);
  color: var(--text-1);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body { min-height: var(--app-height); }

.page { background: var(--app-bg); }
.page-content {
  color: var(--text-1);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
img { max-width: 100%; }

/* Tamaño táctil mínimo sin imponer la apariencia de todos los botones. */
button, .button { min-height: 44px; }

/* Modales legibles. No fuerza colores en todo el DOM. */
.dialog, .popup, .sheet-modal {
  color: var(--text-1);
  font-family: var(--font-main);
}
.dialog-inner, .dialog-buttons {
  background: #151a24;
  color: var(--text-1);
}
.dialog-title { color: var(--text-1); }
.dialog-text { color: var(--text-2); line-height: 1.5; }
.dialog-button { color: #75b1ff; }

.toast { background: #171c27; color: var(--text-1); }

/* Formularios: evita zoom automático de WebView/iOS. */
input, textarea, select { font-size: 16px; }

/* Safe areas aplicadas una sola vez. */
.safe-top { padding-top: var(--app-safe-top); }
.safe-bottom { padding-bottom: var(--app-safe-bottom); }

/* Utilidades de accesibilidad. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (min-width: 900px) {
  .page-content { scrollbar-gutter: stable; }
}

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