@font-face {
  font-family: 'Accordance';
  src: url('../assets/fonts/Accordance.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Accordance';
  src: url('../assets/fonts/AccordanceBold.ttf') format('truetype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Accordance';
  src: url('../assets/fonts/AccordanceItalic.ttf') format('truetype');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Accordance';
  src: url('../assets/fonts/AccordanceBoldItalic.ttf') format('truetype');
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Cardo';
  src: url('../assets/fonts/Cardo104s.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Cardo';
  src: url('../assets/fonts/Cardob101.ttf') format('truetype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Cardo';
  src: url('../assets/fonts/Cardoi99.ttf') format('truetype');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Gentium';
  src: url('../assets/fonts/GenR101.TTF') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Gentium Plus';
  src: url('../assets/fonts/GentiumPlus-R.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Ezra SIL';
  src: url('../assets/fonts/SILEOT.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'theWord Uncial New';
  src: url('../assets/fonts/theWord_Uncial_New-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'theWord Unical Greek';
  src: url('../assets/fonts/theWord_Unical_Greek_6.otf') format('opentype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'theWord Unical Greek-English';
  src: url('../assets/fonts/theWord_Unical_Greek-English.otf') format('opentype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* A shrinkable toolbar group owns a fixed main-axis slot. Its compound child
   must resolve inside that slot rather than retaining an intrinsic width and
   painting over the following buttons. Popup surfaces remain free to extend
   because this constrains layout without clipping overflow. */
[data-tw-delphi-toolbar-item-group-shrink='1'][data-tw-delphi-toolbar-orientation='horizontal'] > * {
  min-width: 0 !important;
  max-width: 100% !important;
}

[data-tw-delphi-toolbar-item-group-shrink='1'][data-tw-delphi-toolbar-orientation='horizontal'] > :only-child {
  width: 100% !important;
}

[data-tw-delphi-toolbar-item-group-shrink='1'][data-tw-delphi-toolbar-orientation='vertical'] > * {
  min-height: 0 !important;
  max-height: 100% !important;
}

[data-tw-delphi-toolbar-item-group-shrink='1'][data-tw-delphi-toolbar-orientation='vertical'] > :only-child {
  height: 100% !important;
}

:root {
  --tw-system-navigation-bottom: 0px;
  --tw-desktop-ui-font-delta: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tw-system-navigation-bottom, 0px));
  --tw-ui-font-color: #1a1a1a;
  --tw-ui-form-background-color: #ffffff;
  --tw-ui-panel-background-color: #f0f0f0;
  --tw-ui-surface-0: #ffffff;
  --tw-ui-surface-1: #f8f8f8;
  --tw-ui-surface-2: #f0f0f0;
  --tw-ui-surface-3: #e8e8e8;
  --tw-ui-surface-4: #e0e0e0;
  --tw-ui-text-primary: #1a1a1a;
  --tw-ui-text-muted: #5a5a5a;
  --tw-ui-border-subtle: #d0d0d0;
  --tw-ui-accent: #1565c0;
  --tw-ui-accent-soft: #dfe9ff;
}

/* Android navigation mode is detected natively because WebView may report a
   zero CSS safe-area inset while edge-to-edge system controls are visible. */
body.android-gesture-nav {
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tw-system-navigation-bottom, 0px));
}

/* Includes legacy two-button navigation, which has the same tappable inset. */
body.android-3button-nav {
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tw-system-navigation-bottom, 0px));
}

body.tw-mobile-ui,
body.tw-mobile-ui #root {
  background-color: var(--tw-ui-accent, #0b6fa4);
}

body.tw-mobile-ui select,
body.tw-mobile-ui .mobile-options-panel select,
body.tw-mobile-ui .book-view-options-panel select,
body.tw-mobile-ui .book-view-options-drawer select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding-right: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  touch-action: manipulation;
}

body.tw-mobile-ui option {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tw-mobile-ui input[type="number"],
body.tw-mobile-ui .mobile-options-number-input {
  touch-action: manipulation; /* removes 300ms tap delay on mobile */
  font-size: max(16px, 1em); /* prevents iOS from auto-zooming the viewport on focus */
  -webkit-appearance: none;
  appearance: none;
}

/* Book modules can contain document-level CSS. The normal reader scopes those
   rules, but editable/selection-formatting HTML is mounted directly while a
   topic is active. Keep that content from changing the shared viewport box
   (for example `body { margin: 1em }`), which otherwise exposes a white frame
   and makes Classic Layout jump as topics are switched. */
html, body, #root {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-width: 0 !important;
  border-style: none !important;
  overflow: hidden !important;
  font-size: var(--tw-ui-font-size, 16px);
  font-family: var(--tw-ui-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--tw-ui-surface-0, var(--tw-ui-form-background-color, #fff));
  color: var(--tw-ui-text-primary, var(--tw-ui-font-color, #1a1a1a));
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

#root {
  padding-top: var(--safe-top) !important;
  padding-bottom: 0 !important;
  height: calc(100% - var(--safe-top)) !important;
}

body.android-webview #root {
  height: 100dvh !important;
  padding-bottom: 0 !important;
}

#global-overlay-root {
  position: fixed;
  inset: 0;
  z-index: var(--tw-z-global-overlay-root);
  pointer-events: none;
  font-size: var(--tw-ui-font-size, 16px);
  font-family: var(--tw-ui-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif);
}

#global-overlay-root > * {
  pointer-events: auto;
}

/* Native form controls do not consistently inherit document typography in
   Chromium. Keep every desktop dropdown/text editor on the interface-font
   accessibility scale, including menus portaled to #global-overlay-root. */
html[data-tw-layout-mode='classic'] select,
html[data-tw-layout-mode='classic'] option,
html[data-tw-layout-mode='classic'] textarea,
html[data-tw-layout-mode='classic'] input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='color']):not([type='file']) {
  font-family: var(--tw-ui-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif) !important;
  font-size: max(8px, calc(12px + var(--tw-desktop-ui-font-delta, 0px))) !important;
}

html[data-tw-layout-mode='classic'] button {
  font-family: var(--tw-ui-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: max(8px, calc(12px + var(--tw-desktop-ui-font-delta, 0px)));
}

html[data-tw-layout-mode='classic'] select,
html[data-tw-layout-mode='classic'] textarea,
html[data-tw-layout-mode='classic'] input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='color']):not([type='file']) {
  min-height: max(22px, calc(24px + var(--tw-desktop-ui-font-delta, 0px)));
}

img[src^="/icons/"] {
  /* Most legacy icons are continuous-tone artwork. Nearest-neighbour
     rendering makes them visibly blocky as the interface font grows. */
  image-rendering: auto;
}

.tw-startup-splash {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b6ea8;
  z-index: var(--tw-z-startup-splash);
  padding-top: calc(24px + var(--safe-top, env(safe-area-inset-top, 0px)));
  padding-right: calc(24px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(24px + max(var(--safe-bottom, 0px), env(safe-area-inset-bottom, 0px)));
  padding-left: calc(24px + env(safe-area-inset-left, 0px));
}

.tw-startup-card {
  width: min(900px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.tw-startup-logo-wrap {
  position: relative;
  width: min(720px, 90vw);
}

.tw-startup-logo {
  width: 100%;
  height: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.tw-startup-version {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.tw-startup-status {
  width: min(720px, 90vw);
  background: rgba(5, 25, 40, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e6f5ff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 12px;
  text-align: left;
}

.tw-startup-phase {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
}

.tw-startup-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: tw-startup-spin 0.9s linear infinite;
}

.tw-startup-major-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.tw-startup-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
}

.tw-startup-step:last-child {
  border-bottom: none;
}

.tw-startup-step-label {
  font-size: 12px;
  color: rgba(230, 245, 255, 0.9);
}

.tw-startup-step-state {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tw-startup-step-done .tw-startup-step-state {
  color: #9be296;
}

.tw-startup-step-active .tw-startup-step-state {
  color: #ffd166;
}

.tw-startup-step-pending .tw-startup-step-state {
  color: rgba(230, 245, 255, 0.65);
}

.tw-startup-status-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.tw-startup-status-list li {
  display: grid;
  gap: 2px;
  padding-left: 10px;
  border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.tw-startup-status-message {
  font-weight: 600;
}

.tw-startup-status-detail {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.tw-startup-status-success {
  border-left-color: #9be296;
}

.tw-startup-status-warning {
  border-left-color: #ffd166;
}

.tw-startup-status-error {
  border-left-color: #ff6b6b;
}

.tw-startup-stamp {
  margin-top: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

@keyframes tw-startup-spin {
  to {
    transform: rotate(360deg);
  }
}

.mobile-options-overlay {
  position: fixed;
  top: calc(var(--safe-top, env(safe-area-inset-top, 0px)) + var(--mobile-toolbar-height, 0px));
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: var(--mobile-options-overlay-z);
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
}

.enhanced-bible-view[data-split-safe='true'] .mobile-options-overlay {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--safe-top, env(safe-area-inset-top, 0px)) + var(--mobile-toolbar-height, 0px));
  bottom: 0;
  width: 100%;
  height: auto;
}

.mobile-options-panel {
  width: min(calc(300px * var(--ui-scale, 1)), 92vw);
  height: 100%;
  margin-top: 0;
  background: var(--bg);
  color: var(--fg);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  padding: calc(14px * var(--ui-scale, 1));
  padding-left: calc(14px * var(--ui-scale, 1) + env(safe-area-inset-left, 0px));
  font-size: calc(14px * var(--ui-scale, 1));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: calc(10px * var(--ui-scale, 1));
}

.mobile-options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(4px * var(--ui-scale, 1));
  border-bottom: 1px solid var(--border);
  min-height: calc(32px * var(--ui-scale, 1));
}

.mobile-options-header-actions {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
}

.mobile-options-tool {
  border: 1px solid var(--border);
  background: var(--button-bg);
  color: var(--fg);
  font-size: calc(12px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  min-height: calc(30px * var(--ui-scale, 1));
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.2;
}

.mobile-options-tool.active {
  border-color: #8ab6ff;
  background: #e6f2ff;
  color: #0b3d91;
  font-weight: 600;
}

.mobile-options-title {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  font-weight: 700;
  font-size: calc(14px * var(--ui-scale, 1));
}

.mobile-options-mode-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(8px * var(--ui-scale, 1));
  margin-bottom: calc(4px * var(--ui-scale, 1));
}

.mobile-options-mode {
  padding: 0 calc(10px * var(--ui-scale, 1));
  min-height: calc(32px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--fg);
  font-size: calc(12px * var(--ui-scale, 1));
  cursor: pointer;
  line-height: 1.2;
}

.mobile-options-mode.active {
  border-color: #007bff;
  background: #e6f2ff;
  color: #0b3d91;
  font-weight: 600;
}

.mobile-options-content {
  flex: 1;
  overflow: auto;
  padding-right: calc(6px * var(--ui-scale, 1));
  padding-bottom: calc(16px * var(--ui-scale, 1) + max(var(--safe-bottom, 0px), env(safe-area-inset-bottom, 0px)));
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--tw-ui-text-muted, #555) 45%, transparent) transparent;
}

.mobile-options-content::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.mobile-options-content::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--tw-ui-text-muted, #555) 45%, transparent);
  border-radius: 999px;
}

.mobile-options-content::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-options-module-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #d6d6d6;
  border-radius: 4px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--tw-ui-text-muted, #555) 45%, transparent) transparent;
}

.mobile-options-module-list.mobile-options-module-list-padded {
  padding: 4px 6px;
}

.mobile-options-module-list::-webkit-scrollbar {
  width: 6px;
}

.mobile-options-module-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--tw-ui-text-muted, #555) 45%, transparent);
  border-radius: 999px;
}

.mobile-options-module-list::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-options-category-title {
  font-size: calc(13px * var(--ui-scale, 1));
  font-weight: 700;
  margin: calc(8px * var(--ui-scale, 1)) 0 calc(10px * var(--ui-scale, 1));
  color: var(--fg);
}

.mobile-options-category-picker {
  margin-bottom: calc(8px * var(--ui-scale, 1));
  display: grid;
  gap: calc(6px * var(--ui-scale, 1));
  position: relative;
}

.mobile-options-category-label {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted-fg);
}

.mobile-options-category-button {
  width: 100%;
  min-height: calc(32px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--fg);
  font-size: calc(12px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  cursor: pointer;
}

.mobile-options-category-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mobile-options-category-caret {
  width: 0;
  height: 0;
  border-left: calc(4px * var(--ui-scale, 1)) solid transparent;
  border-right: calc(4px * var(--ui-scale, 1)) solid transparent;
  border-top: calc(5px * var(--ui-scale, 1)) solid currentColor;
  opacity: 0.8;
}

.mobile-options-category-popover {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-bg);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-options-category-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale, 1));
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  text-align: left;
  min-height: calc(34px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
  cursor: pointer;
}

.mobile-options-category-item > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.mobile-options-category-item:last-child {
  border-bottom: none;
}

.mobile-options-category-item.selected {
  background: var(--accent-soft);
}

.mobile-options-category-check {
  color: var(--accent);
  width: calc(16px * var(--ui-scale, 1));
  text-align: center;
  flex: 0 0 auto;
  font-weight: 700;
}

.mobile-options-close {
  background: transparent;
  border: none;
  font-size: calc(18px * var(--ui-scale, 1));
  cursor: pointer;
  color: var(--fg);
  min-width: calc(28px * var(--ui-scale, 1));
  min-height: calc(28px * var(--ui-scale, 1));
}

.mobile-options-section {
  margin-bottom: calc(12px * var(--ui-scale, 1));
  padding: calc(10px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--section-bg);
  display: flex;
  flex-direction: column;
  gap: calc(4px * var(--ui-scale, 1));
}

.mobile-options-zoom {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin-top: calc(6px * var(--ui-scale, 1));
}

.mobile-options-zoom-button {
  width: calc(32px * var(--ui-scale, 1));
  height: calc(32px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--button-bg);
  cursor: pointer;
  font-size: calc(16px * var(--ui-scale, 1));
  line-height: 1;
}

.mobile-options-zoom-value {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--fg);
  min-width: 44px;
  text-align: center;
}

