/* ═══════════════════════════════════════════════════════
   英语词汇通 — Dark Glassmorphism Design System
   ═══════════════════════════════════════════════════════ */

:root {
  --bg-base:        #06060f;
  --bg-surface:     #0d0d1a;
  --bg-elevated:    #12122a;
  --glass-bg:       rgba(255,255,255,0.04);
  --glass-border:   rgba(255,255,255,0.08);
  --glass-hover:    rgba(255,255,255,0.07);

  --accent:         #6c63ff;
  --accent-2:       #48cfad;
  --accent-warm:    #ff6b6b;
  --accent-gold:    #ffd93d;

  --grad-primary:   linear-gradient(135deg,#6c63ff 0%,#48cfad 100%);
  --grad-danger:    linear-gradient(135deg,#ff6b6b 0%,#ff8e53 100%);
  --grad-gold:      linear-gradient(135deg,#ffd93d 0%,#ff9f43 100%);

  --text-primary:   #f0f0ff;
  --text-secondary: rgba(240,240,255,0.55);
  --text-muted:     rgba(240,240,255,0.30);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 8px 32px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.06) inset;
  --shadow-glow: 0 0 30px rgba(108,99,255,0.25);

  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --ease-smooth: cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Animated gradient background orbs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 18s ease-in-out infinite alternate;
}
body::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(108,99,255,.12) 0%, transparent 70%);
  top: -100px; left: -100px;
}
body::after {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(72,207,173,.10) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  animation-delay: -9s;
}
@keyframes orb-drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,60px) scale(1.15); }
}

/* ── App Shell ────────────────────────────────────────── */
#app { position: relative; z-index: 1; }

/* ── Navigation Bar ───────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px;
  background: rgba(6,6,15,0.85);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--glass-border);
  display: flex; align-items: center; padding: 0 16px;
  gap: 4px;
}

.nav-brand {
  font-size: 18px; font-weight: 700;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-right: auto;
  letter-spacing: -0.5px;
}

.nav-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 6px 10px;
  background: none; border: none; color: var(--text-secondary);
  font-size: 10px; cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all .2s var(--ease-smooth);
  min-width: 52px;
}
.nav-btn .icon { font-size: 20px; transition: transform .2s var(--ease-spring); }
.nav-btn:hover, .nav-btn.active {
  color: var(--accent);
  background: rgba(108,99,255,0.12);
}
.nav-btn.active .icon { transform: scale(1.15); }

/* ── Page Layout ──────────────────────────────────────── */
.page {
  display: none;
  min-height: 100vh;
  padding: 76px 16px 90px;
  max-width: 768px;
  margin: 0 auto;
}
.page.active { display: block; animation: page-in .3s var(--ease-smooth); }
@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Glass Card ───────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: border-color .2s, box-shadow .2s;
}
.card:hover { border-color: rgba(108,99,255,0.25); box-shadow: var(--shadow-card), var(--shadow-glow); }

.card-sm { border-radius: var(--radius-md); padding: 14px 16px; }
.card-flat { box-shadow: none; border-radius: var(--radius-md); }

/* ── Gradient Accent Cards ────────────────────────────── */
.card-accent {
  background: linear-gradient(135deg, rgba(108,99,255,.15) 0%, rgba(72,207,173,.10) 100%);
  border-color: rgba(108,99,255,.3);
}
.card-danger { background: rgba(255,107,107,.08); border-color: rgba(255,107,107,.25); }
.card-gold   { background: rgba(255,217,61,.08);  border-color: rgba(255,217,61,.25); }

/* ── Typography ───────────────────────────────────────── */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.2; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
h3 { font-size: 16px; font-weight: 600; }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted{ color: var(--text-secondary); }
.text-grad {
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.text-gold {
  background: var(--grad-gold);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all .2s var(--ease-spring);
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background .15s;
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108,99,255,0.4);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(108,99,255,0.55); transform: translateY(-1px); }

.btn-ghost {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--glass-hover); border-color: rgba(108,99,255,0.3); }

