/* ===== Scripture's Purpose — Stylesheet ===== */

/* ---------- Theme variables ---------- */
:root {
  /* Light theme */
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #ffffff;
  --card-foreground: #1a1a1a;
  --card-elevated: #fafafa;
  --primary: #1a1a1a;
  --primary-foreground: #ffffff;
  --primary-hover: #333333;
  --secondary: #f5f5f5;
  --secondary-foreground: #1a1a1a;
  --muted: #f5f5f5;
  --muted-foreground: #888888;
  --accent: #f0f0f0;
  --accent-foreground: #1a1a1a;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --border: #e8e8e8;
  --border-subtle: #f0f0f0;
  --input: #e8e8e8;
  --ring: #1a1a1a;
  --sidebar: #fafafa;
  --sidebar-foreground: #1a1a1a;
  --sidebar-accent: #f0f0f0;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --glow: 0 0 0 1px rgba(0,0,0,0.02);
}

html.dark {
  /* True black dark mode with subtle depth */
  --background: #000000;
  --foreground: #f5f5f5;
  --card: #0a0a0a;
  --card-foreground: #f5f5f5;
  --card-elevated: #111111;
  --primary: #f5f5f5;
  --primary-foreground: #000000;
  --primary-hover: #ffffff;
  --secondary: #141414;
  --secondary-foreground: #f5f5f5;
  --muted: #141414;
  --muted-foreground: #707070;
  --accent: #1a1a1a;
  --accent-foreground: #f5f5f5;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #1f1f1f;
  --border-subtle: #161616;
  --input: #1f1f1f;
  --ring: #f5f5f5;
  --sidebar: #000000;
  --sidebar-foreground: #f5f5f5;
  --sidebar-accent: #141414;
  --shadow: 0 1px 2px rgba(0,0,0,0.5);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.6);
  --glow: 0 0 0 1px rgba(255,255,255,0.04);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--background);
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

/* Subtle radial gradient — adds depth without distracting */
html.dark body {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,255,255,0.025), transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255,255,255,0.015), transparent 60%),
    var(--background);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul { list-style: none; }
code { font-family: "SF Mono", Monaco, Menlo, Consolas, monospace; font-size: 0.9em; }

/* Ensure [hidden] attribute always wins */
[hidden] { display: none !important; }

/* Custom scrollbars everywhere — hide default browser scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* ---------- App layout ---------- */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Main cycle view (always visible) ---------- */
#cycle-view {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

/* ---------- Empty hero (no verses yet) ---------- */
#empty-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100%;
  text-align: center;
  padding: 24px;
  position: relative;
}
.empty-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 480px;
}
.empty-hero-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--foreground);
  margin-bottom: 8px;
  position: relative;
}
html.dark .empty-hero-icon {
  background: var(--card-elevated);
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.05),
    0 4px 16px rgba(0,0,0,0.4);
}
html.dark .empty-hero-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.empty-hero h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
}
.empty-hero p {
  font-size: 15px;
  color: var(--muted-foreground);
  line-height: 1.6;
  max-width: 360px;
}
.empty-corners {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

/* ---------- Corner buttons ---------- */
.corner-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--muted-foreground);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
html.dark .corner-btn {
  background: var(--card-elevated);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.04);
}
.corner-btn:hover {
  background: var(--accent);
  color: var(--foreground);
  border-color: var(--muted-foreground);
}
.corner-btn-lg {
  width: auto;
  min-width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
}
.corner-btn-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- Cycle top bar ---------- */
.cycle-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 769px) {
  .cycle-top-bar { padding: 20px 32px; }
}
.cycle-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.cycle-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cycle-table-info { min-width: 0; }
.cycle-table-info .small { font-size: 12px; }
.cycle-table-info .medium {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  letter-spacing: -0.01em;
}
.translation-badge {
  padding: 6px 12px;
  background: var(--secondary);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--foreground);
}

