/* HGL final liquid-glass refinement layer.
   Visual-only overrides: existing ids, content, and event hooks stay intact. */

:root {
  --lg-bg: #edf1f5;
  --lg-bg-deep: #dce3ea;
  --lg-ink: #172033;
  --lg-muted: #5f6c80;
  --lg-tertiary: #7c8798;
  --lg-accent: #3a63c7;
  --lg-accent-soft: #eaf0fb;
  --lg-glass: rgba(255, 255, 255, .58);
  --lg-glass-strong: rgba(255, 255, 255, .76);
  --lg-dense: rgba(255, 255, 255, .88);
  --lg-line: rgba(38, 49, 64, .14);
  --lg-line-strong: rgba(38, 49, 64, .24);
  --lg-edge: rgba(255, 255, 255, .86);
  --lg-shadow: 0 22px 58px rgba(44, 56, 71, .12), 0 3px 10px rgba(44, 56, 71, .05);
  --lg-shadow-float: 0 28px 70px rgba(42, 53, 68, .18), 0 8px 20px rgba(42, 53, 68, .08);
  --lg-radius: 22px;
  --lg-radius-sm: 14px;
  --lg-ease: cubic-bezier(.2, .8, .2, 1);
}

:root.theme-dark,
:root[data-theme="dark"] {
  --lg-bg: #171a21;
  --lg-bg-deep: #10131a;
  --lg-ink: #f4f6fb;
  --lg-muted: #b3bac8;
  --lg-tertiary: #8d96a6;
  --lg-accent: #78a8ff;
  --lg-accent-soft: rgba(120, 168, 255, .16);
  --lg-glass: rgba(39, 44, 56, .62);
  --lg-glass-strong: rgba(48, 54, 68, .78);
  --lg-dense: rgba(32, 36, 45, .92);
  --lg-line: rgba(235, 240, 250, .14);
  --lg-line-strong: rgba(235, 240, 250, .26);
  --lg-edge: rgba(255, 255, 255, .2);
  --lg-shadow: 0 22px 58px rgba(0, 0, 0, .28), 0 3px 10px rgba(0, 0, 0, .2);
  --lg-shadow-float: 0 28px 70px rgba(0, 0, 0, .42), 0 8px 20px rgba(0, 0, 0, .24);
}

html,
body {
  min-width: 320px;
  color: var(--lg-ink) !important;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif !important;
  letter-spacing: 0 !important;
  background:
    radial-gradient(900px 520px at 4% -10%, rgba(147, 190, 234, .34), transparent 68%),
    radial-gradient(820px 560px at 98% 4%, rgba(190, 195, 222, .22), transparent 66%),
    radial-gradient(900px 580px at 52% 112%, rgba(238, 200, 188, .16), transparent 70%),
    linear-gradient(145deg, var(--lg-bg), var(--lg-bg-deep)) !important;
}

html.theme-dark body,
html[data-theme="dark"] body {
  background:
    radial-gradient(900px 520px at 0% -12%, rgba(49, 93, 140, .32), transparent 68%),
    radial-gradient(760px 500px at 100% 8%, rgba(92, 92, 132, .2), transparent 66%),
    linear-gradient(145deg, var(--lg-bg), var(--lg-bg-deep)) !important;
}

html.theme-light body,
html[data-theme="light"] body {
  background:
    radial-gradient(900px 520px at 4% -10%, rgba(147, 190, 234, .34), transparent 68%),
    radial-gradient(820px 560px at 98% 4%, rgba(190, 195, 222, .22), transparent 66%),
    radial-gradient(900px 580px at 52% 112%, rgba(238, 200, 188, .16), transparent 70%),
    linear-gradient(145deg, var(--lg-bg), var(--lg-bg-deep)) !important;
}

body::before,
body::after {
  display: none !important;
}

html body .container {
  width: min(1160px, calc(100% - 48px)) !important;
  max-width: none !important;
  margin: 0 auto !important;
  overflow: visible !important;
}

html body .header {
  padding: 68px 4px 34px !important;
  text-align: left !important;
}

html body .header h1 {
  color: var(--lg-ink) !important;
  font-size: 4rem !important;
  line-height: 1.04 !important;
  font-weight: 760 !important;
  letter-spacing: 0 !important;
  text-shadow: none !important;
}

html body .header p {
  max-width: 660px !important;
  margin: 15px 0 0 !important;
  color: var(--lg-muted) !important;
  font-size: 1.06rem !important;
  line-height: 1.6 !important;
}

html body .header::after {
  color: var(--lg-tertiary) !important;
  margin-top: 18px !important;
  letter-spacing: .14em !important;
}

html body .content {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  padding: 0 0 92px !important;
}

/* Material hierarchy: chrome is translucent, dense content remains readable. */
html body .file-upload-section,
html body .encoding-text-manager,
html body .settings-section,
html body .chapters-preview,
html body .chapter-filter-section,
html body .custom-styles-section,
html body .result,
html body .progress {
  position: relative !important;
  width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--lg-line) !important;
  border-radius: var(--lg-radius) !important;
  background: rgb(255, 255, 255) !important;
  box-shadow: var(--lg-shadow) !important;
}

html.theme-dark body .file-upload-section,
html[data-theme="dark"] body .file-upload-section,
html.theme-dark body .encoding-text-manager,
html[data-theme="dark"] body .encoding-text-manager,
html.theme-dark body .settings-section,
html[data-theme="dark"] body .settings-section,
html.theme-dark body .chapters-preview,
html[data-theme="dark"] body .chapters-preview,
html.theme-dark body .chapter-filter-section,
html[data-theme="dark"] body .chapter-filter-section,
html.theme-dark body .custom-styles-section,
html[data-theme="dark"] body .custom-styles-section,
html.theme-dark body .result,
html[data-theme="dark"] body .result,
html.theme-dark body .progress {
  background: rgb(35, 38, 47) !important;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html body .file-upload-section,
  html body .encoding-text-manager,
  html body .settings-section,
  html body .chapters-preview,
  html body .chapter-filter-section,
  html body .custom-styles-section,
  html body .result,
  html body .progress {
    background: linear-gradient(135deg, var(--lg-glass-strong), var(--lg-glass)) !important;
    border-color: var(--lg-edge) !important;
    -webkit-backdrop-filter: blur(24px) saturate(135%);
    backdrop-filter: blur(24px) saturate(135%);
  }
}

/* Keep title bars as their own rounded surface instead of a square slice of the card. */
html body .encoding-text-manager > .section-header,
html body .repair-section > .repair-header,
html body .basic-info-section > .section-header,
html body .cover-settings-section > .section-header,
html body .custom-styles-section > .section-header,
html body .chapter-filter-section > .section-header {
  width: calc(100% - 32px) !important;
  margin: 12px 16px 0 !important;
  border: 1px solid var(--lg-line) !important;
  border-radius: 16px !important;
  background: var(--lg-glass-strong) !important;
}

html body .manager-content,
html body .basic-info-content,
html body .cover-settings-content,
html body .styles-content,
html body .filter-content,
html body .multi-select-container {
  padding: 28px 30px !important;
  background: rgba(248, 250, 253, .62) !important;
  color: var(--lg-ink) !important;
}

html body .manager-content,
html body .basic-info-content,
html body .cover-settings-content,
html body .styles-content,
html body .filter-content { border-radius: 16px !important; }

/* Inner panels are independent surfaces, so their top edge is not cut square. */
html body .encoding-text-manager > .manager-content,
html body .repair-section > .manager-content,
html body .settings-section > .manager-content,
html body .basic-info-section > .basic-info-content,
html body .cover-settings-section > .cover-settings-content,
html body .custom-styles-section > .styles-content,
html body .chapter-filter-section > .filter-content {
  width: calc(100% - 32px) !important;
  margin: 14px auto 16px !important;
  padding: 24px 26px !important;
  border: 1px solid var(--lg-line) !important;
  border-radius: 16px !important;
  background: var(--lg-dense) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 8px 20px rgba(42, 53, 68, .05) !important;
}

html.theme-dark body .manager-content,
html[data-theme="dark"] body .manager-content,
html.theme-dark body .basic-info-content,
html[data-theme="dark"] body .basic-info-content,
html.theme-dark body .cover-settings-content,
html[data-theme="dark"] body .cover-settings-content,
html.theme-dark body .styles-content,
html[data-theme="dark"] body .styles-content,
html.theme-dark body .filter-content,
html[data-theme="dark"] body .filter-content,
html.theme-dark body .multi-select-container,
html[data-theme="dark"] body .multi-select-container { background: rgba(22, 25, 32, .62) !important; }

html body .settings-section > h3#settingsTitle { padding: 28px 30px 10px !important; color: var(--lg-ink) !important; font-size: 1.3rem !important; }
html body .settings-section > form { padding: 0 30px 32px !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 18px 22px !important; }
html body .settings-section > form > .basic-info-section,
html body .settings-section > form > .cover-settings-section,
html body .settings-section > form > .form-group:has(.chapter-tabs),
html body .settings-section > form > .custom-styles-section,
html body .settings-section > form > #chaptersPreview { grid-column: 1 / -1 !important; min-width: 0 !important; }

html body .basic-info-section { border: 1px solid var(--lg-line) !important; border-radius: 17px !important; background: var(--lg-dense) !important; overflow: hidden !important; }
html body .form-group,
html body .style-group { margin: 0 0 20px !important; min-width: 0; }
html body .form-group > label,
html body .style-group > label,
html body .encoding-selector-row > label,
html body .text-header > label { margin: 0 0 8px !important; color: var(--lg-ink) !important; font-size: .93rem !important; font-weight: 650 !important; line-height: 1.35 !important; }
html body .help-text,
html body .description-text,
html body .multi-select-desc,
html body .header-subtitle,
html body .rule-description,
html body .encoding-selector-row small,
html body .settings-section small { color: var(--lg-muted) !important; line-height: 1.55 !important; }

html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html body select,
html body textarea {
  width: 100% !important;
  min-height: 46px !important;
  padding: 11px 13px !important;
  border: 1px solid var(--lg-line-strong) !important;
  border-radius: var(--lg-radius-sm) !important;
  background: var(--lg-dense) !important;
  color: var(--lg-ink) !important;
  font: inherit !important;
  line-height: 1.4 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55) !important;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease !important;
}

html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
html body select:focus,
html body textarea:focus { outline: none !important; border-color: var(--lg-accent) !important; box-shadow: 0 0 0 4px rgba(23, 105, 210, .14) !important; }
html body input::placeholder,
html body textarea::placeholder { color: var(--lg-tertiary) !important; }
html body textarea { min-height: 170px !important; resize: vertical !important; }
html body .text-manager-textarea { min-height: 260px !important; line-height: 1.7 !important; }

html body .btn-base,
html body .btn-primary,
html body .btn-secondary,
html body .btn-action,
html body .convert-btn,
html body .download-btn,
html body .upload-btn,
html body .action-btn,
html body .control-btn,
html body .filter-apply-btn,
html body .preset-btn,
html body .btn-edit,
html body .btn-readonly,
html body .btn-save,
html body .btn-confirm-encoding,
html body .btn-test {
  min-height: 46px !important;
  padding: 11px 17px !important;
  border-radius: 12px !important;
  font: inherit !important;
  font-size: .94rem !important;
  font-weight: 680 !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  text-shadow: none !important;
  transition: transform 120ms var(--lg-ease), background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease !important;
}

