html[data-theme="dark"],
html:not([data-theme]) {
  --bg-deep: #0c0f1a;
  --bg-header: rgba(12, 15, 26, 0.7);
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-passage: rgba(0, 0, 0, 0.25);
  --bg-modal: #151a28;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaef;
  --text-muted: #8b92a8;
  --text-passage: #c5cad6;
  --accent: #c9a227;
  --accent-glow: rgba(201, 162, 39, 0.35);
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.15);
  --primary-text: #a5b4fc;
  --success: #34d399;
  --error: #f87171;
  --mesh-1: rgba(99, 102, 241, 0.25);
  --mesh-2: rgba(201, 162, 39, 0.12);
  --mesh-3: rgba(16, 185, 129, 0.08);
  --radius: 14px;
  --radius-lg: 22px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

html[data-theme="light"] {
  --bg-deep: #f4f6fb;
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #ffffff;
  --bg-passage: rgba(99, 102, 241, 0.06);
  --bg-modal: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --text: #1e293b;
  --text-muted: #64748b;
  --text-passage: #334155;
  --accent: #b45309;
  --accent-glow: rgba(180, 83, 9, 0.2);
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --primary-soft: rgba(79, 70, 229, 0.1);
  --primary-text: #4338ca;
  --success: #059669;
  --error: #dc2626;
  --mesh-1: rgba(99, 102, 241, 0.12);
  --mesh-2: rgba(201, 162, 39, 0.08);
  --mesh-3: rgba(16, 185, 129, 0.06);
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

html[data-theme="eyecare"] {
  /* 护眼浅色：豆沙绿基调 */
  --bg-deep: #d4eed9;
  --bg-header: rgba(255, 255, 255, 0.52);
  --bg-card: rgba(255, 255, 255, 0.42);
  --bg-card-hover: rgba(255, 255, 255, 0.58);
  --bg-passage: rgba(255, 255, 255, 0.35);
  --bg-modal: rgba(255, 255, 255, 0.88);
  --border: rgba(72, 120, 96, 0.18);
  --text: #2a3d34;
  --text-muted: #5a7268;
  --text-passage: #3d5248;
  --accent: #b8860b;
  --accent-glow: rgba(184, 134, 11, 0.22);
  --primary: #3d8f6e;
  --primary-hover: #4aa87f;
  --primary-soft: rgba(61, 143, 110, 0.14);
  --primary-text: #2d6b52;
  --success: #15803d;
  --error: #c2410c;
  --mesh-1: rgba(120, 180, 140, 0.35);
  --mesh-2: rgba(160, 200, 170, 0.28);
  --mesh-3: rgba(200, 220, 180, 0.25);
  --shadow: 0 12px 32px rgba(60, 100, 80, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* 护眼色主题：Canvas 粒子背景（见 particles-bg.js） */
.bg-particles {
  display: none;
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 18%, #e4f5e8 0%, #d4eed9 45%, #c8e6ce 100%);
}

body.has-eyecare-bg .bg-particles {
  display: block;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, var(--mesh-1), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, var(--mesh-2), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, var(--mesh-3), transparent),
    var(--bg-deep);
}

body.has-eyecare-bg .bg-mesh {
  background: rgba(212, 238, 217, 0.35);
}

body.has-eyecare-bg .main-content {
  position: relative;
}

body.has-eyecare-bg .site-header {
  backdrop-filter: blur(14px) saturate(1.15);
}

body.has-eyecare-bg .word-card,
body.has-eyecare-bg .sentence-card,
body.has-eyecare-bg .article-card,
body.has-eyecare-bg .exam-card,
body.has-eyecare-bg .home-feature-card {
  backdrop-filter: blur(10px);
}

@media (prefers-reduced-motion: reduce) {
  body.has-eyecare-bg .bg-particles {
    display: none;
  }
  body.has-eyecare-bg .bg-mesh {
    background: #d4eed9;
  }
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  width: 100%;
  max-width: none;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 1.25rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.logo-text {
  white-space: nowrap;
}

.logo-icon {
  color: var(--accent);
  font-size: 1.1rem;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 0.05rem;
  flex-wrap: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.nav-main::-webkit-scrollbar {
  display: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

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

.nav-link-admin {
  font-size: 0.82rem;
  padding: 0.4rem 0.65rem;
}

.nav-login-btn {
  white-space: nowrap;
}

.nav-user-menu {
  position: relative;
}

.nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 0.65rem 0 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  max-width: 160px;
}

.nav-user-btn:hover,
.nav-user-menu.open .nav-user-btn {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.nav-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.nav-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.nav-user-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.nav-user-menu.open .nav-user-chevron {
  transform: rotate(180deg);
}

.nav-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 200px;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  z-index: 200;
  overflow: hidden;
  padding: 0.35rem;
}

.nav-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.nav-dropdown-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--primary), var(--primary-hover));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.nav-dropdown-header strong {
  display: block;
  font-size: 0.9rem;
}

.nav-dropdown-header small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s;
}

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

.nav-dropdown-danger:hover {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

.nav-dropdown-logout {
  margin: 0.25rem 0 0;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}

.nav-dropdown-icon {
  width: 1.25rem;
  text-align: center;
  opacity: 0.85;
}

.translate-keywords {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
}

.translate-keywords .kw-title {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.translate-keywords .kw-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.translate-keywords .kw-list li {
  margin: 0.2rem 0;
}

.translate-keywords .kw-list strong {
  color: var(--primary-text);
  margin-right: 0.35rem;
}

.translate-popup-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.btn-popup-action {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-popup-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
}

.btn-popup-ai {
  border-color: rgba(201, 162, 39, 0.45);
  color: var(--accent);
}

.btn-popup-action.faved {
  color: var(--success);
  border-color: var(--success);
}

.btn-fav-word-btn {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(201, 162, 39, 0.12);
  color: var(--accent);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-fav-word-btn:hover,
.btn-fav-word-btn.faved {
  background: var(--accent-glow);
  transform: scale(1.02);
}

.ai-modal-panel {
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ai-modal-source {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.ai-modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 0.25rem;
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.page-intro {
  padding: 2.5rem 0 1rem;
}

.page-intro h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.page-intro p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Nav: settings dropdown (display mode + speech) */
.nav-settings-menu {
  position: relative;
  flex-shrink: 0;
}

.btn-nav-settings {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-nav-settings:hover,
.nav-settings-menu.open .btn-nav-settings {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--text);
}

.nav-settings-icon {
  opacity: 0.85;
}

.nav-settings-dropdown {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 200;
  min-width: 13.5rem;
  padding: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.nav-settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.45rem 0.35rem;
}

.nav-settings-group + .nav-settings-group {
  border-top: 1px solid var(--border);
  margin-top: 0.15rem;
  padding-top: 0.65rem;
}

.nav-settings-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.nav-settings-mode-btns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}

.nav-mode-btn {
  padding: 0.45rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

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

.nav-mode-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.nav-theme-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  padding: 0.3rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.nav-theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem 0.45rem;
  border: 2px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
}

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

.nav-theme-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}

.nav-theme-swatch {
  width: 100%;
  max-width: 2.6rem;
  height: 1.1rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.nav-theme-swatch-dark {
  background: linear-gradient(135deg, #0c0f1a 40%, #1e1b4b 100%);
}

.nav-theme-swatch-light {
  background: linear-gradient(135deg, #f8fafc 40%, #e0e7ff 100%);
}

.nav-theme-swatch-eyecare {
  background: linear-gradient(135deg, #e8f5eb 0%, #c7edcc 50%, #d4eed9 100%);
}

.nav-theme-btn[data-theme-choice="eyecare"].active .nav-theme-swatch-eyecare {
  box-shadow: 0 0 0 2px var(--primary);
}


.nav-settings-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 2.1rem;
  padding: 0 1.75rem 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 12 12'%3E%3Cpath fill='%238b92a8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
}

.nav-settings-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}

.btn-theme {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s;
  flex-shrink: 0;
}

.btn-theme:hover { background: var(--bg-card-hover); }

.btn-xs {
  padding: 0.35rem 0.75rem !important;
  font-size: 0.8rem !important;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* Hero */
.hero {
  text-align: center;
  padding: 4rem 1rem 5rem;
}

.hero-badge {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(201, 162, 39, 0.4);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  animation: fadeUp 0.6s ease;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.6s ease 0.1s both;
}

.hero-title em {
  font-style: italic;
  background: linear-gradient(135deg, var(--accent), #f0d78c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  max-width: 560px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  animation: fadeUp 0.6s ease 0.2s both;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
  animation: fadeUp 0.6s ease 0.3s both;
}

.hero-stats {
  display: flex;
  gap: 3rem;
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 0.6s ease 0.4s both;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat strong {
  font-size: 2rem;
  font-family: var(--font-serif);
  color: var(--accent);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
}

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

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-card);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

/* Sections */
.section { padding: 3rem 0; }

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.section-header p { color: var(--text-muted); }

/* Exam grid */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.exam-card {
  position: relative;
  display: block;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s, border-color 0.25s, background 0.25s, box-shadow 0.25s;
  overflow: hidden;
}

.exam-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.25s;
}

.exam-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: var(--shadow);
}

.exam-card:hover::before { opacity: 1; }

.exam-card-icon { font-size: 2rem; display: block; margin-bottom: 0.75rem; }

.exam-card h3 { font-size: 1.15rem; margin-bottom: 0.25rem; }

.exam-card-en {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.exam-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.exam-card-meta {
  font-size: 0.8rem;
  color: var(--accent);
}

.exam-card-arrow {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.25s, transform 0.25s;
  color: var(--accent);
}

.exam-card:hover .exam-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.2s;
}

.feature-card:hover { background: var(--bg-card-hover); }

.feature-icon { font-size: 2rem; margin-bottom: 1rem; }

.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

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

/* Breadcrumb */
.breadcrumb {
  padding: 1.5rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb span { margin: 0 0.35rem; }

/* Page hero */
.page-hero {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
}

.page-hero-sm { padding: 1.5rem 1rem 2rem; }

.page-hero-icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; }

.page-hero h1 {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.page-hero p { color: var(--text-muted); }

/* Paper list */
.paper-list { display: flex; flex-direction: column; gap: 1rem; }

.paper-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.paper-card:hover {
  transform: translateX(4px);
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.3);
}

.paper-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

.paper-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.tag-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.paper-card-btn {
  color: var(--primary-hover);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .btn { margin-top: 1rem; }

/* Practice */
.practice-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.practice-header h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
}

.practice-meta { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.25rem; }

.practice-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.translate-tip {
  font-size: 0.8rem;
  color: var(--accent);
}

.practice-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .practice-layout { grid-template-columns: 1fr; }
  .answer-sheet { position: static !important; }
}

.answer-sheet {
  position: sticky;
  top: 5rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.answer-sheet h3 {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.sheet-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sheet-item {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.sheet-item:hover {
  border-color: var(--primary);
  color: var(--text);
}

.sheet-item.answered {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #a5b4fc;
}

.sheet-item.correct {
  background: rgba(52, 211, 153, 0.2);
  border-color: var(--success);
  color: var(--success);
}

.sheet-item.wrong {
  background: rgba(248, 113, 113, 0.2);
  border-color: var(--error);
  color: var(--error);
}

.sheet-legend {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.dot-default { background: var(--border); }
.dot-answered { background: var(--primary); }
.dot-correct { background: var(--success); }
.dot-wrong { background: var(--error); }

/* Questions */
.questions-panel { display: flex; flex-direction: column; gap: 1.5rem; }

.question-card {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  scroll-margin-top: 6rem;
}

.question-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.q-number { font-weight: 600; }

.q-type {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: var(--primary-soft);
  border-radius: 6px;
  color: var(--primary-text);
}

.q-difficulty {
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-left: auto;
  color: var(--text-muted);
}

.passage {
  padding: 1rem 1.25rem;
  background: var(--bg-passage);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-passage);
}

.stem {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.options { list-style: none; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.option:hover { background: rgba(255, 255, 255, 0.03); }

.option input { margin-top: 0.25rem; accent-color: var(--primary); }

.option-label {
  font-weight: 600;
  color: var(--accent);
  min-width: 1.5rem;
}

.option-text { flex: 1; line-height: 1.5; }

.option:has(input:checked) {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.question-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
}

.feedback.correct .feedback-result { color: var(--success); }
.feedback.wrong .feedback-result { color: var(--error); }

.explanation {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.explanation strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.85rem;
}

.explanation p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.hidden { display: none !important; }

/* Selectable text highlight */
.selectable-text ::selection {
  background: rgba(201, 162, 39, 0.4);
  color: white;
}

html[data-theme="eyecare"] .selectable-text ::selection {
  background: rgba(61, 143, 110, 0.35);
  color: #1a2e24;
}

/* Selection hint */
.selection-hint {
  position: fixed;
  z-index: 999;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  pointer-events: none;
  white-space: nowrap;
  animation: popIn 0.15s ease;
}

.selection-hint::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
  animation: hintPulse 1s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Translate popup */
.translate-popup {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  max-width: 320px;
  padding: 0.85rem 1rem;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: popIn 0.2s ease;
}

.translate-popup-rich {
  max-width: min(440px, calc(100vw - 24px));
  padding: 1rem 1.1rem;
}

.translate-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.translate-word {
  font-weight: 700;
  color: var(--accent);
  font-size: 1.05rem;
}

.translate-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}

.translate-close:hover { color: var(--text); }

.translate-result {
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.translate-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.translate-popup.loading .translate-result::after {
  content: "…";
  animation: dots 1s infinite;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 1.5rem 1.75rem;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.modal-content {
  position: relative;
  text-align: center;
  padding: 2.5rem;
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 100%;
}

.modal-content h2 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.score-display {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.score-display span:first-child {
  color: var(--accent);
  font-family: var(--font-serif);
}

.score-message {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

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

@keyframes popIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes dots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Auth */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 3rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.auth-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.auth-error {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.auth-form label {
  display: block;
  margin-bottom: 1rem;
}

.auth-form label span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.auth-form input,
.auth-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.auth-form input:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-block { width: 100%; margin-top: 0.5rem; }

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-footer a { color: var(--primary); }

@media (max-width: 1024px) {
  .header-left { gap: 1rem; }
  .nav-main { gap: 0; }
  .nav-link { padding: 0.4rem 0.5rem; font-size: 0.82rem; }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }
  .header-left {
    gap: 0.65rem;
  }
  .logo-text {
    font-size: 1rem;
  }
  .nav-link {
    padding: 0.35rem 0.45rem;
    font-size: 0.78rem;
  }
  .nav-user-name { display: none; }
  .nav-user-btn {
    max-width: none;
    padding: 0 0.35rem;
    width: 40px;
    justify-content: center;
  }
  .nav-user-chevron { display: none; }
  .nav-settings-text {
    display: none;
  }
  .btn-nav-settings {
    width: 2.25rem;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .main-content { padding: 0 1rem 3rem; }
  .hero { padding: 2.5rem 0.5rem 3rem; }
}

/* Auth pages: minimal header */
body.page-auth .site-header {
  max-width: none;
  padding: 1rem 1.5rem;
}

body.page-auth .main-content {
  padding-top: 0;
}