/* ---------- Drawer (slide-out panel) ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--background);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
html.dark .drawer {
  background: var(--background);
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}
html.dark .drawer::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.06) 20%, rgba(255,255,255,0.06) 80%, transparent);
  pointer-events: none;
}
.drawer.open {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.drawer-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.drawer-section:last-of-type {
  border-bottom: none;
}
.drawer-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.drawer-section-header span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}
.drawer-ad {
  padding: 20px 24px;
}

/* ---------- Sidebar ---------- */
#sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--foreground);
  color: var(--background);
  border-radius: 8px;
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-foreground);
  letter-spacing: -0.01em;
}

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

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 8px;
}

.sidebar-section-header span {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--muted-foreground);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--accent);
  color: var(--foreground);
}

/* ---------- New table form ---------- */
.new-table-form {
  padding: 0 12px 8px;
  display: flex;
  gap: 8px;
}
.new-table-form input {
  flex: 1;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
}
.new-table-form input:focus {
  outline: none;
  border-color: var(--ring);
}

.tables-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 16px;
}
.tables-list::-webkit-scrollbar { width: 4px; }
.tables-list::-webkit-scrollbar-track { background: transparent; }
.tables-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.table-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  color: var(--sidebar-foreground);
  border-radius: 8px;
  text-align: left;
  transition: background 0.15s;
  margin-bottom: 1px;
  font-size: 14px;
}
.table-item:hover { background: var(--sidebar-accent); }
.table-item.active { background: var(--sidebar-accent); }

.table-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.table-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.table-item-count {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.table-item-menu {
  display: none;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--muted-foreground);
}
.table-item:hover .table-item-menu { display: flex; }
.table-item-menu:hover { background: var(--card); color: var(--foreground); }

.table-item-rename-input {
  flex: 1;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--ring);
  border-radius: 6px;
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
}

/* Dropdown menu */
.dropdown {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  min-width: 160px;
  z-index: 100;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  color: var(--foreground);
  border-radius: 6px;
  text-align: left;
  font-size: 14px;
  transition: background 0.1s;
}
.dropdown-item:hover { background: var(--accent); }
.dropdown-item.danger { color: var(--destructive); }
.dropdown-item.danger:hover { background: color-mix(in srgb, var(--destructive) 12%, transparent); }
.dropdown-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
}
.sidebar-footer p {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted-foreground);
}

.sidebar-ad {
  padding: 12px;
  border-top: 1px solid var(--border);
}

/* Ad placeholder */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.ad-sidebar { min-height: 200px; }
.ad-inline { min-height: 90px; width: 100%; }

/* ---------- Main ---------- */
#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-header, .desktop-header {
  display: none;
}

@media (max-width: 768px) {
  #sidebar { display: none; }
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }
  .mobile-title { flex: 1; min-width: 0; }
  .mobile-table-name {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.01em;
  }
  .mobile-table-meta { font-size: 12px; color: var(--muted-foreground); }
}
@media (min-width: 769px) {
  .desktop-header {
    display: flex;
    justify-content: flex-end;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
  }
}

.hide-mobile { }
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

/* ---------- Mobile sidebar overlay ---------- */
.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 50;
}
.mobile-sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
}
.mobile-sidebar .sidebar-brand { padding: 24px 20px 20px; }
.mobile-sidebar .sidebar-section-header { padding: 4px 20px 8px; }
.mobile-sidebar .tables-list { padding: 0 8px 16px; }
.mobile-sidebar .sidebar-footer { border-top: 1px solid var(--border); padding: 12px 20px; }