.btn-danger { background: var(--grad-danger); color: #fff; box-shadow: 0 4px 20px rgba(255,107,107,0.35); }
.btn-success{ background: linear-gradient(135deg,#48cfad,#26de81); color: #fff; box-shadow: 0 4px 20px rgba(72,207,173,0.35); }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: var(--radius-lg); width: 100%; }
.btn-icon { padding: 10px; border-radius: 50%; }

/* Rating buttons */
.rating-btns {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px;
  margin-top: 16px;
}
.btn-rate {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg); cursor: pointer;
  transition: all .2s var(--ease-spring); color: var(--text-primary);
  font-size: 12px; font-weight: 600;
}
.btn-rate .rate-icon { font-size: 20px; }
.btn-rate-1:hover, .btn-rate-1.active { background: rgba(255,107,107,.2); border-color: #ff6b6b; color: #ff6b6b; transform: scale(1.05); }
.btn-rate-2:hover, .btn-rate-2.active { background: rgba(255,185,0,.2);  border-color: #ffb900; color: #ffb900; transform: scale(1.05); }
.btn-rate-3:hover, .btn-rate-3.active { background: rgba(72,207,173,.2); border-color: #48cfad; color: #48cfad; transform: scale(1.05); }
.btn-rate-4:hover, .btn-rate-4.active { background: rgba(108,99,255,.2); border-color: #6c63ff; color: #6c63ff; transform: scale(1.05); }

/* ── Stat Numbers ─────────────────────────────────────── */
.stat-number {
  font-size: 32px; font-weight: 800; letter-spacing: -1px;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Progress Bar ─────────────────────────────────────── */
.progress-bar {
  height: 6px; border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden; position: relative;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: var(--grad-primary);
  transition: width .6s var(--ease-smooth);
}
.progress-fill.gold { background: var(--grad-gold); }
.progress-fill.green { background: linear-gradient(90deg,#48cfad,#26de81); }

/* ── XP Bar ───────────────────────────────────────────── */
.xp-bar-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}
.level-badge {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0;
  box-shadow: 0 0 16px rgba(108,99,255,0.4);
}
.xp-info { flex: 1; min-width: 0; }
.xp-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }

/* ── Flash Card ───────────────────────────────────────── */
.flashcard-scene {
  perspective: 1200px;
  width: 100%; min-height: 260px;
}
.flashcard {
  width: 100%; min-height: 260px;
  position: relative; transform-style: preserve-3d;
  transition: transform .5s var(--ease-smooth);
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 28px 24px;
  box-shadow: var(--shadow-card);
}
.card-face.back { transform: rotateY(180deg); align-items: flex-start; justify-content: flex-start; }

.card-word {
  font-size: 38px; font-weight: 800; letter-spacing: -1px;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}
.card-phonetic { font-size: 18px; color: var(--text-secondary); font-family: monospace; }
.card-pos { font-size: 13px; color: var(--accent-2); font-weight: 600; }
.card-meaning { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.card-phrase { font-size: 13px; color: var(--accent-2); line-height: 1.7; }
.card-example { font-size: 13px; color: var(--text-secondary); line-height: 1.6; font-style: italic; }
.card-tap-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ── MCQ Options ──────────────────────────────────────── */
.mcq-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.mcq-option {
  padding: 14px 16px;
  background: var(--glass-bg); border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md); cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text-primary);
  transition: all .18s var(--ease-smooth);
  text-align: center; position: relative; overflow: hidden;
}
.mcq-option:hover:not(.disabled) {
  border-color: rgba(108,99,255,.5);
  background: rgba(108,99,255,.12);
  transform: translateY(-2px);
}
.mcq-option.correct {
  border-color: #48cfad; background: rgba(72,207,173,.18);
  color: #48cfad; font-weight: 700;
}
.mcq-option.wrong {
  border-color: #ff6b6b; background: rgba(255,107,107,.15);
  color: #ff6b6b;
}
.mcq-option.disabled { cursor: default; pointer-events: none; }

/* ── Input / Search ───────────────────────────────────── */
.input {
  width: 100%; padding: 12px 16px;
  background: var(--glass-bg); border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 15px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus {
  border-color: rgba(108,99,255,.6);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}
.input::placeholder { color: var(--text-muted); }

/* ── Tag / Badge ──────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.tag-accent  { background: rgba(108,99,255,.2); color: #a29bfe; }
.tag-green   { background: rgba(72,207,173,.2);  color: #48cfad; }
.tag-red     { background: rgba(255,107,107,.2); color: #ff6b6b; }
.tag-gold    { background: rgba(255,217,61,.2);  color: #ffd93d; }
.tag-muted   { background: rgba(255,255,255,.08); color: var(--text-secondary); }

/* ── Streak Calendar ──────────────────────────────────── */
.streak-calendar {
  display: grid; grid-template-columns: repeat(10,1fr); gap: 5px;
}
.streak-dot {
  aspect-ratio: 1; border-radius: 5px;
  background: rgba(255,255,255,.06);
  transition: all .2s;
  position: relative;
}
.streak-dot.done {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(108,99,255,.5);
}
.streak-dot.today { border: 2px solid rgba(255,255,255,.3); }

/* ── Heat Map ─────────────────────────────────────────── */
.heatmap {
  display: flex; gap: 3px; overflow-x: auto;
  padding-bottom: 4px;
}
.heatmap-week { display: flex; flex-direction: column; gap: 3px; }
.heatmap-cell {
  width: 12px; height: 12px; border-radius: 2px;
  background: rgba(255,255,255,.05);
}
.heatmap-cell[data-v="1"] { background: rgba(108,99,255,.35); }
.heatmap-cell[data-v="2"] { background: rgba(108,99,255,.55); }
.heatmap-cell[data-v="3"] { background: rgba(108,99,255,.75); }
.heatmap-cell[data-v="4"] { background: rgba(108,99,255,.95); }

/* ── Word List Item ───────────────────────────────────── */
.word-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--glass-border);
  transition: opacity .2s;
}
.word-item:last-child { border-bottom: none; }
.word-item-word { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.word-item-phonetic { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.word-item-meaning { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── Donut Chart wrapper ──────────────────────────────── */
.chart-wrap { position: relative; max-width: 220px; margin: 0 auto; }

/* ── Notification / Toast ─────────────────────────────── */
.toast-container {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(20,20,40,.95);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  color: var(--text-primary); font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: var(--radius-md);
  white-space: nowrap;
  animation: toast-in .3s var(--ease-spring), toast-out .3s .2s var(--ease-smooth) forwards;
  animation-delay: 0s, 2.5s;
}
@keyframes toast-in  { from { opacity:0; transform:translateY(-12px) scale(.9); } to { opacity:1; transform:none; } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; transform:translateY(-8px); } }

.toast.success { border-color: rgba(72,207,173,.4); }
.toast.error   { border-color: rgba(255,107,107,.4); }
.toast.xp      { border-color: rgba(108,99,255,.4); }

/* ── XP Burst ─────────────────────────────────────────── */
.xp-burst {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 28px; font-weight: 900;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none; z-index: 998;
  animation: xp-pop .7s var(--ease-spring) forwards;
}
@keyframes xp-pop {
  0%  { opacity:0; transform:translate(-50%,-50%) scale(.4); }
  60% { opacity:1; transform:translate(-50%,-70%) scale(1.1); }
  100%{ opacity:0; transform:translate(-50%,-90%) scale(.9); }
}

/* ── Particles (correct answer) ──────────────────────── */
.particle {
  position: fixed; pointer-events: none; z-index: 997;
  width: 8px; height: 8px; border-radius: 50%;
  animation: particle-fly .8s ease-out forwards;
}
@keyframes particle-fly {
  0%  { opacity:1; transform:translate(0,0) scale(1); }
  100%{ opacity:0; transform:var(--end-pos) scale(0); }
}

/* ── Skeleton Loading ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,.04) 0%,
    rgba(255,255,255,.08) 50%,
    rgba(255,255,255,.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0%{background-position:200%} 100%{background-position:-200%} }

/* ── Grid helpers ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.flex-row { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-8 { margin-top: 8px; }
.mt-12{ margin-top: 12px; }
.mt-16{ margin-top: 16px; }
.mt-20{ margin-top: 20px; }
.gap-8 { gap: 8px; }
.w-full { width: 100%; }

/* ── Spelling input ───────────────────────────────────── */
.spell-input-wrap {
  display: flex; gap: 10px; margin-top: 16px;
}
.spell-input {
  flex: 1; padding: 14px 16px; font-size: 22px; letter-spacing: 4px;
  text-align: center; font-weight: 700;
  background: var(--glass-bg); border: 2px solid var(--glass-border);
  border-radius: var(--radius-md); color: var(--text-primary);
  outline: none; transition: border-color .2s;
  font-family: 'Courier New', monospace;
}
.spell-input:focus { border-color: rgba(108,99,255,.6); }
.spell-input.correct { border-color: #48cfad; color: #48cfad; }
.spell-input.wrong   { border-color: #ff6b6b; color: #ff6b6b; }

/* ── Section header ───────────────────────────────────── */
.section-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.section-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

/* ── Tabs ─────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); padding: 4px;
}
.tab-btn {
  flex: 1; padding: 8px 10px; border-radius: var(--radius-sm);
  background: none; border: none;
  color: var(--text-secondary); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(108,99,255,.4);
}

/* ── Chip filter row ──────────────────────────────────── */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--glass-border); background: var(--glass-bg);
  color: var(--text-secondary); cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.chip:hover, .chip.active {
  border-color: var(--accent); background: rgba(108,99,255,.15); color: var(--accent);
}

/* ── Achievement badge ────────────────────────────────── */
.achv-badge {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg,rgba(255,217,61,.08),rgba(255,159,67,.06));
  border: 1px solid rgba(255,217,61,.2);
  border-radius: var(--radius-md);
}
.achv-icon { font-size: 28px; }
.achv-name { font-size: 14px; font-weight: 700; color: #ffd93d; }
.achv-date { font-size: 11px; color: var(--text-muted); }

/* ── Tense table ──────────────────────────────────────── */
.tense-table { width: 100%; border-collapse: collapse; }
.tense-table th, .tense-table td {
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--glass-border); font-size: 14px;
}
.tense-table th { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.tense-table td:last-child { font-weight: 700; color: var(--accent-2); }

/* ── Responsive tweaks for tablet ────────────────────── */
@media (min-width: 600px) {
  .page { padding: 76px 24px 90px; }
  .card-word { font-size: 46px; }
  .mcq-options { gap: 12px; }
  .streak-calendar { grid-template-columns: repeat(15,1fr); }
  .grid-2 { gap: 16px; }
}

/* ── Bottom tab bar (tablet) ──────────────────────────── */
@media (max-width: 599px) {
  .nav { padding: 0 4px; }
  .nav-brand { font-size: 15px; margin-right: 0; }
}

/* ── Scrollbar styling ────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(108,99,255,.3); border-radius: 99px; }
