/* LITREAD Modern Minimalist Stylesheet */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Dark Theme Default */
  --bg-primary: #121212;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --bg-card: #1c1c1e;
  --bg-hover: #2e2e2e;

  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;

  --border: #2a2a2a;
  --border-focus: #555555;

  --accent: #ffffff;
  --accent-inverted: #121212;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);

  --header-height: 64px;
}

[data-theme="light"] {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f5;
  --bg-card: #ffffff;
  --bg-hover: #e9ecef;

  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;

  --border: #e0e0e0;
  --border-focus: #1a1a1a;

  --accent: #121212;
  --accent-inverted: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.reading-mode {
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Offline Banner */
.offline-banner {
  display: none;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 8px 16px;
  text-align: center;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.offline-banner.active {
  display: flex;
}

.offline-banner svg {
  width: 16px;
  height: 16px;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}

/* Search Bar */
.search-bar {
  flex: 1;
  max-width: 460px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  pointer-events: none;
  color: var(--text-muted);
}

.search-icon svg {
  width: 16px;
  height: 16px;
}

.search-input-wrap input {
  width: 100%;
  height: 38px;
  padding: 0 16px 0 38px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.search-input-wrap input:focus {
  border-color: var(--border-focus);
}

.search-input-wrap input::placeholder {
  color: var(--text-muted);
}

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

/* Language Switcher Dropdown in Header */
.lang-switcher-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-lang-toggle {
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-lang-toggle:hover,
.btn-lang-toggle.active {
  background-color: var(--bg-secondary);
  border-color: var(--border-focus);
}

.btn-lang-toggle svg {
  width: 17px;
  height: 17px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.lang-current-code {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
  line-height: 1;
}

.lang-chevron-icon {
  display: inline-flex;
  align-items: center;
}

.lang-chevron-icon svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 2px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.lang-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  gap: 10px;
  transition: background-color 0.15s ease;
}

.lang-menu-item:hover {
  background-color: var(--bg-secondary);
}

.lang-menu-item.active {
  background-color: var(--bg-tertiary);
  font-weight: 600;
}

.lang-badge-mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 20px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  transition: all 0.15s ease;
}

.lang-menu-item:hover .lang-badge-mono {
  border-color: var(--text-muted);
}

.lang-menu-item.active .lang-badge-mono {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.lang-menu-item .lang-native-name {
  flex: 1;
}

.lang-menu-item .lang-check-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  color: var(--text-primary);
}

.lang-menu-item.active .lang-check-icon {
  opacity: 1;
}

.lang-menu-item .lang-check-icon svg {
  width: 14px;
  height: 14px;
}

/* Mobile Drawer Language Section */
.mobile-lang-section {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-lang-header {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 4px;
}

.mobile-lang-header .icon-wrap-globe svg {
  width: 18px;
  height: 18px;
}

.mobile-lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.mobile-lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mobile-lang-btn:hover {
  background-color: var(--bg-hover);
}

.mobile-lang-btn.active {
  background-color: var(--bg-tertiary);
  border-color: var(--border-focus);
  font-weight: 600;
}

.mobile-lang-btn .lang-badge-mono {
  width: 32px;
  height: 22px;
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.mobile-lang-btn.active .lang-badge-mono {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.mobile-lang-name {
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mobile-menu-btn {
  display: none;
}

/* Mobile Navigation Side Drawer */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.25s ease;
}

.mobile-menu-overlay.active {
  pointer-events: auto;
  visibility: visible;
}

.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-menu-overlay.active .mobile-menu-backdrop {
  opacity: 1;
}

.mobile-menu-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background-color: var(--bg-primary);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 2;
}

.mobile-menu-overlay.active .mobile-menu-drawer {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.mobile-menu-body {
  flex: 1;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.mobile-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.mobile-user-avatar svg {
  width: 20px;
  height: 20px;
}

.mobile-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.mobile-user-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.mobile-user-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-menu-divider {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus-visible {
  background-color: var(--bg-hover);
  border-color: var(--border);
}

.mobile-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.mobile-item-icon svg {
  width: 20px;
  height: 20px;
}

.mobile-item-label {
  flex: 1;
}

.mobile-item-danger {
  color: #e53e3e;
}

.mobile-item-danger .mobile-item-icon {
  color: #e53e3e;
}

.mobile-item-danger:hover {
  background-color: rgba(229, 62, 62, 0.08);
  border-color: rgba(229, 62, 62, 0.2);
}

.mobile-menu-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--accent-inverted);
}

.btn-primary:hover {
  opacity: 0.92;
}

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

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

.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary:disabled:hover,
.btn-primary[disabled]:hover,
.btn-primary[aria-disabled="true"]:hover {
  opacity: 0.38;
}

.btn-secondary:disabled:hover,
.btn-secondary[disabled]:hover,
.btn-secondary[aria-disabled="true"]:hover {
  background-color: var(--bg-secondary);
}

.mobile-menu-item:disabled,
.mobile-menu-item[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-icon.active {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.user-display {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Upload Progress Floating Bar */
.upload-progress-container {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  width: 320px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
}

.upload-progress-container.active {
  display: block;
}

.upload-progress-header {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-track {
  height: 4px;
  background-color: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
}

.upload-bar {
  height: 100%;
  width: 0%;
  background-color: var(--text-primary);
  transition: width 0.2s ease;
}

/* Dropzone Overlay */
.drop-zone-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.drop-zone-overlay.drag-active {
  display: flex;
}

.btn-close-drop-zone {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 10000;
}

.btn-close-drop-zone:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.drop-zone-content {
  border: 2px dashed #ffffff;
  border-radius: var(--radius-lg);
  padding: 60px 80px;
  text-align: center;
  color: #ffffff;
  pointer-events: none;
  cursor: default;
}

.drop-icon svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

/* Main Layout */
.app-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px;
}

/* Shelves Bar Section */
.shelves-bar-section {
  margin-bottom: 14px;
}

.shelves-wrapper {
  overflow-x: visible;
  padding-bottom: 2px;
}

.shelves-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.shelf-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.shelf-tab:hover {
  color: var(--text-primary);
  border-color: var(--border-hover, var(--text-muted));
  background-color: var(--bg-hover);
}

.shelf-tab.active {
  background-color: var(--accent);
  color: var(--accent-inverted);
  border-color: var(--accent);
  font-weight: 600;
}

.shelf-tab.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.04);
}

.shelf-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.12);
}

.shelf-tab.active .shelf-count {
  background-color: rgba(0, 0, 0, 0.22);
}

.btn-delete-shelf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: opacity 0.15s, background-color 0.15s;
}

.btn-delete-shelf:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.25);
}

.shelf-tab.active .btn-delete-shelf:hover {
  background-color: rgba(0, 0, 0, 0.25);
}

.btn-new-shelf {
  border-style: dashed;
  color: var(--text-muted);
}

.btn-new-shelf:hover {
  border-style: solid;
  color: var(--text-primary);
}

.btn-new-shelf svg {
  width: 13px;
  height: 13px;
}

/* Card dragging state */
.book-card.is-dragging {
  opacity: 0.45;
  border: 1px dashed var(--accent);
  transform: scale(0.98);
}

/* Library Toolbar */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background-color: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.filter-tab {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 500;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sort-select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
}

.sort-select:focus {
  border-color: var(--border-focus);
}

.view-switch {
  display: flex;
  gap: 4px;
}

/* Stats */
.library-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.stat-num {
  font-weight: 600;
  color: var(--text-primary);
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 24px;
}

.book-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

/* Cover Image / Placeholder */
.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background-color: var(--bg-tertiary);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.book-card:hover .book-cover-img {
  transform: scale(1.03);
}

.book-cover-placeholder {
  width: 100%;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  position: relative;
  border-left: 4px solid rgba(255, 255, 255, 0.08);
}

.placeholder-format {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.placeholder-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.placeholder-book-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.35;
  margin: auto 0;
  color: var(--text-secondary);
}

.placeholder-book-icon svg {
  width: 36px;
  height: 36px;
}

.placeholder-author {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.format-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.offline-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  font-size: 0.68rem;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.offline-badge svg {
  width: 12px;
  height: 12px;
}

.translation-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(14, 165, 233, 0.85);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.02em;
}

.translation-badge svg {
  width: 12px;
  height: 12px;
}

/* Card Body */
.book-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.book-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.book-author {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 12px;
}

.book-lang-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.85;
}

.book-progress-wrap {
  margin-top: auto;
  margin-bottom: 12px;
}

.book-finished-wrap {
  display: flex;
  align-items: center;
  min-height: 24px;
}

.book-finished-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 3px 10px;
  border-radius: 9999px;
  line-height: 1.2;
}

.book-finished-status svg {
  width: 14px;
  height: 14px;
  stroke: #10b981;
  stroke-width: 2.2;
  flex-shrink: 0;
}

.progress-bar {
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.book-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-read {
  flex: 1;
  height: 32px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-read:hover {
  background-color: var(--accent);
  color: var(--accent-inverted);
  border-color: var(--accent);
}

.btn-read svg {
  width: 14px;
  height: 14px;
}

.btn-edit,
.btn-delete,
.btn-book-more {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-edit:hover,
.btn-delete:hover,
.btn-book-more:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-edit svg,
.btn-delete svg,
.btn-book-more svg {
  width: 15px;
  height: 15px;
}

/* Book Options Popover Menu */
.book-options-wrapper {
  position: relative;
  display: inline-flex;
}

.book-options-dropdown {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  min-width: 190px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 100;
}

.book-options-dropdown.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-header {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 8px 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s ease;
}

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

.dropdown-item.active {
  font-weight: 600;
  color: var(--accent);
}

.dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.dropdown-shelf-check {
  margin-left: auto;
  color: var(--accent);
}

.dropdown-item.text-danger {
  color: #ff6b6b;
}

.dropdown-item.text-danger:hover {
  background-color: rgba(255, 107, 107, 0.12);
}

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

/* Processing Book Placeholder Card */
.book-card.is-processing {
  opacity: 0.95;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.03);
}

.book-card.is-processing .book-cover-wrap {
  cursor: default;
}

.book-card.is-processing .book-cover-placeholder {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(255, 255, 255, 0.03) 100%);
  position: relative;
  overflow: hidden;
}

.book-card.is-processing .book-cover-placeholder::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: placeholder-shimmer 1.8s infinite;
}

@keyframes placeholder-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.processing-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: rgba(0, 0, 0, 0.75);
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.processing-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.progress-fill.processing-fill {
  background: linear-gradient(90deg, var(--text-muted), var(--text-primary));
  animation: progress-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes progress-pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.btn-read.btn-processing {
  cursor: not-allowed;
  opacity: 0.8;
  pointer-events: none;
}

/* List View */
.books-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.books-list .book-card {
  flex-direction: row;
  align-items: center;
  padding: 10px 16px;
  height: 72px;
}

.books-list .book-cover-wrap {
  width: 44px;
  height: 56px;
  aspect-ratio: auto;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.books-list .format-badge,
.books-list .offline-badge,
.books-list .library-badge {
  display: none;
}

.books-list .book-info {
  flex-direction: row;
  align-items: center;
  padding: 0 0 0 16px;
  gap: 20px;
}

.books-list .book-title {
  flex: 2;
  margin-bottom: 0;
}

.books-list .book-author {
  flex: 1.5;
  margin-bottom: 0;
}

.books-list .book-progress-wrap {
  flex: 1.5;
  margin: 0;
}

.books-list .book-actions {
  flex-shrink: 0;
}

/* Empty State */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
}

.empty-state.active {
  display: flex;
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-icon-wrap svg {
  width: 100%;
  height: 100%;
}

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

.empty-state p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 380px;
  margin-bottom: 24px;
}

/* Auth Dialog */
.auth-dialog {
  border: none;
  background: transparent;
  max-width: 420px;
  width: 90%;
  margin: auto;
  padding: 0;
  color: var(--text-primary);
}

.auth-dialog[open],
.auth-dialog.active {
  display: block;
}

.auth-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Shelves & Gutenberg Modals */
.new-shelf-modal,
.gutenberg-loading-modal {
  border: none;
  background: transparent;
  max-width: 440px;
  width: 90%;
  margin: auto;
  padding: 0;
  color: var(--text-primary);
}

.new-shelf-modal[open],
.gutenberg-loading-modal[open] {
  display: block;
}

.new-shelf-modal::backdrop,
.gutenberg-loading-modal::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.new-shelf-card,
.gutenberg-loading-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--border-focus, var(--accent));
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Gutenberg Loading Modal */
.gutenberg-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  gap: 16px;
}