html body .btn-primary,
html body .btn-action,
html body .convert-btn,
html body .upload-btn { background: var(--lg-accent) !important; color: #fff !important; border: 1px solid var(--lg-accent) !important; box-shadow: 0 8px 18px rgba(23, 105, 210, .2) !important; }
html body .btn-primary:hover:not(:disabled),
html body .btn-action:hover:not(:disabled),
html body .convert-btn:hover:not(:disabled),
html body .upload-btn:hover:not(:disabled) { background: #0d5fc5 !important; transform: translateY(-1px) !important; box-shadow: 0 12px 24px rgba(23, 105, 210, .26) !important; }
html body .btn-secondary,
html body .action-btn,
html body .control-btn,
html body .preset-btn,
html body .btn-edit,
html body .btn-readonly,
html body .btn-save,
html body .btn-confirm-encoding { background: rgba(118, 118, 128, .12) !important; color: var(--lg-ink) !important; border: 1px solid var(--lg-line) !important; }
html body .btn-secondary:hover:not(:disabled),
html body .action-btn:hover:not(:disabled),
html body .control-btn:hover:not(:disabled),
html body .preset-btn:hover:not(:disabled) { background: rgba(118, 118, 128, .2) !important; transform: translateY(-1px) !important; }
html body button:active:not(:disabled) { transform: scale(.98) !important; }
html body button:focus-visible,
html body a:focus-visible,
html body input:focus-visible,
html body select:focus-visible,
html body textarea:focus-visible { outline: 3px solid rgba(23, 105, 210, .55) !important; outline-offset: 3px !important; }

html body .chapter-tabs { margin: 0 0 18px !important; padding: 5px !important; gap: 6px !important; border: 1px solid var(--lg-line) !important; border-radius: 15px !important; background: rgba(118, 118, 128, .1) !important; }
html body .chapter-tab { min-height: 44px !important; border: 0 !important; border-radius: 11px !important; color: var(--lg-muted) !important; font-weight: 650 !important; transition: transform 120ms var(--lg-ease), color 150ms ease, background-color 150ms ease !important; }
html body .chapter-tab.active { background: var(--lg-dense) !important; color: var(--lg-ink) !important; box-shadow: 0 3px 10px rgba(35, 51, 77, .1) !important; }

html body #chaptersPreview { display: grid !important; grid-template-columns: minmax(250px, .74fr) minmax(0, 1.26fr) !important; gap: 0 24px !important; align-items: start !important; }
html body #chaptersPreview > h3,
html body #chaptersPreview > .description-text { grid-column: 1 / -1 !important; }
html body #chaptersPreview > .form-group,
html body #chaptersPreview > .chapter-controls { grid-column: 1 !important; }
html body #chaptersPreview > .chapter-list-wrapper { grid-column: 2 !important; grid-row: 3 / span 4 !important; width: 100% !important; min-width: 0 !important; margin: 0 !important; }
html body #chaptersPreview .chapter-list-container { min-height: 270px !important; max-height: 540px !important; overflow: auto !important; border: 1px solid var(--lg-line) !important; border-radius: 16px !important; background: var(--lg-dense) !important; }
html body .chapter-item { margin: 0 !important; padding: 11px 14px !important; border: 0 !important; border-bottom: 1px solid var(--lg-line) !important; border-radius: 0 !important; background: transparent !important; transition: background-color 140ms ease, transform 140ms var(--lg-ease) !important; }
html body .chapter-item:last-child { border-bottom: 0 !important; }
html body .chapter-item:hover { background: rgba(23, 105, 210, .07) !important; transform: translateX(2px) !important; }

/* Outer shells stay quiet; the inset header/content surfaces carry the hierarchy. */
html body .encoding-text-manager,
html body .repair-section,
html body .settings-section,
html body .chapter-filter-section,
html body .chapters-preview,
html body .custom-styles-section {
  background: rgba(255, 255, 255, .24) !important;
  border-color: rgba(255, 255, 255, .48) !important;
  box-shadow: 0 14px 34px rgba(44, 56, 71, .08) !important;
}

html.theme-dark body .encoding-text-manager,
html[data-theme="dark"] body .encoding-text-manager,
html.theme-dark body .repair-section,
html[data-theme="dark"] body .repair-section,
html.theme-dark body .settings-section,
html[data-theme="dark"] body .settings-section,
html.theme-dark body .chapter-filter-section,
html[data-theme="dark"] body .chapter-filter-section,
html.theme-dark body .chapters-preview,
html[data-theme="dark"] body .chapters-preview,
html.theme-dark body .custom-styles-section,
html[data-theme="dark"] body .custom-styles-section {
  background: rgba(38, 42, 52, .46) !important;
  border-color: rgba(255, 255, 255, .2) !important;
}

html body .multi-select-container,
html body .filter-content,
html body .cover-settings-content,
html body .styles-content { border: 1px solid var(--lg-line) !important; border-radius: 16px !important; }
html body .multi-level-header-setting,
html body .filter-rule-card,
html body .reason-item { border: 1px solid var(--lg-line) !important; border-radius: 14px !important; background: var(--lg-dense) !important; box-shadow: none !important; }
html body .format-tag { min-height: 40px !important; border: 1px solid var(--lg-line-strong) !important; border-radius: 11px !important; background: var(--lg-dense) !important; color: var(--lg-ink) !important; transition: transform 120ms var(--lg-ease), border-color 150ms ease, background-color 150ms ease !important; }
html body .format-tag:hover { background: var(--lg-accent-soft) !important; border-color: rgba(23, 105, 210, .36) !important; }

html body .custom-format-modal,
html body .chapter-preview-overlay,
html body .preview-modal-overlay { background: rgba(17, 25, 39, .38) !important; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
html body .modal-content,
html body .chapter-preview-content,
html body .preview-modal { background: var(--lg-dense) !important; color: var(--lg-ink) !important; border: 1px solid var(--lg-edge) !important; border-radius: 20px !important; box-shadow: var(--lg-shadow-float) !important; }
html body .modal-title,
html body .modal-content h3,
html body .modal-content h4,
html body .modal-content label { color: var(--lg-ink) !important; }

/* Higher-specificity theme rules keep older legacy overrides from restoring the blue wash. */
html.theme-light body .file-upload-section,
html[data-theme="light"] body .file-upload-section,
html.theme-light body .encoding-text-manager,
html[data-theme="light"] body .encoding-text-manager,
html.theme-light body .settings-section,
html[data-theme="light"] body .settings-section,
html.theme-light body .chapters-preview,
html[data-theme="light"] body .chapters-preview,
html.theme-light body .chapter-filter-section,
html[data-theme="light"] body .chapter-filter-section,
html.theme-light body .custom-styles-section,
html[data-theme="light"] body .custom-styles-section,
html.theme-light body .result,
html[data-theme="light"] body .result,
html.theme-light body .progress {
  background: linear-gradient(135deg, var(--lg-glass-strong), var(--lg-glass)) !important;
  border-color: var(--lg-edge) !important;
}

html.theme-light body .manager-content,
html[data-theme="light"] body .manager-content,
html.theme-light body .basic-info-content,
html[data-theme="light"] body .basic-info-content,
html.theme-light body .cover-settings-content,
html[data-theme="light"] body .cover-settings-content,
html.theme-light body .styles-content,
html[data-theme="light"] body .styles-content,
html.theme-light body .filter-content,
html[data-theme="light"] body .filter-content,
html.theme-light body .multi-select-container,
html[data-theme="light"] body .multi-select-container {
  background: var(--lg-dense) !important;
}

@keyframes lg-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  html body .settings-section > form { grid-template-columns: 1fr !important; }
  html body .settings-section > form > .basic-info-section,
  html body .settings-section > form > .cover-settings-section,
  html body .settings-section > form > .form-group:has(.chapter-tabs),
  html body .settings-section > form > .custom-styles-section,
  html body .settings-section > form > #chaptersPreview { grid-column: 1 !important; }
  html body #chaptersPreview { grid-template-columns: 1fr !important; gap: 18px !important; }
  html body #chaptersPreview > .chapter-list-wrapper { grid-column: 1 !important; grid-row: auto !important; }
}

@media (max-width: 640px) {
  html body .container { width: calc(100% - 24px) !important; }
  html body .header { padding: 42px 0 26px !important; }
  html body .header h1 { font-size: 2.8rem !important; }
  html body .workspace-title { gap: .24em !important; }
  html body .header p { font-size: .98rem !important; }
  html body .content { gap: 16px !important; padding-bottom: 88px !important; }
  html body .file-upload-section { min-height: 208px !important; padding: 24px !important; grid-template-columns: 56px minmax(0, 1fr) !important; grid-template-areas: "icon title" "status status" "action action" !important; gap: 15px !important; }
  html body .upload-icon { width: 56px !important; height: 56px !important; line-height: 56px !important; border-radius: 17px !important; font-size: 1.75rem !important; }
  html body .file-upload-section h3 { font-size: 1.15rem !important; }
  html body .file-upload-section .upload-btn { grid-area: action !important; width: 100% !important; }
  html body .section-header,
  html body .repair-header,
  html body .cover-settings-section > .section-header,
  html body .custom-styles-section > .section-header { padding: 16px 18px !important; }
  html body .encoding-text-manager > .section-header,
  html body .repair-section > .repair-header,
  html body .basic-info-section > .section-header,
  html body .cover-settings-section > .section-header,
  html body .custom-styles-section > .section-header,
  html body .chapter-filter-section > .section-header { width: calc(100% - 20px) !important; margin: 10px auto 0 !important; }
  html body .manager-content,
  html body .basic-info-content,
  html body .cover-settings-content,
  html body .styles-content,
  html body .filter-content { padding: 22px 18px !important; }
  html body .encoding-text-manager > .manager-content,
  html body .repair-section > .manager-content,
  html body .basic-info-section > .basic-info-content,
  html body .cover-settings-section > .cover-settings-content,
  html body .custom-styles-section > .styles-content,
  html body .chapter-filter-section > .filter-content { width: calc(100% - 20px) !important; margin: 10px auto 12px !important; padding: 20px 16px !important; }
  html body .settings-section > h3#settingsTitle { padding: 24px 18px 8px !important; }
  html body .settings-section > form { padding: 0 18px 24px !important; }
  html body .btn-base,
  html body .btn-primary,
  html body .btn-secondary,
  html body .btn-action,
  html body .convert-btn,
  html body .download-btn,
  html body .upload-btn,
  html body .action-btn,
  html body .control-btn,
  html body .filter-apply-btn,
  html body .preset-btn,
  html body .btn-edit,
  html body .btn-readonly,
  html body .btn-save,
  html body .btn-confirm-encoding,
  html body .btn-test { white-space: normal !important; min-height: 46px !important; }
  html body .convert-buttons { position: sticky !important; bottom: 0 !important; z-index: 40 !important; margin: 0 -12px !important; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) !important; background: rgba(248, 250, 253, .86) !important; border-top: 1px solid var(--lg-line) !important; -webkit-backdrop-filter: blur(18px) saturate(135%); backdrop-filter: blur(18px) saturate(135%); }
  html body .convert-buttons .convert-btn { width: 100% !important; }
}

html.theme-dark body .mobile-menu,
html[data-theme="dark"] body .mobile-menu {
  background: rgba(28, 31, 39, .9) !important;
  border-left-color: var(--lg-line) !important;
}

html.theme-dark body .convert-buttons,
html[data-theme="dark"] body .convert-buttons {
  background: rgba(23, 26, 33, .9) !important;
}

@media (max-width: 640px) {
  html body .convert-buttons { border-radius: 16px 16px 0 0 !important; }
}

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

@media (prefers-reduced-transparency: reduce) {
  html body .unified-navbar,
  html body .navbar,
  html body .file-upload-section,
  html body .encoding-text-manager,
  html body .settings-section,
  html body .chapters-preview,
  html body .chapter-filter-section,
  html body .custom-styles-section,
  html body .result,
  html body .progress,
  html body .convert-buttons { background: var(--lg-dense) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}

@media (prefers-contrast: more), (forced-colors: active) {
  html body .file-upload-section,
  html body .encoding-text-manager,
  html body .settings-section,
  html body .chapters-preview,
  html body .chapter-filter-section,
  html body .custom-styles-section,
  html body .result,
  html body .progress,
  html body input,
  html body select,
  html body textarea,
  html body .chapter-list-container { background: Canvas !important; color: CanvasText !important; border: 1px solid CanvasText !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  html body .file-upload-section::before,
  html body .encoding-text-manager::before,
  html body .settings-section::before,
  html body .chapters-preview::before,
  html body .chapter-filter-section::before,
  html body .custom-styles-section::before,
  html body .result::before,
  html body .progress::before { display: none !important; }
}

/* Precision pass: keep inset surfaces inside their shells and center all title bars. */
html body .encoding-text-manager > .section-header,
html body .repair-section > .repair-header,
html body .basic-info-section > .section-header,
html body .cover-settings-section > .section-header,
html body .custom-styles-section > .section-header,
html body .chapter-filter-section > .section-header {
  box-sizing: border-box !important;
  min-height: 68px !important;
  height: 68px !important;
  margin: 12px 16px !important;
  padding: 0 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  line-height: 1.3 !important;
}

html body .encoding-text-manager > .section-header .encoding-title,
html body .repair-section > .repair-header .repair-title,
html body .basic-info-section > .section-header .filename-preview-compact,
html body .chapter-filter-section > .section-header h3,
html body .cover-settings-section > .section-header h3,
html body .custom-styles-section > .section-header h3 {
  min-width: 0 !important;
  margin: 0 !important;
  line-height: 1.3 !important;
}

html body .encoding-text-manager > .section-header .encoding-title,
html body .repair-section > .repair-header .repair-title {
  display: inline-flex !important;
  align-items: center !important;
}

html body .chapter-filter-section > .section-header h3,
html body .cover-settings-section > .section-header h3,
html body .custom-styles-section > .section-header h3 {
  flex: 1 1 auto !important;
}

html body .basic-info-section > .section-header .filename-preview-compact {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  flex: 1 1 auto !important;
  min-height: 40px !important;
  padding: 0 12px !important;
  border-radius: 11px !important;
  text-align: right !important;
  overflow-wrap: anywhere !important;
}

html body .encoding-text-manager > .manager-content,
html body .repair-section > .manager-content,
html body .settings-section > .manager-content,
html body .basic-info-section > .basic-info-content,
html body .cover-settings-section > .cover-settings-content,
html body .custom-styles-section > .styles-content,
html body .chapter-filter-section > .filter-content {
  box-sizing: border-box !important;
}

/* The list frame owns its border; only the list itself scrolls. This avoids the
   legacy wrapper's 500px clipping and negative scrollbar compensation. */
html body #chaptersPreview {
  overflow: visible !important;
}

html body #chaptersPreview > .chapter-list-wrapper {
  box-sizing: border-box !important;
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 12px 12px 14px !important;
  overflow: visible !important;
  border: 1px solid var(--lg-line) !important;
  border-radius: 16px !important;
  background: var(--lg-dense) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .58), 0 8px 20px rgba(42, 53, 68, .05) !important;
}

