:root {
  color-scheme: light dark;
  --luna-viewport-height: 100dvh;
  --luna-safe-top: env(safe-area-inset-top, 0px);
  --luna-safe-right: env(safe-area-inset-right, 0px);
  --luna-safe-bottom: env(safe-area-inset-bottom, 0px);
  --luna-safe-left: env(safe-area-inset-left, 0px);
}
html, body { margin: 0; width: 100%; height: 100%; background: #F9F9F9; }
#root { min-height: 0; height: var(--luna-viewport-height, 100vh); display: flex; flex-direction: column; }
body { overflow: hidden; -webkit-text-size-adjust: 100%; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="light"], html[data-theme="light"] body { background: #F9F9F9; }
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"], html[data-theme="dark"] body { background: #11100F; }
/* Only an active PWA editor owns viewport coordinates; nested scrolling stays native. */
html[data-luna-pwa-viewport="active"],
html[data-luna-pwa-viewport="active"] body {
  overflow: hidden;
  overscroll-behavior: none;
}
html[data-luna-pwa-viewport="active"] body {
  position: fixed;
  inset: 0;
}
html[data-luna-pwa-viewport="active"] #root {
  position: fixed;
  top: var(--luna-viewport-top, 0px);
  left: var(--luna-viewport-left, 0px);
  width: var(--luna-viewport-width, 100%);
  height: var(--luna-viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
}
button, [role="button"] { touch-action: manipulation; }
@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
}
@media (prefers-color-scheme: dark) { html:not([data-theme]), html:not([data-theme]) body { background: #11100F; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Composer only: one calm surface, no cramped inner focus rectangle. */
[data-testid="luna-chat-composer-input"]:focus {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: none;
  caret-color: currentColor;
}
[data-testid="luna-chat-composer-input"]:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Quiet PWA typing: keep field borders and the caret, not browser accent rings. */
input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]):not([type="color"]):not([type="file"]):focus,
textarea:focus {
  outline: none !important;
  box-shadow: none !important;
  caret-color: currentColor;
  -webkit-tap-highlight-color: transparent;
}
/* Keyboard navigation stays visible without the default blue accent. */
button:focus-visible,
[role="button"]:focus-visible {
  outline: 1px solid #8C8C92;
  outline-offset: 2px;
}
