@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-main: #090d16;
  --bg-panel-left: #0e1526;
  --bg-panel-right: #111a2e;
  --bg-card: rgba(22, 31, 51, 0.75);
  --bg-card-hover: rgba(30, 42, 69, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(139, 92, 246, 0.4);
  
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.3);
  
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  
  --hl-yellow: #fef08a;
  --hl-green: #bbf7d0;
  --hl-blue: #bfdbfe;
  --hl-pink: #fbcfe8;
  
  --shadow-main: 0 8px 25px rgba(0, 0, 0, 0.4);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Header */
header.app-header {
  height: 60px;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 12px var(--primary-glow);
}

.brand-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(to right, #fff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-wrapper select {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.select-wrapper select:hover {
  border-color: var(--primary);
}

.btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-accent {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.3);
}

/* MAIN LAYOUT: Split Screen with 100% Height & Independent Scrollbars */
main.main-layout {
  display: flex;
  height: calc(100vh - 60px);
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Left Panel: Reading Passage (Independent Scrollbar) */
.passage-container {
  flex: 1.1;
  height: 100%;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg-panel-left);
  border-right: 1px solid var(--border-color);
}

.passage-article {
  max-width: 780px;
  margin: 0 auto;
}

.article-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 14px;
}

.article-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 6px;
  color: #ffffff;
}

.article-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Paragraphs & Sentence Analysis */
.paragraph-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-main);
  backdrop-filter: blur(12px);
  position: relative;
}

.sentence-span {
  position: relative;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  transition: var(--transition);
}

.sentence-span:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
}

.sentence-span.active {
  background: rgba(139, 92, 246, 0.35);
  border-bottom: 2px solid var(--primary);
}

/* Sentence Breakdown Card */
.sentence-analysis-card {
  margin-top: 14px;
  background: rgba(9, 13, 22, 0.95);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  animation: fadeIn 0.25s ease-out;
}

.analysis-section {
  margin-bottom: 10px;
}
.analysis-section:last-child {
  margin-bottom: 0;
}

.analysis-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.analysis-content {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* Right Panel: Questions & Quiz (INDEPENDENT SCROLL) */
.questions-container {
  flex: 0.9;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel-right);
  transition: transform 0.35s ease, margin-right 0.35s ease, flex 0.35s ease;
  overflow: hidden;
}

.questions-container.collapsed {
  display: none;
}

.questions-header {
  height: 52px;
  padding: 0 24px;
  background: rgba(17, 26, 46, 0.95);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.questions-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
}

.questions-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.question-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
  transition: var(--transition);
}

.question-text {
  font-size: 0.92rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.option-btn:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
}

.option-btn.selected {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--primary);
  color: #fff;
}

.option-btn.correct-ans {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--accent-emerald) !important;
  color: #4ade80 !important;
}

.option-btn.wrong-ans {
  background: rgba(244, 63, 94, 0.25) !important;
  border-color: var(--accent-rose) !important;
  color: #f87171 !important;
}

.open-answer-box textarea {
  width: 100%;
  height: 70px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  resize: vertical;
  margin-bottom: 8px;
}

.explanation-card {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(6, 182, 212, 0.1);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 4px;
  font-size: 0.83rem;
  color: #cbd5e1;
  line-height: 1.45;
}

/* FULL PASSAGE ANALYSIS MODAL (全篇精读解析报告) */
.full-analysis-modal {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 13, 22, 0.98);
  backdrop-filter: blur(24px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.full-analysis-modal.open {
  transform: translateY(0);
}

.modal-header {
  height: 60px;
  padding: 0 32px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 40px 60px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  color: var(--text-main);
  line-height: 1.7;
}

/* Styled Markdown Content in Modal */
.modal-body h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  color: #fff;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
}
.modal-body h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  color: var(--accent-cyan);
  margin: 24px 0 12px 0;
}
.modal-body h3 {
  font-size: 1.15rem;
  color: var(--primary);
  margin: 20px 0 10px 0;
}
.modal-body h4 {
  font-size: 1rem;
  color: #ffffff;
  margin: 14px 0 6px 0;
  padding: 4px 0;
}
.modal-body ul {
  margin-left: 20px;
  margin-bottom: 12px;
}

/* CLEAN WHITE TYPOGRAPHY VOCABULARY TABLE STYLING */
.vocab-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.vocab-table th {
  background: rgba(30, 41, 59, 0.95);
  color: #f3f4f6;
  padding: 14px 18px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.vocab-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.9rem;
  color: #ffffff !important; /* Pure clean white text for all columns */
  background: transparent !important;
  vertical-align: middle;
  box-shadow: none !important;
  text-shadow: none !important;
  outline: none !important;
}

.vocab-table td code {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #ffffff !important; /* Pure white text without glow box */
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0 !important;
}

.vocab-table tr:last-child td {
  border-bottom: none;
}

.vocab-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.vocab-table tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Floating Highlighting Toolbar */
.hl-toolbar {
  position: absolute;
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 200;
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hl-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s;
}
.hl-dot:hover { transform: scale(1.25); }
.hl-dot.yellow { background: var(--hl-yellow); }
.hl-dot.green { background: var(--hl-green); }
.hl-dot.blue { background: var(--hl-blue); }
.hl-dot.pink { background: var(--hl-pink); }

mark.hl-yellow { background: var(--hl-yellow); color: #1e1e1e; border-radius: 3px; padding: 0 3px; }
mark.hl-green { background: var(--hl-green); color: #1e1e1e; border-radius: 3px; padding: 0 3px; }
mark.hl-blue { background: var(--hl-blue); color: #1e1e1e; border-radius: 3px; padding: 0 3px; }
mark.hl-pink { background: var(--hl-pink); color: #1e1e1e; border-radius: 3px; padding: 0 3px; }

/* Vocab Drawer Modal */
.vocab-drawer {
  position: fixed;
  right: 0;
  top: 60px;
  bottom: 0;
  width: 360px;
  background: #0f172a;
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 30px rgba(0,0,0,0.7);
  z-index: 150;
  padding: 20px;
  transform: translateX(100%);
  transition: var(--transition);
}

.vocab-drawer.open {
  transform: translateX(0);
}

.vocab-list-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.vocab-word {
  font-weight: 700;
  color: var(--accent-cyan);
}

.vocab-meaning {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 3px;
}

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

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