:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Global System Variables */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-round: 9999px;
  
  --border-width: 1px;
}

/* Light Theme (Default) */
[data-theme="light"], :root:not([data-theme="dark"]) {
  color-scheme: light;
  --bg-app: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-elevated: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --border-color: rgba(226, 232, 240, 0.8);
  --text-main: #0f172a;
  --text-main-rgb: 15, 23, 42;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --primary: #0ea5e9;
  --primary-rgb: 14, 165, 233;
  --primary-hover: #0284c7;
  --primary-light: #e0f2fe;
  --primary-glow: rgba(14, 165, 233, 0.15);
  
  --success: #10b981;
  --success-hover: #059669;
  --success-light: #d1fae5;
  --success-border: rgba(16, 185, 129, 0.2);
  
  --error: #ef4444;
  --error-hover: #dc2626;
  --error-light: #fee2e2;
  --error-border: rgba(239, 68, 68, 0.2);
  
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --warning-border: rgba(245, 158, 11, 0.2);
  
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.04);
}

/* Dark Theme */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-app: radial-gradient(circle at 50% 0%, #082f49 0%, #0f172a 60%, #020617 100%);
  --bg-card: rgba(15, 23, 42, 0.6);
  --bg-card-elevated: #1e293b;
  --bg-surface-alt: #0f172a;
  --border-color: rgba(51, 65, 85, 0.5);
  --text-main: #f8fafc;
  --text-main-rgb: 248, 250, 252;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --primary: #38bdf8;
  --primary-rgb: 56, 189, 248;
  --primary-hover: #0ea5e9;
  --primary-light: rgba(56, 189, 248, 0.12);
  --primary-glow: rgba(56, 189, 248, 0.2);
  
  --success: #34d399;
  --success-hover: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --success-border: rgba(52, 211, 153, 0.2);
  
  --error: #f87171;
  --error-hover: #ef4444;
  --error-light: rgba(239, 68, 68, 0.15);
  --error-border: rgba(248, 113, 113, 0.2);
  
  --warning: #fbbf24;
  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(251, 191, 36, 0.2);
  
  --glass-bg: rgba(15, 23, 42, 0.5);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-fast);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

/* Glassmorphism containers */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--border-width) solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}

/* App Shell */
.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

/* Topbar & Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.topbar-title h1 {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, #0d9488 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 2px;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.status-pill {
  padding: 6px 14px;
  border-radius: var(--radius-round);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  color: var(--text-muted);
}

.status-pill::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: var(--radius-round);
}

.status-pill.ready {
  color: var(--success);
  border-color: var(--success-border);
  background: var(--success-light);
}

.status-pill.ready::before {
  background: var(--success);
}

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

/* Theme Switcher Button */
.theme-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-round);
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.theme-btn:hover {
  transform: scale(1.05);
  background: var(--bg-surface-alt);
}

/* Dashboard / Progress Section */
.dashboard-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(var(--text-main-rgb), 0.02);
  border: var(--border-width) solid var(--border-color);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  user-select: none;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: rgba(var(--text-main-rgb), 0.04);
}

.stat-card.active {
  background: var(--bg-card-elevated);
  box-shadow: var(--shadow-md);
}

.stat-card.active#statCardMastered {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-border);
}

.stat-card.active#statCardLearning {
  border-color: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-border);
}

.stat-card.active#statCardNew {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
}

.stat-icon.mastered { background: var(--success-light); color: var(--success); }
.stat-icon.learning { background: var(--warning-light); color: var(--warning); }
.stat-icon.new { background: var(--primary-light); color: var(--primary); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}

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

/* Settings and Filters Panels */
.settings-panel,
.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
}

.filters {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) auto;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input,
select,
textarea {
  min-height: 46px;
  width: 100%;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card-elevated);
  color: var(--text-main);
  padding: 0 14px;
  outline: none;
  transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Buttons */
.btn {
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

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

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border: var(--border-width) solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border-color);
  transform: translateY(-1px);
}

.btn-icon {
  min-width: 48px;
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  color: var(--primary);
  font-size: 1.2rem;
}

.btn-icon:hover:not(:disabled) {
  background: var(--primary-light);
}

/* Tabs Navigation */
.tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 2px;
}

.tab {
  padding: 12px 24px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: color var(--transition-fast), background var(--transition-fast);
  margin-bottom: -2px;
}

.tab::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition-fast);
}

.tab:hover:not(:disabled) {
  color: var(--text-main);
  background: rgba(var(--primary-rgb), 0.05);
}

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  background: var(--primary);
}

.tab.locked {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Alert Message */
.message {
  margin: 16px 0;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--warning-light);
  color: var(--warning);
  border: var(--border-width) solid var(--warning-border);
  font-weight: 600;
  animation: slide-down 0.3s ease;
}

.hidden {
  display: none !important;
}

/* Learn Layout */
.learn-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

