:root {
  --primary-color: #6a11cb;
  --secondary-color: #2575fc;
  --accent-color: #ff4b1f;
  --accent-color-2: #ff9068;
  --success-color: #00b09b;
  --error-color: #ff5f6d;
  --text-dark: #2d3436;
  --text-light: #636e72;
  --white: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  --border-radius: 20px;
  --font-main: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: var(--text-dark);
  line-height: 1.6;
}

/* Background Animation */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 10% 20%, rgba(106, 17, 203, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(37, 117, 252, 0.1) 0%, transparent 40%);
  z-index: -1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 0;
}

h1 {
  font-family: var(--font-main);
  font-size: 2.5rem;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}

.subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
}

/* Navigation */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.nav-btn {
  background: var(--white);
  border: none;
  padding: 12px 24px;
  border-radius: 50px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(37, 117, 252, 0.3);
}

/* Main Content Area */
.view-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dictionary View */
.dictionary-controls {
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

.search-input {
  padding: 12px 20px;
  border: 2px solid #e1e1e1;
  border-radius: 12px;
  width: 100%;
  max-width: 300px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.search-input:focus {
  outline: none;
  border-color: var(--secondary-color);
}

.unit-section {
  margin-bottom: 30px;
}

.unit-title {
  font-family: var(--font-main);
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(106, 17, 203, 0.1);
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.word-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.word-card:hover {
  transform: translateY(-5px);
}

.word-en {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.word-cn {
  font-size: 1rem;
  color: var(--text-light);
}

.starred-badge {
  color: #f1c40f;
  margin-right: 8px;
}

/* Quiz View */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.quiz-setup {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.unit-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.unit-chip {
  padding: 8px 16px;
  border: 2px solid #eee;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.unit-chip.selected {
  background: var(--secondary-color);
  color: white;
  border-color: var(--secondary-color);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-color-2));
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 75, 31, 0.4);
  transition: transform 0.2s;
}

.primary-btn:hover {
  transform: scale(1.05);
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  margin-bottom: 30px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--success-color), var(--secondary-color));
  width: 0%;
  transition: width 0.3s ease;
}

.question-card {
  margin-bottom: 30px;
}

.question-text {
  font-size: 2.5rem;
  font-family: var(--font-main);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.question-instruction {
  color: var(--text-light);
  font-size: 1.1rem;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.option-btn {
  background: var(--white);
  border: 2px solid #eee;
  padding: 20px;
  border-radius: 16px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.option-btn:hover {
  border-color: var(--secondary-color);
  background: rgba(37, 117, 252, 0.05);
}

.option-btn.correct {
  background: #d4edda;
  border-color: #c3e6cb;
  color: #155724;
}

.option-btn.wrong {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}

.quiz-result-score {
  font-size: 4rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--success-color), var(--secondary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 20px 0;
}

/* Notebook View */
.notebook-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px 30px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-label {
  color: var(--text-light);
}

.mistake-list {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.mistake-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.mistake-item:last-child {
  border-bottom: none;
}

.mistake-word {
  font-size: 1.2rem;
  font-weight: 600;
}

.mistake-count {
  background: var(--error-color);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-left: 10px;
}

.review-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: #f1f2f6;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: #dfe4ea;
}

.delete-btn:hover {
  background: #ff7675;
  color: white;
}

/* Progress View */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.chart-card {
  background: white;
  padding: 25px;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.chart-title {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--text-dark);
}

.data-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #eee;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* Flashcard Styles - Global Overrides */
.flashcard-container {
  perspective: 1000px;
  width: 100%;
  min-height: 400px;
  background: white;
  cursor: pointer;
  margin-bottom: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  transition: transform 0.2s;
}

.flashcard-container:active {
  transform: scale(0.98);
}

.flashcard-content {
  text-align: center;
  width: 100%;
}

#flashcard-front {
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 30px;
  line-height: 1.2;
}

#flashcard-back {
  font-size: 3rem;
  color: var(--primary-color);
  padding-top: 30px;
  margin-top: 20px;
  border-top: 2px dashed #eee;
  animation: fadeIn 0.3s ease;
  width: 100%;
  font-weight: 600;
}

#flashcard-back.hidden,
.flashcard-content.hidden {
  display: none !important;
}

.tap-hint {
  position: absolute;
  bottom: 20px;
  color: #ccc;
  font-size: 1rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0.6;
  }
}

.study-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 768px) {
  .options-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }
}