html body #chaptersPreview .chapter-list-container {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 260px !important;
  height: min(500px, 62vh) !important;
  max-height: 500px !important;
  margin: 0 !important;
  padding: 0 30px 0 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  border: 1px solid var(--lg-line) !important;
  border-radius: 12px !important;
  background: var(--lg-dense) !important;
}

html body #chaptersPreview .custom-scrollbar {
  top: 18px !important;
  right: 1px !important;
  bottom: 20px !important;
  width: 8px !important;
}

html body #chaptersPreview .scrollbar-track {
  margin: 0 !important;
  background: rgba(118, 118, 128, .14) !important;
}

@media (max-width: 640px) {
  html body .encoding-text-manager > .section-header,
  html body .repair-section > .repair-header,
  html body .basic-info-section > .section-header,
  html body .cover-settings-section > .section-header,
  html body .custom-styles-section > .section-header,
  html body .chapter-filter-section > .section-header {
    height: auto !important;
    min-height: 60px !important;
    margin: 10px auto !important;
    padding: 0 16px !important;
  }

  html body .basic-info-section > .section-header .filename-preview-compact {
    min-height: 38px !important;
    justify-content: flex-start !important;
    text-align: left !important;
  }

  html body #chaptersPreview > .chapter-list-wrapper {
    padding: 10px 10px 12px !important;
  }

  html body #chaptersPreview .chapter-list-container {
    height: min(460px, 58vh) !important;
    min-height: 220px !important;
    padding-right: 26px !important;
  }

  html body #chaptersPreview .custom-scrollbar {
    top: 16px !important;
    right: 1px !important;
    bottom: 18px !important;
    width: 8px !important;
  }
}

/* 2026-09 workbench refinement.
   This pass replaces the retired saturated glass layer and keeps the first
   task compact, readable, and consistent across light and dark themes. */
html.theme-light,
html[data-theme="light"],
html.theme-light body,
html[data-theme="light"] body {
  background:
    linear-gradient(118deg, rgba(112, 143, 136, .12), transparent 42%),
    linear-gradient(302deg, rgba(183, 145, 112, .1), transparent 38%),
    linear-gradient(145deg, #f3f4f1 0%, #e7e9e5 100%) !important;
  color: var(--lg-ink) !important;
}

html.theme-dark,
html[data-theme="dark"],
html.theme-dark body,
html[data-theme="dark"] body {
  background:
    linear-gradient(118deg, rgba(116, 147, 138, .1), transparent 42%),
    linear-gradient(302deg, rgba(139, 108, 80, .08), transparent 38%),
    linear-gradient(145deg, #202422 0%, #171a19 100%) !important;
}

html body .header {
  display: flex !important;
  align-items: flex-end !important;
  justify-content: space-between !important;
  gap: 28px !important;
  padding: 38px 2px 26px !important;
  text-align: left !important;
}

html body .header-copy { min-width: 0; }

html body .workspace-brand {
  display: flex;
  align-items: center;
  width: 210px;
  height: 126px;
  margin: 0 0 16px;
  overflow: hidden;
}

html body .workspace-brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

html.theme-dark body .workspace-brand-logo,
html[data-theme="dark"] body .workspace-brand-logo {
  filter: invert(1) brightness(1.12);
}

html body .workspace-kicker {
  display: block;
  margin-bottom: 9px;
  color: var(--lg-accent);
  font-size: .72rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: .12em !important;
}

html body .header h1 {
  margin: 0 !important;
  font-family: "得意黑", "HarmonyOS Sans SC", "Noto Sans SC", "Segoe UI", "Microsoft YaHei UI", sans-serif !important;
  font-style: normal !important;
  font-synthesis: none !important;
  color: var(--lg-ink) !important;
  font-size: 3rem !important;
  font-weight: 760 !important;
  line-height: 1.05 !important;
  letter-spacing: 0 !important;
}

html body .workspace-title {
  display: inline-flex !important;
  align-items: center !important;
  gap: .28em !important;
  max-width: 100% !important;
}

html body .workspace-title-logo {
  display: block !important;
  flex: 0 0 auto !important;
  width: .86em !important;
  height: 1.02em !important;
  object-fit: contain !important;
  object-position: center !important;
  filter: drop-shadow(0 5px 10px rgba(20, 26, 42, .12)) !important;
}

html.theme-dark body .workspace-title-logo,
html[data-theme="dark"] body .workspace-title-logo {
  filter: invert(1) drop-shadow(0 5px 10px rgba(0, 0, 0, .28)) !important;
}

html body .workspace-title > span {
  min-width: 0 !important;
  white-space: nowrap !important;
}

html body .header h1::before {
  content: none !important;
  display: none !important;
}

html body .header p {
  margin: 10px 0 0 !important;
  color: var(--lg-muted) !important;
  font-size: .94rem !important;
  line-height: 1.4 !important;
}

html body .header::after { content: none !important; }

html body .workspace-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--lg-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .52);
  color: var(--lg-muted);
  font-size: .82rem;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .64);
  -webkit-backdrop-filter: blur(16px) saturate(125%);
  backdrop-filter: blur(16px) saturate(125%);
}

html body .workspace-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b966f;
  box-shadow: 0 0 0 4px rgba(59, 150, 111, .12);
}

html.theme-dark body .workspace-status,
html[data-theme="dark"] body .workspace-status {
  background: rgba(49, 56, 53, .72);
}

html.theme-light body .unified-navbar,
html[data-theme="light"] body .unified-navbar,
html.theme-light body .navbar,
html[data-theme="light"] body .navbar {
  background: rgba(247, 249, 246, .72) !important;
  border-bottom-color: rgba(48, 57, 55, .12) !important;
  box-shadow: 0 8px 26px rgba(43, 55, 50, .06) !important;
}

html.theme-light body .file-upload-section,
html[data-theme="light"] body .file-upload-section,
html.theme-light body .encoding-text-manager,
html[data-theme="light"] body .encoding-text-manager,
html.theme-light body .settings-section,
html[data-theme="light"] body .settings-section,
html.theme-light body .chapters-preview,
html[data-theme="light"] body .chapters-preview,
html.theme-light body .chapter-filter-section,
html[data-theme="light"] body .chapter-filter-section,
html.theme-light body .custom-styles-section,
html[data-theme="light"] body .custom-styles-section,
html.theme-light body .result,
html[data-theme="light"] body .result,
html.theme-light body .progress,
html[data-theme="light"] body .progress {
  background: linear-gradient(135deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .56)) !important;
  border-color: rgba(255, 255, 255, .9) !important;
  box-shadow: 0 18px 48px rgba(45, 57, 52, .1), inset 0 1px 0 rgba(255, 255, 255, .72) !important;
  -webkit-backdrop-filter: blur(22px) saturate(130%) !important;
  backdrop-filter: blur(22px) saturate(130%) !important;
}

html.theme-dark body .file-upload-section,
html[data-theme="dark"] body .file-upload-section,
html.theme-dark body .encoding-text-manager,
html[data-theme="dark"] body .encoding-text-manager,
html.theme-dark body .settings-section,
html[data-theme="dark"] body .settings-section,
html.theme-dark body .chapters-preview,
html[data-theme="dark"] body .chapters-preview,
html.theme-dark body .chapter-filter-section,
html[data-theme="dark"] body .chapter-filter-section,
html.theme-dark body .custom-styles-section,
html[data-theme="dark"] body .custom-styles-section,
html.theme-dark body .result,
html[data-theme="dark"] body .result,
html.theme-dark body .progress,
html[data-theme="dark"] body .progress {
  background: linear-gradient(135deg, rgba(54, 61, 58, .84), rgba(39, 44, 42, .72)) !important;
  border-color: rgba(237, 238, 233, .18) !important;
  box-shadow: 0 20px 52px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .1) !important;
  -webkit-backdrop-filter: blur(22px) saturate(125%) !important;
  backdrop-filter: blur(22px) saturate(125%) !important;
}

html body .content {
  gap: 14px !important;
  padding-bottom: 64px !important;
}

html body .file-upload-section {
  min-height: 148px !important;
  padding: 26px 30px !important;
  grid-template-columns: 62px minmax(0, 1fr) auto !important;
  grid-template-areas:
    "icon title action"
    "icon status action" !important;
  column-gap: 20px !important;
  row-gap: 2px !important;
  border-radius: 18px !important;
}

html body .file-upload-section h3 {
  margin: 0 !important;
  align-self: end !important;
  font-size: 1.24rem !important;
  line-height: 1.25 !important;
}

html body .file-upload-section > #uploadDescription,
html body .file-upload-section > .upload-status-message {
  grid-area: status !important;
  align-self: start !important;
  margin: 5px 0 0 !important;
  color: var(--lg-muted) !important;
  font-size: .86rem !important;
  line-height: 1.35 !important;
}

html body .file-upload-section.file-selected > #uploadDescription { display: none !important; }

html body .upload-icon {
  position: relative;
  display: inline-flex !important;
  grid-area: icon !important;
  width: 62px !important;
  height: 62px !important;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(95, 123, 118, .16);
  border-radius: 16px !important;
  background: var(--lg-accent-soft) !important;
  color: var(--lg-accent) !important;
  font-size: .76rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: .06em !important;
}

html body .upload-icon::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  opacity: .36;
}

html body .file-upload-section .upload-btn {
  min-width: 118px !important;
  min-height: 44px !important;
  padding: 10px 16px !important;
  border-radius: 10px !important;
}

html body .encoding-text-manager > .section-header,
html body .repair-section > .repair-header {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 60px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 22px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--lg-ink) !important;
  font: inherit !important;
  text-align: left !important;
  cursor: pointer !important;
}

html body .encoding-text-manager > .section-header:hover,
html body .repair-section > .repair-header:hover {
  background: rgba(96, 125, 120, .08) !important;
}