/* ---------- Browse mode ---------- */
.browse-mode {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.browse-mode::-webkit-scrollbar { width: 4px; }
.browse-mode::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.browse-left {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 1024px) {
  .browse-mode { flex-direction: column; padding: 20px; }
  .browse-left { width: 100%; }
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  position: relative;
}

/* Subtle top-edge highlight on dark cards for depth */
html.dark .card {
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.03),
    0 1px 2px rgba(0,0,0,0.4);
}
html.dark .card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 30%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.card-header p {
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ---------- Form ---------- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.form-row .form-group { margin-bottom: 0; }

input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  outline: none;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 15%, transparent);
}
input[type="text"]::placeholder, input[type="email"]::placeholder, input[type="password"]::placeholder {
  color: var(--muted-foreground);
}
input.invalid { border-color: var(--destructive); }

/* ---------- Combobox ---------- */
.combobox { position: relative; }
.combobox-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
  font-weight: 400;
  transition: border-color 0.15s;
}
.combobox-btn:hover { border-color: var(--muted-foreground); }
.combobox-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 320px;
  display: flex;
  flex-direction: column;
}
.combobox-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
}
.combobox-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--foreground);
  font-size: 14px;
  height: 24px;
}
.combobox-search input:focus { outline: none; box-shadow: none; }
.combobox-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px;
}
.combobox-list::-webkit-scrollbar { width: 4px; }
.combobox-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.combobox-group-label {
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}
.combobox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--foreground);
  text-align: left;
  font-size: 14px;
  width: 100%;
  border-radius: 6px;
  transition: background 0.1s;
}
.combobox-item:hover { background: var(--accent); }
.combobox-item .check {
  width: 16px;
  height: 16px;
  opacity: 0;
  color: var(--foreground);
}
.combobox-item.selected .check { opacity: 1; }
.combobox-item .chapters {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted-foreground);
}
.combobox-empty {
  padding: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted-foreground);
}

/* ---------- Preview row ---------- */
.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
.preview-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.preview-badge {
  font-family: "SF Mono", Monaco, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Divider ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider span {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
}

/* ---------- Quick add ---------- */
.quick-add-row {
  display: flex;
  gap: 8px;
}
.input-with-icon {
  position: relative;
  flex: 1;
}
.input-with-icon svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.input-with-icon input {
  padding-left: 36px;
}

/* ---------- Tip box ---------- */
.tip-box {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--secondary);
  margin-top: 20px;
}
.tip-box svg { flex-shrink: 0; color: var(--muted-foreground); margin-top: 2px; }
.tip-box div { font-size: 12px; line-height: 1.5; color: var(--muted-foreground); }
.tip-box code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--card);
  color: var(--foreground);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  background: var(--primary);
  color: var(--primary-foreground);
  transition: background 0.15s, opacity 0.15s, transform 0.05s, box-shadow 0.15s;
  white-space: nowrap;
  position: relative;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Primary button gets a subtle inner highlight in dark mode */
html.dark .btn:not(.btn-secondary):not(.btn-ghost):not(.btn-danger):not(.btn-outline) {
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.12),
    0 1px 2px rgba(0,0,0,0.4);
}
html.dark .btn:not(.btn-secondary):not(.btn-ghost):not(.btn-danger):not(.btn-outline):active {
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.06),
    0 0 0 rgba(0,0,0,0);
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 32px; font-size: 15px; min-width: 180px; }
.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.btn-secondary:hover { background: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
}
.btn-ghost:hover { background: var(--accent); color: var(--foreground); }
.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.btn-danger:hover { background: color-mix(in srgb, var(--destructive) 90%, black); }
.danger-hover:hover { color: var(--destructive); }

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--accent); }

/* ---------- Help card ---------- */
.help-card {
  border-color: var(--border);
  background: var(--secondary);
}
.help-card h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 12px;
}
.help-card ol { padding-left: 0; }
.help-card li {
  font-size: 14px;
  color: var(--foreground);
  margin-bottom: 8px;
  line-height: 1.6;
}

