/* ==========================================================================
   ECSA Disability Access and Inclusion Plan (DAIP) - Accessible Stylesheet
   ========================================================================== */

/* Web Fonts: Lexend (Dyslexia-friendly designed) & OpenDyslexic */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Lexend:wght@400;500;600;700&display=swap');

@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://cdn.jsdelivr.net/npm/opendyslexic-font@0.9.2/dist/OpenDyslexic-Regular.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/opendyslexic-font@0.9.2/dist/OpenDyslexic-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://cdn.jsdelivr.net/npm/opendyslexic-font@0.9.2/dist/OpenDyslexic-Bold.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/opendyslexic-font@0.9.2/dist/OpenDyslexic-Bold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-dyslexic: 'OpenDyslexic', 'Lexend', -apple-system, sans-serif;
  
  /* Light Theme (Default) - Crisp ECSA Cool Blue/White Aesthetics */
  --bg-color: #f0f6fc;
  --surface-color: #ffffff;
  --surface-alt: #e6f0fa;
  --border-color: #bcd5eb;
  --text-main: #0c2340;
  --text-muted: #1e3852;
  --text-inverse: #ffffff;
  
  --primary: #00487a;
  --primary-light: #e0f2fe;
  --primary-dark: #002e52;
  --accent: #005691;
  --accent-light: #e0f2fe;
  
  --hero-bg: linear-gradient(135deg, #00487a 0%, #002e52 100%);
  --hero-text: #ffffff;
  
  --success: #0f766e;
  --success-bg: #ccfbf1;
  --info: #002e52;
  --info-bg: #e0f2fe;
  --warning: #0c2340;
  --warning-bg: #e6f0fa;
  --danger: #1e40af;
  --danger-bg: #dbeafe;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 2px 4px -1px rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 6px 16px -2px rgb(0 0 0 / 0.09), 0 3px 6px -3px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 14px 28px -4px rgb(0 0 0 / 0.12), 0 6px 12px -4px rgb(0 0 0 / 0.08);
  --shadow-hover: 0 10px 24px -3px rgb(0 0 0 / 0.14), 0 4px 8px -2px rgb(0 0 0 / 0.08);

  --font-scale: 1rem;
  --line-height-base: 1.6;
  --letter-spacing-base: normal;
  --word-spacing-base: normal;
  
  --sidebar-width: 320px;
  --header-height: 70px;
  --border-radius: 8px;
  --transition: all 0.2s ease-in-out;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-color: #0b1120;
  --surface-color: #1e293b;
  --surface-alt: #0f172a;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0b1120;
  
  --primary: #38bdf8;
  --primary-light: #082f49;
  --primary-dark: #7dd3fc;
  --accent: #60a5fa;
  --accent-light: #1e3a8a;
  
  --hero-bg: linear-gradient(135deg, #0f2b48 0%, #0b1728 100%);
  --hero-text: #f8fafc;
  
  --success: #2dd4bf;
  --success-bg: #042f2e;
  --info: #38bdf8;
  --info-bg: #082f49;
  --warning: #7dd3fc;
  --warning-bg: #0c4a6e;
  --danger: #93c5fd;
  --danger-bg: #1e3a8a;

  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-sm: 0 2px 4px -1px rgb(0 0 0 / 0.5);
  --shadow-md: 0 6px 16px -2px rgb(0 0 0 / 0.6);
  --shadow-lg: 0 14px 28px -4px rgb(0 0 0 / 0.7);
  --shadow-hover: 0 10px 24px -3px rgb(0 0 0 / 0.75);
}

/* High Contrast Yellow on Black */
[data-theme="high-contrast-yellow"] {
  --bg-color: #000000;
  --surface-color: #000000;
  --surface-alt: #121212;
  --border-color: #ffff00;
  --text-main: #ffff00;
  --text-muted: #ffff88;
  --text-inverse: #000000;
  
  --primary: #ffff00;
  --primary-light: #333300;
  --primary-dark: #ffff00;
  --accent: #00ffff;
  --accent-light: #003333;
  
  --hero-bg: #000000;
  --hero-text: #ffff00;
  
  --success: #00ff00;
  --success-bg: #003300;
  --info: #00ffff;
  --info-bg: #003333;
  --warning: #ffff00;
  --warning-bg: #333300;
  --danger: #ff5555;
  --danger-bg: #330000;

  --shadow-sm: 0 0 0 1px #ffff00;
  --shadow-md: 0 0 0 2px #ffff00;
  --shadow-lg: 0 0 0 3px #ffff00;
}

/* Font Size Modifiers */
html[data-font-size="normal"],
:root[data-font-size="normal"] {
  font-size: 16px !important;
  --font-scale: 1rem;
  --line-height-base: 1.6;
}

html[data-font-size="large"],
:root[data-font-size="large"] {
  font-size: 20px !important;
  --font-scale: 1.15rem;
  --line-height-base: 1.75;
}

html[data-font-size="extra-large"],
:root[data-font-size="extra-large"] {
  font-size: 24px !important;
  --font-scale: 1.3rem;
  --line-height-base: 1.85;
}

/* Dyslexia-Friendly Typography */
[data-font-style="dyslexic"],
[data-font-style="dyslexic"] body,
[data-font-style="dyslexic"] * {
  font-family: 'OpenDyslexic', 'Lexend', sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.08em !important;
}

/* Base Reset & Layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-scale);
  line-height: var(--line-height-base);
  color: var(--text-main);
  background-color: var(--bg-color);
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Screen Reader Only Utility */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  color: #0c2340 !important;
  background-color: #ffffff !important;
}