.word-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 6px;
  border-radius: var(--radius-md);
}

/* Custom Scrollbar for word-list */
.word-list::-webkit-scrollbar {
  width: 6px;
}

.word-list::-webkit-scrollbar-track {
  background: transparent;
}

.word-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-round);
}

.word-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.word-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 16px 20px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.word-button:hover {
  border-color: var(--primary);
  background: var(--bg-surface-alt);
  transform: translateX(3px);
}

.word-button.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.word-button strong {
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.word-button .score-pill {
  padding: 2px 8px;
  border-radius: var(--radius-round);
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--border-color);
  color: var(--text-muted);
}

.word-button.active .score-pill {
  background: var(--primary);
  color: var(--text-inverse);
}

/* Study Surface Card */
.study-surface {
  min-height: 480px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.study-surface::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--primary);
}

.study-surface .card-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fade-in 0.3s ease;
}

.german {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--text-muted);
}

.english {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--primary);
  word-break: break-word;
}

.example {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.5;
  color: var(--text-main);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  border-left: 4px solid var(--text-muted);
  font-style: italic;
}

.example-block {
  display: grid;
  gap: 8px;
}

.example-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.example-toolbar > span {
  color: var(--text-muted);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.example-edit-button {
  padding: 4px 0;
  color: var(--primary);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 800;
}

.example-edit-button:hover {
  text-decoration: underline;
}

.example-editor {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: var(--border-width) solid var(--primary);
  border-radius: var(--radius-md);
  background: var(--primary-light);
}

.example-editor textarea {
  min-height: 112px;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}

.example-editor > small {
  color: var(--text-muted);
  font-size: .76rem;
}

.example-editor-actions {
  display: flex;
  gap: 10px;
}

.example-editor-actions .btn {
  min-height: 40px;
  padding: 0 15px;
}

.example-editor-error {
  color: var(--error);
  font-size: .82rem;
}

.study-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* Test Layout and Interactive Quiz Card */
.test-layout {
  padding: 32px;
}

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

.test-header h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
}

/* Card-Based Quiz Styles */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 0;
}

/* Progress Area */
.quiz-progress-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-round);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #0d9488 100%);
  border-radius: var(--radius-round);
  width: 0%;
  transition: width var(--transition-normal);
}

.quiz-progress-text {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}

/* Quiz Card UI */
.quiz-card {
  padding: 40px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  transition: all var(--transition-normal);
  background: var(--bg-card-elevated);
  box-shadow: var(--shadow-lg);
  border: var(--border-width) solid var(--border-color);
  min-height: 280px;
  justify-content: center;
}

.quiz-card.success-state {
  border-color: var(--success);
  box-shadow: 0 0 0 4px var(--success-border);
}

.quiz-card.error-state {
  border-color: var(--error);
  box-shadow: 0 0 0 4px var(--error-border);
  animation: shake 0.5s ease;
}

.quiz-card-prompt {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.quiz-card-word {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
}

.quiz-card-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-card input {
  font-size: 1.2rem;
  min-height: 52px;
}

.quiz-card input:disabled {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  opacity: 1;
}

/* Quiz Feedback and Overlay */
.quiz-feedback {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  display: none;
  animation: pop-in 0.25s ease;
}

.quiz-feedback.success {
  display: block;
  background: var(--success-light);
  color: var(--success);
  border: var(--border-width) solid var(--success-border);
}

.quiz-feedback.error {
  display: block;
  background: var(--error-light);
  color: var(--error);
  border: var(--border-width) solid var(--error-border);
}

.quiz-feedback .expected-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

.quiz-feedback .expected-answer {
  font-size: 1.1rem;
  font-weight: 800;
}

/* Quiz Results Section */
.quiz-result {
  margin-top: 24px;
  animation: fade-in 0.5s ease;
}

.result-summary-card {
  padding: 32px;
  border-radius: var(--radius-xl);
  text-align: center;
  background: var(--bg-card-elevated);
  border: var(--border-width) solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.result-score-circle {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-round);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  margin: 0 auto 16px;
  border: 4px solid var(--primary);
}

.result-summary-card h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-summary-card p {
  color: var(--text-muted);
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: var(--border-width) solid var(--border-color);
  align-items: center;
  transition: transform var(--transition-fast);
}

.result-item:hover {
  transform: translateY(-1px);
}

.result-item.good {
  border-left: 6px solid var(--success);
}

.result-item.bad {
  border-left: 6px solid var(--error);
}

.result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-german {
  font-weight: 700;
  font-size: 1.05rem;
}

.result-detail {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-detail .user-ans {
  color: var(--error);
  text-decoration: line-through;
  margin-right: 6px;
}

.result-detail .correct-ans {
  color: var(--success);
  font-weight: 600;
}

.result-state {
  font-weight: 800;
  font-size: 0.9rem;
  padding: 4px 10px;
  border-radius: var(--radius-round);
}

.result-item.good .result-state {
  background: var(--success-light);
  color: var(--success);
}

.result-item.bad .result-state {
  background: var(--error-light);
  color: var(--error);
}

/* Optional upload and report views */
.feature-layout {
  padding: 32px;
}

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

.feature-header h2 {
  margin: 2px 0 5px;
  font-family: var(--font-title);
  font-size: 1.65rem;
  font-weight: 800;
}

.feature-header p:not(.eyebrow) {
  color: var(--text-muted);
  font-size: .9rem;
}

.upload-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.upload-files-field {
  grid-column: 1 / -1;
}

.upload-files-field small {
  color: var(--text-muted);
  font-size: .76rem;
}

.upload-form input[type="file"] {
  min-height: auto;
  padding: 11px 14px;
}

.upload-form > .btn {
  grid-column: 1 / -1;
  justify-self: start;
}

#uploadFeedback {
  margin-top: 22px;
}

#uploadFeedback.success {
  color: var(--success);
  background: var(--success-light);
  border-color: var(--success-border);
}