/* ---------- Verses list ---------- */
.verses-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.verses-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.verses-header h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.verses-header p {
  font-size: 13px;
  color: var(--muted-foreground);
  margin-top: 2px;
}
.verses-actions {
  display: flex;
  gap: 8px;
}
.filter-row {
  padding: 16px 24px 0;
}
.filter-row input { height: 38px; }
.verses-list-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}
.verses-list-body::-webkit-scrollbar { width: 4px; }
.verses-list-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.verse-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  transition: background 0.1s;
}
.verse-item:hover { background: var(--accent); }
.verse-item-num {
  width: 24px;
  text-align: right;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.verse-item-info { flex: 1; min-width: 0; }
.verse-item-ref {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.verse-item-meta {
  font-size: 12px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}
.verse-item-remove {
  display: none;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}
.verse-item:hover .verse-item-remove { display: flex; }
.verse-item-remove:hover { color: var(--destructive); background: color-mix(in srgb, var(--destructive) 12%, transparent); }

.verse-item-edit {
  display: none;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.1s, background 0.1s;
}
.verse-item:hover .verse-item-edit { display: flex; }
.verse-item-edit:hover { color: var(--foreground); background: var(--accent); }

.verse-item-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--foreground);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--secondary);
  color: var(--muted-foreground);
  margin-bottom: 16px;
}
.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  max-width: 300px;
  line-height: 1.6;
}

/* ---------- Cycle mode ---------- */
.cycle-mode {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.cycle-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
@media (min-width: 769px) {
  .cycle-top-bar { padding: 16px 32px; }
}
.cycle-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.cycle-table-info { min-width: 0; }
.cycle-table-info .small { font-size: 12px; }
.cycle-table-info .medium {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.translation-badge {
  padding: 5px 12px;
  background: var(--secondary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--foreground);
}

/* Scrollable card area */
.cycle-content {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px 20px;
  overflow: hidden;
  min-height: 0;
}
@media (min-width: 769px) {
  .cycle-content { padding: 24px 32px; }
}
.cycle-inner {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.cycle-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.muted { color: var(--muted-foreground); }
.small { font-size: 12px; }
.medium { font-size: 15px; }
.primary-text { color: var(--foreground); font-weight: 500; }

/* ---------- Flip card ---------- */
.flip-card-container {
  perspective: 1400px;
  flex: 1;
  min-height: 0;
  display: flex;
}
.flip-card {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  min-height: 0;
}
.flip-card.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 24px 24px;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  height: 100%;
}
.card-front:hover { border-color: var(--muted-foreground); }

/* Elevated card face with depth */
html.dark .card-face {
  background: var(--card-elevated);
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.04),
    0 4px 24px rgba(0,0,0,0.5);
}
.card-back {
  transform: rotateY(180deg);
  border-color: var(--border);
}
.card-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.card-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-foreground);
}
.card-reference {
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--foreground);
  text-wrap: balance;
  line-height: 1.1;
}
@media (min-width: 769px) {
  .card-reference { font-size: 56px; }
}
.card-hint { font-size: 13px; }

.card-blockquote {
  font-size: 22px;
  line-height: 1.5;
  color: var(--foreground);
  text-wrap: balance;
  letter-spacing: -0.005em;
}
@media (min-width: 769px) {
  .card-blockquote { font-size: 26px; line-height: 1.5; }
}
.card-reference-small {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted-foreground);
}
.card-letters {
  font-family: "SF Mono", Monaco, Menlo, Consolas, monospace;
  font-size: 26px;
  letter-spacing: 0.3em;
  color: var(--foreground);
  font-weight: 500;
}
@media (min-width: 769px) {
  .card-letters { font-size: 32px; }
}
.card-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted-foreground);
  padding: 24px 0;
}
.card-loading p { font-size: 13px; }
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--foreground);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--destructive);
  padding: 24px 0;
  max-width: 440px;
}
.card-error p { font-size: 13px; }