.gutenberg-loading-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--bg-tertiary);
  margin-bottom: 4px;
}

.gutenberg-loading-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.gutenberg-loading-author {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.gutenberg-loading-status {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.gutenberg-loading-actions {
  margin-top: 8px;
}

.auth-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand-logo {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.auth-brand-logo svg {
  width: 32px;
  height: 32px;
}

.auth-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.auth-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-form input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.auth-form input:focus {
  border-color: var(--border-focus);
}

.auth-error {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin-bottom: 14px;
  min-height: 20px;
}

.auth-footer {
  text-align: center;
  margin-top: 18px;
}

.auth-footer a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-footer a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ================= EDIT BOOK DETAILS DIALOG ================= */
.edit-book-dialog {
  border: none;
  background: transparent;
  max-width: 680px;
  width: 92%;
  margin: auto;
  padding: 0;
  color: var(--text-primary);
}

.edit-book-dialog[open],
.edit-book-dialog.active {
  display: block;
}

.edit-book-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.edit-book-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.edit-book-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.edit-book-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.edit-book-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.edit-close-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.edit-book-layout {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
}

.edit-cover-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.edit-section-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  align-self: flex-start;
}

.edit-cover-preview-wrap {
  width: 140px;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  position: relative;
}

.edit-cover-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.edit-cover-preview .book-cover-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.edit-cover-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.edit-action-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
}

.edit-remove-cover-btn {
  color: var(--text-muted);
}
.edit-remove-cover-btn:hover {
  color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
}

.edit-cover-url-group {
  margin-top: 12px;
  width: 100%;
}

.edit-sublabel {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.edit-cover-url-input-wrap {
  display: flex;
  gap: 6px;
}

.edit-cover-url-input-wrap input {
  flex: 1;
  min-width: 0;
  height: 32px;
  font-size: 0.8rem;
  padding: 0 8px;
}

.edit-cover-status {
  margin-top: 8px;
  font-size: 0.78rem;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.3;
}
.edit-cover-status.info {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}
.edit-cover-status.success {
  background-color: rgba(46, 213, 115, 0.15);
  color: #2ed573;
}
.edit-cover-status.error {
  background-color: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

.edit-fields-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edit-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required-star {
  color: #ff6b6b;
}

.edit-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.edit-input:focus {
  border-color: var(--border-focus);
}

.edit-textarea {
  width: 100%;
  padding: 10px 12px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.45;
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.edit-textarea:focus {
  border-color: var(--border-focus);
}

.edit-modal-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.edit-footer-buttons {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.edit-form-error {
  color: #ff6b6b;
  font-size: 0.84rem;
}

@media (max-width: 620px) {
  .edit-book-layout {
    grid-template-columns: 1fr;
  }
  .edit-cover-section {
    margin-bottom: 8px;
  }
}

/* Responsive tweaks */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 14px;
    gap: 10px;
  }
  .brand-title {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
  }
  .search-bar {
    max-width: 240px;
    flex: 1;
    min-width: 0;
  }
  .search-input-wrap input {
    height: 36px;
    padding: 0 10px 0 32px;
    font-size: 0.85rem;
  }
  .search-icon {
    left: 8px;
  }
  .search-icon svg {
    width: 14px;
    height: 14px;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
  }
  .header-desktop-btn,
  #header-guest-nav {
    display: none !important;
  }
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-tabs {
    overflow-x: auto;
  }
  .toolbar-right {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 10px;
    gap: 8px;
  }
  .brand {
    gap: 6px;
  }
  .brand-title {
    font-size: 0.95rem;
    letter-spacing: 0.06em;
  }
  .search-bar {
    max-width: 170px;
  }
  .search-input-wrap input {
    padding: 0 8px 0 28px;
  }
}

/* Translate Button and Modal */
.btn-translate-card {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-translate-card:hover {
  background-color: var(--bg-hover);
  color: #38bdf8;
  border-color: var(--border);
}

.btn-translate-card.translated {
  color: #38bdf8;
}

.btn-translate-card svg {
  width: 15px;
  height: 15px;
}

.translate-dialog {
  max-width: 440px;
}

.translate-card {
  padding: 24px;
}

.translate-modal-sparkle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.translate-select {
  width: 100%;
  height: 40px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
}

.translate-select:focus {
  border-color: var(--accent);
}

.translate-info-note {
  margin: 16px 0;
  padding: 12px 14px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.translate-note-icon {
  color: #38bdf8;
  font-weight: bold;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.translate-status-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
}

.translate-status-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.translate-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Dansun OIDC Styles */
.auth-oidc-container {
  margin-top: 20px;
  margin-bottom: 16px;
}

.btn-oidc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 18px;
  background: var(--text-primary);
  color: var(--bg-primary) !important;
  border-radius: var(--radius-sm);
  border: 1px solid var(--text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-oidc:hover {
  background: var(--accent-hover);
  color: var(--bg-primary) !important;
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.oidc-key-icon {
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0 20px 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.auth-divider span {
  padding: 0 12px;
}

/* ==========================================================================
   PAGES Minimalist Monochrome Landing Page
   ========================================================================== */

.landing-view {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  color: var(--text-primary);
  animation: fadeInLanding 0.3s ease;
}

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

/* Header Guest Navigation */
.header-guest-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
  border-color: var(--border);
}

.btn-lg {
  height: 48px;
  padding: 0 24px;
  font-size: 0.96rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 0.82rem;
}

/* Hero Section */
.landing-hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 40px 0 72px;
  border-bottom: 1px solid var(--border);
}

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.74rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.landing-badge-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
}

.landing-title {
  font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-wrap: balance;
}

.landing-lead {
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 32px;
  text-wrap: pretty;
  max-width: 540px;
}

.landing-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.landing-btn-arrow {
  transition: transform 0.2s ease;
}

.btn-start-reading:hover .landing-btn-arrow {
  transform: translateX(3px);
}

.landing-auth-subtext {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.landing-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.84rem;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.landing-link-btn:hover {
  opacity: 0.75;
}

/* Monochrome Mockup Book Frame */
.landing-mockup {
  position: relative;
  display: flex;
  flex-direction: column;
}

.mockup-frame {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.mockup-frame:hover {
  border-color: var(--border-focus);
}

.mockup-header {
  height: 38px;
  background-color: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.mockup-dots {
  display: flex;
  gap: 6px;
}

.mockup-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-focus);
  background: transparent;
}

.mockup-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.mockup-sync-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.mockup-book-body {
  display: flex;
  background-color: var(--bg-primary);
  min-height: 270px;
  padding: 22px 20px;
  gap: 20px;
  position: relative;
  font-family: "Georgia", "Cambria", "Times New Roman", serif;
}

.mockup-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mockup-page-gutter {
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border), transparent);
}

.mockup-chapter {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.mockup-text {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-align: justify;
}

.lead-para::first-letter {
  font-size: 2.1rem;
  float: left;
  line-height: 0.85;
  padding-right: 6px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 700;
}

.mockup-footer {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 10px;
}

.mockup-badges {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mockup-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background-color: var(--bg-tertiary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Landing Section General */
.landing-section {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.section-heading {
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 40px;
  text-wrap: balance;
}

/* Feature Cards Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.feature-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.feature-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.feature-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.feature-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-tertiary);
}

.feature-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.feature-title {
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.feature-desc {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* Details Section */
.landing-details-section {
  padding-bottom: 60px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.detail-item {
  padding: 24px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.detail-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.detail-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Bottom CTA Banner */
.landing-cta-banner {
  padding: 64px 32px;
  margin: 60px 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  justify-content: center;
}

.cta-inner {
  max-width: 640px;
}

.cta-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 14px;
  text-wrap: balance;
}

.cta-sub {
  font-size: 1.04rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 28px;
  text-wrap: pretty;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
}

.cta-oidc-row {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cta-oidc-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: opacity 0.15s ease;
}

.cta-oidc-link:hover {
  opacity: 0.75;
}

/* Landing Footer */
.landing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 0 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-brand-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.footer-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease;
}

.footer-link-btn:hover,
.footer-link:hover {
  color: var(--text-primary);
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.84rem;
  transition: color 0.15s ease;
}

.footer-version {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* Modal Close Button */
.auth-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-close-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.auth-card {
  position: relative;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .landing-hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 20px 0 48px;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .landing-view {
    padding: 24px 16px 60px;
  }

  .landing-title {
    font-size: 2.1rem;
  }

  .landing-lead {
    font-size: 1rem;
  }

  .mockup-page-right,
  .mockup-page-gutter {
    display: none;
  }

  .landing-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 14px;
  }
}

/* ==========================================================================
   Vocabulary Dictionary & Flashcards Modal
   ========================================================================== */

.dictionary-modal {
  border: none;
  background: transparent;
  max-width: 820px;
  width: 94%;
  margin: auto;
  padding: 0;
  color: var(--text-primary);
  border-radius: var(--radius-lg);
}

.dictionary-modal[open] {
  display: block;
}

.dictionary-modal::backdrop {
  background-color: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dictionary-modal-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  min-height: 540px;
  overflow: hidden;
}

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

.dictionary-modal-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dictionary-header-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.dictionary-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.dictionary-view-toggle {
  display: inline-flex;
  background: var(--bg-tertiary);
  border-radius: 9999px;
  padding: 3px;
  border: 1px solid var(--border);
}

.dict-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dict-toggle-btn svg {
  width: 15px;
  height: 15px;
}

.dict-toggle-btn:hover {
  color: var(--text-primary);
}

.dict-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

.dictionary-controls-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.dictionary-lang-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dictionary-control-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dictionary-select {
  height: 36px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  min-width: 140px;
}

.dictionary-select:focus {
  border-color: var(--accent);
}

.dictionary-search-wrap {
  flex: 1;
  min-width: 180px;
}

.dictionary-search-wrap input {
  width: 100%;
  height: 36px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.85rem;
  outline: none;
}

.dictionary-search-wrap input:focus {
  border-color: var(--accent);
}

.dictionary-meta-stat {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.dictionary-actions-wrap {
  margin-left: auto;
}

.btn-clear-dict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-clear-dict:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ff6b6b;
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-clear-dict:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-clear-dict svg {
  width: 14px;
  height: 14px;
}

.dictionary-content-view {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  background-color: var(--bg-primary);
}

/* Alphabetical List */
.dictionary-words-list {
  display: flex;
  flex-direction: column;
}

.dict-alphabet-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  padding: 10px 0 4px;
  margin: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dict-word-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dict-word-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.dict-word-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dict-word-title-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.dict-word-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.dict-word-phrase {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.dict-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.dict-badge-lang {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dict-badge-book {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dict-word-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dict-word-actions .btn-icon {
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

.dict-word-actions .btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.dict-word-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.dict-word-def h4 {
  margin: 10px 0 4px;
  font-size: 0.95rem;
  color: var(--accent);
}

.dict-word-def p {
  margin: 4px 0 8px;
}

.dict-word-def ul {
  padding-left: 18px;
  margin: 4px 0 8px;
}

.dict-word-def code {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 0.85em;
}

.dict-word-context {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.dict-context-label {
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 4px;
}

.dict-context-quote {
  font-style: italic;
}

/* Empty States */
.dictionary-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.dictionary-empty-icon svg {
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  opacity: 0.45;
}

.dictionary-empty-state h3 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.dictionary-empty-state p {
  max-width: 420px;
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}

/* Flash Card Mode */
#dictionary-flashcard-view {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}

.flashcard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.flashcard-progress {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.flashcard-stage {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  perspective: 1200px;
  padding: 10px 0;
}

.flashcard-card {
  width: 100%;
  max-width: 560px;
  min-height: 300px;
  position: relative;
  cursor: pointer;
  outline: none;
}

.flashcard-card:focus-visible .flashcard-face {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.flashcard-card-inner {
  width: 100%;
  min-height: 300px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  position: relative;
  display: flex;
}

.flashcard-card.is-flipped .flashcard-card-inner {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 300px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--bg-secondary);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.flashcard-card:hover .flashcard-face {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.flashcard-front {
  transform: rotateY(0deg);
  text-align: center;
}

.flashcard-back {
  transform: rotateY(180deg);
  overflow-y: auto;
  text-align: left;
}

.flashcard-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flashcard-back-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flashcard-back-actions .btn-icon {
  width: 28px;
  height: 28px;
  padding: 4px;
}

.flashcard-word-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.flashcard-word {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.flashcard-phrase {
  font-size: 1.05rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 8px 0 0;
}

.flashcard-back-word-row {
  margin: 12px 0 8px;
}

.flashcard-word-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.flashcard-definition-body {
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 8px 0 16px;
}

.flashcard-hint-row {
  text-align: center;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.flashcard-tap-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.flashcard-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.flashcard-complete-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* AI Insights auto-saved badge in reader */
.para-ai-dict-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  padding: 3px 10px;
  margin-bottom: 12px;
}

.para-ai-dict-tag svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 600px) {
  .dictionary-modal-box {
    max-height: 94vh;
    min-height: 480px;
  }

  .dictionary-modal-header {
    padding: 14px 16px;
  }

  .dictionary-controls-bar {
    padding: 10px 16px;
  }

  .dictionary-content-view {
    padding: 14px 16px;
  }

  .flashcard-word {
    font-size: 1.8rem;
  }

  .flashcard-stage {
    min-height: 280px;
  }

  .flashcard-card,
  .flashcard-card-inner,
  .flashcard-face {
    min-height: 280px;
  }
}

/* ==========================================================================
   PUBLIC DOMAIN LIBRARY & LANGUAGE LEARNING STYLES
   ========================================================================== */

.header-main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab-btn svg {
  width: 14px;
  height: 14px;
}

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

.nav-tab-btn.active {
  color: var(--accent-inverted);
  background: var(--accent);
  font-weight: 600;
}

/* Language Learning Tip Banner */
.library-tip-banner {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.library-tip-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 4px 10px;
  margin-bottom: 12px;
}

[data-theme="light"] .library-tip-badge {
  background: rgba(0, 0, 0, 0.05);
}

.tip-sparkle-icon {
  width: 14px;
  height: 14px;
}

.library-tip-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.library-tip-text {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 860px;
  margin-bottom: 16px;
}

.library-tip-text strong {
  color: var(--text-primary);
}

.library-tip-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tip-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-primary);
}

.tip-pill svg {
  width: 13px;
  height: 13px;
  color: var(--text-secondary);
}

/* Language Filter Tabs */
.library-lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.library-search-inline {
  position: relative;
  display: flex;
  align-items: center;
}

.library-search-inline input {
  height: 34px;
  padding: 0 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  outline: none;
  min-width: 180px;
  transition: border-color 0.15s ease;
}

.library-search-inline input:focus {
  border-color: var(--border-focus);
}

/* Library badge on cards */
.library-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.library-badge svg {
  width: 10px;
  height: 10px;
}

.library-badge.downloaded-badge {
  top: 36px;
  background: rgba(20, 20, 20, 0.85);
  border-color: rgba(255, 255, 255, 0.3);
  font-size: 0.62rem;
}

.book-lang-tag {
  display: inline-block;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  margin-left: 4px;
}

.subview-container {
  display: block;
}

@media (max-width: 768px) {
  .library-tip-banner {
    padding: 18px 16px;
  }
  .library-tip-title {
    font-size: 1.02rem;
  }
  .library-tip-text {
    font-size: 0.85rem;
  }
  .library-search-inline input {
    width: 100%;
    min-width: 130px;
  }
}
.btn-on-shelf {
  background-color: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-on-shelf:hover {
  background-color: var(--accent);
  color: var(--accent-inverted);
  border-color: var(--accent);
}

.btn-add-shelf {
  background-color: var(--bg-tertiary);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-add-shelf:hover {
  background-color: var(--accent);
  color: var(--accent-inverted);
  border-color: var(--accent);
}

/* App Toast Notification */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.app-toast.error {
  border-color: #ef4444;
  color: #ef4444;
}

/* ==========================================================================
   App Settings Modal (Fullscreen Dialog)
   ========================================================================== */

.app-settings-dialog {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  z-index: 15000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.app-settings-dialog:not([open]):not(.active) {
  display: none !important;
}

.app-settings-dialog[open],
.app-settings-dialog.active {
  display: flex !important;
}

.app-settings-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-settings-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  flex-shrink: 0;
}

.app-settings-header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.app-settings-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-settings-header-icon svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.app-settings-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.app-settings-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.app-settings-close-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.app-settings-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px 48px;
}

.app-settings-container {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-settings-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.app-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.app-settings-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.app-settings-row-vertical {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.app-settings-row-text {
  flex: 1;
}

.app-settings-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.app-settings-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.app-settings-control {
  flex-shrink: 0;
}

.setting-buttons.segmented-control {
  display: inline-flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.app-setting-btn {
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.app-setting-btn:hover {
  color: var(--text-primary);
}

.app-setting-btn.active {
  background: var(--accent);
  color: var(--accent-inverted);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.app-settings-lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.app-settings-lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.app-settings-lang-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.app-settings-lang-btn.active {
  background: var(--accent);
  color: var(--accent-inverted);
  border-color: var(--accent);
  font-weight: 600;
}

.app-settings-lang-btn .lang-badge-mono {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(125, 125, 125, 0.2);
}

.app-settings-lang-btn.active .lang-badge-mono {
  background: rgba(0, 0, 0, 0.18);
  color: var(--accent-inverted);
}

.app-settings-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  flex-shrink: 0;
}

.app-settings-footer-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: 100%;
}

.app-settings-about {
  background: transparent;
  border: none;
  padding: 6px 4px;
}

.app-settings-about-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.app-settings-version {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
}

.app-settings-about-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 640px) {
  .app-settings-row:not(.app-settings-row-vertical) {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .app-settings-control {
    width: 100%;
  }
  .app-settings-control .setting-buttons {
    width: 100%;
    display: flex;
  }
  .app-settings-control .setting-buttons button {
    flex: 1;
    text-align: center;
  }
  .app-settings-footer-inner {
    justify-content: stretch;
  }
  .app-settings-footer-inner button {
    flex: 1;
  }
}

/* Paste Book / Add Text / URL Import Modal */
.paste-book-dialog {
  max-width: 680px;
  width: 95vw;
  padding: 0;
  border-radius: var(--radius-lg, 14px);
  background: var(--bg-card, #1c1c1e);
  background-color: var(--bg-card, #1c1c1e);
  border: 1px solid var(--border-color, rgba(128, 128, 128, 0.25));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.paste-book-tabs {
  display: flex;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 6px 12px 0;
  gap: 8px;
}

.paste-book-tab {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 6px 6px 0 0;
}

.paste-book-tab:hover {
  color: var(--text-primary);
}

.paste-book-tab.active {
  color: var(--accent-primary, #4f46e5);
  border-bottom-color: var(--accent-primary, #4f46e5);
  background-color: var(--bg-card, #1c1c1e);
  font-weight: 600;
}

.paste-book-body {
  padding: 20px 24px 24px;
}

.paste-book-textarea {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 180px;
  max-height: 400px;
}

.form-help-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

.paste-book-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.88rem;
  margin-top: 12px;
}

.paste-book-status.error {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.paste-book-status.info {
  background-color: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.paste-book-status.success {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