.mobile-options-toggle-keys {
  display: flex;
  flex-wrap: wrap;
  gap: calc(8px * var(--ui-scale, 1));
}

.mobile-options-toggle-key {
  padding: calc(6px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--button-bg);
  font-size: calc(11px * var(--ui-scale, 1));
  cursor: pointer;
}

.mobile-options-toggle-key.active {
  border-color: #007bff;
  background: #e6f2ff;
  color: #0b3d91;
}

.mobile-options-section-title {
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 700;
  color: var(--muted-fg);
  margin-bottom: calc(8px * var(--ui-scale, 1));
  line-height: 1.2;
}

.mobile-options-history-strip {
  display: inline-flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  margin: 0 0 calc(8px * var(--ui-scale, 1));
}

.mobile-options-history-control-row {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--button-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset;
}

.mobile-options-history-main,
.mobile-options-history-arrow {
  border: none;
  background: transparent;
  color: var(--fg);
  min-height: calc(30px * var(--ui-scale, 1));
  cursor: pointer;
}

.mobile-options-history-main {
  width: calc(34px * var(--ui-scale, 1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-options-format-text-glyph {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(18px * var(--ui-scale, 1));
  height: calc(18px * var(--ui-scale, 1));
  font-size: calc(15px * var(--ui-scale, 1));
  font-weight: 700;
  line-height: 1;
}

.mobile-options-format-text-glyph::after {
  content: '';
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: max(var(--safe-bottom, 0px), env(safe-area-inset-bottom, 0px));
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.mobile-options-history-arrow {
  width: calc(18px * var(--ui-scale, 1));
  border-left: 1px solid var(--border);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-options-history-arrow-glyph {
  width: 0;
  height: 0;
  border-left: calc(3px * var(--ui-scale, 1)) solid transparent;
  border-right: calc(3px * var(--ui-scale, 1)) solid transparent;
  border-top: calc(4px * var(--ui-scale, 1)) solid currentColor;
  opacity: 0.8;
}

.mobile-options-history-main:disabled,
.mobile-options-history-arrow:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mobile-options-item {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale, 1));
  padding: calc(6px * var(--ui-scale, 1)) 0;
  font-size: calc(13px * var(--ui-scale, 1));
  color: var(--fg);
  line-height: 1.25;
}

.mobile-options-item > span {
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.25;
}

.mobile-options-item select {
  margin-left: auto;
  min-height: calc(30px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  padding-right: calc(24px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--fg);
  font-family: var(--tw-ui-font-family, Segoe UI, Arial, sans-serif);
  max-width: min(58vw, 220px);
  width: min(58vw, 220px);
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}

.mobile-options-item select.mobile-options-select-compact {
  width: calc(72px * var(--ui-scale, 1));
  max-width: calc(72px * var(--ui-scale, 1));
  min-width: calc(72px * var(--ui-scale, 1));
  flex: 0 0 auto;
}

.mobile-options-item.mobile-options-item-compact-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: calc(8px * var(--ui-scale, 1));
}

.mobile-options-item.mobile-options-item-compact-control > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-options-item.mobile-options-item-stack-control {
  display: grid;
  grid-template-columns: 1fr;
  row-gap: calc(6px * var(--ui-scale, 1));
  align-items: start;
}

.mobile-options-item.mobile-options-item-stack-control > span {
  width: 100%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.mobile-options-item.mobile-options-item-stack-control input[type="text"] {
  margin-left: 0;
  width: 100%;
  max-width: 100%;
}

.mobile-options-inline-picker {
  width: 100%;
  position: relative;
}

.mobile-options-inline-picker-button {
  width: 100%;
  min-height: calc(32px * var(--ui-scale, 1));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(8px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--fg);
  font-size: calc(12px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  cursor: pointer;
}

.mobile-options-inline-picker-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mobile-options-inline-picker-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.mobile-options-inline-picker-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: var(--mobile-options-inline-picker-popover-z);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-bg);
  max-height: min(52vh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mobile-options-inline-picker-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(10px * var(--ui-scale, 1));
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  text-align: left;
  min-height: calc(34px * var(--ui-scale, 1));
  padding: 0 calc(10px * var(--ui-scale, 1));
  font-size: calc(13px * var(--ui-scale, 1));
  cursor: pointer;
}

.mobile-options-inline-picker-item > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.mobile-options-inline-picker-item:last-child {
  border-bottom: none;
}

.mobile-options-inline-picker-item.selected {
  background: var(--accent-soft);
}

.mobile-options-inline-picker-item:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.mobile-options-xref-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--button-bg);
  max-height: min(32vh, 220px);
  overflow-y: auto;
  padding: calc(6px * var(--ui-scale, 1));
}

.mobile-options-xref-row {
  display: flex;
  align-items: flex-start;
  gap: calc(8px * var(--ui-scale, 1));
  min-height: calc(24px * var(--ui-scale, 1));
  padding: calc(2px * var(--ui-scale, 1)) 0;
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--fg);
}

.mobile-options-xref-row > span {
  line-height: 1.3;
}

.mobile-options-xref-empty {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted-fg);
  padding: calc(4px * var(--ui-scale, 1)) calc(2px * var(--ui-scale, 1));
}