/* ---------- Dialog ---------- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.15s;
  backdrop-filter: blur(4px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.dialog-sm { max-width: 400px; }

.dialog-header {
  padding: 24px 24px 16px;
}
.dialog-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.dialog-header h2 svg { color: var(--foreground); }
.dialog-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.dialog-body {
  padding: 0 24px 24px;
}
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 24px;
}
.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  border-radius: 6px;
  transition: background 0.1s, color 0.1s;
}
.dialog-close:hover { background: var(--accent); color: var(--foreground); }

.settings-section {
  margin-bottom: 24px;
}
.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}
.settings-hint {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 10px;
  line-height: 1.5;
}

.translation-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.translation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--foreground);
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}
.translation-item:hover { background: var(--accent); }
.translation-item.active {
  border-color: var(--foreground);
  background: var(--accent);
}
.translation-item-name { font-size: 15px; font-weight: 600; }
.translation-item-desc { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.translation-item-check {
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--foreground);
  color: var(--background);
}
.translation-item.active .translation-item-check { display: flex; }

.theme-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-btn:hover { background: var(--accent); color: var(--foreground); }
.theme-btn.active {
  border-color: var(--foreground);
  background: var(--accent);
  color: var(--foreground);
}

.settings-danger-zone {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 8px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 14px 18px;
  font-size: 14px;
  max-width: 360px;
  z-index: 200;
  animation: slideInRight 0.2s;
}
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-color: var(--foreground); }
.toast.error { border-color: var(--destructive); }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-desc { color: var(--muted-foreground); font-size: 13px; }

/* ---------- Tutorial ---------- */
.dialog-tutorial {
  max-width: 480px;
}

.tutorial-step {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.tutorial-step:last-child {
  border-bottom: none;
}

.tutorial-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--foreground);
  color: var(--background);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tutorial-step-content {
  flex: 1;
  min-width: 0;
}

.tutorial-step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
}

.tutorial-step-desc {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.tutorial-step-desc code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--secondary);
  color: var(--foreground);
  font-size: 12px;
}

.tutorial-step-desc strong {
  color: var(--foreground);
  font-weight: 600;
}

/* ---------- Guided Tour ---------- */
/* The highlight element creates the spotlight effect via a huge box-shadow.
   No separate overlay needed — this keeps the rest of the UI visible enough. */

.tour-highlight {
  position: fixed;
  border: 2px solid var(--foreground);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  z-index: 9000;
  pointer-events: none;
  transition: top 0.2s ease, left 0.2s ease, width 0.2s ease, height 0.2s ease;
}

/* When there's no highlight (centered welcome/finish), use a subtle overlay */
.tour-overlay-only {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 8999;
}

.tour-tooltip {
  position: fixed;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px 16px;
  width: 320px;
  max-width: calc(100vw - 32px);
  z-index: 9001;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: tourSlideIn 0.2s ease-out;
}
@keyframes tourSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tour-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tour-step-num {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}

.tour-skip {
  font-size: 12px;
  color: var(--muted-foreground);
  padding: 2px 8px;
  border-radius: 6px;
  transition: background 0.1s, color 0.1s;
}
.tour-skip:hover {
  background: var(--accent);
  color: var(--foreground);
}

.tour-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.tour-body {
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: 16px;
}

.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Confirm dialog should appear above other dialogs */
#confirm-dialog { z-index: 200 !important; }

/* ---------- Verse Editor ---------- */
.dialog-verse-editor {
  max-width: 520px;
}

.verse-editor-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--secondary);
}
.verse-editor-status.custom {
  color: var(--foreground);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.verse-editor-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s;
}
.verse-editor-textarea:focus {
  outline: none;
  border-color: var(--ring);
}

.verse-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.verse-editor-footer-right {
  display: flex;
  gap: 8px;
}

/* ---------- Empty state stats ---------- */
.empty-stats {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.empty-stat {
  text-align: center;
}
.empty-stat-num {
  font-size: 28px;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.empty-stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
  margin-top: 2px;
}

/* ---------- Cycle control panel ---------- */
.cycle-controls {
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
}
html.dark .cycle-controls {
  background: var(--card-elevated);
  box-shadow:
    inset 0 1px 0 0 rgba(255,255,255,0.04),
    0 1px 2px rgba(0,0,0,0.3);
}

.cycle-section + .cycle-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle, var(--border));
}

