:root {
  --vrt-font-scale: 1;
  --vrt-pref-background: #ffffff;
  --vrt-pref-text: #172437;
  --vrt-pref-muted: #43536a;
  --vrt-pref-border: #718096;
  --vrt-pref-soft: #eef3f9;
  --vrt-pref-accent: #075bb5;
  --vrt-pref-focus: #0057b8;
}

html[data-vrt-text="large"] { --vrt-font-scale: 1.15; }
html[data-vrt-text="extra"] { --vrt-font-scale: 1.3; }

html[data-vrt-theme="dark"] {
  --vrt-pref-background: #101d2e;
  --vrt-pref-text: #f5f8ff;
  --vrt-pref-muted: #c0cede;
  --vrt-pref-border: #8393aa;
  --vrt-pref-soft: #203248;
  --vrt-pref-accent: #91c8ff;
  --vrt-pref-focus: #9bd1ff;
}

.vrt-pref-toolbar,
.vrt-pref-dialog {
  box-sizing: border-box;
  color: var(--vrt-pref-text);
  background: var(--vrt-pref-background);
  border: 1px solid var(--vrt-pref-border);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: calc(16px * var(--vrt-font-scale));
  line-height: 1.5;
  text-align: start;
  color-scheme: light;
}

html[data-vrt-theme="dark"] .vrt-pref-toolbar,
html[data-vrt-theme="dark"] .vrt-pref-dialog { color-scheme: dark; }

.vrt-pref-toolbar {
  position: fixed;
  z-index: 900;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgb(9 24 45 / 18%);
}

.vrt-pref-toolbar button,
.vrt-pref-dialog button,
.vrt-pref-dialog input { font: inherit; }

.vrt-pref-icon-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 8px;
  color: var(--vrt-pref-text);
  background: var(--vrt-pref-background);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}

.vrt-pref-icon-button svg { display: block; flex: none; }
.vrt-pref-icon-button:hover { background: var(--vrt-pref-soft); border-color: var(--vrt-pref-border); }
.vrt-pref-toolbar button:focus-visible,
.vrt-pref-dialog button:focus-visible,
.vrt-pref-dialog input:focus-visible { outline: 3px solid var(--vrt-pref-focus); outline-offset: 3px; }

.vrt-pref-dialog {
  position: fixed;
  inset: 0;
  width: min(460px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100% - 24px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: auto;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 20px 80px rgb(0 12 30 / 25%);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.vrt-pref-dialog::backdrop { background: rgb(0 12 30 / 55%); }
.vrt-pref-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.vrt-pref-heading h2 { margin: 4px 0 0; color: var(--vrt-pref-text); font-size: calc(22px * var(--vrt-font-scale)); font-weight: 750; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.vrt-pref-description { margin: 0 0 24px; color: var(--vrt-pref-muted); font-size: inherit; line-height: 1.6; }
.vrt-pref-text-options { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; margin: 0 0 24px; padding: 0; border: 0; }
.vrt-pref-text-options legend { float: none; width: 100%; margin: 0 0 10px; padding: 0; color: var(--vrt-pref-text); font-size: inherit; font-weight: 700; }
.vrt-pref-radio { box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; margin: 0; border: 1px solid var(--vrt-pref-border); border-radius: 10px; color: var(--vrt-pref-text); cursor: pointer; }
.vrt-pref-radio:has(input:checked) { background: var(--vrt-pref-soft); border-color: var(--vrt-pref-accent); }
.vrt-pref-size-value { margin-left: auto; color: var(--vrt-pref-muted); font-size: .875em; }
.vrt-pref-dialog input { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; accent-color: var(--vrt-pref-accent); }
.vrt-pref-check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; margin: 0 0 24px; color: var(--vrt-pref-text); cursor: pointer; }
.vrt-pref-check input { margin-top: 3px; }
.vrt-pref-check-copy { display: block; min-width: 0; }
.vrt-pref-check-copy strong { display: block; color: var(--vrt-pref-text); font-size: inherit; font-weight: 700; }
.vrt-pref-help { display: block; margin-top: 4px; color: var(--vrt-pref-muted); font-size: .875em; line-height: 1.6; }
.vrt-pref-check:has(input:disabled) { cursor: default; }
.vrt-pref-reset { display: block; width: 100%; min-height: 44px; padding: 12px 16px; border: 1px solid var(--vrt-pref-border); border-radius: 10px; background: var(--vrt-pref-soft); color: var(--vrt-pref-text); font-weight: 700; line-height: 1.5; white-space: normal; cursor: pointer; }
.vrt-pref-reset:hover { border-color: var(--vrt-pref-accent); }
.vrt-pref-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.vrt-pref-spacer { display: block; height: calc(84px + env(safe-area-inset-bottom)); }

/* Keep the dock clear of other modal controls and transaction notifications. */
body:has(dialog[open]) .vrt-pref-toolbar,
body:has([role="dialog"][aria-modal="true"]:not(#vrt-preferences-dialog)) .vrt-pref-toolbar,
body:has(.gittu-toast) .vrt-pref-toolbar { visibility: hidden; }

html[data-vrt-links="underlined"] body a { text-decoration-line: underline !important; text-underline-offset: .18em; }
html[data-vrt-motion="reduce"],
html[data-vrt-motion="reduce"] *,
html[data-vrt-motion="reduce"] *::before,
html[data-vrt-motion="reduce"] *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }

@media (prefers-reduced-motion: reduce) {
  html, html *, html *::before, html *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
}

@media (max-width: 480px) {
  .vrt-pref-dialog { padding: 20px 16px; border-radius: 16px; }
}

@media print {
  .vrt-pref-toolbar, .vrt-pref-dialog, .vrt-pref-spacer { display: none !important; }
}
