:root {
  --bg-grad-start: #1e1b4b;
  --bg-grad-end: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.6);
  --accent: #818cf8;
  --accent-glow: rgba(129, 140, 248, 0.3);
  --success: #34d399;
  --gold: #fbbf24;
  --text-main: #f1f5f9;
  --text-dim: #94a3b8;
  --danger: #ef4444;
  --orange: #f97316;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 0 120px;
  background: radial-gradient(circle at top, var(--bg-grad-start), var(--bg-grad-end));
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

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

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

.page-section {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.page-section.active {
  display: flex;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
}

.help-text, .feedback-label {
  color: var(--text-dim);
  font-size: 11px;
}

.header {
  width: 100%;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 5px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
  max-width: 80%;
  line-height: 1.4;
}

.unified-width {
  width: 90%;
  max-width: 380px;
  margin: 0 auto;
}

.vocab-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.2s;
}

.vocab-item.deleting {
  opacity: 0;
  transform: translateX(-20px);
}

.vocab-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.delete-btn {
  padding: 2px 6px;
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}

.delete-btn:hover {
  color: var(--danger);
  transform: scale(1.1);
}

.level-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: #64748b;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.level-dot.new {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.level-dot.learning {
  background: var(--orange);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.level-dot.master {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.v-word {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.3px;
  flex: 1;
}

.v-meta {
  display: flex;
  align-items: center;
}

.v-trans {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(129, 140, 248, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: capitalize;
  white-space: nowrap;
}

.v-def {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.3;
  margin-top: -2px;
}

.v-ctx {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#quiz-container {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  align-items: center;
}

.quiz-card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 30px 20px;
  text-align: center;
  width: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  margin-bottom: 20px;
}

.q-context {
  font-size: 18px;
  line-height: 1.5;
  color: #fff;
  margin-bottom: 20px;
  font-style: italic;
}

.q-word,
.q-trans {
  display: none;
}

.q-word {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 10px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.q-trans {
  font-size: 16px;
  color: var(--text-dim);
}

.quiz-controls {
  display: none;
  width: 100%;
  gap: 8px;
  margin-top: 20px;
}

.q-btn {
  flex: 1;
  padding: 12px 0;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s;
}

.q-btn:active {
  transform: scale(0.95);
}

.q-btn.fail {
  background: var(--danger);
}

.q-btn.hard {
  background: var(--orange);
}

.q-btn.good {
  background: var(--accent);
}

.q-btn.easy {
  background: var(--success);
}

.vocab-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 15px;
}

.action-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  padding: 10px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.action-btn.primary {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.3);
}

.btn,
.btn:active {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn {
  transition: transform 0.1s;
}

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

.btn-action {
  background: var(--accent);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-premium {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  color: #451a03;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-invite {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  margin-bottom: 12px;
}

.btn-close {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: 20px 0;
}

.premium-banner {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 16px;
  padding: 16px;
  margin: 10px 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.25);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.1s;
}

.premium-banner:active {
  transform: scale(0.98);
}

.pb-content {
  z-index: 1;
  text-align: left;
}

.pb-text {
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 2px;
}

.pb-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pb-icon {
  font-size: 24px;
  z-index: 1;
}

.accordion-item {
  background: var(--card-bg);
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: background 0.2s;
}

.accordion-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: #e2e8f0;
}

.acc-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.acc-icon,
.arrow-icon {
  width: 18px;
  height: 18px;
  transition: 0.3s;
}

.acc-icon {
  color: var(--accent);
  opacity: 0.8;
}

.arrow-icon {
  color: var(--text-dim);
}

.accordion-item.open .arrow-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

.accordion-item.open {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(129, 140, 248, 0.3);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
  transition: max-height 0.3s ease;
}

.accordion-content.open {
  max-height: 1500px;
}

.accordion-inner {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-step {
  display: flex;
  gap: 12px;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-step:last-child {
  border-bottom: none;
}

.step-num {
  min-width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.step-text {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
}

.option-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.option-card.active {
  background: rgba(129, 140, 248, 0.15);
  border-color: var(--accent);
}

.option-info {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  text-align: left;
}

.option-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.option-title {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.option-tags {
    margin-left: 10px;
    display: flex;
    align-items: center;
}

.tag {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-right: 5px;
}

.tag.accent {
  color: var(--accent);
  background: rgba(129, 140, 248, 0.1);
}

.tag.green {
  color: var(--success);
  background: rgba(52, 211, 153, 0.1);
}

.tag.gold {
  color: var(--gold);
  background: rgba(251, 191, 36, 0.1);
}

.option-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.2;
  width: 100%;
}

.check-icon {
  display: none;
  color: var(--accent);
  font-size: 14px;
}

.option-card.active .check-icon {
  display: block;
}

.feedback-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 10px;
}

.calendar-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-weight: 700;
}

.cal-nav {
  cursor: pointer;
  padding: 5px 10px;
  color: var(--text-dim);
  font-size: 18px;
}

.cal-nav:hover {
  color: white;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.03);
}

.day.active {
  background: var(--success);
  color: #064e3b;
  font-weight: 700;
}

.day.today {
  border: 1px solid var(--accent);
  color: white;
  background: transparent;
}

.day.other-month {
    opacity: 0.3;
    pointer-events: none; 
}

.toggle-container {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 100px;
  margin: 0 auto 20px;
  position: relative;
  width: 200px;
}

.toggle-btn {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  border-radius: 100px;
  cursor: pointer;
  z-index: 2;
  transition: color 0.3s;
}

.toggle-btn.active {
  color: white;
}

.toggle-bg {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: var(--accent);
  border-radius: 100px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-container.yearly .toggle-bg {
  transform: translateX(100%);
}

.plan-card {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.plan-card.premium {
  border: 1px solid var(--gold);
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.15);
}

.plan-save {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  display: none;
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.plan-title {
  font-size: 20px;
  font-weight: 800;
}

.plan-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
}

.plan-features {
  list-style: none;
  padding: 0 5px;
  margin: 0 0 20px 0;
  text-align: left;
}

.plan-features li {
  padding: 8px 0;
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.plan-features li:last-child {
  border-bottom: none;
}

.check {
  color: var(--success);
}

.check.gold {
  color: var(--gold);
}

.bottom-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  max-width: 400px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  transition: 0.2s;
  width: 60px;
  background: transparent;
  border: none;
}

.nav-icon {
  font-size: 20px;
  transition: 0.2s;
}

.nav-item.active {
  color: white;
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  color: var(--accent);
}

.nav-item.active.gold .nav-icon {
  color: var(--gold);
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  margin: 0 auto 15px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-img,
.avatar-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--bg-grad-end);
  display: none;
}

.avatar-img {
  object-fit: cover;
}

.avatar-initials {
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: white;
  background: #1e293b;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card-bg);
  padding: 16px;
  border-radius: 18px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-val {
  font-size: 32px;
  font-weight: 800;
  color: white;
}

.stat-val.orange {
  background: linear-gradient(to bottom, #fbbf24, #d97706);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