.cycle-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-foreground);
  margin-bottom: 12px;
  text-align: center;
}

/* ---------- View buttons (segmented control) ---------- */
.view-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--secondary);
  padding: 4px;
  border-radius: 10px;
  flex-shrink: 0;
}
.view-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: transparent;
  color: var(--foreground);
  opacity: 0.5;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.view-btn:hover {
  opacity: 0.85;
}
.view-btn.active {
  background: var(--card);
  color: var(--foreground);
  opacity: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
html.dark .view-btn.active {
  background: var(--background);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.view-btn span { font-size: 12px; }

/* ---------- Cycle action row ---------- */
.cycle-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-shrink: 0;
}
.cycle-mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  transition: all 0.15s;
}
.cycle-mode-btn:hover {
  border-color: var(--muted-foreground);
  color: var(--foreground);
}

/* ---------- Sync ---------- */
.corner-btn.synced { color: var(--foreground); border-color: var(--foreground); }
.corner-btn.synced::after {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80; border: 2px solid var(--background);
}
.sync-setup { text-align: left; }
.sync-steps { margin-bottom: 16px; }
.sync-step { font-size: 13px; color: var(--muted-foreground); line-height: 1.6; margin-bottom: 8px; }
.sync-step strong { color: var(--foreground); }
.sync-step a { color: var(--foreground); text-decoration: underline; }
.sync-config-input {
  width: 100%; min-height: 100px; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--foreground);
  font-size: 12px; font-family: monospace; line-height: 1.5; resize: vertical;
}
.sync-config-input:focus { outline: none; border-color: var(--ring); }
.sync-error {
  font-size: 12px; color: var(--destructive); padding: 8px 10px;
  background: color-mix(in srgb, var(--destructive) 10%, transparent);
  border-radius: 6px; margin-top: 8px;
}
.sync-account {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--secondary); border-radius: 12px;
}
.sync-account-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: var(--foreground);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sync-account-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
}
.sync-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 44px; padding: 0 16px;
  background: #fff; color: #3c4043;
  border: 1px solid #dadce0; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: 'Google Sans', 'Roboto', sans-serif;
  transition: background 0.15s, box-shadow 0.15s;
}
.sync-google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.sync-google-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.sync-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
}
.sync-divider::before, .sync-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.sync-divider span {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted-foreground);
}
.sync-account-info { flex: 1; min-width: 0; }
.sync-account-email {
  font-size: 14px; font-weight: 600; color: var(--foreground);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sync-account-status { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.sync-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--secondary); padding: 4px; border-radius: 8px; margin-bottom: 16px;
}
.sync-tab {
  padding: 8px; border: none; background: transparent;
  color: var(--muted-foreground); font-size: 13px; font-weight: 500;
  border-radius: 6px; transition: background 0.15s, color 0.15s;
}
.sync-tab.active { background: var(--card); color: var(--foreground); }
html.dark .sync-tab.active { background: var(--background); }

/* ---------- Section header actions ---------- */
.section-header-actions {
  display: flex;
  gap: 2px;
}