html body .encoding-text-manager > .manager-content,
html body .repair-section > .manager-content {
  box-sizing: border-box !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 22px !important;
  border: 0 !important;
  border-top: 1px solid var(--lg-line) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, .46) !important;
  box-shadow: none !important;
}

html.theme-dark body .encoding-text-manager > .manager-content,
html[data-theme="dark"] body .encoding-text-manager > .manager-content,
html.theme-dark body .repair-section > .manager-content,
html[data-theme="dark"] body .repair-section > .manager-content {
  background: rgba(29, 34, 32, .48) !important;
}

html body .collapse-indicator {
  display: inline-block;
  transition: transform 180ms var(--lg-ease) !important;
}

html body .section-header[aria-expanded="true"] > .collapse-indicator,
html body .repair-header[aria-expanded="true"] .collapse-indicator {
  transform: rotate(90deg);
}

html body #settingsSection {
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

html body #settingsSection::before { display: none !important; }

html body #settingsSection > h3#settingsTitle {
  padding: 18px 2px 12px !important;
  font-size: 1.22rem !important;
}

html body #settingsSection > form { padding: 0 !important; }

html body .convert-buttons.hidden { display: none !important; }

@media (max-width: 640px) {
  html body .container { width: calc(100% - 24px) !important; }

  html body .header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
    padding: 28px 0 20px !important;
  }

  html body .workspace-kicker { margin-bottom: 7px; font-size: .65rem; }
  html body .workspace-brand { width: 154px; height: 92px; margin-bottom: 12px; }
  html body .header h1 { font-size: 2.16rem !important; }
  html body .header p { margin-top: 7px !important; font-size: .84rem !important; }

  html body .workspace-status {
    min-height: 34px;
    padding: 7px 9px;
    font-size: .74rem;
  }

  html body .content { gap: 12px !important; padding-bottom: 48px !important; }

  html body .file-upload-section {
    min-height: 164px !important;
    padding: 20px !important;
    grid-template-columns: 52px minmax(0, 1fr) !important;
    grid-template-areas:
      "icon title"
      "icon status"
      "action action" !important;
    column-gap: 14px !important;
    row-gap: 3px !important;
    border-radius: 16px !important;
  }

  html body .upload-icon {
    width: 52px !important;
    height: 52px !important;
    border-radius: 14px !important;
    font-size: .68rem !important;
  }

  html body .file-upload-section h3 { font-size: 1.08rem !important; }
  html body .file-upload-section .upload-btn { grid-area: action !important; width: 100% !important; margin-top: 12px !important; }

  html body .encoding-text-manager > .section-header,
  html body .repair-section > .repair-header {
    width: 100% !important;
    min-height: 58px !important;
    margin: 0 !important;
    padding: 0 16px !important;
  }

  html body .encoding-text-manager > .manager-content,
  html body .repair-section > .manager-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 18px 16px !important;
  }

  html body .convert-buttons {
    margin: 0 -12px !important;
  }

  html body .convert-buttons.hidden {
    display: none !important;
    position: static !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .collapse-indicator { transition: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  html body .workspace-status,
  html.theme-light body .file-upload-section,
  html[data-theme="light"] body .file-upload-section,
  html.theme-dark body .file-upload-section,
  html[data-theme="dark"] body .file-upload-section {
    background: var(--lg-dense) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  html body #chaptersPreview > .chapter-list-wrapper,
  html body #chaptersPreview .chapter-list-container {
    background: var(--lg-dense) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-contrast: more), (forced-colors: active) {
  html body #chaptersPreview > .chapter-list-wrapper,
  html body #chaptersPreview .chapter-list-container {
    background: Canvas !important;
    color: CanvasText !important;
    border-color: CanvasText !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Color system pass: porcelain surfaces, graphite text, and a restrained
   sea-glass accent replace the legacy saturated blue wash. */
:root {
  --lg-bg: #f1f1ee;
  --lg-bg-deep: #e4e5e1;
  --lg-ink: #303937;
  --lg-muted: #6b7470;
  --lg-tertiary: #929a96;
  --lg-accent: #5f7b76;
  --lg-accent-soft: #e3ebe8;
  --lg-glass: rgba(255, 255, 255, .68);
  --lg-glass-strong: rgba(255, 255, 255, .84);
  --lg-dense: rgba(255, 255, 255, .95);
  --lg-line: rgba(48, 57, 55, .15);
  --lg-line-strong: rgba(48, 57, 55, .25);
  --lg-edge: rgba(255, 255, 255, .86);
  --lg-shadow: 0 22px 58px rgba(55, 62, 58, .11), 0 3px 10px rgba(55, 62, 58, .05);
  --lg-shadow-float: 0 28px 70px rgba(55, 62, 58, .16), 0 8px 20px rgba(55, 62, 58, .07);
  --color-primary: #5f7b76;
  --color-primary-dark: #506963;
  --color-primary-light: #e3ebe8;
  --color-primary-lighter: #f1f6f4;
  --color-primary-rgb: 96, 125, 120;
  --workspace-bg: var(--lg-bg);
  --workspace-surface: var(--lg-dense);
  --workspace-surface-soft: var(--lg-glass-strong);
  --workspace-blue: var(--lg-accent);
}

:root.theme-dark,
:root[data-theme="dark"] {
  --lg-bg: #202322;
  --lg-bg-deep: #171a19;
  --lg-ink: #edeee9;
  --lg-muted: #aeb5af;
  --lg-tertiary: #8d9791;
  --lg-accent: #9db4ac;
  --lg-accent-soft: rgba(157, 180, 172, .18);
  --lg-glass: rgba(48, 54, 52, .76);
  --lg-glass-strong: rgba(58, 65, 62, .86);
  --lg-dense: rgba(40, 45, 43, .95);
  --lg-line: rgba(237, 238, 233, .16);
  --lg-line-strong: rgba(237, 238, 233, .28);
  --lg-edge: rgba(237, 238, 233, .24);
  --lg-shadow: 0 22px 58px rgba(0, 0, 0, .3), 0 3px 10px rgba(0, 0, 0, .2);
  --lg-shadow-float: 0 28px 70px rgba(0, 0, 0, .44), 0 8px 20px rgba(0, 0, 0, .24);
  --color-primary: #9db4ac;
  --color-primary-dark: #819a92;
  --color-primary-light: rgba(157, 180, 172, .18);
  --color-primary-lighter: rgba(157, 180, 172, .1);
  --color-primary-rgb: 157, 180, 172;
  --workspace-bg: var(--lg-bg);
  --workspace-surface: var(--lg-dense);
  --workspace-surface-soft: var(--lg-glass-strong);
  --workspace-blue: var(--lg-accent);
}

html,
html body {
  background:
    radial-gradient(850px 480px at 0% -8%, rgba(143, 164, 160, .18), transparent 70%),
    radial-gradient(760px 500px at 100% 8%, rgba(191, 163, 136, .14), transparent 72%),
    linear-gradient(140deg, var(--lg-bg), var(--lg-bg-deep)) !important;
  color: var(--lg-ink) !important;
}

html.theme-dark body,
html[data-theme="dark"] body {
  background:
    radial-gradient(850px 480px at 0% -8%, rgba(108, 133, 125, .2), transparent 70%),
    radial-gradient(760px 500px at 100% 8%, rgba(145, 117, 88, .12), transparent 72%),
    linear-gradient(140deg, var(--lg-bg), var(--lg-bg-deep)) !important;
}

html body .unified-navbar,
html body .navbar {
  background: rgba(255, 255, 255, .64) !important;
  border-bottom-color: var(--lg-line) !important;
  box-shadow: 0 8px 24px rgba(35, 51, 53, .08) !important;
}

html.theme-dark body .unified-navbar,
html[data-theme="dark"] body .unified-navbar,
html.theme-dark body .navbar,
html[data-theme="dark"] body .navbar {
  background: rgba(31, 42, 42, .8) !important;
  border-bottom-color: var(--lg-line) !important;
}

html body .file-upload-section,
html body .encoding-text-manager,
html body .settings-section,
html body .chapters-preview,
html body .chapter-filter-section,
html body .custom-styles-section,
html body .result,
html body .progress {
  background: var(--lg-glass) !important;
  border-color: var(--lg-edge) !important;
  box-shadow: var(--lg-shadow) !important;
}

html body .section-header,
html body .repair-header,
html body .cover-settings-section > .section-header,
html body .custom-styles-section > .section-header {
  background: var(--lg-glass-strong) !important;
  border-bottom-color: var(--lg-line) !important;
  color: var(--lg-ink) !important;
}

html body .section-header:hover,
html body .repair-header:hover {
  background: rgba(96, 125, 120, .1) !important;
}

html.theme-dark body .section-header:hover,
html[data-theme="dark"] body .section-header:hover,
html.theme-dark body .repair-header:hover,
html[data-theme="dark"] body .repair-header:hover {
  background: rgba(157, 180, 172, .13) !important;
}

html body .manager-content,
html body .basic-info-content,
html body .cover-settings-content,
html body .styles-content,
html body .filter-content,
html body .multi-select-container,
html body #chaptersPreview > .chapter-list-wrapper,
html body #chaptersPreview .chapter-list-container,
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html body select,
html body textarea {
  background: var(--lg-dense) !important;
  color: var(--lg-ink) !important;
  border-color: var(--lg-line-strong) !important;
}

html body .upload-icon {
  background: var(--lg-accent-soft) !important;
  color: var(--lg-accent) !important;
}

html body .btn-primary,
html body .btn-action,
html body .convert-btn,
html body .upload-btn,
html body .filter-apply-btn {
  background: var(--lg-accent) !important;
  border-color: var(--lg-accent) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(96, 125, 120, .2) !important;
}

html body .btn-primary:hover:not(:disabled),
html body .btn-action:hover:not(:disabled),
html body .convert-btn:hover:not(:disabled),
html body .upload-btn:hover:not(:disabled),
html body .filter-apply-btn:hover:not(:disabled) {
  background: #506a66 !important;
  border-color: #506a66 !important;
}

html.theme-dark body .btn-primary,
html[data-theme="dark"] body .btn-primary,
html.theme-dark body .btn-action,
html[data-theme="dark"] body .btn-action,
html.theme-dark body .convert-btn,
html[data-theme="dark"] body .convert-btn,
html.theme-dark body .upload-btn,
html[data-theme="dark"] body .upload-btn,
html.theme-dark body .filter-apply-btn,
html[data-theme="dark"] body .filter-apply-btn {
  background: #718c85 !important;
  border-color: #718c85 !important;
  color: #18201e !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .24) !important;
}

html.theme-dark body .btn-primary:hover:not(:disabled),
html[data-theme="dark"] body .btn-primary:hover:not(:disabled),
html.theme-dark body .btn-action:hover:not(:disabled),
html[data-theme="dark"] body .btn-action:hover:not(:disabled),
html.theme-dark body .convert-btn:hover:not(:disabled),
html[data-theme="dark"] body .convert-btn:hover:not(:disabled),
html.theme-dark body .upload-btn:hover:not(:disabled),
html[data-theme="dark"] body .upload-btn:hover:not(:disabled),
html.theme-dark body .filter-apply-btn:hover:not(:disabled),
html[data-theme="dark"] body .filter-apply-btn:hover:not(:disabled) {
  background: #829c94 !important;
  border-color: #829c94 !important;
  color: #18201e !important;
}

html body .file-upload-section:hover {
  border-color: rgba(96, 125, 120, .38) !important;
}

html body .file-upload-section:focus-within {
  border-color: rgba(96, 125, 120, .62) !important;
  box-shadow: 0 0 0 4px rgba(96, 125, 120, .16), var(--lg-shadow) !important;
}

html body .nav-link:hover,
html body .nav-link-right:hover,
html body .theme-toggle-btn:hover,
html body .nav-link.active,
html body .nav-link-right.active {
  color: var(--lg-accent) !important;
  background: rgba(96, 125, 120, .12) !important;
}

html.theme-dark body .nav-link:hover,
html[data-theme="dark"] body .nav-link:hover,
html.theme-dark body .nav-link-right:hover,
html[data-theme="dark"] body .nav-link-right:hover,
html.theme-dark body .theme-toggle-btn:hover,
html[data-theme="dark"] body .theme-toggle-btn:hover,
html.theme-dark body .nav-link.active,
html[data-theme="dark"] body .nav-link.active,
html.theme-dark body .nav-link-right.active,
html[data-theme="dark"] body .nav-link-right.active {
  color: var(--lg-accent) !important;
  background: rgba(157, 180, 172, .16) !important;
}

html body .encoding-badge,
html body .repair-badge,
html body .beta-badge,
html body .beta-badge-mini {
  border-color: rgba(96, 125, 120, .22) !important;
}

html body button:focus-visible,
html body a:focus-visible,
html body input:focus-visible,
html body select:focus-visible,
html body textarea:focus-visible {
  outline-color: rgba(96, 125, 120, .64) !important;
}

html body .filter-rule-card:hover {
  border-color: rgba(96, 125, 120, .38) !important;
  box-shadow: 0 6px 16px rgba(96, 125, 120, .1) !important;
}

html body input[type="checkbox"],
html body input[type="radio"] {
  accent-color: var(--lg-accent) !important;
}

html body .progress-bar {
  background: linear-gradient(90deg, var(--lg-accent), #829c94) !important;
  box-shadow: 0 0 16px rgba(96, 125, 120, .24) !important;
}

html body::-webkit-scrollbar-thumb,
html body *::-webkit-scrollbar-thumb {
  background: rgba(96, 125, 120, .38) !important;
  border-color: transparent !important;
}

html body::-webkit-scrollbar-thumb:hover,
html body *::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 125, 120, .56) !important;
}

html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
html body select:focus,
html body textarea:focus {
  border-color: var(--lg-accent) !important;
  box-shadow: 0 0 0 4px rgba(96, 125, 120, .18) !important;
}

html body .format-tag.active,
html body .chapter-tab.active {
  background: var(--lg-accent-soft) !important;
  border-color: var(--lg-accent) !important;
  color: var(--lg-accent) !important;
}

html body .chapter-item:hover,
html body .format-tag:hover {
  background: rgba(96, 125, 120, .1) !important;
  border-color: rgba(96, 125, 120, .38) !important;
}

html body .switch-input:checked + .switch-label {
  background: var(--lg-accent) !important;
}

/* Footer signature stays readable over both the page background and glass shells. */
html body .footer {
  box-sizing: border-box !important;
  width: min(1180px, calc(100% - 48px)) !important;
  margin: 34px auto 0 !important;
  padding: 0 0 28px !important;
  border-top: 0 !important;
  color: var(--lg-muted) !important;
  text-align: center !important;
}

html body .footer .version-display {
  position: relative !important;
  isolation: isolate !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  margin: 16px auto 0 !important;
  padding: 8px 16px !important;
  color: var(--lg-muted) !important;
  font-size: .82rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  letter-spacing: .04em !important;
  background: linear-gradient(135deg, rgba(255, 255, 255, .045), rgba(64, 194, 235, .14)) !important;
  border: 1px solid rgba(255, 255, 255, .46) !important;
  border-radius: 26px !important;
  box-shadow:
    0 16px 34px rgba(18, 32, 52, .14),
    inset 0 1px 0 rgba(255, 255, 255, .52),
    inset 0 -1px 0 rgba(255, 255, 255, .16) !important;
  -webkit-backdrop-filter: blur(22px) saturate(155%) !important;
  backdrop-filter: blur(22px) saturate(155%) !important;
}

html body .footer .version-display .version-logo {
  position: relative !important;
  z-index: 1 !important;
  width: 176px !important;
  height: 86px !important;
  object-fit: contain !important;
  opacity: .78 !important;
}

/* The footer uses the same independent sweep layer as the functional glass panels. */
html body .footer .version-display .footer-surface-sweep {
  content: "" !important;
  position: absolute !important;
  z-index: 0 !important;
  top: -45% !important;
  bottom: -45% !important;
  left: -38% !important;
  width: 34% !important;
  pointer-events: none !important;
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,.1) 18%, rgba(255,255,255,.82) 50%, rgba(146,204,255,.3) 72%, transparent 100%) !important;
  filter: blur(3px) !important;
  opacity: .62;
  transform: translate3d(-115%, 0, 0) rotate(12deg);
  will-change: transform, opacity;
  animation: liquid-surface-sweep 7s cubic-bezier(.77,0,.175,1) infinite !important;
}