.upload-results {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.upload-result {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card-elevated);
}

.upload-result.error-result {
  color: var(--error);
  border-color: var(--error-border);
}

.upload-result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.upload-result-heading > span {
  display: grid;
  gap: 3px;
}

.upload-result-heading small,
.upload-preview-list small {
  color: var(--text-muted);
}

.upload-preview-list {
  display: grid;
  gap: 8px;
  padding-left: 22px;
}

.upload-preview-list li {
  padding-left: 4px;
}

.upload-preview-list li > span,
.upload-preview-list li > small {
  display: block;
}

.upload-warnings {
  padding: 12px 14px;
  color: var(--warning);
  background: var(--warning-light);
  border: var(--border-width) solid var(--warning-border);
  border-radius: var(--radius-md);
  font-size: .82rem;
}

.upload-warnings ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.saved-label {
  color: var(--success);
  font-size: .82rem;
  font-weight: 700;
}

.report-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.report-progress > div {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--primary-light);
}

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

.report-progress strong {
  color: var(--primary);
  font-family: var(--font-title);
  font-size: 1.35rem;
}

.reports-list {
  display: grid;
  gap: 12px;
}

.report-card {
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card-elevated);
  overflow: hidden;
}

.report-card summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.report-card summary::-webkit-details-marker {
  display: none;
}

.report-card summary > span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.report-card summary strong {
  overflow-wrap: anywhere;
}

.report-card summary small {
  color: var(--text-muted);
}

.report-score {
  flex-shrink: 0;
  padding: 5px 10px;
  color: var(--warning);
  background: var(--warning-light);
  border-radius: var(--radius-round);
  font-weight: 800;
}

.report-score.good {
  color: var(--success);
  background: var(--success-light);
}

.report-score.low {
  color: var(--error);
  background: var(--error-light);
}

.report-details {
  display: grid;
  gap: 8px;
  margin: 0 18px 16px;
  padding-top: 14px;
  border-top: var(--border-width) solid var(--border-color);
}

.report-detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: .84rem;
}

.report-detail span {
  max-width: 64%;
  color: var(--text-muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.report-detail.correct span {
  color: var(--success);
}

.report-detail.wrong span {
  color: var(--error);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: .82rem;
}

.pagination:empty {
  display: none;
}

.pagination .btn {
  min-height: 38px;
  padding: 0 14px;
  font-size: .82rem;
}

.empty-state,
.error-text {
  color: var(--text-muted);
}

.error-text {
  color: var(--error);
}

/* Animations */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@keyframes pop-in {
  0% { transform: scale(0.97); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slide-down {
  0% { transform: translateY(-10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Screen Responsiveness */
@media (max-width: 840px) {
  .app-shell {
    width: min(100vw - 24px, 1180px);
    padding: 16px 0 32px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .topbar-actions {
    justify-content: space-between;
  }

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

  .learn-layout {
    grid-template-columns: 1fr;
  }

  .word-list {
    max-height: 240px;
  }

  .study-surface {
    padding: 24px;
    min-height: auto;
  }

  .test-layout {
    padding: 20px;
  }

  .feature-layout {
    padding: 20px;
  }

  .feature-header,
  .upload-result-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-form,
  .report-progress {
    grid-template-columns: 1fr;
  }

  .upload-form > .btn,
  .upload-result-heading .btn {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    flex: 1 0 auto;
    padding-right: 16px;
    padding-left: 16px;
  }

  .report-detail {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .report-detail span {
    max-width: none;
    text-align: left;
  }

  .example-editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .example-editor-actions .btn {
    width: 100%;
  }

  .quiz-card {
    padding: 24px;
  }

}

/* Confetti styles */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  top: -20px;
  z-index: 9999;
  border-radius: var(--radius-sm);
  animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}