/* Accessibility: Skip to Content */
.skip-link {
  position: absolute;
  top: -60px;
  left: 20px;
  background: var(--primary);
  color: var(--text-inverse);
  padding: 12px 20px;
  z-index: 9999;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--border-radius);
  transition: top 0.2s ease-in-out;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 15px;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Universal Accessible Focus Rings (WCAG 2.4.7 & 2.4.13) */
:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 2px !important;
}

[data-theme="dark"] :focus-visible {
  outline: 3px solid var(--primary) !important;
  outline-offset: 2px !important;
}

[data-theme="high-contrast-yellow"] :focus-visible {
  outline: 3px solid #ffff00 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px #000000 !important;
}

/* Explicit interactive element focus styling */
.nav-link:focus-visible,
.nav-sub-link:focus-visible,
.view-tab:focus-visible,
.finder-pill-btn:focus-visible,
.btn-bookmark:focus-visible,
.glossary-letter-btn:focus-visible,
.filter-reset-btn:focus-visible,
.search-step-btn:focus-visible,
.clear-search-btn:focus-visible,
.back-to-top-btn:focus-visible,
.domain-quick-card:focus-visible,
.search-result-item:focus-visible,
.brand-logo-link:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 2px !important;
}

[data-theme="high-contrast-yellow"] .nav-link:focus-visible,
[data-theme="high-contrast-yellow"] .nav-sub-link:focus-visible,
[data-theme="high-contrast-yellow"] .view-tab:focus-visible,
[data-theme="high-contrast-yellow"] .finder-pill-btn:focus-visible,
[data-theme="high-contrast-yellow"] .btn-bookmark:focus-visible,
[data-theme="high-contrast-yellow"] .glossary-letter-btn:focus-visible,
[data-theme="high-contrast-yellow"] .filter-reset-btn:focus-visible,
[data-theme="high-contrast-yellow"] .search-step-btn:focus-visible,
[data-theme="high-contrast-yellow"] .clear-search-btn:focus-visible,
[data-theme="high-contrast-yellow"] .back-to-top-btn:focus-visible,
[data-theme="high-contrast-yellow"] .domain-quick-card:focus-visible,
[data-theme="high-contrast-yellow"] .search-result-item:focus-visible,
[data-theme="high-contrast-yellow"] .brand-logo-link:focus-visible {
  outline: 3px solid #ffff00 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 5px #000000 !important;
}

/* Top Sticky Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--surface-color);
  border-bottom: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.25s, border-color 0.25s;
}

.top-bar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.brand-logo-link:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-hover);
}

.ecsa-header-logo {
  height: 42px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

[data-theme="high-contrast-yellow"] .brand-logo-link {
  background: #000000;
  border: 1px solid #ffff00;
}

[data-theme="high-contrast-yellow"] .ecsa-header-logo {
  filter: brightness(0) invert(1) drop-shadow(0 0 1px #ffff00);
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title h1,
.brand-title .brand-title-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-title span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Accessibility Toolbar Controls */
.accessibility-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

.control-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.control-label {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 6px;
  color: var(--text-muted);
}

.btn-ctrl {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-ctrl:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}

