:root {
  --bg-primary: #FAF7F0;
  --bg-secondary: #F2ECE0;
  --bg-card: #FFFFFF;
  --bg-subtle: #EAE2D1;
  --text-primary: #1A1714;
  --text-secondary: #4A443C;
  --text-muted: #766E62;
  --border-color: #DCD3C0;
  --border-strong: #C2B69E;
  --accent-emerald: #0C4A3E;
  --accent-emerald-light: #156B5B;
  --accent-emerald-bg: rgba(12, 74, 62, 0.08);
  --accent-gold: #9A6E12;
  --accent-gold-bg: rgba(154, 110, 18, 0.12);
  --accent-crimson: #8C2327;
  --accent-crimson-bg: rgba(140, 35, 39, 0.11);
  --highlight-bg: #FDE68A;
  --highlight-text: #781D1F;
  --shadow-sm: 0 2px 6px rgba(26, 23, 20, 0.05);
  --shadow-md: 0 8px 24px rgba(26, 23, 20, 0.08);
  --shadow-lg: 0 20px 50px rgba(26, 23, 20, 0.16);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --header-height: 68px;
}

[data-theme="dark"] {
  --bg-primary: #111413;
  --bg-secondary: #181D1B;
  --bg-card: #1D2320;
  --bg-subtle: #252D29;
  --text-primary: #EFECE6;
  --text-secondary: #B9B2A6;
  --text-muted: #847D72;
  --border-color: #2B3430;
  --border-strong: #3B4741;
  --accent-emerald: #34A88E;
  --accent-emerald-light: #4BC2A7;
  --accent-emerald-bg: rgba(52, 168, 142, 0.14);
  --accent-gold: #D9A536;
  --accent-gold-bg: rgba(217, 165, 54, 0.15);
  --accent-crimson: #E06C70;
  --accent-crimson-bg: rgba(224, 108, 112, 0.16);
  --highlight-bg: rgba(217, 165, 54, 0.3);
  --highlight-text: #FFD579;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ==================== HEADER ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1460px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-crest {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-emerald);
  color: #FFF;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.2);
}

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

.brand-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
}

.nav-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.nav-btn.active {
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  border-color: rgba(12, 74, 62, 0.2);
  font-weight: 600;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
}

.nav-badge.gold {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
}

/* Dropdown */
.nav-dropdown-wrap {
  position: relative;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 310px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}

.nav-dropdown-wrap:hover .nav-dropdown {
  display: flex;
}

.dropdown-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-primary);
}

.dropdown-item:hover {
  background: var(--bg-secondary);
}

.dropdown-item strong {
  font-size: 13.5px;
  color: var(--text-primary);
}

.dropdown-item span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-header-search {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 2px 4px 2px 10px;
}

.quick-header-search input {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  width: 185px;
  outline: none;
}

.quick-header-search button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 5px;
  cursor: pointer;
  border-radius: 5px;
}

.quick-header-search button:hover {
  color: var(--accent-emerald);
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ==================== LOADER ==================== */
.app-loader {
  position: fixed;
  inset: 0;
  background: rgba(250, 247, 240, 0.94);
  backdrop-filter: blur(6px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease;
}

[data-theme="dark"] .app-loader {
  background: rgba(17, 20, 19, 0.94);
}

.app-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-card {
  max-width: 480px;
  width: 90%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.loader-crest {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--accent-emerald);
  color: #FFF;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-card h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  margin: 0 0 8px;
}

.loader-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

.loader-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 99px;
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  width: 25%;
  background: var(--accent-emerald);
  transition: width 0.25s ease;
}

/* ==================== VIEWS ==================== */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* ==================== HERO ==================== */
.hero-banner {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 48px 24px 42px;
}

.hero-content {
  max-width: 1120px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-emerald);
  background: var(--accent-emerald-bg);
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 14px;
}

.hero-content h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 14px;
}

