/* ===== CSS Variables - Light Theme (Default) ===== */
:root {
  --primary-color: #5B8DEF;
  --primary-dark: #4A7DE0;
  --secondary-color: #7FD8BE;
  --accent-color: #FFD166;
  --danger-color: #EF5B5B;
  --success-color: #06D6A0;
  --bg-color: #F8F9FA;
  --card-bg: #FFFFFF;
  --text-primary: #2D3748;
  --text-secondary: #718096;
  --text-light: #A0AEC0;
  --border-color: #E2E8F0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 16px;
  --radius-sm: 8px;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --primary-color: #6B9EFF;
  --primary-dark: #5A8DEF;
  --secondary-color: #8EE8CE;
  --accent-color: #FFE177;
  --danger-color: #FF6B6B;
  --success-color: #17E6B0;
  --bg-color: #1A202C;
  --card-bg: #2D3748;
  --text-primary: #F7FAFC;
  --text-secondary: #A0AEC0;
  --text-light: #718096;
  --border-color: #4A5568;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}

#app {
  min-height: 100vh;
  padding-bottom: 20px;
}

/* ===== Screen Container ===== */
.screen {
  animation: fadeIn 0.3s ease-out;
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

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

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 20px;
}

.header__back,
.header__home {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

.header__back:active,
.header__home:active {
  transform: scale(0.95);
}

.header__back svg,
.header__home svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-primary);
}

.header__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
  margin: 0 12px;
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: all 0.3s ease;
  font-size: 1.5rem;
}

.theme-toggle:hover {
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* ===== Support Button ===== */
.support-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-top: 16px;
}

.support-btn:hover {
  border-color: var(--primary-color);
  background: rgba(91, 141, 239, 0.1);
}

.support-btn:active {
  transform: scale(0.98);
}

/* ===== Buttons ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  margin-bottom: 12px;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(91, 141, 239, 0.4);
}

.btn--primary:active {
  box-shadow: 0 2px 8px rgba(91, 141, 239, 0.3);
}

.btn--secondary {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn--accent {
  background: linear-gradient(135deg, var(--accent-color), #FFC447);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(255, 209, 102, 0.4);
}

.btn--success {
  background: linear-gradient(135deg, var(--success-color), #05B386);
  color: white;
  box-shadow: 0 4px 12px rgba(6, 214, 160, 0.4);
}

.btn--danger {
  background: linear-gradient(135deg, var(--danger-color), #D94A4A);
  color: white;
}

.btn--icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
}

.btn svg {
  width: 20px;
  height: 20px;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
}

.card:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card--topic {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
}

.card--topic__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.card--topic__content {
  flex: 1;
}

.card--topic__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card--topic__subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.card--topic__arrow {
  width: 24px;
  height: 24px;
  stroke: var(--text-light);
}

/* ===== Word Card ===== */
.word-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s, background 0.3s;
}

.word-card:active {
  transform: scale(0.98);
}

.word-card__english {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 12px;
}

.word-card__transcription {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-family: 'Courier New', monospace;
}

.word-card__russian {
  font-size: 1.5rem;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.word-card__russian.visible {
  opacity: 1;
  transform: translateY(0);
}

.word-card__hint {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 16px;
}

/* ===== Card Navigation ===== */
.card-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.card-nav__btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s, background 0.3s;
}

.card-nav__btn:active {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.card-nav__btn:active svg {
  stroke: white;
}

.card-nav__btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-primary);
}

.card-nav__counter {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: center;
}

/* ===== Progress Bar ===== */
.progress-bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* ===== Text Display ===== */
.text-display {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  line-height: 1.8;
  font-size: 1.1rem;
  transition: background 0.3s;
}

.text-display p {
  margin-bottom: 16px;
}

.text-display p:last-child {
  margin-bottom: 0;
}

/* ===== Fill Word Exercise ===== */
.fill-word {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}

.fill-word__text {
  font-size: 1.1rem;
  line-height: 2;
  margin-bottom: 24px;
}

.fill-word__blank {
  display: inline-block;
  min-width: 100px;
  padding: 4px 12px;
  margin: 0 4px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-color);
}

.fill-word__blank:hover {
  border-color: var(--primary-color);
  background: rgba(91, 141, 239, 0.1);
}

.fill-word__blank.filled {
  border-style: solid;
  border-color: var(--primary-color);
  background: rgba(91, 141, 239, 0.1);
  color: var(--primary-color);
  font-weight: 600;
}

.fill-word__blank.correct {
  border-color: var(--success-color);
  background: rgba(6, 214, 160, 0.1);
  color: var(--success-color);
}

.fill-word__blank.wrong {
  border-color: var(--danger-color);
  background: rgba(239, 91, 91, 0.1);
  color: var(--danger-color);
}

.fill-word__options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.fill-word__option {
  padding: 10px 20px;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  color: var(--text-primary);
}

.fill-word__option:hover {
  border-color: var(--primary-color);
  background: rgba(91, 141, 239, 0.1);
}

.fill-word__option.used {
  opacity: 0.4;
  pointer-events: none;
}

/* ===== Test ===== */
.test-question {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: background 0.3s;
}

.test-question__text {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.test-option {
  padding: 16px 20px;
  background: var(--bg-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.test-option:hover {
  border-color: var(--primary-color);
  background: rgba(91, 141, 239, 0.05);
}

.test-option__letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.test-option.correct {
  border-color: var(--success-color);
  background: rgba(6, 214, 160, 0.1);
}

.test-option.correct .test-option__letter {
  background: var(--success-color);
  color: white;
}

.test-option.wrong {
  border-color: var(--danger-color);
  background: rgba(239, 91, 91, 0.1);
}

.test-option.wrong .test-option__letter {
  background: var(--danger-color);
  color: white;
}

/* ===== Results ===== */
.results {
  text-align: center;
  padding: 40px 20px;
}

.results__score {
  font-size: 4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.results__label {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.results__message {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 32px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: background 0.3s;
}

/* ===== Menu Grid ===== */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.menu-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s, background 0.3s;
  box-shadow: var(--shadow);
}

.menu-item:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.menu-item__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.menu-item__icon--blue {
  background: rgba(91, 141, 239, 0.15);
}

.menu-item__icon--green {
  background: rgba(127, 216, 190, 0.15);
}

.menu-item__icon--yellow {
  background: rgba(255, 209, 102, 0.15);
}

.menu-item__icon--purple {
  background: rgba(155, 105, 245, 0.15);
}

.menu-item__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Welcome Screen ===== */
.welcome {
  text-align: center;
  padding: 40px 20px;
}

.welcome__logo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: var(--shadow-lg);
}

.welcome__logo-img {
  height: 120px;
  width: auto;
  max-width: 90%;
  margin: 0 auto 24px;
  display: block;
  object-fit: contain;
}

/* Same size logo for light theme */
[data-theme="light"] .welcome__logo-img,
:root:not([data-theme="dark"]) .welcome__logo-img {
  height: 120px;
}

.welcome__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome__subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
}

/* ===== Utility Classes ===== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ===== Animation for card flip ===== */
.flip-card {
  perspective: 1000px;
}

.flip-card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card__inner {
  transform: rotateY(180deg);
}

.flip-card__front,
.flip-card__back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
}

.flip-card__back {
  transform: rotateY(180deg);
}