html body .footer .version-display::after { display: none !important; }

html.theme-dark body .footer .version-display .footer-surface-sweep,
html[data-theme="dark"] body .footer .version-display .footer-surface-sweep {
  background: linear-gradient(100deg, transparent 0%, rgba(174,222,255,.08) 22%, rgba(193,213,255,.42) 50%, rgba(132,142,255,.2) 68%, transparent 100%) !important;
  opacity: .56;
}

@media (hover: hover) and (pointer: fine) {
  html body .footer .version-display {
    transition: transform 180ms cubic-bezier(.23, 1, .32, 1) !important;
  }

  html body .footer .version-display:hover {
    transform: translateY(-3px) perspective(900px) rotateX(.45deg) !important;
  }
}

html.theme-dark body .footer .version-display,
html[data-theme="dark"] body .footer .version-display {
  background: linear-gradient(135deg, rgba(40, 56, 76, .28), rgba(40, 128, 156, .2)) !important;
  border-color: rgba(255, 255, 255, .3) !important;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, .28),
    inset 0 1px 0 rgba(255, 255, 255, .36),
    inset 0 -1px 0 rgba(0, 0, 0, .18) !important;
}

@media (prefers-reduced-motion: reduce) {
  html body .footer .version-display .footer-surface-sweep {
    animation: none !important;
    display: none !important;
  }
}

html body .repair-badge {
  background: rgba(38, 138, 99, .13) !important;
  color: #23764f !important;
}

html.theme-dark body .repair-badge,
html[data-theme="dark"] body .repair-badge {
  background: rgba(157, 180, 172, .2) !important;
  color: #c6d8d0 !important;
}

@media (prefers-contrast: more), (forced-colors: active) {
  html body,
  html.theme-dark body,
  html[data-theme="dark"] body { background: Canvas !important; color: CanvasText !important; }
}