.btn-ctrl.active {
  background-color: var(--primary) !important;
  color: var(--text-inverse) !important;
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-ctrl:focus-visible {
  outline: 2px solid var(--accent);
}

/* Main Layout Container */
.app-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  padding: 24px;
  gap: 28px;
  position: relative;
}

/* Sidebar Navigation / Table of Contents */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.sidebar-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
  gap: 12px;
}

.sidebar-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.sidebar-heading h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.btn-listen-sidebar {
  font-size: 0.78rem;
  padding: 4px 12px;
  gap: 5px;
  margin-top: 2px;
}

/* Search Box */
.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  background: var(--surface-color);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-sm);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: none;
  font-size: 0.9rem;
}

/* Live Search Results Bar & Stepper */
.search-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.85rem;
}

.search-count-badge {
  font-weight: 700;
  color: var(--primary);
}

.search-stepper {
  display: flex;
  gap: 4px;
}

.search-step-btn {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-main);
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-step-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Search Dropdown Results List */
.search-dropdown-results {
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.search-result-item {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  text-align: left;
  font-family: inherit;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.search-result-category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.search-result-snippet {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* In-document Search Highlight */
mark.search-highlight {
  background: #fef08a !important;
  color: #854d0e !important;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

mark.search-highlight.current-match {
  background: #f59e0b !important;
  color: #000000 !important;
  font-weight: 700;
  box-shadow: 0 0 0 2px #d97706;
}

/* Nav Menu Tree */
.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: var(--surface-alt);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  border-left-color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.nav-badge {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.nav-link.active .nav-badge {
  background: var(--primary);
  color: var(--text-inverse);
}

.nav-sub-list {
  list-style: none;
  padding-left: 16px;
  margin-top: 4px;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 1px solid var(--border-color);
  margin-left: 12px;
}

.nav-sub-link {
  display: block;
  padding: 5px 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
  transition: var(--transition);
}

.nav-sub-link:hover {
  color: var(--primary);
  background: var(--surface-alt);
  box-shadow: var(--shadow-xs);
}

.nav-sub-link.active {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
  box-shadow: var(--shadow-xs);
}

/* Content Area */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* View Mode Switcher Header */
.content-toolbar {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-md);
  transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.view-tabs {
  display: inline-flex;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.view-tab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.view-tab:hover {
  color: var(--text-main);
  box-shadow: var(--shadow-xs);
}

.view-tab.active {
  background: var(--surface-color);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Domain Quick Jump Dashboard */
.domain-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.domain-quick-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, border-color 0.2s;
  border-top: 4px solid var(--primary);
}

.domain-quick-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.domain-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.domain-card-head strong {
  font-size: 0.85rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.domain-quick-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.domain-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

/* Interactive Accessible Voting Options Finder */
.voting-finder-section {
  background: linear-gradient(135deg, var(--surface-alt), var(--surface-color));
  border: 2px solid var(--primary);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-top: 24px;
  box-shadow: var(--shadow-md);
}

.finder-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.finder-pill-btn {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.finder-pill-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.finder-pill-btn.active {
  background: var(--primary) !important;
  color: var(--text-inverse) !important;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-sm);
}

.finder-results-box {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
  animation: toastFadeIn 0.3s ease;
}

.finder-results-box h4 {
  font-size: 1.15rem;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.finder-results-box p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.finder-results-box ul {
  margin-left: 20px;
  line-height: 1.6;
  color: var(--text-main);
}

/* Banner / Hero */
.hero-banner {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 36px 32px;
  border-radius: var(--border-radius);
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.hero-banner h1,
.hero-banner .hero-main-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  color: var(--hero-text);
}

.commissioner-lead {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.5;
}

.hero-banner p {
  font-size: 1.1rem;
  opacity: 0.95;
  max-width: 800px;
  line-height: 1.5;
}

.hero-meta {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  background: var(--surface-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.hero-download-btn {
  background: var(--primary) !important;
  color: var(--text-inverse) !important;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.hero-download-btn:hover {
  background: var(--primary-dark) !important;
}

/* Quick Stats Bar */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.stat-info h3,
.stat-info .stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
  display: block;
}

.stat-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Section Containers */
.content-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
  scroll-margin-top: 90px;
  transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-color);
}

.section-title-wrap h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title-wrap p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Commissioner Message Box */
.message-box {
  background: var(--surface-alt);
  border-left: 5px solid var(--primary);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 24px;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.commissioner-profile {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.commissioner-avatar {
  width: 140px;
  height: 175px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.commissioner-text {
  flex: 1;
  min-width: 260px;
}

/* Responsive Image Figures */
.content-figure {
  margin: 24px 0;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--surface-alt);
  box-shadow: var(--shadow-md);
}

.content-figure img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  max-height: 420px;
}

.content-figure figcaption {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.message-box p {
  margin-bottom: 16px;
  font-size: 1.05rem;
  line-height: 1.7;
}

.message-box p:last-child {
  margin-bottom: 0;
}

.message-signoff {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-weight: 700;
  color: var(--primary);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.info-card {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, border-color 0.2s;
}

.info-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.info-card-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.info-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.info-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Priority Area Block */
.priority-block {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.priority-header {
  background: var(--surface-alt);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.priority-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.priority-outcome {
  padding: 14px 20px;
  background: var(--primary-light);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
}

.priority-outcome strong {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Action Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.action-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.action-table th {
  background: var(--surface-alt);
  color: var(--text-main);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.action-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  line-height: 1.55;
  color: var(--text-main);
}

.action-table tr:hover td {
  background-color: var(--surface-alt);
}

.cell-action {
  min-width: 260px;
  font-weight: 600;
  color: var(--text-main);
}

.cell-measure {
  min-width: 220px;
  color: var(--text-muted);
}

.cell-timeframe {
  min-width: 130px;
  white-space: normal;
}

.cell-resp {
  min-width: 160px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 20px;
  line-height: 1.3;
  color: var(--text-main);
  background-color: var(--surface-alt);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.badge-timeframe {
  background-color: #e0f2fe;
  color: #002e52;
  border: 1px solid #7dc1e8;
  font-weight: 700;
}

.badge-resp {
  background-color: #e6f0fa;
  color: #0c2340;
  border: 1px solid #9dc4e6;
  font-weight: 700;
}

.badge-matrix-pa {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  color: #0c2340 !important;
  background-color: #e6f0fa !important;
  border: 1px solid #9dc4e6 !important;
  white-space: nowrap;
}

.badge-page {
  font-size: 0.75rem;
  color: var(--text-main);
  background-color: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

/* Domain Header Cards */
.domain-header-card {
  background-color: var(--surface-color);
  background: var(--surface-color);
  border: 2px solid var(--primary);
  padding: 24px;
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.domain-outcome-text {
  font-size: 1.05rem;
  color: var(--text-main);
  font-weight: 600;
  margin-top: 8px;
}

.domain-outcome-text strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.domain-objective-text {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-top: 6px;
}

.domain-objective-text strong {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Action Matrix View (Filters & Matrix Table) */
.matrix-filter-bar {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  flex: 1;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light), var(--shadow-sm);
}

.filter-reset-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  align-self: flex-end;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.filter-reset-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: var(--shadow-sm);
}

/* Glossary Section */
.glossary-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.glossary-letter-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

.glossary-letter-btn:hover,
.glossary-letter-btn.active {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.glossary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.glossary-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, border-color 0.2s;
}

.glossary-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.glossary-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.glossary-card p {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.6;
}

/* Footer */
.app-footer {
  background: var(--surface-color);
  border-top: 2px solid var(--border-color);
  padding: 36px 24px;
  margin-top: 48px;
  box-shadow: 0 -4px 12px -2px rgb(0 0 0 / 0.05);
  transition: background-color 0.25s, border-color 0.25s;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-info h4,
.footer-info .footer-org-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.footer-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.back-to-top-btn {
  background: var(--primary);
  color: var(--text-inverse);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.back-to-top-btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}



/* Reading Progress Bar */
.scroll-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  z-index: 1001;
  background: transparent;
}

.scroll-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.1s ease-out;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface-color);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.7s forwards;
  pointer-events: auto;
}

@keyframes toastFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* Interactive Action Bookmark Ribbon */
.btn-bookmark {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s;
  padding: 4px 6px;
  border-radius: 4px;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.btn-bookmark svg {
  display: block;
  width: 19px;
  height: 19px;
  transition: transform 0.2s ease, fill 0.2s ease, stroke 0.2s ease;
}

.btn-bookmark:hover {
  transform: scale(1.22);
  color: #ef4444;
}

.btn-bookmark.bookmarked {
  color: #e11d48 !important;
  transform: scale(1.15);
}

.btn-bookmark.bookmarked svg {
  fill: #e11d48;
  stroke: #e11d48;
}

[data-theme="high-contrast-yellow"] .btn-bookmark.bookmarked {
  color: #ffff00 !important;
}

[data-theme="high-contrast-yellow"] .btn-bookmark.bookmarked svg {
  fill: #ffff00 !important;
  stroke: #ffff00 !important;
}

[data-theme="high-contrast-yellow"] .toast {
  background: #000000 !important;
  color: #ffff00 !important;
  border: 2px solid #ffff00 !important;
}

[data-theme="dark"] .badge-timeframe {
  background-color: #0c2742;
  color: #7dd3fc;
  border-color: #0284c7;
}

[data-theme="dark"] .badge-resp {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}

[data-theme="dark"] .badge-matrix-pa {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

[data-theme="high-contrast-yellow"] .badge-timeframe,
[data-theme="high-contrast-yellow"] .badge-resp,
[data-theme="high-contrast-yellow"] .badge-matrix-pa {
  background-color: #000000 !important;
  color: #ffff00 !important;
  border: 2px solid #ffff00 !important;
}

.filter-reset-btn.active {
  background: var(--primary) !important;
  color: var(--text-inverse) !important;
  border-color: var(--primary) !important;
}

/* Bookmarks View Styles */
.bookmarks-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface-alt);
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  margin-top: 20px;
}

.bookmarks-empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.bookmarks-empty-state h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  margin-bottom: 8px;
}

.bookmarks-empty-state p {
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* Smooth Content Transitions */
.reveal-on-scroll {
  opacity: 1;
  transform: none;
}

/* Accessibility: Disable motion for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .wave-bar {
    animation: none !important;
  }
  .toast {
    animation: none !important;
  }
}

/* Responsive Styles */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }
}

@media (max-width: 1200px) and (min-width: 861px) {
  .top-bar-inner {
    padding: 8px 18px;
    gap: 12px;
  }
  .brand-section {
    gap: 10px;
  }
  .ecsa-header-logo {
    height: 38px;
  }
  .brand-title h1,
  .brand-title .brand-title-text {
    font-size: 1.05rem;
  }
  .brand-title span {
    font-size: 0.78rem;
  }
  .accessibility-toolbar {
    gap: 6px;
  }
  .btn-ctrl {
    padding: 4px 8px;
    font-size: 0.78rem;
    gap: 4px;
  }
  .control-label {
    padding: 2px 4px;
    font-size: 0.74rem;
  }
}

@media (max-width: 860px) {
  .top-bar-inner {
    flex-direction: column;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }
  .accessibility-toolbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .hero-banner h1 {
    font-size: 1.6rem;
  }
  .content-section {
    padding: 20px;
  }
}

/* Print Stylesheet */
@media print {
  .top-header,
  .sidebar,
  .accessibility-toolbar,
  .content-toolbar,
  .back-to-top-btn,
  .skip-link,
  .voice-player-bar,
  .btn-listen-section {
    display: none !important;
  }
  .app-container {
    display: block;
    padding: 0;
  }
  .main-content {
    width: 100% !important;
  }
  .content-section {
    box-shadow: none;
    border: none;
    border-bottom: 1px solid #000;
    page-break-inside: avoid;
    padding: 20px 0;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt;
  }
}

/* -------------------------------------------------------------------------- */
/* Voice Reader Audio Floating Toolbar & In-Section Buttons                   */
/* -------------------------------------------------------------------------- */

/* Section "Listen" button */
.btn-listen-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-alt);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 10px;
  align-self: flex-start;
}

.btn-listen-section:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-listen-section.is-reading {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  animation: voicePulse 1.6s infinite ease-in-out;
}

/* Domain header card listen button */
.btn-listen-domain {
  margin-top: 6px;
  margin-bottom: 10px;
}

/* Priority Area button styling */
.priority-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.btn-listen-pa {
  font-size: 0.76rem;
  padding: 4px 12px;
  gap: 5px;
  margin-top: 4px;
}

.btn-listen-pathway {
  font-size: 0.8rem;
  padding: 5px 12px;
  gap: 5px;
  margin-top: 2px;
  margin-bottom: 8px;
}

.btn-listen-hero {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  margin-top: 4px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  padding: 6px 16px;
}

.btn-listen-hero:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: #ffffff;
  color: #ffffff;
}

.btn-listen-hero.is-reading {
  background: var(--primary);
  border-color: #ffffff;
  color: #ffffff;
}

@keyframes voicePulse {
  0% { box-shadow: 0 0 0 0 rgba(199, 32, 47, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(199, 32, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(199, 32, 47, 0); }
}

/* Floating Voice Bar */
.voice-player-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  width: calc(100% - 40px);
  max-width: 900px;
  background: var(--surface-color);
  border: 2px solid var(--primary);
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  padding: 10px 18px;
  animation: slideUpVoice 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

@keyframes slideUpVoice {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.voice-player-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.voice-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}

.voice-pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  transition: background-color 0.25s;
}

.voice-player-bar.is-speaking .voice-pulse-dot {
  background: var(--primary);
  animation: voiceDotPulse 1.2s infinite ease-in-out;
}

@keyframes voiceDotPulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.voice-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  overflow: hidden;
}

.voice-state-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.voice-target-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.voice-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.voice-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.voice-btn-play {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.voice-btn-play:hover {
  background: var(--primary-dark);
  color: #ffffff;
}

.voice-select {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 20px;
  outline: none;
  cursor: pointer;
}

.voice-select-main {
  max-width: 170px;
}

/* Exclusive Voice Badge Pill */
.voice-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  user-select: none;
  box-shadow: var(--shadow-xs);
}

.voice-badge-pill .voice-flag {
  font-size: 0.95rem;
}

.voice-btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.voice-btn-close:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* Speaking visual highlight on current reading element */
.voice-speaking-highlight {
  outline: 3px solid var(--primary) !important;
  outline-offset: 6px;
  background-color: rgba(199, 32, 47, 0.04) !important;
  border-radius: 8px;
  scroll-margin-top: calc(var(--header-height) + 24px);
  transition: background-color 0.25s, outline 0.25s;
}

/* Karaoke Paragraph/Sentence Active Highlight */
.karaoke-active-block {
  background-color: rgba(254, 240, 138, 0.25) !important;
  border-left: 4px solid var(--primary) !important;
  padding-left: 12px !important;
  border-radius: 4px;
  scroll-margin-top: calc(var(--header-height) + 24px);
  box-shadow: 0 0 10px rgba(199, 32, 47, 0.1);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Karaoke Word-by-Word Highlight (Karaoke style) */
.karaoke-word {
  display: inline;
  transition: background-color 0.1s ease, color 0.1s ease, transform 0.1s ease;
}

.karaoke-word.karaoke-word-active {
  background: #fde047 !important;
  color: #0f172a !important;
  border-radius: 4px;
  padding: 1px 3px;
  box-shadow: 0 0 0 2px #eab308, 0 2px 5px rgba(0, 0, 0, 0.2);
  font-weight: 700 !important;
  position: relative;
  z-index: 2;
}

/* High Contrast Yellow Theme overrides */
[data-theme="high-contrast-yellow"] .voice-player-bar {
  background: #000000 !important;
  border: 3px solid #ffff00 !important;
  box-shadow: 0 0 0 4px #000000, 0 10px 25px rgba(255, 255, 0, 0.4) !important;
}

[data-theme="high-contrast-yellow"] .karaoke-active-block {
  background-color: rgba(255, 255, 0, 0.15) !important;
  border-left: 4px solid #ffff00 !important;
}

[data-theme="high-contrast-yellow"] .karaoke-word.karaoke-word-active {
  background: #ffff00 !important;
  color: #000000 !important;
  box-shadow: 0 0 0 2px #000000 !important;
}

[data-theme="high-contrast-yellow"] .voice-btn-play,
[data-theme="high-contrast-yellow"] .btn-listen-section.is-reading {
  background: #ffff00 !important;
  color: #000000 !important;
  border-color: #ffff00 !important;
}

[data-theme="high-contrast-yellow"] .voice-pulse-dot {
  background: #ffff00 !important;
}

[data-theme="high-contrast-yellow"] .voice-speaking-highlight {
  outline: 3px solid #ffff00 !important;
  background-color: rgba(255, 255, 0, 0.2) !important;
}

@media (max-width: 768px) {
  .voice-player-bar {
    border-radius: 16px;
    bottom: 12px;
    width: calc(100% - 24px);
    padding: 10px 14px;
  }
  .voice-target-label {
    max-width: 180px;
  }
  .voice-select-main {
    max-width: 120px;
  }
}