/* ---------- Marketplace ---------- */
.dialog-marketplace { max-width: 560px; max-height: 85vh; }
.marketplace-body { padding: 0; }
.mp-tabs {
  display: flex; gap: 0; padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.mp-tab {
  padding: 12px 16px; border: none; background: transparent;
  color: var(--muted-foreground); font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent; transition: all 0.15s;
}
.mp-tab:hover { color: var(--foreground); }
.mp-tab.active { color: var(--foreground); border-bottom-color: var(--foreground); }
.mp-bar {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.mp-search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.mp-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.mp-filter {
  padding: 5px 10px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--muted-foreground); transition: all 0.15s;
}
.mp-filter:hover { color: var(--foreground); }
.mp-filter.active { background: var(--accent); color: var(--foreground); border-color: var(--foreground); }
.mp-bar-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
#mp-results { max-height: 420px; overflow-y: auto; padding: 12px 20px; }
#mp-results::-webkit-scrollbar { width: 4px; }
#mp-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.mp-card {
  padding: 0; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 10px; background: var(--card); overflow: hidden;
  transition: border-color 0.15s;
}
.mp-card:hover { border-color: var(--muted-foreground); }
.mp-card-clickable {
  padding: 14px; cursor: pointer;
}
.mp-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 6px;
}
.mp-card-info { min-width: 0; flex: 1; }
.mp-card-title { font-size: 15px; font-weight: 600; color: var(--foreground); margin-bottom: 4px; }
.mp-card-author {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted-foreground);
}
.mp-mini-avatar {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
}
.mp-mini-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--foreground);
  font-size: 9px; font-weight: 600;
}
.mp-card-stats { display: flex; gap: 8px; flex-shrink: 0; }
.mp-stat {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--muted-foreground);
}
.mp-card-desc { font-size: 13px; color: var(--muted-foreground); line-height: 1.5; margin-bottom: 6px; }
.mp-card-meta {
  font-size: 11px; color: var(--muted-foreground);
  display: flex; gap: 6px;
}
.mp-card-actions {
  display: flex; justify-content: flex-end; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border-subtle, var(--border));
}
.mp-delete-btn { color: var(--destructive); }
.mp-installed-badge {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 600; color: #22c55e;
  padding: 6px 12px;
}

.marketplace-add-btn {
  background: #22c55e; color: #fff; border: none;
  height: 34px; padding: 0 14px; font-size: 13px; font-weight: 600;
  border-radius: 8px; display: flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.marketplace-add-btn:hover { background: #16a34a; }

/* Pack detail view */
.mp-detail { padding: 20px; }
.mp-back-btn {
  display: flex; align-items: center; gap: 6px;
  border: none; background: transparent; color: var(--muted-foreground);
  font-size: 13px; font-weight: 500; padding: 0; margin-bottom: 16px;
  cursor: pointer; transition: color 0.15s;
}
.mp-back-btn:hover { color: var(--foreground); }
.mp-detail-header {
  padding: 20px; background: var(--secondary); border-radius: 14px;
  margin-bottom: 16px;
}
html.dark .mp-detail-header {
  background: var(--card-elevated);
  box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.04);
}
.mp-detail-title { font-size: 22px; font-weight: 700; color: var(--foreground); margin-bottom: 6px; letter-spacing: -0.02em; }
.mp-detail-desc { font-size: 14px; color: var(--muted-foreground); line-height: 1.6; margin-bottom: 14px; }
.mp-detail-stats {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.mp-stat-pill {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; color: var(--muted-foreground);
  padding: 5px 10px; border-radius: 9999px;
  background: var(--card); border: 1px solid var(--border);
}
html.dark .mp-stat-pill { background: var(--background); }
.mp-detail-actions {
  display: flex; align-items: center; gap: 8px; margin-bottom: 24px;
}
.mp-icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: 10px; background: transparent; color: var(--muted-foreground);
  transition: all 0.15s;
}
.mp-icon-btn:hover { color: var(--foreground); border-color: var(--muted-foreground); }
.mp-icon-btn.liked { color: #ef4444; border-color: #ef4444; }
.mp-icon-btn.liked svg { fill: #ef4444; }
.mp-detail-section { margin-bottom: 24px; }
.mp-detail-section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted-foreground); margin-bottom: 10px;
}
.mp-section-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card); cursor: pointer;
  transition: border-color 0.15s; margin-bottom: 0;
}
.mp-section-toggle:hover { border-color: var(--muted-foreground); }
.mp-toggle-icon { color: var(--muted-foreground); transition: transform 0.2s; flex-shrink: 0; }
.mp-collapsed { display: none; }