.hero-lead {
  max-width: 840px;
  margin: 0 auto 28px;
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.hero-search-panel {
  max-width: 860px;
  margin: 0 auto 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.hero-search-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.hero-tab {
  flex: 1;
  min-width: 200px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.hero-tab.active {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.hero-search-form {
  display: flex;
  gap: 10px;
}

.hero-search-form input {
  flex: 1;
  padding: 13px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
}

.hero-search-form input:focus {
  border-color: var(--accent-emerald);
}

.hero-search-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.example-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  cursor: pointer;
}

.example-chip:hover {
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 860px;
  margin: 0 auto;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-emerald);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==================== SECTIONS & CARDS ==================== */
.section-container {
  max-width: 1420px;
  margin: 0 auto;
  padding: 36px 24px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-kicker {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: 30px;
  margin: 0;
}

.genres-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.genre-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.genre-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.genre-tag {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-emerald);
  background: var(--accent-emerald-bg);
  padding: 3px 10px;
  border-radius: 99px;
}

.genre-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.genre-card h3 {
  font-family: var(--font-serif);
  font-size: 26px;
  margin: 0 0 8px;
}

.genre-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.genre-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.pill-link {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}

.pill-link:hover {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.genre-excertos-preview {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.mini-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 5px;
}

.text-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-emerald);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
}

.btn-card-action {
  margin-top: auto;
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--accent-emerald);
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: var(--accent-emerald);
  color: #FFF;
}

.philology-showcase {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding-top: 8px;
}

.showcase-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 26px;
}

.showcase-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  margin-bottom: 10px;
}

.showcase-badge.gold {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
}

.showcase-card h3 {
  font-family: var(--font-serif);
  font-size: 25px;
  margin: 0 0 10px;
}

.showcase-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 18px;
}

/* Buttons */
.btn-primary {
  background: var(--accent-emerald);
  color: #FFF;
  border: 1px solid var(--accent-emerald);
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--accent-emerald-light);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
  border-radius: 7px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary.active, .btn-secondary:hover {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 7px;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ==================== OBRAS & ARQUIVO VIEW ==================== */
.obras-subnav-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}

.obras-subnav-inner {
  max-width: 1420px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
}

.obra-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 15px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.obra-tab-btn.active {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.count-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(0,0,0,0.1);
}

.obra-tab-btn.active .count-pill {
  background: rgba(255,255,255,0.22);
}

.obra-subview {
  display: none;
}

.obra-subview.active {
  display: block;
}

.two-col-layout {
  max-width: 1420px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 28px;
  align-items: start;
}

.filters-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  max-height: calc(100vh - var(--header-height) - 32px);
  overflow-y: auto;
}

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0;
}

.btn-text-clear {
  background: none;
  border: none;
  color: var(--accent-crimson);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.filter-group {
  margin-bottom: 16px;
}

.filter-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.filter-input, .filter-select {
  width: 100%;
  padding: 8px 11px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.canto-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.canto-pill {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.canto-pill.full-span {
  grid-column: span 2;
}

.canto-pill.active {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-chip {
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

/* Subgenre Tree in Lírica */
.subgenre-tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subgenre-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
  margin: 8px 0 3px;
}

.subgenre-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

.subgenre-btn.active {
  background: var(--accent-emerald);
  color: #FFF;
}

.badge-num {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.8;
}

/* Reader Column */
.reader-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.reader-toolbar h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  margin: 0;
}

.reader-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

/* Stanzas & Verses */
.stanzas-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stanza-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 22px 28px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.stanza-card.highlighted-stanza {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px var(--accent-gold-bg);
}

.stanza-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-subtle);
}

.stanza-num-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-emerald);
  margin: 0;
}

.stanza-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tax-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.tax-badge.excerto {
  background: var(--accent-gold-bg);
  color: var(--accent-gold);
  border-color: transparent;
}

.tax-badge.plano {
  background: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  border-color: transparent;
}

.tax-badge.ano {
  background: var(--accent-crimson-bg);
  color: var(--accent-crimson);
  border-color: transparent;
}

.yt-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-crimson);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--accent-crimson-bg);
}

.verse-block {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.68;
  color: var(--text-primary);
}

.verse-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 1px 0;
}

.verse-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  width: 28px;
  text-align: right;
  user-select: none;
  flex-shrink: 0;
}

.verse-text {
  flex: 1;
}