@media (prefers-reduced-transparency: reduce) {
  html body .unified-navbar,
  html body .navbar,
  html body .file-upload-section,
  html body .encoding-text-manager,
  html body .settings-section,
  html body .chapters-preview,
  html body .chapter-filter-section,
  html body .custom-styles-section,
  html body .result,
  html body .progress,
  html body .section-header,
  html body .repair-header,
  html body .manager-content,
  html body .basic-info-content,
  html body .cover-settings-content,
  html body .styles-content,
  html body .filter-content,
  html body .multi-select-container,
  html body #chaptersPreview > .chapter-list-wrapper,
  html body #chaptersPreview .chapter-list-container {
    background: var(--lg-dense) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-contrast: more), (forced-colors: active) {
  html body .file-upload-section,
  html body .encoding-text-manager,
  html body .settings-section,
  html body .chapters-preview,
  html body .chapter-filter-section,
  html body .custom-styles-section,
  html body .result,
  html body .progress,
  html body .section-header,
  html body .repair-header,
  html body .manager-content,
  html body .basic-info-content,
  html body .cover-settings-content,
  html body .styles-content,
  html body .filter-content,
  html body .multi-select-container,
  html body #chaptersPreview > .chapter-list-wrapper,
  html body #chaptersPreview .chapter-list-container,
  html body input,
  html body select,
  html body textarea,
  html body button {
    background: Canvas !important;
    color: CanvasText !important;
    border-color: CanvasText !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Live palette override: cool blue refraction, translucent white surfaces. */
html.theme-light body .btn-primary,
html[data-theme="light"] body .btn-primary,
html.theme-light body .btn-action,
html[data-theme="light"] body .btn-action,
html.theme-light body .convert-btn,
html[data-theme="light"] body .convert-btn,
html.theme-light body .upload-btn,
html[data-theme="light"] body .upload-btn,
html.theme-light body .filter-apply-btn,
html[data-theme="light"] body .filter-apply-btn,
html.theme-dark body .btn-primary,
html[data-theme="dark"] body .btn-primary,
html.theme-dark body .btn-action,
html[data-theme="dark"] body .btn-action,
html.theme-dark body .convert-btn,
html[data-theme="dark"] body .convert-btn,
html.theme-dark body .upload-btn,
html[data-theme="dark"] body .upload-btn,
html.theme-dark body .filter-apply-btn,
html[data-theme="dark"] body .filter-apply-btn {
  background: var(--lg-accent) !important;
  border-color: var(--lg-accent) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(91, 115, 214, .28) !important;
}

html.theme-light body .btn-primary:hover:not(:disabled),
html[data-theme="light"] body .btn-primary:hover:not(:disabled),
html.theme-light body .btn-action:hover:not(:disabled),
html[data-theme="light"] body .btn-action:hover:not(:disabled),
html.theme-light body .convert-btn:hover:not(:disabled),
html[data-theme="light"] body .convert-btn:hover:not(:disabled),
html.theme-light body .upload-btn:hover:not(:disabled),
html[data-theme="light"] body .upload-btn:hover:not(:disabled),
html.theme-dark body .btn-primary:hover:not(:disabled),
html[data-theme="dark"] body .btn-primary:hover:not(:disabled),
html.theme-dark body .btn-action:hover:not(:disabled),
html[data-theme="dark"] body .btn-action:hover:not(:disabled),
html.theme-dark body .convert-btn:hover:not(:disabled),
html[data-theme="dark"] body .convert-btn:hover:not(:disabled),
html.theme-dark body .upload-btn:hover:not(:disabled),
html[data-theme="dark"] body .upload-btn:hover:not(:disabled) {
  background: var(--lg-accent-strong) !important;
  border-color: var(--lg-accent-strong) !important;
}

html.theme-light body .file-upload-section,
html[data-theme="light"] body .file-upload-section,
html.theme-light body .encoding-text-manager,
html[data-theme="light"] body .encoding-text-manager,
html.theme-light body .settings-section,
html[data-theme="light"] body .settings-section,
html.theme-light body .chapters-preview,
html[data-theme="light"] body .chapters-preview,
html.theme-light body .chapter-filter-section,
html[data-theme="light"] body .chapter-filter-section,
html.theme-light body .custom-styles-section,
html[data-theme="light"] body .custom-styles-section,
html.theme-light body .result,
html[data-theme="light"] body .result,
html.theme-light body .progress,
html[data-theme="light"] body .progress {
  background: linear-gradient(135deg, rgba(255, 255, 255, .48), rgba(221, 232, 255, .22)) !important;
  border-color: rgba(255, 255, 255, .72) !important;
  box-shadow: 0 22px 58px rgba(47, 68, 109, .18), inset 0 1px 0 rgba(255, 255, 255, .8) !important;
  -webkit-backdrop-filter: blur(28px) saturate(150%) !important;
  backdrop-filter: blur(28px) saturate(150%) !important;
}

html.theme-dark body .file-upload-section,
html[data-theme="dark"] body .file-upload-section,
html.theme-dark body .encoding-text-manager,
html[data-theme="dark"] body .encoding-text-manager,
html.theme-dark body .settings-section,
html[data-theme="dark"] body .settings-section,
html.theme-dark body .chapters-preview,
html[data-theme="dark"] body .chapters-preview,
html.theme-dark body .chapter-filter-section,
html[data-theme="dark"] body .chapter-filter-section,
html.theme-dark body .custom-styles-section,
html[data-theme="dark"] body .custom-styles-section,
html.theme-dark body .result,
html[data-theme="dark"] body .result,
html.theme-dark body .progress,
html[data-theme="dark"] body .progress {
  background: linear-gradient(135deg, rgba(48, 63, 97, .56), rgba(21, 29, 47, .46)) !important;
  border-color: rgba(218, 229, 255, .24) !important;
  box-shadow: 0 22px 58px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .14) !important;
  -webkit-backdrop-filter: blur(28px) saturate(145%) !important;
  backdrop-filter: blur(28px) saturate(145%) !important;
}

html.theme-light body,
html[data-theme="light"] body {
  background:
    radial-gradient(900px 560px at 0% -12%, rgba(112, 188, 255, .38), transparent 68%),
    radial-gradient(780px 560px at 100% 5%, rgba(172, 165, 255, .28), transparent 68%),
    radial-gradient(900px 620px at 52% 112%, rgba(91, 145, 224, .16), transparent 70%),
    linear-gradient(145deg, #e9eef6, #d5ddeb) !important;
}

html.theme-dark body,
html[data-theme="dark"] body {
  background:
    radial-gradient(900px 560px at 0% -12%, rgba(61, 123, 205, .34), transparent 68%),
    radial-gradient(780px 560px at 100% 5%, rgba(109, 93, 193, .26), transparent 68%),
    linear-gradient(145deg, #171e2d, #0f1522) !important;
}

html.theme-light body .unified-navbar,
html[data-theme="light"] body .unified-navbar,
html.theme-light body .navbar,
html[data-theme="light"] body .navbar {
  background: rgba(245, 248, 255, .64) !important;
  border-bottom-color: rgba(48, 67, 108, .15) !important;
}

html.theme-dark body .unified-navbar,
html[data-theme="dark"] body .unified-navbar,
html.theme-dark body .navbar,
html[data-theme="dark"] body .navbar {
  background: rgba(21, 29, 47, .7) !important;
  border-bottom-color: rgba(218, 229, 255, .15) !important;
}
:root {
  --lg-bg: #e9eef6;
  --lg-bg-deep: #d5ddeb;
  --lg-ink: #182238;
  --lg-muted: #59677f;
  --lg-tertiary: #7b879b;
  --lg-accent: #5b73d6;
  --lg-accent-strong: #4561c2;
  --lg-accent-soft: rgba(91, 115, 214, .16);
  --lg-glass: rgba(255, 255, 255, .42);
  --lg-glass-strong: rgba(255, 255, 255, .62);
  --lg-dense: rgba(249, 251, 255, .88);
  --lg-line: rgba(48, 67, 108, .16);
  --lg-line-strong: rgba(48, 67, 108, .27);
  --lg-edge: rgba(255, 255, 255, .78);
  --lg-shadow: 0 22px 58px rgba(47, 68, 109, .15), 0 3px 10px rgba(47, 68, 109, .06);
  --lg-shadow-float: 0 28px 70px rgba(42, 61, 104, .22), 0 8px 20px rgba(42, 61, 104, .1);
  --color-primary: #5b73d6;
  --color-primary-dark: #4561c2;
  --color-primary-light: #e5eaff;
  --color-primary-lighter: #f3f5ff;
  --color-primary-rgb: 91, 115, 214;
}

:root.theme-dark,
:root[data-theme="dark"] {
  --lg-bg: #171e2d;
  --lg-bg-deep: #0f1522;
  --lg-ink: #eef3ff;
  --lg-muted: #aebbd2;
  --lg-tertiary: #8491aa;
  --lg-accent: #91a7ff;
  --lg-accent-strong: #7690f0;
  --lg-accent-soft: rgba(145, 167, 255, .17);
  --lg-glass: rgba(29, 40, 64, .6);
  --lg-glass-strong: rgba(38, 50, 78, .76);
  --lg-dense: rgba(25, 33, 51, .9);
  --lg-line: rgba(218, 229, 255, .16);
  --lg-line-strong: rgba(218, 229, 255, .28);
  --lg-edge: rgba(218, 229, 255, .24);
  --lg-shadow: 0 22px 58px rgba(0, 0, 0, .34), 0 3px 10px rgba(0, 0, 0, .22);
  --lg-shadow-float: 0 28px 70px rgba(0, 0, 0, .48), 0 8px 20px rgba(0, 0, 0, .28);
  --color-primary: #91a7ff;
  --color-primary-dark: #7690f0;
  --color-primary-light: rgba(145, 167, 255, .18);
  --color-primary-lighter: rgba(145, 167, 255, .1);
  --color-primary-rgb: 145, 167, 255;
}

html,
html body {
  background:
    radial-gradient(900px 560px at 0% -12%, rgba(112, 188, 255, .38), transparent 68%),
    radial-gradient(780px 560px at 100% 5%, rgba(172, 165, 255, .28), transparent 68%),
    radial-gradient(900px 620px at 52% 112%, rgba(91, 145, 224, .16), transparent 70%),
    linear-gradient(145deg, var(--lg-bg), var(--lg-bg-deep)) !important;
  color: var(--lg-ink) !important;
}

html.theme-dark body,
html[data-theme="dark"] body {
  background:
    radial-gradient(900px 560px at 0% -12%, rgba(61, 123, 205, .34), transparent 68%),
    radial-gradient(780px 560px at 100% 5%, rgba(109, 93, 193, .26), transparent 68%),
    linear-gradient(145deg, var(--lg-bg), var(--lg-bg-deep)) !important;
}

html body .unified-navbar,
html body .navbar {
  background: rgba(245, 248, 255, .64) !important;
  border-bottom-color: var(--lg-line) !important;
  box-shadow: 0 8px 28px rgba(47, 68, 109, .1) !important;
  -webkit-backdrop-filter: blur(24px) saturate(145%) !important;
  backdrop-filter: blur(24px) saturate(145%) !important;
}

html.theme-dark body .unified-navbar,
html[data-theme="dark"] body .unified-navbar,
html.theme-dark body .navbar,
html[data-theme="dark"] body .navbar {
  background: rgba(21, 29, 47, .7) !important;
  border-bottom-color: var(--lg-line) !important;
}

html body .file-upload-section,
html body .encoding-text-manager,
html body .settings-section,
html body .chapters-preview,
html body .chapter-filter-section,
html body .custom-styles-section,
html body .result,
html body .progress {
  background: linear-gradient(135deg, rgba(255, 255, 255, .56), rgba(236, 242, 255, .3)) !important;
  border-color: rgba(255, 255, 255, .78) !important;
  box-shadow: var(--lg-shadow) !important;
  -webkit-backdrop-filter: blur(26px) saturate(145%) !important;
  backdrop-filter: blur(26px) saturate(145%) !important;
}

html.theme-dark body .file-upload-section,
html[data-theme="dark"] body .file-upload-section,
html.theme-dark body .encoding-text-manager,
html[data-theme="dark"] body .encoding-text-manager,
html.theme-dark body .settings-section,
html[data-theme="dark"] body .settings-section,
html.theme-dark body .chapters-preview,
html[data-theme="dark"] body .chapters-preview,
html.theme-dark body .chapter-filter-section,
html[data-theme="dark"] body .chapter-filter-section,
html.theme-dark body .custom-styles-section,
html[data-theme="dark"] body .custom-styles-section,
html.theme-dark body .result,
html[data-theme="dark"] body .result,
html.theme-dark body .progress,
html[data-theme="dark"] body .progress {
  background: linear-gradient(135deg, rgba(48, 63, 97, .66), rgba(27, 36, 57, .58)) !important;
  border-color: rgba(218, 229, 255, .23) !important;
  box-shadow: var(--lg-shadow) !important;
}

html body .manager-content,
html body .basic-info-content,
html body .cover-settings-content,
html body .styles-content,
html body .filter-content,
html body .multi-select-container,
html body #chaptersPreview > .chapter-list-wrapper,
html body #chaptersPreview .chapter-list-container,
html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html body select,
html body textarea {
  background: rgba(249, 251, 255, .82) !important;
  color: var(--lg-ink) !important;
  border-color: var(--lg-line-strong) !important;
}

html.theme-dark body .manager-content,
html[data-theme="dark"] body .manager-content,
html.theme-dark body .basic-info-content,
html[data-theme="dark"] body .basic-info-content,
html.theme-dark body .cover-settings-content,
html[data-theme="dark"] body .cover-settings-content,
html.theme-dark body .styles-content,
html[data-theme="dark"] body .styles-content,
html.theme-dark body .filter-content,
html[data-theme="dark"] body .filter-content,
html.theme-dark body .multi-select-container,
html[data-theme="dark"] body .multi-select-container,
html.theme-dark body #chaptersPreview > .chapter-list-wrapper,
html[data-theme="dark"] body #chaptersPreview > .chapter-list-wrapper,
html.theme-dark body #chaptersPreview .chapter-list-container,
html[data-theme="dark"] body #chaptersPreview .chapter-list-container,
html.theme-dark body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.theme-dark body select,
html[data-theme="dark"] body select,
html.theme-dark body textarea,
html[data-theme="dark"] body textarea {
  background: rgba(25, 33, 51, .84) !important;
  color: var(--lg-ink) !important;
  border-color: var(--lg-line-strong) !important;
}

html body .btn-primary,
html body .btn-action,
html body .convert-btn,
html body .upload-btn,
html body .filter-apply-btn {
  background: var(--lg-accent) !important;
  border-color: var(--lg-accent) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(91, 115, 214, .28) !important;
}

html body .btn-primary:hover:not(:disabled),
html body .btn-action:hover:not(:disabled),
html body .convert-btn:hover:not(:disabled),
html body .upload-btn:hover:not(:disabled),
html body .filter-apply-btn:hover:not(:disabled) {
  background: var(--lg-accent-strong) !important;
  border-color: var(--lg-accent-strong) !important;
}

html body .upload-icon {
  background: rgba(111, 190, 255, .16) !important;
  border-color: rgba(91, 115, 214, .2) !important;
  color: var(--lg-accent) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72), 0 8px 20px rgba(91, 115, 214, .1) !important;
}

html body .encoding-badge,
html body .repair-badge,
html body .beta-badge,
html body .beta-badge-mini {
  background: rgba(91, 115, 214, .13) !important;
  border-color: rgba(91, 115, 214, .24) !important;
  color: var(--lg-accent-strong) !important;
}

html.theme-dark body .encoding-badge,
html[data-theme="dark"] body .encoding-badge,
html.theme-dark body .repair-badge,
html[data-theme="dark"] body .repair-badge,
html.theme-dark body .beta-badge,
html[data-theme="dark"] body .beta-badge,
html.theme-dark body .beta-badge-mini,
html[data-theme="dark"] body .beta-badge-mini {
  background: rgba(145, 167, 255, .17) !important;
  border-color: rgba(145, 167, 255, .26) !important;
  color: #b8c7ff !important;
}

html body .progress-bar { background: linear-gradient(90deg, #5b73d6, #6fbfff) !important; box-shadow: 0 0 18px rgba(91, 115, 214, .3) !important; }
html body::-webkit-scrollbar-thumb,
html body *::-webkit-scrollbar-thumb { background: rgba(91, 115, 214, .38) !important; }
html body::-webkit-scrollbar-thumb:hover,
html body *::-webkit-scrollbar-thumb:hover { background: rgba(91, 115, 214, .58) !important; }

html body .workspace-status {
  background: rgba(244, 248, 255, .58) !important;
  border-color: rgba(91, 115, 214, .2) !important;
  color: var(--lg-muted) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.82), 0 8px 20px rgba(47,68,109,.08) !important;
}

html body .workspace-status-dot {
  background: #5ec6e8 !important;
  box-shadow: 0 0 0 4px rgba(94,198,232,.14), 0 0 14px rgba(94,198,232,.32) !important;
}

html.theme-dark body .workspace-status,
html[data-theme="dark"] body .workspace-status {
  background: rgba(29, 42, 69, .64) !important;
  border-color: rgba(145,167,255,.2) !important;
}

/* Code-generated refraction layer: the moving field sits behind the real UI. */
html body {
  position: relative !important;
  isolation: isolate !important;
  background: transparent !important;
}

html { background: #d5ddeb !important; }

html.theme-dark body,
html[data-theme="dark"] body { background: transparent !important; }

html.theme-dark,
html[data-theme="dark"] { background: #111827 !important; }

html body #liquidBackdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 0 !important;
  display: block !important;
  width: 100vw !important;
  height: 100vh !important;
  pointer-events: none !important;
  opacity: .95 !important;
  filter: blur(18px) saturate(115%) !important;
  transform: scale(1.04) !important;
  transform-origin: center !important;
}

html body .container,
html body .unified-navbar,
html body .navbar { position: relative !important; z-index: 1 !important; }

html body .file-upload-section,
html body .encoding-text-manager,
html body .settings-section,
html body .chapters-preview,
html body .chapter-filter-section,
html body .custom-styles-section,
html body .result,
html body .progress,
html body .unified-navbar,
html body .navbar {
  isolation: isolate !important;
  --pointer-x: 50%;
  --pointer-y: 18%;
}

html body .file-upload-section::before,
html body .encoding-text-manager::before,
html body .settings-section::before,
html body .chapters-preview::before,
html body .chapter-filter-section::before,
html body .custom-styles-section::before,
html body .result::before,
html body .progress::before,
html body .unified-navbar::before,
html body .navbar::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 0 !important;
  pointer-events: none !important;
  border-radius: inherit !important;
  background:
    radial-gradient(260px 180px at var(--pointer-x) var(--pointer-y), rgba(255,255,255,.26), transparent 68%),
    linear-gradient(120deg, rgba(255,255,255,.18), transparent 38%, rgba(142,180,255,.08) 72%, transparent),
    linear-gradient(108deg, transparent 0%, transparent 54%, rgba(255,255,255,.34) 55%, rgba(146,215,255,.14) 56%, transparent 59%) !important;
  border: 1px solid rgba(255,255,255,.24) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -1px 0 rgba(102,148,228,.18) !important;
  mix-blend-mode: screen !important;
  opacity: .82 !important;
  transition: opacity 180ms cubic-bezier(.23,1,.32,1) !important;
}

html.theme-dark body .file-upload-section::before,
html[data-theme="dark"] body .file-upload-section::before,
html.theme-dark body .encoding-text-manager::before,
html[data-theme="dark"] body .encoding-text-manager::before,
html.theme-dark body .settings-section::before,
html[data-theme="dark"] body .settings-section::before,
html.theme-dark body .chapters-preview::before,
html[data-theme="dark"] body .chapters-preview::before,
html.theme-dark body .chapter-filter-section::before,
html[data-theme="dark"] body .chapter-filter-section::before,
html.theme-dark body .custom-styles-section::before,
html[data-theme="dark"] body .custom-styles-section::before,
html.theme-dark body .result::before,
html[data-theme="dark"] body .result::before,
html.theme-dark body .progress::before,
html[data-theme="dark"] body .progress::before,
html.theme-dark body .unified-navbar::before,
html[data-theme="dark"] body .unified-navbar::before,
html.theme-dark body .navbar::before,
html[data-theme="dark"] body .navbar::before {
  background:
    radial-gradient(260px 180px at var(--pointer-x) var(--pointer-y), rgba(190,225,255,.2), transparent 68%),
    linear-gradient(120deg, rgba(255,255,255,.12), transparent 38%, rgba(120,145,255,.1) 72%, transparent),
    linear-gradient(108deg, transparent 0%, transparent 54%, rgba(210,235,255,.28) 55%, rgba(132,155,255,.18) 56%, transparent 59%) !important;
  opacity: .72 !important;
}

html body .file-upload-section > *,
html body .encoding-text-manager > *,
html body .settings-section > *,
html body .chapters-preview > *,
html body .chapter-filter-section > *,
html body .custom-styles-section > *,
html body .result > *,
html body .progress > *,
html body .unified-navbar > *,
html body .navbar > * { position: relative !important; z-index: 1 !important; }

html body .file-upload-section,
html body .encoding-text-manager,
html body .settings-section,
html body .chapters-preview,
html body .chapter-filter-section,
html body .custom-styles-section,
html body .result,
html body .progress {
  box-shadow:
    0 22px 58px rgba(47,68,109,.18),
    inset 0 1px 0 rgba(255,255,255,.86),
    inset 0 -1px 0 rgba(101,130,188,.12) !important;
}

@media (prefers-reduced-motion: reduce), (prefers-reduced-transparency: reduce), (forced-colors: active) {
  html body #liquidBackdrop { filter: none !important; opacity: 0 !important; }
  html body .file-upload-section::before,
  html body .encoding-text-manager::before,
  html body .settings-section::before,
  html body .chapters-preview::before,
  html body .chapter-filter-section::before,
  html body .custom-styles-section::before,
  html body .result::before,
  html body .progress::before,
  html body .unified-navbar::before,
  html body .navbar::before { display: none !important; }
}

/* Stronger liquid read: let the moving field show through, then add a slow surface sweep. */
html body .file-upload-section,
html body .encoding-text-manager,
html body .settings-section,
html body .chapters-preview,
html body .chapter-filter-section,
html body .custom-styles-section,
html body .result,
html body .progress {
  background: radial-gradient(120% 100% at 6% 0%, rgba(255,255,255,.46), transparent 35%), radial-gradient(90% 120% at 100% 100%, rgba(101,158,255,.18), transparent 52%), linear-gradient(135deg, rgba(255,255,255,.2), rgba(215,229,255,.06)) !important;
  -webkit-backdrop-filter: blur(7px) saturate(190%) contrast(110%) !important;
  backdrop-filter: blur(7px) saturate(190%) contrast(110%) !important;
  border-color: rgba(255,255,255,.84) !important;
  box-shadow: 0 28px 74px rgba(40,70,126,.28), inset 1px 1px 0 rgba(255,255,255,.96), inset -1px -1px 0 rgba(88,132,215,.36), inset 0 -14px 32px rgba(80,128,214,.1) !important;
}

html.theme-light body .file-upload-section,
html[data-theme="light"] body .file-upload-section,
html.theme-light body .encoding-text-manager,
html[data-theme="light"] body .encoding-text-manager,
html.theme-light body .settings-section,
html[data-theme="light"] body .settings-section,
html.theme-light body .chapters-preview,
html[data-theme="light"] body .chapters-preview,
html.theme-light body .chapter-filter-section,
html[data-theme="light"] body .chapter-filter-section,
html.theme-light body .custom-styles-section,
html[data-theme="light"] body .custom-styles-section,
html.theme-light body .result,
html[data-theme="light"] body .result,
html.theme-light body .progress,
html[data-theme="light"] body .progress {
  background: radial-gradient(120% 100% at 6% 0%, rgba(255,255,255,.46), transparent 35%), radial-gradient(90% 120% at 100% 100%, rgba(101,158,255,.18), transparent 52%), linear-gradient(135deg, rgba(255,255,255,.2), rgba(215,229,255,.06)) !important;
  -webkit-backdrop-filter: blur(7px) saturate(190%) contrast(110%) !important;
  backdrop-filter: blur(7px) saturate(190%) contrast(110%) !important;
  border-color: rgba(255,255,255,.84) !important;
  box-shadow: 0 28px 74px rgba(40,70,126,.28), inset 1px 1px 0 rgba(255,255,255,.96), inset -1px -1px 0 rgba(88,132,215,.36), inset 0 -14px 32px rgba(80,128,214,.1) !important;
}

html.theme-dark body .file-upload-section,
html[data-theme="dark"] body .file-upload-section,
html.theme-dark body .encoding-text-manager,
html[data-theme="dark"] body .encoding-text-manager,
html.theme-dark body .settings-section,
html[data-theme="dark"] body .settings-section,
html.theme-dark body .chapters-preview,
html[data-theme="dark"] body .chapters-preview,
html.theme-dark body .chapter-filter-section,
html[data-theme="dark"] body .chapter-filter-section,
html.theme-dark body .custom-styles-section,
html[data-theme="dark"] body .custom-styles-section,
html.theme-dark body .result,
html[data-theme="dark"] body .result,
html.theme-dark body .progress {
  background: radial-gradient(120% 100% at 6% 0%, rgba(218,240,255,.2), transparent 35%), radial-gradient(90% 120% at 100% 100%, rgba(117,133,255,.2), transparent 52%), linear-gradient(135deg, rgba(38,58,98,.3), rgba(16,27,51,.17)) !important;
  -webkit-backdrop-filter: blur(7px) saturate(190%) contrast(110%) !important;
  backdrop-filter: blur(7px) saturate(190%) contrast(110%) !important;
  border-color: rgba(204,224,255,.38) !important;
  box-shadow: 0 30px 82px rgba(0,0,0,.52), inset 1px 1px 0 rgba(223,239,255,.42), inset -1px -1px 0 rgba(104,126,218,.5), inset 0 -16px 36px rgba(76,104,190,.18) !important;
}

html body #liquidBackdrop {
  opacity: 1 !important;
  filter: blur(3px) saturate(160%) contrast(114%) !important;
}

html body .file-upload-section::after,
html body .encoding-text-manager::after,
html body .settings-section::after,
html body .chapters-preview::after,
html body .chapter-filter-section::after,
html body .custom-styles-section::after,
html body .result::after,
html body .progress::after {
  content: "" !important;
  position: absolute !important;
  z-index: 0 !important;
  top: -45% !important;
  bottom: -45% !important;
  left: -38% !important;
  width: 34% !important;
  pointer-events: none !important;
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,.1) 18%, rgba(255,255,255,.82) 50%, rgba(146,204,255,.3) 72%, transparent 100%) !important;
  filter: blur(3px) !important;
  opacity: .62 !important;
  transform: translate3d(-115%, 0, 0) rotate(12deg) !important;
  animation: liquid-surface-sweep 7s cubic-bezier(.77,0,.175,1) infinite !important;
}