.mobile-options-item input[type="number"] {
  margin-left: auto;
  width: calc(76px * var(--ui-scale, 1));
  min-width: calc(76px * var(--ui-scale, 1));
  max-width: calc(76px * var(--ui-scale, 1));
  min-height: calc(30px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--fg);
  font-family: var(--tw-ui-font-family, Segoe UI, Arial, sans-serif);
  box-sizing: border-box;
}

.mobile-options-item input[type="text"] {
  margin-left: auto;
  width: min(58vw, 220px);
  max-width: min(58vw, 220px);
  min-height: calc(30px * var(--ui-scale, 1));
  padding: 0 calc(8px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--fg);
  font-family: var(--tw-ui-font-family, Segoe UI, Arial, sans-serif);
  box-sizing: border-box;
  min-width: 0;
}

.mobile-options-category-picker label {
  display: flex;
  flex-direction: column;
  gap: calc(6px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  font-weight: 600;
  color: var(--fg);
}

.mobile-options-category-picker select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: calc(32px * var(--ui-scale, 1));
  font-size: calc(12px * var(--ui-scale, 1));
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 calc(8px * var(--ui-scale, 1));
  padding-right: calc(24px * var(--ui-scale, 1));
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--button-bg);
  color: var(--fg);
  font-family: var(--tw-ui-font-family, Segoe UI, Arial, sans-serif);
}

.mobile-options-item input[type="checkbox"] {
  width: calc(16px * var(--ui-scale, 1));
  height: calc(16px * var(--ui-scale, 1));
  flex: 0 0 auto;
  margin: 0;
}

.mobile-options-tip {
  font-size: calc(12px * var(--ui-scale, 1));
  color: var(--muted-fg);
  background: var(--section-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: calc(8px * var(--ui-scale, 1)) calc(10px * var(--ui-scale, 1));
  margin-bottom: calc(10px * var(--ui-scale, 1));
}

@media (max-width: 380px) {
  .mobile-options-panel {
    width: 92vw;
  }

  .mobile-options-item {
    align-items: flex-start;
  }

  .mobile-options-item select {
    max-width: min(54vw, 210px);
    width: min(54vw, 210px);
  }

  .mobile-options-item input[type="text"] {
    max-width: min(54vw, 210px);
    width: min(54vw, 210px);
  }

  .mobile-options-item.mobile-options-item-stack-control input[type="text"] {
    max-width: 100%;
    width: 100%;
  }
}