/* Clickable Words inside Poems/Stanzas */
.c-word {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.c-word:hover {
  background-color: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.c-word.word-highlight {
  background-color: var(--highlight-bg);
  color: var(--highlight-text);
  font-weight: 600;
  padding: 0 3px;
}

.editorial-note {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  font-size: 13px;
  color: var(--text-secondary);
}

/* A-Z Bar & Catalog List */
.az-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  padding: 8px 10px;
}

.az-btn {
  min-width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

.az-btn.active, .az-btn:hover:not(:disabled) {
  background: var(--accent-emerald);
  color: #FFF;
}

.az-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.obras-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.catalog-letter-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
}

.catalog-letter-heading {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-emerald);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.catalog-item:hover {
  background: var(--bg-secondary);
}

.catalog-item-title {
  font-family: var(--font-serif);
  font-size: 18.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.catalog-item-incipit {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 8px;
  font-style: italic;
}

/* Teatro & Cartas Grids */
.teatro-grid, .cartas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 18px;
}

.work-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.work-card h3 {
  font-family: var(--font-serif);
  font-size: 23px;
  margin: 6px 0 10px;
}

.work-excerpt {
  font-family: var(--font-serif);
  font-size: 16.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.55;
}

/* ==================== SINGLE OBRA MODAL ==================== */
.obra-reader-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.obra-reader-modal[aria-hidden="false"] {
  display: flex;
}

.obra-reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 17, 0.65);
  backdrop-filter: blur(3px);
}

.obra-reader-dialog {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.obra-reader-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-radius: 14px 14px 0 0;
}

.obra-reader-nav, .obra-reader-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-modal {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.obra-reader-body {
  padding: 32px 42px;
  overflow-y: auto;
}

/* ==================== VIEW 3: PHI CONCORDANCE SEARCH ==================== */
.phi-container {
  max-width: 1420px;
  margin: 0 auto;
  padding: 28px 24px;
}

.phi-search-header {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.phi-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.phi-title-row h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin: 0;
}

.phi-syntax-help {
  font-size: 12.5px;
  color: var(--text-muted);
}

.phi-syntax-help code {
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-emerald);
}

.phi-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.phi-input-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.phi-input-wrapper .search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
}

.phi-input-wrapper input {
  width: 100%;
  padding: 13px 40px 13px 42px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15.5px;
  font-family: var(--font-sans);
  outline: none;
}

.phi-input-wrapper input:focus {
  border-color: var(--accent-emerald);
}

.phi-clear-input {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

.phi-controls-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 16px;
  align-items: start;
}

.phi-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* PHI Summary & Results */
.phi-summary-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

.phi-stats-headline {
  font-family: var(--font-serif);
  font-size: 24px;
  margin: 0 0 8px;
}

.phi-forms-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.form-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
}

.form-chip.active, .form-chip:hover {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.phi-dict-preview-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 18px;
}

.phi-dict-preview-box h4 {
  font-family: var(--font-serif);
  font-size: 20px;
  margin: 0 0 4px;
  color: var(--accent-emerald);
}

.phi-distribution-bars {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.dist-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.phi-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

/* PHI Work Group Card (latin.packhum.org style) */
.phi-work-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}

.phi-work-header {
  background: var(--bg-secondary);
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.phi-work-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--accent-emerald);
  cursor: pointer;
}

.phi-work-title:hover {
  text-decoration: underline;
}

.phi-hit-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 10px 18px;
  border-bottom: 1px solid var(--bg-subtle);
  transition: background 0.12s ease;
}

.phi-hit-row:last-child {
  border-bottom: none;
}

.phi-hit-row:hover {
  background: var(--bg-primary);
}

.phi-hit-loc {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.phi-hit-loc:hover {
  color: var(--accent-emerald);
  text-decoration: underline;
}

.phi-hit-verse {
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--text-primary);
}

.phi-hit-verse mark {
  background: var(--highlight-bg);
  color: var(--highlight-text);
  font-weight: 700;
  padding: 0 3px;
  border-radius: 3px;
}

.phi-hit-actions {
  display: flex;
  gap: 6px;
}

.phi-context-box {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border-left: 3px solid var(--accent-emerald);
  padding: 12px 18px;
  margin-top: 6px;
  border-radius: 0 8px 8px 0;
  font-family: var(--font-serif);
  font-size: 17.5px;
  line-height: 1.6;
}

/* KWIC Table */
.kwic-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow-x: auto;
}

.kwic-row {
  display: grid;
  grid-template-columns: 145px 1fr auto 1fr 90px;
  gap: 10px;
  align-items: baseline;
  padding: 8px 16px;
  border-bottom: 1px solid var(--bg-subtle);
  font-family: var(--font-serif);
  font-size: 18px;
}