html.theme-dark body .file-upload-section::after,
html[data-theme="dark"] body .file-upload-section::after,
html.theme-dark body .encoding-text-manager::after,
html[data-theme="dark"] body .encoding-text-manager::after,
html.theme-dark body .settings-section::after,
html[data-theme="dark"] body .settings-section::after,
html.theme-dark body .chapters-preview::after,
html[data-theme="dark"] body .chapters-preview::after,
html.theme-dark body .chapter-filter-section::after,
html[data-theme="dark"] body .chapter-filter-section::after,
html.theme-dark body .custom-styles-section::after,
html[data-theme="dark"] body .custom-styles-section::after,
html.theme-dark body .result::after,
html[data-theme="dark"] body .result::after,
html.theme-dark body .progress::after,
html[data-theme="dark"] body .progress::after {
  background: linear-gradient(100deg, transparent 0%, rgba(174,222,255,.08) 22%, rgba(193,213,255,.42) 50%, rgba(132,142,255,.2) 68%, transparent 100%) !important;
  opacity: .56 !important;
}

@keyframes liquid-surface-sweep {
  0% { transform: translate3d(-115%, 0, 0) rotate(12deg); opacity: .22; }
  18% { opacity: .62; }
  62% { opacity: .62; }
  100% { transform: translate3d(470%, 0, 0) rotate(12deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce), (prefers-reduced-transparency: reduce), (forced-colors: active) {
  html body .file-upload-section::after,
  html body .encoding-text-manager::after,
  html body .settings-section::after,
  html body .chapters-preview::after,
  html body .chapter-filter-section::after,
  html body .custom-styles-section::after,
  html body .result::after,
  html body .progress::after { animation: none !important; opacity: 0 !important; }
}

@media (hover: hover) and (pointer: fine) {
  html body .file-upload-section:hover,
  html body .encoding-text-manager:hover,
  html body .settings-section:hover,
  html body .chapters-preview:hover,
  html body .chapter-filter-section:hover,
  html body .custom-styles-section:hover,
  html body .result:hover,
  html body .progress:hover {
    transform: translateY(-3px) perspective(900px) rotateX(.45deg) !important;
  }
}

/* Inner content surfaces share the same cool tint instead of falling back to white. */
html body .manager-content,
html body .basic-info-content,
html body .cover-settings-content,
html body .styles-content,
html body .filter-content,
html body .multi-select-container,
html body #chaptersPreview > .chapter-list-wrapper,
html body #chaptersPreview .chapter-list-container {
  background: linear-gradient(135deg, rgba(239,247,255,.34), rgba(205,226,255,.14)) !important;
  border-color: rgba(255,255,255,.58) !important;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.62), inset -1px -1px 0 rgba(94,142,220,.16) !important;
  -webkit-backdrop-filter: blur(6px) saturate(155%) !important;
  backdrop-filter: blur(6px) saturate(155%) !important;
}