.mp-verse-list {
  border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; overflow: hidden;
}
.mp-verse-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-subtle, var(--border));
  background: var(--card);
}
.mp-verse-row:last-child { border-bottom: none; }
.mp-verse-num { font-size: 12px; font-weight: 600; color: var(--muted-foreground); min-width: 20px; }
.mp-verse-ref { font-size: 14px; color: var(--foreground); }

/* Comments */
.comment-loading { padding: 12px; text-align: center; font-size: 13px; color: var(--muted-foreground); }
.comment-empty { padding: 16px; text-align: center; font-size: 13px; color: var(--muted-foreground); }
.comment-form {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.comment-form input {
  flex: 1; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--foreground); font-size: 13px;
}
.comment-form input:focus { outline: none; border-color: var(--ring); }
.comment-item {
  padding: 10px 0; border-bottom: 1px solid var(--border-subtle, var(--border));
}
.comment-item:last-child { border-bottom: none; }
.comment-body { display: flex; gap: 10px; }
.comment-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover;
}
.comment-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--foreground);
  font-size: 12px; font-weight: 600;
}
.comment-content { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.comment-author { font-size: 12px; font-weight: 600; color: var(--foreground); }
.comment-date { font-size: 10px; color: var(--muted-foreground); }
.comment-delete {
  margin-left: auto; border: none; background: transparent;
  color: var(--muted-foreground); cursor: pointer;
  padding: 4px; border-radius: 4px; display: flex; align-items: center;
}
.comment-delete:hover { color: var(--destructive); background: color-mix(in srgb, var(--destructive) 10%, transparent); }
.comment-text { font-size: 13px; color: var(--foreground); line-height: 1.5; }
/* Profile view */
.profile-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; background: var(--secondary); border-radius: 14px;
  margin-bottom: 16px;
}
html.dark .profile-header { background: var(--card-elevated); box-shadow: inset 0 1px 0 0 rgba(255,255,255,0.04); }
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover;
}
.profile-avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--foreground);
  font-size: 24px; font-weight: 600;
}
.profile-info { min-width: 0; }
.profile-name { font-size: 20px; font-weight: 700; color: var(--foreground); }
.profile-email { margin-top: 2px; }
.profile-stats {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.mp-author-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  cursor: pointer; transition: opacity 0.15s;
}
.mp-author-row:hover { opacity: 0.8; }
.mp-author-name { font-size: 13px; font-weight: 600; color: var(--muted-foreground); }
.post-pack-form { padding: 20px; }

/* ---------- Toggle switch ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}
.toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
}
.toggle-desc {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 2px;
}
.toggle {
  flex-shrink: 0;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: var(--secondary);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
}
.toggle[aria-checked="true"] {
  background: var(--foreground);
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--background);
  transition: transform 0.2s;
}
.toggle[aria-checked="true"] .toggle-thumb {
  transform: translateX(16px);
}

/* ---------- Search results ---------- */
.search-results {
  margin-top: 12px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
  cursor: pointer;
  transition: background 0.1s;
  width: 100%;
  text-align: left;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--accent); }
.search-result-ref {
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
  flex-shrink: 0;
  min-width: 100px;
}
.search-result-text {
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result-text mark {
  background: color-mix(in srgb, var(--primary) 20%, transparent);
  color: var(--foreground);
  border-radius: 2px;
  padding: 0 1px;
}
.search-loading {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted-foreground);
}
.search-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted-foreground);
}

/* ---------- Drag and drop ---------- */
.verse-item {
  cursor: grab;
}
.verse-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.verse-item.drag-over {
  border-top: 2px solid var(--foreground);
}

/* ---------- Animated counter ---------- */
.animated-count {
  display: inline-block;
  transition: transform 0.2s;
}
.animated-count.bump {
  animation: countBump 0.4s ease;
}
@keyframes countBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); color: var(--foreground); }
  100% { transform: scale(1); }
}