.kwic-left {
  text-align: right;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kwic-key {
  font-weight: 700;
  background: var(--highlight-bg);
  color: var(--highlight-text);
  padding: 1px 7px;
  border-radius: 4px;
  text-align: center;
  white-space: nowrap;
}

.kwic-right {
  text-align: left;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== VIEW 4: PHILOLOG.US DICTIONARY ==================== */
.philologus-header-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
}

.philologus-header-inner {
  max-width: 1460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.philologus-header-inner h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  margin: 0;
}

.philologus-workspace {
  display: none;
  max-width: 1460px;
  margin: 0 auto;
  padding: 20px 24px;
  grid-template-columns: 300px 1fr 370px;
  gap: 20px;
  height: calc(100vh - var(--header-height) - 92px);
  min-height: 640px;
}

.philologus-workspace.active {
  display: grid;
}

.philologus-wheel-pane, .philologus-entry-pane, .philologus-concordance-pane {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.wheel-search-box {
  padding: 14px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.wheel-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.mini-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.mini-pill.active {
  background: var(--accent-emerald);
  color: #FFF;
  border-color: var(--accent-emerald);
}

.wheel-az-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.wheel-az-btn {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 3px;
}

.wheel-az-btn:hover {
  background: var(--accent-emerald);
  color: #FFF;
}

.wheel-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.wheel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid transparent;
}

.wheel-item:hover {
  background: var(--bg-secondary);
}

.wheel-item.active {
  background: var(--accent-emerald);
  color: #FFF;
  font-weight: 600;
}

.wheel-item-word {
  font-family: var(--font-serif);
  font-size: 17px;
}

.wheel-item-badges {
  display: flex;
  align-items: center;
  gap: 5px;
}

.wheel-dic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-gold);
}

.wheel-item.active .wheel-dic-dot {
  background: #FFD579;
}

.wheel-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
}

/* Center & Right Panes of Philolog.us */
.philologus-entry-pane, .philologus-concordance-pane {
  overflow-y: auto;
  padding: 24px;
}

.dict-entry-header {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.dict-headword-title {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  color: var(--accent-emerald);
  margin: 0;
  line-height: 1.1;
}

.dict-submeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dict-section-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.dict-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.peixoto-entry-card {
  border-left: 3px solid var(--accent-emerald);
  padding-left: 14px;
  margin-bottom: 16px;
}

.peixoto-entry-card:last-child {
  margin-bottom: 0;
}

.peixoto-hw {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.peixoto-def {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-emerald);
  margin: 4px 0 8px;
}

.peixoto-body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-line;
}

.cit-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-emerald);
  background: var(--accent-emerald-bg);
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
}

.cit-link:hover {
  background: var(--accent-emerald);
  color: #FFF;
}

/* Grammar Workspace */
.philologus-grammar-workspace {
  display: none;
}

.philologus-grammar-workspace.active {
  display: block;
}

.grammar-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
}

.grammar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grammar-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 28px 36px;
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  white-space: pre-line;
}

/* Mobile Advanced Filters Toggle Button (Hidden on Desktop) */
.mobile-adv-filters-btn {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--accent-emerald);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-adv-filters-btn .adv-chevron {
  transition: transform 0.2s ease;
  font-size: 14px;
}

.sidebar-card.mobile-adv-open .mobile-adv-filters-btn {
  margin-bottom: 14px;
  background: var(--accent-emerald-bg);
  border-color: var(--accent-emerald);
}

.sidebar-card.mobile-adv-open .mobile-adv-filters-btn .adv-chevron {
  transform: rotate(180deg);
}

/* ==================== GLOBAL WORD INSPECTOR DRAWER ==================== */
.word-inspector-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 17, 0.45);
  backdrop-filter: blur(2px);
  z-index: 390;
  display: none;
}

.word-inspector-backdrop[aria-hidden="false"] {
  display: block;
}