html.theme-light body .manager-content,
html[data-theme="light"] body .manager-content,
html.theme-light body .basic-info-content,
html[data-theme="light"] body .basic-info-content,
html.theme-light body .cover-settings-content,
html[data-theme="light"] body .cover-settings-content,
html.theme-light body .styles-content,
html[data-theme="light"] body .styles-content,
html.theme-light body .filter-content,
html[data-theme="light"] body .filter-content,
html.theme-light body .multi-select-container,
html[data-theme="light"] body .multi-select-container,
html.theme-light body #chaptersPreview > .chapter-list-wrapper,
html[data-theme="light"] body #chaptersPreview > .chapter-list-wrapper,
html.theme-light body #chaptersPreview .chapter-list-container,
html[data-theme="light"] body #chaptersPreview .chapter-list-container {
  background: linear-gradient(135deg, rgba(239,247,255,.34), rgba(205,226,255,.14)) !important;
}

html.theme-dark body .manager-content,
html[data-theme="dark"] body .manager-content,
html.theme-dark body .basic-info-content,
html[data-theme="dark"] body .basic-info-content,
html.theme-dark body .cover-settings-content,
html[data-theme="dark"] body .cover-settings-content,
html.theme-dark body .styles-content,
html[data-theme="dark"] body .styles-content,
html.theme-dark body .filter-content,
html[data-theme="dark"] body .filter-content,
html.theme-dark body .multi-select-container,
html[data-theme="dark"] body .multi-select-container,
html.theme-dark body #chaptersPreview > .chapter-list-wrapper,
html[data-theme="dark"] body #chaptersPreview > .chapter-list-wrapper,
html.theme-dark body #chaptersPreview .chapter-list-container,
html[data-theme="dark"] body #chaptersPreview .chapter-list-container {
  background: linear-gradient(135deg, rgba(27,46,79,.52), rgba(16,29,54,.38)) !important;
  border-color: rgba(193,220,255,.24) !important;
  box-shadow: inset 1px 1px 0 rgba(222,239,255,.2), inset -1px -1px 0 rgba(90,122,220,.26) !important;
}

html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html body select,
html body textarea {
  background: rgba(245,249,255,.58) !important;
  border-color: rgba(88,126,192,.28) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.72), 0 1px 0 rgba(82,128,208,.05) !important;
}

html.theme-dark body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="dark"] body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.theme-dark body select,
html[data-theme="dark"] body select,
html.theme-dark body textarea,
html[data-theme="dark"] body textarea {
  background: rgba(24,39,67,.58) !important;
  border-color: rgba(178,208,255,.24) !important;
  box-shadow: inset 0 1px 0 rgba(225,240,255,.18) !important;
}

html body .section-header,
html body .repair-header,
html body .multi-level-header-setting,
html body .filter-rule-card,
html body .reason-item,
html body .format-tag {
  background: rgba(235,245,255,.3) !important;
  border-color: rgba(255,255,255,.52) !important;
}

html.theme-dark body .section-header,
html[data-theme="dark"] body .section-header,
html.theme-dark body .repair-header,
html[data-theme="dark"] body .repair-header,
html.theme-dark body .multi-level-header-setting,
html[data-theme="dark"] body .multi-level-header-setting,
html.theme-dark body .filter-rule-card,
html[data-theme="dark"] body .filter-rule-card,
html.theme-dark body .reason-item,
html[data-theme="dark"] body .reason-item,
html.theme-dark body .format-tag,
html[data-theme="dark"] body .format-tag {
  background: rgba(29,48,82,.46) !important;
  border-color: rgba(190,218,255,.24) !important;
}

html body .multi-select-container,
html body .styles-content,
html body .filter-content { padding: 22px 24px 26px !important; }

html body .multi-select-header h4 { margin-bottom: 8px !important; }
html body .multi-select-desc { margin-bottom: 18px !important; }
html body .format-tags-grid { gap: 10px !important; padding: 4px 2px 12px !important; }
html body .format-tag { flex: 1 1 150px !important; min-width: 132px !important; min-height: 44px !important; }
html body .format-actions { gap: 10px !important; margin-bottom: 16px !important; }

/* Conversion feedback: one centered track, one clear next action. */
html body .progress {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  box-sizing: border-box !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 24px 28px 20px !important;
  text-align: center !important;
}

html body .progress-track {
  position: relative !important;
  width: min(760px, 100%) !important;
  height: 18px !important;
  margin: 0 auto !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 255, 255, .64) !important;
  border-radius: 999px !important;
  background: rgba(40, 69, 125, .12) !important;
  box-shadow: inset 0 1px 3px rgba(30, 57, 105, .14), 0 4px 14px rgba(55, 93, 165, .1) !important;
}

html body .progress-bar {
  position: absolute !important;
  inset: 0 auto 0 0 !important;
  height: 100% !important;
  min-width: 0 !important;
  border-radius: inherit !important;
  transition: width .35s var(--lg-ease) !important;
  box-shadow: 0 0 18px rgba(91, 115, 214, .34), inset 0 1px 0 rgba(255, 255, 255, .52) !important;
}

html body .progress-percentage {
  position: absolute !important;
  inset: 50% auto auto 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 2 !important;
  color: var(--lg-ink) !important;
  font-size: .78rem !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  letter-spacing: .02em !important;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .5) !important;
  pointer-events: none !important;
}

html body .progress-time {
  width: 100% !important;
  margin: 11px 0 0 !important;
  color: var(--lg-muted) !important;
  font-size: .86rem !important;
  line-height: 1.4 !important;
  text-align: center !important;
}

html body .result {
  box-sizing: border-box !important;
  padding: 30px 32px 32px !important;
  text-align: center !important;
}

html body .result-title {
  margin: 0 !important;
  color: var(--lg-ink) !important;
  font-size: 1.4rem !important;
  font-weight: 760 !important;
  line-height: 1.3 !important;
}

html body .result-summary {
  margin: 8px 0 22px !important;
  color: var(--lg-muted) !important;
  font-size: .94rem !important;
  line-height: 1.5 !important;
}

html body .result-stats {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  width: min(860px, 100%) !important;
  margin: 0 auto 26px !important;
  border: 1px solid rgba(255, 255, 255, .56) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: linear-gradient(135deg, rgba(239, 247, 255, .3), rgba(205, 226, 255, .12)) !important;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .48), 0 8px 20px rgba(53, 90, 158, .08) !important;
}

html body .result-stat {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  min-height: 74px !important;
  padding: 13px 10px !important;
  border-right: 1px solid rgba(255, 255, 255, .42) !important;
  gap: 6px !important;
}

html body .result-stat:last-child { border-right: 0 !important; }
html body .result-stat span {
  color: var(--lg-muted) !important;
  font-size: .78rem !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
}
html body .result-stat strong {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  color: var(--lg-ink) !important;
  font-size: .96rem !important;
  font-weight: 720 !important;
  line-height: 1.25 !important;
  font-variant-numeric: tabular-nums !important;
}

html body .download-buttons-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 auto !important;
}

html body .result .download-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: min(260px, 100%) !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 12px 22px !important;
  border: 1px solid var(--lg-accent) !important;
  border-radius: 13px !important;
  background: linear-gradient(135deg, var(--lg-accent), #719dff) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(91, 115, 214, .28), inset 0 1px 0 rgba(255, 255, 255, .3) !important;
  font-size: .96rem !important;
  font-weight: 720 !important;
  text-decoration: none !important;
  transition: transform 160ms var(--lg-ease), box-shadow 160ms ease, filter 160ms ease !important;
}

html body .result .download-btn:hover {
  transform: translateY(-2px) !important;
  filter: saturate(1.08) brightness(1.03) !important;
  box-shadow: 0 14px 30px rgba(91, 115, 214, .36), inset 0 1px 0 rgba(255, 255, 255, .38) !important;
}

html body .result .download-btn:active { transform: translateY(0) scale(.98) !important; }

@media (max-width: 820px) {
  html body .result { padding: 26px 20px 28px !important; }
  html body .result-stats { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  html body .result-stat:nth-child(3) { border-right: 0 !important; }
  html body .result-stat:nth-child(-n + 3) { border-bottom: 1px solid rgba(255, 255, 255, .42) !important; }
}

@media (max-width: 520px) {
  html body .progress { padding: 20px 16px 18px !important; }
  html body .progress-track { height: 16px !important; }
  html body .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  html body .result-stat { min-height: 68px !important; }
  html body .result-stat:nth-child(3) { border-right: 1px solid rgba(255, 255, 255, .42) !important; }
  html body .result-stat:nth-child(odd) { border-right: 1px solid rgba(255, 255, 255, .42) !important; }
  html body .result-stat:nth-child(-n + 3) { border-bottom: 1px solid rgba(255, 255, 255, .42) !important; }
  html body .result-stat:nth-child(2n) { border-right: 0 !important; }
  html body .result-stat:nth-child(4) { border-bottom: 1px solid rgba(255, 255, 255, .42) !important; }
  html body .result-stat:last-child { grid-column: 1 / -1 !important; border-right: 0 !important; border-bottom: 0 !important; }
  html body .result .download-btn { width: 100% !important; }
}

/* Initial state and upload focus: keep the first viewport quiet and readable. */
html body .progress.hidden,
html body .result.hidden,
html body .encoding-text-manager.hidden,
html body .repair-section.hidden,
html body .settings-section.hidden,
html body .convert-buttons.hidden { display: none !important; }

html body .file-upload-section {
  align-items: center !important;
}

html body .file-upload-section h3,
html body .file-upload-section > #uploadDescription,
html body .file-upload-section > .upload-status-message,
html body .file-upload-section .upload-btn {
  align-self: center !important;
}

html body .file-upload-section > #uploadDescription,
html body .file-upload-section > .upload-status-message {
  margin-top: 0 !important;
}

/* The import and repair surfaces stay still; motion remains on the page backdrop. */
html body .file-upload-section::after,
html body .encoding-text-manager::after,
html body .repair-section::after {
  display: none !important;
  animation: none !important;
  opacity: 0 !important;
}

html body .file-upload-section::before,
html body .encoding-text-manager::before,
html body .repair-section::before {
  background:
    radial-gradient(320px 220px at var(--pointer-x) var(--pointer-y), rgba(255, 255, 255, .18), transparent 70%),
    linear-gradient(135deg, rgba(255, 255, 255, .12), transparent 42%, rgba(135, 185, 255, .06)) !important;
}

/* Format choices use a real grid so examples stay inside their own card. */
html body #allFormatsGrid.format-tags-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  gap: 12px !important;
  width: 100% !important;
  max-height: 360px !important;
  margin: 0 !important;
  padding: 4px 2px 12px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  align-items: stretch !important;
}

html body #allFormatsGrid .format-tag {
  box-sizing: border-box !important;
  display: flex !important;
  flex: none !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 76px !important;
  height: auto !important;
  padding: 12px 14px !important;
  gap: 10px !important;
  align-items: center !important;
  justify-content: space-between !important;
  border-radius: 14px !important;
  white-space: normal !important;
  overflow: hidden !important;
}

html body #allFormatsGrid .tag-content {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  gap: 4px !important;
  overflow: hidden !important;
}

html body #allFormatsGrid .tag-name {
  display: block !important;
  min-width: 0 !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  font-size: .9rem !important;
  line-height: 1.3 !important;
}

html body #allFormatsGrid .tag-examples {
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
  font-size: .74rem !important;
  line-height: 1.35 !important;
  opacity: .76 !important;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

html body #allFormatsGrid .level-selector {
  flex: 0 0 auto !important;
  margin-left: 4px !important;
}

html body #allFormatsGrid .level-label,
html body #allFormatsGrid .level-select {
  white-space: nowrap !important;
}

@media (max-width: 640px) {
  html body #allFormatsGrid.format-tags-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
    max-height: 420px !important;
  }

  html body #allFormatsGrid .format-tag {
    min-height: 70px !important;
    padding: 10px 11px !important;
    gap: 7px !important;
  }

  html body #allFormatsGrid .tag-name { font-size: .84rem !important; }
  html body #allFormatsGrid .tag-examples { font-size: .7rem !important; }
}

@media (max-width: 380px) {
  html body #allFormatsGrid.format-tags-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  html body .file-upload-section .upload-btn {
    align-self: center !important;
    margin-top: 0 !important;
  }
}