.word-inspector-drawer {
  position: fixed;
  top: 0;
  right: -460px;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  display: flex;
  flex-direction: column;
  transition: right 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.word-inspector-drawer[aria-hidden="false"] {
  right: 0;
}

.inspector-header {
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inspector-kicker {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
}

.inspector-header h3 {
  font-family: var(--font-serif);
  font-size: 28px;
  margin: 2px 0 0;
  color: var(--accent-emerald);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Arquivo Index & Footer */
.arquivo-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.arquivo-panel {
  display: none;
}

.arquivo-panel.active {
  display: block;
}

.bio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px 40px;
  max-width: 920px;
  font-family: var(--font-serif);
  font-size: 19.5px;
  line-height: 1.72;
  white-space: pre-line;
}

.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 24px;
  margin-top: 48px;
  font-size: 13px;
  color: var(--text-secondary);
}

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

.footer-inner a {
  color: var(--accent-emerald);
  text-decoration: none;
  font-weight: 500;
}

/* ==================== RESPONSIVE & MOBILE ADAPTATION ==================== */
@media (max-width: 1100px) {
  .two-col-layout,
  .philologus-workspace,
  .phi-controls-grid,
  .phi-summary-banner,
  .genres-grid,
  .philology-showcase,
  .grammar-layout {
    grid-template-columns: 1fr;
  }

  .philologus-workspace {
    height: auto;
    min-height: 0;
  }

  .philologus-wheel-pane .wheel-list {
    max-height: 210px;
    -webkit-overflow-scrolling: touch;
  }

  .grammar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .grammar-nav .subgenre-btn {
    width: auto;
    flex: 1 1 220px;
    gap: 8px;
  }

  .filters-sidebar {
    position: static;
    max-height: none;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .site-header {
    height: auto;
  }

  .header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 8px;
  }

  .brand {
    order: 1;
  }

  .header-actions {
    order: 2;
    margin-left: auto;
  }

  .main-nav {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
  }

  .main-nav .nav-dropdown-wrap {
    width: 100%;
  }

  .main-nav .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 8px 6px;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
  }

  .nav-dropdown-wrap .caret,
  .nav-dropdown-wrap:hover .nav-dropdown {
    display: none !important;
  }

  /* Collapsible secondary filters on tablet & mobile */
  .mobile-adv-filters-btn {
    display: flex;
  }

  .sidebar-card:not(.mobile-adv-open) .mobile-adv-filters-btn ~ .filter-group {
    display: none;
  }

  #lus-canto-pills {
    grid-template-columns: repeat(5, 1fr);
  }

  #lus-canto-pills .canto-pill.full-span {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  html, body {
    overflow-x: hidden;
  }

  .header-inner {
    padding: 8px 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-crest {
    width: 34px;
    height: 34px;
    font-size: 14px;
    border-radius: 7px;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand-subtitle {
    display: none;
  }

  .quick-header-search {
    padding: 2px 3px 2px 8px;
  }

  .quick-header-search input {
    width: 125px;
    font-size: 14px;
  }

  .theme-toggle {
    width: 34px;
    height: 34px;
  }

  .main-nav {
    gap: 4px;
    padding-top: 6px;
  }

  .main-nav .nav-btn {
    flex-direction: column;
    gap: 3px;
    padding: 6px 3px;
    font-size: 11px;
    line-height: 1.15;
    border-radius: 6px;
  }

  .main-nav .nav-btn svg {
    width: 15px;
    height: 15px;
  }

  /* Hero Mobile */
  .hero-banner {
    padding: 22px 12px 20px;
  }

  .hero-eyebrow {
    font-size: 10px;
    padding: 4px 10px;
    line-height: 1.35;
    white-space: normal;
    border-radius: 10px;
  }

  .hero-content h1 {
    font-size: 27px;
    line-height: 1.18;
    margin-bottom: 10px;
  }

  .hero-lead {
    font-size: 14.5px;
    line-height: 1.55;
    margin-bottom: 18px;
  }

  .hero-search-panel {
    padding: 12px;
    margin-bottom: 20px;
  }

  .hero-search-tabs {
    flex-direction: column;
    gap: 5px;
  }

  .hero-tab {
    min-width: 0;
    width: 100%;
    padding: 9px 10px;
    font-size: 12.5px;
  }

  .hero-search-form {
    flex-direction: column;
    gap: 8px;
  }

  .hero-search-form input,
  .phi-input-wrapper input,
  .filter-input,
  .filter-select {
    font-size: 16px;
  }

  .hero-search-form .btn-primary {
    width: 100%;
    padding: 12px;
  }

  .hero-search-examples {
    justify-content: center;
    gap: 5px;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-box {
    padding: 10px 8px;
  }

  .stat-num {
    font-size: 22px;
  }

  .stat-label {
    font-size: 11px;
  }

  /* Sections, Layouts & Cards */
  .section-container,
  .two-col-layout,
  .phi-container,
  .philologus-workspace {
    padding: 14px 12px;
    gap: 14px;
  }

  .section-header h2,
  .reader-toolbar h2,
  .phi-title-row h2,
  .philologus-header-inner h2 {
    font-size: 22px;
  }

  .obras-subnav-bar {
    padding: 0 12px;
  }

  .obras-subnav-inner {
    padding: 8px 0;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .obra-tab-btn {
    padding: 7px 11px;
    font-size: 12.5px;
  }

  .sidebar-card {
    padding: 14px 12px;
  }

  #lus-canto-pills {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .canto-pill {
    padding: 7px 4px;
    font-size: 11.5px;
    text-align: center;
  }

  .reader-toolbar {
    padding: 12px 14px;
    margin-bottom: 12px;
    gap: 10px;
  }

  .stanza-card,
  .genre-card,
  .showcase-card,
  .work-card,
  .bio-card,
  .grammar-content {
    padding: 16px 14px;
  }

  .stanza-num-title {
    font-size: 19px;
  }

  .verse-block {
    font-size: 17px;
    line-height: 1.6;
  }

  .verse-line {
    gap: 8px;
  }

  .verse-num {
    width: 18px;
    font-size: 10px;
  }

  /* A-Z Bar & Catalog Items */
  .az-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px;
  }

  .az-btn {
    flex-shrink: 0;
  }

  .catalog-letter-group {
    padding: 12px 12px;
  }

  .catalog-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--bg-subtle);
  }

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

  .catalog-item-title {
    font-size: 17px;
  }

  .catalog-item-incipit {
    display: block;
    margin-left: 0;
    margin-top: 2px;
    font-size: 12.5px;
  }

  /* Single Obra Modal on Mobile (Bottom Sheet style) */
  .obra-reader-modal {
    padding: 0;
    align-items: flex-end;
  }

  .obra-reader-dialog {
    max-height: 93vh;
    height: 93vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }

  .obra-reader-header {
    padding: 10px 12px;
    border-radius: 16px 16px 0 0;
    gap: 6px;
  }

  .obra-reader-header .btn-sm {
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .obra-reader-body {
    padding: 14px 12px;
    -webkit-overflow-scrolling: touch;
  }

  /* Concordância Mobile */
  .phi-search-header {
    padding: 14px 12px;
    margin-bottom: 14px;
  }

  .phi-input-row {
    flex-direction: column;
    gap: 8px;
  }

  .phi-input-row .btn-primary {
    width: 100%;
    padding: 12px;
  }

  .phi-summary-banner {
    padding: 14px;
    gap: 14px;
  }

  .phi-stats-headline {
    font-size: 19px;
  }

  .phi-work-header {
    padding: 10px 12px;
  }

  .phi-work-title {
    font-size: 17px;
  }

  .phi-hit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 12px;
  }

  .phi-hit-loc {
    order: 1;
    font-weight: 600;
    color: var(--accent-emerald);
  }

  .phi-hit-actions {
    order: 2;
    margin-left: auto;
  }

  .phi-hit-verse {
    order: 3;
    width: 100%;
    font-size: 17.5px;
    line-height: 1.5;
    margin-top: 2px;
  }

  .phi-context-box {
    order: 4;
    width: 100%;
    padding: 10px 12px;
    font-size: 16px;
  }

  .kwic-row {
    min-width: 580px;
    font-size: 16px;
    padding: 8px 12px;
  }

  /* Dictionary Mobile */
  .philologus-header-bar {
    padding: 12px;
  }

  .philologus-mode-tabs {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .philologus-mode-tabs .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .philologus-entry-pane,
  .philologus-concordance-pane {
    padding: 16px 14px;
  }

  .dict-headword-title {
    font-size: 28px;
  }

  .dict-section-block {
    padding: 14px;
    margin-bottom: 14px;
  }

  .peixoto-body {
    font-size: 16.5px;
  }

  /* Global Word Inspector Drawer as Mobile Bottom Sheet */
  .word-inspector-drawer {
    top: auto;
    bottom: -100vh;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 82vh;
    border-left: none;
    border-top: 1px solid var(--border-strong);
    border-radius: 16px 16px 0 0;
    transition: bottom 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .word-inspector-drawer[aria-hidden="false"] {
    bottom: 0;
    right: 0;
  }

  .inspector-header {
    padding: 12px 16px;
    border-radius: 16px 16px 0 0;
  }

  .inspector-header h3 {
    font-size: 24px;
  }

  .inspector-body {
    padding: 14px;
  }

  .site-footer {
    padding: 18px 14px;
    margin-top: 28px;
    text-align: center;
  }

  .footer-inner {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .quick-header-search input {
    width: 98px;
  }

  #lus-canto-pills {
    grid-template-columns: repeat(3, 1fr);
  }

  .verse-block {
    font-size: 16px;
  }
}
