:root {
  --theme-bg: #f5ecd7;
  --theme-bg-card: #fffef5;
  --theme-text: #3a3028;
  --theme-text-dim: #8a7d6b;
  --theme-primary: #f0a878;
  --theme-primary-light: #fcc8a0;
  --theme-primary-dark: #d4885e;
  --theme-primary-shadow: #b87048;
  --theme-accent: #7eb8d8;
  --theme-accent-light: #a8d4f0;
  --theme-accent-dark: #5a97b8;
  --theme-accent-shadow: #447a98;
  --theme-success: #8ccf8e;
  --theme-success-dark: #5ea862;
  --theme-success-shadow: #488a4c;
  --theme-danger: #e88a8a;
  --theme-danger-dark: #c45a5a;
  --theme-danger-shadow: #a04444;
  --theme-warning: #e8c570;
  --theme-warning-dark: #c4a450;
  --theme-border: #d4c8a8;
  --theme-border-dark: #b8a880;
  --theme-shadow: #c4b898;
  --theme-dot1: #e8d8c0;
  --theme-dot2: #e0d0b8;
  --font-pixel: 'Press Start 2P', 'DotGothic16', monospace;
  --font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-word: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --motion-silk: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-pop: cubic-bezier(0.18, 1.18, 0.22, 1);
  --motion-snappy: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--theme-bg);
  background-image:
    radial-gradient(circle, var(--theme-dot1) 1px, transparent 1px),
    radial-gradient(circle, var(--theme-dot2) 1px, transparent 1px);
  background-size: 24px 24px, 48px 48px;
  background-position: 0 0, 12px 12px;
  color: var(--theme-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  image-rendering: pixelated;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 30%),
    linear-gradient(0deg, rgba(200,180,150,0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

#app {
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  padding: 24px 16px 48px;
  position: relative;
  z-index: 1;
}

.view { display: block; }
.view.hidden { display: none !important; }

/* ======== DECORATIVE PIXEL ELEMENTS ======== */

.pixel-deco-top {
  text-align: center;
  margin-bottom: 8px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--theme-accent);
  letter-spacing: 2px;
  opacity: 0.6;
}

.pixel-deco-side {
  font-family: var(--font-pixel);
  font-size: 15px;
  color: var(--theme-text-dim);
  opacity: 0.5;
  margin: 0 6px;
}

.pixel-divider {
  text-align: center;
  margin: 16px 0;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--theme-border-dark);
  letter-spacing: 4px;
  user-select: none;
}

.pixel-icon-book { display: inline-block; width: 32px; height: 32px; position: relative; }
.pixel-icon-book::after {
  content: '📖';
  font-size: 28px;
  position: absolute;
  top: 0; left: 0;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.15));
}

/* ======== MODAL ======== */

.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(40,30,20,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none !important; }
.modal-content {
  background: var(--theme-bg-card);
  border: 4px solid var(--theme-border-dark);
  box-shadow:
    6px 6px 0 var(--theme-shadow),
    inset 0 0 0 2px var(--theme-bg-card),
    inset 0 0 0 4px var(--theme-border);
  padding: 28px 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: modal-pop 0.15s step-end;
}
@keyframes modal-pop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  cursor: pointer;
  font-size: 22px;
  color: var(--theme-text-dim);
  font-family: var(--font-pixel);
  background: var(--theme-bg);
  border: 2px solid var(--theme-border);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  transition: all 0.05s step-end;
}
.modal-close:hover { color: #fff; background: var(--theme-danger); border-color: var(--theme-danger-dark); }

/* ======== HELP MODAL ======== */

.modal-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
}
.help-modal-content {
  background: var(--theme-bg-card);
  border: 4px solid var(--theme-border-dark);
  box-shadow:
    6px 6px 0 var(--theme-shadow),
    inset 0 0 0 2px var(--theme-bg-card),
    inset 0 0 0 4px var(--theme-border);
  max-width: 700px;
  width: 92%;
  max-height: 75vh;
  position: relative;
  z-index: 1000;
  animation: modal-pop 0.15s step-end;
}
.help-layout {
  display: flex;
  min-height: 320px;
  max-height: 75vh;
}
.help-nav {
  width: 160px;
  flex-shrink: 0;
  border-right: 3px solid var(--theme-border);
  padding: 16px 0;
  overflow-y: auto;
  background: var(--theme-bg);
}
.help-nav-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--theme-text-dim);
  border-left: 3px solid transparent;
  transition: all 0.05s step-end;
  line-height: 1.3;
}
.help-nav-item:hover {
  color: var(--theme-text);
  background: var(--theme-bg-card);
}
.help-nav-item.active {
  color: var(--theme-primary-dark);
  background: var(--theme-primary-light);
  border-left-color: var(--theme-primary);
}
.help-body {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
  color: var(--theme-text);
}

/* ======== BUTTONS ======== */

.pixel-btn {
  display: inline-block;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--theme-primary);
  border: none;
  border-bottom: 5px solid var(--theme-primary-shadow);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  position: relative;
  transition: transform 0.05s step-end, border-bottom-width 0.05s step-end;
  image-rendering: pixelated;
  letter-spacing: 1px;
}
.pixel-btn::after {
  content: '';
  position: absolute;
  top: 3px; left: 4px; right: 4px; height: 2px;
  background: rgba(255,255,255,0.3);
  pointer-events: none;
}
.pixel-btn:hover { background: var(--theme-primary-dark); }
.pixel-btn:active { transform: translateY(2px); border-bottom-width: 3px; }
.pixel-btn:active::after { top: 2px; }

.pixel-btn.btn-sm { padding: 10px 18px; font-size: 14px; border-bottom-width: 4px; }
.pixel-btn.btn-sm::after { top: 2px; left: 3px; right: 3px; height: 2px; }
.pixel-btn.btn-sm:active { border-bottom-width: 2px; }

.pixel-btn.btn-accent { background: var(--theme-accent); border-color: var(--theme-accent-shadow); }
.pixel-btn.btn-accent:hover { background: var(--theme-accent-dark); }
.pixel-btn.btn-secondary { background: var(--theme-primary); border-color: var(--theme-primary-shadow); }
.pixel-btn.btn-secondary:hover { background: var(--theme-primary-dark); }
.pixel-btn.btn-success { background: var(--theme-success); border-color: var(--theme-success-shadow); }
.pixel-btn.btn-success:hover { background: var(--theme-success-dark); }
.pixel-btn.btn-danger { background: var(--theme-danger); border-color: var(--theme-danger-shadow); }
.pixel-btn.btn-danger:hover { background: var(--theme-danger-dark); }
.pixel-btn.btn-block { display: block; width: 100%; }
.pixel-btn.btn-lg { padding: 18px 36px; font-size: 19px; border-bottom-width: 6px; }
.pixel-btn.btn-lg:active { border-bottom-width: 4px; }
.pixel-btn.btn-lg::after { top: 4px; left: 5px; right: 5px; height: 3px; }
.pixel-btn.btn-lg:active::after { top: 3px; }

#dashboard-start-btn {
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
#dashboard-start-btn:hover {
  transform: scale(1.02);
  box-shadow:
    0 0 20px rgba(126, 184, 216, 0.3),
    0 0 40px rgba(126, 184, 216, 0.1);
}

/* ======== CARDS ======== */

.pixel-card {
  background: var(--theme-bg-card);
  border: 3px solid var(--theme-border-dark);
  box-shadow:
    5px 5px 0 var(--theme-shadow),
    inset 0 0 0 1px var(--theme-bg-card),
    inset 0 0 0 3px var(--theme-border);
  padding: 20px 18px;
  margin-bottom: 18px;
  image-rendering: pixelated;
  transition: box-shadow 0.1s step-end;
}

/* ======== FREQUENT MISTAKES CARD ======== */

.card-mistakes-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px dashed var(--theme-border);
}
.card-mistakes-icon {
  font-size: 20px;
}
.card-mistakes-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--theme-danger-dark);
}
.card-mistakes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mistake-word-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(232, 138, 138, 0.08);
  border: 1px solid rgba(232, 138, 138, 0.2);
  padding: 4px 10px;
}
.mistake-word {
  font-family: var(--font-word);
  font-size: 14px;
  color: var(--theme-text);
}
.mistake-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--theme-danger);
  font-family: var(--font-pixel);
}

.mistake-count-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--theme-danger);
  font-family: var(--font-pixel);
  border: 1px solid rgba(232, 138, 138, 0.4);
  background: rgba(232, 138, 138, 0.08);
  padding: 2px 8px;
  flex-shrink: 0;
}

/* ======== INPUT ======== */

.pixel-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-word);
  font-size: 18px;
  border: 4px solid var(--theme-border-dark);
  background: var(--theme-bg-card);
  color: var(--theme-text);
  outline: none;
  box-shadow:
    inset 3px 3px 0 rgba(0,0,0,0.06),
    0 0 0 1px var(--theme-border);
  transition: border-color 0.1s step-end;
}
.pixel-input:focus { border-color: var(--theme-accent); box-shadow: inset 3px 3px 0 rgba(0,0,0,0.06), 0 0 0 1px var(--theme-accent); }
.pixel-input:read-only { opacity: 0.65; background: var(--theme-bg); cursor: default; }
.pixel-input.input-sm { padding: 10px 14px; font-size: 15px; }
.pixel-input.correct { border-color: var(--theme-success); background: #e8f8e8; animation: flash-green 0.5s step-end; }
.pixel-input.wrong { border-color: var(--theme-danger); background: #fde8e8; animation: flash-red 0.5s step-end; }

@keyframes flash-green {
  0%, 100% { background: var(--theme-bg-card); }
  50% { background: #d4f0d4; }
}
@keyframes flash-red {
  0%, 100% { background: var(--theme-bg-card); }
  50% { background: #fdd4d4; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.shake { animation: shake 0.3s step-end; }

/* ======== LABELS ======== */

.pixel-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--theme-text);
  display: block;
  margin-bottom: 8px;
}

/* ======== WELCOME / TITLES ======== */

.welcome-text {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.6;
  color: var(--theme-text);
}

.title-text {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
  color: var(--theme-primary-dark);
  text-shadow: 3px 3px 0 var(--theme-shadow);
  letter-spacing: 2px;
}

.subtitle-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--theme-text-dim);
  margin-bottom: 14px;
}

/* ======== DASHBOARD STATS ======== */

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

.stat-card {
  background: var(--theme-bg-card);
  border: 3px solid var(--theme-border-dark);
  box-shadow: 4px 4px 0 var(--theme-shadow);
  padding: 18px 14px 14px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.06s step-end, box-shadow 0.06s step-end;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 6px; right: 6px; height: 3px;
  background: var(--theme-border);
  pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 4px 7px 0 var(--theme-shadow); }
.stat-card:active { transform: translateY(0); box-shadow: 4px 2px 0 var(--theme-shadow); }

.stat-card .stat-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
  image-rendering: pixelated;
}
.stat-card .stat-num {
  font-family: var(--font-pixel);
  font-size: 28px;
  color: var(--theme-accent-dark);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.06);
}
.stat-card .stat-label {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--theme-text-dim);
  margin-top: 6px;
}

.stat-card.card-new .stat-num { color: var(--theme-primary-dark); }
.stat-card.card-new .stat-icon, .stat-card.card-new::after { background: none; }
.stat-card.card-review .stat-num { color: var(--theme-warning-dark); }
.stat-card.card-done .stat-num { color: var(--theme-success-dark); }
.stat-card.card-mastered .stat-num { color: #6bb06e; }

/* ======== PROGRESS BAR ======== */

.progress-bar-wrap {
  background: repeating-linear-gradient(
    90deg,
    #e8d8c0 0px,
    #e8d8c0 4px,
    #e0ccb0 4px,
    #e0ccb0 8px
  );
  border: 3px solid var(--theme-border-dark);
  height: 28px;
  margin-bottom: 8px;
  position: relative;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.06);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    var(--theme-accent-light) 0px,
    var(--theme-accent-light) 6px,
    var(--theme-accent) 6px,
    var(--theme-accent) 8px,
    var(--theme-accent-dark) 8px,
    var(--theme-accent-dark) 10px
  );
  transition: width 0.4s step-end;
  position: relative;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px; right: 3px; height: 3px;
  background: rgba(255,255,255,0.25);
}
.progress-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--theme-text);
}

/* ======== CHAPTER SELECT ======== */

.chapter-select-card {
  background: var(--theme-bg-card);
  border: 3px solid var(--theme-border-dark);
  box-shadow: 4px 4px 0 var(--theme-shadow);
  padding: 14px 16px;
  margin-bottom: 16px;
  position: relative;
}
.chapter-select-card::before {
  content: '';
  position: absolute;
  top: 0; left: 8px; right: 8px; height: 3px;
  background: var(--theme-primary-light);
}
.chapter-select-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--theme-text-dim);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chapter-select-icon {
  font-size: 10px;
  color: var(--theme-primary-dark);
}
.chapter-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-select-dropdown {
  flex: 1;
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 6px 10px;
  border: 3px solid var(--theme-border-dark);
  background: var(--theme-bg);
  color: var(--theme-text);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233a3028' d='M2 4h8L6 8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}
.chapter-select-dropdown:focus {
  border-color: var(--theme-accent);
}
.chapter-word-count {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-text-dim);
  white-space: nowrap;
}

/* ======== LEARNING CONTAINER ======== */

.learn-container, .review-container, .dictation-container {
  text-align: center;
  position: relative;
}

/* ======== QUICK SETTINGS BAR ======== */

.quick-settings {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.qs-btn {
  background: var(--theme-bg);
  border: 2px solid var(--theme-border);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  opacity: 0.4;
  transition: all 0.05s step-end;
  line-height: 1;
  border-radius: 0;
}
.qs-btn:hover { opacity: 0.7; }
.qs-btn.active { opacity: 1; border-color: var(--theme-primary); background: var(--theme-primary-light); }

/* ======== STATE BADGE IN TOP BAR ======== */

.state-badge-inline {
  font-family: var(--font-pixel);
  font-size: 9px;
  padding: 3px 8px;
  border: 2px solid var(--theme-border-dark);
  white-space: nowrap;
  background: var(--theme-bg-card);
  color: var(--theme-text-dim);
  flex-shrink: 0;
}

/* ======== LEARN STATS ======== */

.learn-timer-row {
  text-align: center;
  margin: 0 auto 8px;
  max-width: 460px;
}
.learn-timer {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--theme-text-dim);
  padding: 4px 12px;
  border: 2px solid var(--theme-border);
  background: var(--theme-bg-card);
  cursor: pointer;
  user-select: none;
  transition: all 0.05s step-end;
}
.learn-timer:hover {
  color: var(--theme-primary-dark);
  border-color: var(--theme-primary);
}

.learn-stats {
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 10px;
  padding: 8px 14px;
  background: var(--theme-bg-card);
  border: 2px solid var(--theme-border);
  text-align: left;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}
.learn-stat-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  color: var(--theme-text);
}
.learn-stat-val {
  color: var(--theme-primary-dark);
  font-weight: 700;
}
.pct-badge {
  display: inline-block;
  background: var(--theme-primary-light);
  color: var(--theme-primary-dark);
  padding: 1px 8px;
  border: 2px solid var(--theme-primary);
  font-family: var(--font-pixel);
  font-size: 9px;
}

/* ======== HINT KEYS LARGER ======== */

.hint-key {
  display: inline-block;
  background: var(--theme-bg);
  border: 2px solid var(--theme-border-dark);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--theme-text);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.05);
}
.hint-key-main { font-size: 14px; }
.hint-key-sub { font-size: 12px; opacity: 0.7; }

/* ======== TOP BAR LARGER ======== */

.top-bar .back-btn {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  color: var(--theme-text-dim);
  background: var(--theme-bg);
  border: 2px solid var(--theme-border);
  padding: 4px 14px;
  box-shadow: 2px 2px 0 var(--theme-shadow);
  transition: all 0.05s step-end;
}
.top-bar .back-btn:hover { color: var(--theme-text); background: #fff; }
.top-bar .back-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--theme-shadow); }

.top-bar .top-title {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--theme-text);
  letter-spacing: 2px;
}

.top-center {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.learn-top-bar .quick-settings {
  margin-left: auto;
}

/* ======== CHAPTER SELECT ======== */

.chapter-select-card {
  background: var(--theme-bg-card);
  border: 3px solid var(--theme-border-dark);
  box-shadow: 4px 4px 0 var(--theme-shadow);
  padding: 14px 16px 16px;
  margin-bottom: 8px;
}
.chapter-select-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--theme-text-dim);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chapter-select-icon {
  font-size: 16px;
}
.chapter-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chapter-select-dropdown {
  flex: 1;
  padding: 8px 10px;
  font-size: 15px;
  font-family: var(--font-body);
  border: 3px solid var(--theme-border-dark);
  background: var(--theme-bg-card);
  color: var(--theme-text);
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.04);
  outline: none;
  cursor: pointer;
  min-height: 36px;
  appearance: auto;
  -webkit-appearance: auto;
}
.chapter-select-dropdown:focus {
  border-color: var(--theme-accent);
}
.chapter-word-count {
  font-size: 13px;
  color: var(--theme-text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ======== SETTINGS PANEL ======== */

.settings-section { margin-bottom: 4px; }
.settings-section-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: var(--theme-bg-card);
  border: 2px solid var(--theme-border);
  cursor: pointer;
  font-size: 14px; font-weight: 700;
  color: var(--theme-text);
  transition: background 0.05s step-end;
}
.settings-section-hd:hover { background: var(--theme-bg); }
.settings-section-hd.danger { color: var(--theme-danger-dark); border-color: var(--theme-danger); }
.settings-arrow { margin-left: auto; font-size: 12px; color: var(--theme-text-dim); }
.settings-section-bd {
  padding: 10px 14px;
  border-left: 2px solid var(--theme-border);
  border-right: 2px solid var(--theme-border);
  border-bottom: 2px solid var(--theme-border);
  background: rgba(255,255,255,0.2);
}
.settings-section-bd.collapsed { display: none; }
.settings-field {
  margin-bottom: 10px;
}
.settings-field:last-child { margin-bottom: 0; }
.settings-label {
  font-size: 13px; font-weight: 700;
  color: var(--theme-text-dim);
  display: block; margin-bottom: 6px;
}
.settings-toggle {
  display: flex; align-items: center; gap: 10px;
}
.settings-toggle span { font-size: 13px; color: var(--theme-text-dim); }

/* ======== LEARN INPUT FULL CENTERED ======== */

.learn-input-full {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  padding: 18px 20px;
  font-family: var(--font-body);
}

#learn-input.pixel-input {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 1px;
  font-family: var(--font-body);
}

.learn-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
}
.learn-input-row .pixel-input { flex: 1; }
.learn-input-full {
  max-width: 460px;
  margin: 0 auto;
  display: block;
}

.word-placeholder-lg {
  display: inline-block;
  font-family: var(--font-word);
  font-size: 36px;
  font-weight: bold;
  color: var(--theme-border-dark);
  letter-spacing: 4px;
  user-select: none;
  padding: 10px 0;
}
.word-placeholder-sm {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--theme-border);
  letter-spacing: 2px;
  user-select: none;
  padding: 8px 14px;
  border: 1px dashed var(--theme-border);
}

.eye-toggle-btn {
  background: none;
  border: 1px solid var(--theme-border);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  opacity: 0.4;
  transition: opacity 0.1s step-end;
  line-height: 1;
  border-radius: 0;
}
.eye-toggle-btn:hover { opacity: 0.8; }
.eye-toggle-btn.eye-open { opacity: 0.6; background: var(--theme-bg); }

.learn-progress-bar-wrap {
  background: var(--theme-bg-card);
  border: 3px solid var(--theme-border-dark);
  height: 24px;
  margin: 0 auto 16px;
  max-width: 460px;
  position: relative;
  box-shadow:
    inset 0 0 0 2px var(--theme-bg),
    inset 2px 2px 0 rgba(0,0,0,0.08);
  overflow: hidden;
  image-rendering: pixelated;
}
.learn-progress-bar-fill {
  height: 100%;
  background: repeating-linear-gradient(90deg,
    var(--theme-success-light, #a8e0b0) 0px,
    var(--theme-success-light, #a8e0b0) 4px,
    var(--theme-success) 4px,
    var(--theme-success) 6px,
    var(--theme-success-dark) 6px,
    var(--theme-success-dark) 8px
  );
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.15);
}
.learn-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(90deg,
    transparent 0px, transparent 8px,
    rgba(255,255,255,0.08) 8px, rgba(255,255,255,0.08) 16px
  );
}

.progress-info {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--theme-text-dim);
  margin-bottom: 18px;
  letter-spacing: 1px;
}

.word-box {
  background: var(--theme-bg-card);
  border: 4px solid var(--theme-border-dark);
  box-shadow:
    5px 5px 0 var(--theme-shadow),
    inset 0 0 0 2px var(--theme-bg-card),
    inset 0 0 0 4px var(--theme-border);
  padding: 28px 20px 20px;
  margin: 0 auto 20px;
  max-width: 460px;
  position: relative;
  word-break: break-word;
}
.word-box::before {
  content: '';
  position: absolute;
  top: 0; left: 8px; right: 8px; height: 4px;
  background: var(--theme-primary-light);
}

.word-display {
  font-family: var(--font-word);
  font-size: 36px;
  margin: 10px 0 10px;
  color: var(--theme-text);
  word-break: break-word;
  line-height: 1.5;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.05);
}
.word-display.incorrect { color: var(--theme-danger); animation: flash-red 0.5s step-end; }

.word-meaning {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--theme-text);
  margin-bottom: 8px;
  line-height: 1.5;
  font-weight: 700;
  padding: 8px 14px;
  background: #fef8e8;
  border: 2px dashed var(--theme-border);
  display: inline-block;
}

.speaker-icon {
  display: inline-block;
  font-size: 44px;
  cursor: pointer;
  margin: 10px 0 18px;
  user-select: none;
  transition: transform 0.1s step-end, filter 0.1s step-end;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.1));
}
.speaker-icon:hover { transform: scale(1.08); }
.speaker-icon:active { transform: scale(1.15); }
.speaker-icon.playing { animation: speaker-pulse 0.4s step-end infinite; }
@keyframes speaker-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ======== HINT KEYS ======== */

.hint-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.correct-answer {
  font-family: var(--font-word);
  font-size: 24px;
  color: var(--theme-danger);
  margin: 12px 0;
  font-weight: bold;
}

/* ======== WORD LIST ======== */

.word-list {
  max-height: 60vh;
  overflow-y: auto;
}
.word-list::before {
  content: '';
  display: block;
  height: 4px;
  background: repeating-linear-gradient(
    90deg, var(--theme-border) 0px, var(--theme-border) 4px, transparent 4px, transparent 8px
  );
  margin-bottom: 4px;
}
.word-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 2px dotted var(--theme-border);
  font-size: 15px;
  transition: background 0.05s step-end;
}
.word-list-item:hover { background: #fefcf0; }
.word-list-item .wl-name {
  font-family: var(--font-word);
  font-size: 16px;
  font-weight: bold;
  word-break: break-word;
}
.word-list-item .wl-trans {
  font-size: 13px;
  color: var(--theme-text-dim);
  text-align: right;
  max-width: 60%;
  overflow-wrap: anywhere;
}
.word-list-item .wl-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.word-list-item .wl-index {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-text-dim);
}
.word-list-item .wl-level {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-accent-dark);
  background: var(--theme-accent-light);
  border: 2px solid var(--theme-accent);
  padding: 1px 6px;
  display: inline-block;
}
.word-list-item .wl-level.mastered {
  color: var(--theme-success-dark);
  background: #d8f0d8;
  border-color: var(--theme-success);
}
.word-list-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 10px 0 8px;
}
.word-list-check-all,
.word-list-left {
  display: flex;
  align-items: center;
}
.word-list-check-all {
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--theme-text);
}
.word-list-left {
  flex: 1;
  min-width: 0;
  gap: 10px;
  cursor: pointer;
}
.word-list-left input,
.word-list-check-all input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--theme-danger);
}
.word-list-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.word-list-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  max-width: 60%;
  min-width: 0;
}
.word-list-right .wl-trans {
  max-width: none;
}
.mistake-list-item {
  gap: 12px;
}
.mistake-clear-one {
  padding: 6px 10px;
  font-size: 11px;
  border-bottom-width: 3px;
  flex-shrink: 0;
}
.word-list-item .wl-mistakes {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-danger);
  background: rgba(232, 138, 138, 0.08);
  border: 2px solid rgba(232, 138, 138, 0.5);
  padding: 1px 6px;
  display: inline-block;
}

/* ======== SETUP PAGE ======== */

.setup-card {
  max-width: 460px;
  margin: 0 auto;
  background: var(--theme-bg-card);
  border: 3px solid var(--theme-border-dark);
  box-shadow: 6px 6px 0 var(--theme-shadow), 0 0 60px rgba(0,0,0,0.04);
  padding: 32px 24px 24px;
  position: relative;
  z-index: 1;
}
.setup-card .pixel-input { margin-bottom: 4px; }
.setup-card .setup-start-btn { margin-top: 24px; }
.setup-card .range-info { font-size: 12px; color: var(--theme-text-dim); margin-bottom: 14px; padding-left: 2px; }

.setup-hero { text-align: center; margin-bottom: 24px; }
.setup-hero-icon {
  font-size: 56px;
  filter: drop-shadow(3px 3px 0 var(--theme-shadow));
  animation: hero-float 3s ease-in-out infinite;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.setup-hero-glitch {
  font-family: var(--font-pixel);
  font-size: 24px;
  color: var(--theme-primary-dark);
  text-shadow: 3px 3px 0 var(--theme-shadow), 1px 1px 0 var(--theme-primary-light);
  letter-spacing: 3px;
  margin-top: 10px;
  position: relative;
}
.setup-hero-sub {
  font-size: 14px;
  color: var(--theme-text-dim);
  margin-top: 6px;
  font-weight: 700;
  letter-spacing: 4px;
}
.setup-divider {
  height: 4px;
  margin: 20px 0;
  background: repeating-linear-gradient(
    90deg,
    var(--theme-primary-light) 0px,
    var(--theme-primary-light) 8px,
    transparent 8px,
    transparent 16px
  );
}
.setup-greeting { text-align: center; margin-bottom: 20px; }
.setup-greeting-line {
  font-size: 16px; font-weight: 700;
  color: var(--theme-text);
  line-height: 2;
}
.setup-greeting-line.sub { font-size: 13px; color: var(--theme-text-dim); opacity: 0.7; }
.setup-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700;
  color: var(--theme-text);
  margin-bottom: 8px;
}
.setup-label-icon { font-size: 18px; }
.setup-form-group { margin-bottom: 14px; }

/* setup background */
.setup-backdrop {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; overflow: hidden;
  background: linear-gradient(170deg,
    var(--theme-bg) 0%,
    var(--theme-primary-light) 50%,
    var(--theme-accent-light) 100%
  );
  opacity: 0.3;
}
.setup-backdrop::after {
  content: '';
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--theme-bg);
  opacity: 0.75;
}
.setup-wrapper {
  position: relative; z-index: 1;
  padding: 40px 16px 60px;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.bg-char {
  position: absolute;
  top: -5%;
  font-family: var(--font-pixel);
  color: var(--theme-text);
  pointer-events: none;
  animation: char-fall linear infinite;
}
@keyframes char-fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 0; }
  5% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(105vh) rotate(180deg); opacity: 0; }
}
.bg-star {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--theme-primary);
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
  animation: star-pulse ease-in-out infinite;
}
@keyframes star-pulse {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: 0.5; transform: scale(1); }
}

/* ======== COMPLETE / MODAL ======== */

.complete-icon {
  font-size: 64px;
  text-align: center;
  margin-bottom: 16px;
  animation: complete-bounce 0.6s step-end;
}
@keyframes complete-bounce {
  0% { transform: scale(0.3); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.complete-text {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  line-height: 2;
  margin-bottom: 20px;
}
.complete-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.stats-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.stats-summary-item {
  background: var(--theme-bg);
  border: 2px solid var(--theme-border);
  padding: 12px;
  text-align: center;
}
.stats-summary-item .ss-num {
  font-family: var(--font-pixel);
  font-size: 20px;
  color: var(--theme-accent-dark);
}
.stats-summary-item .ss-label {
  font-size: 12px;
  color: var(--theme-text-dim);
  margin-top: 4px;
}

/* ======== SNAPSHOT RESUME MODAL ======== */

.snapshot-modal {
  text-align: center;
  padding: 32px 28px 28px;
}
.snapshot-deco {
  margin-bottom: 16px;
}
.snapshot-flag {
  width: 48px;
  height: 56px;
  margin: 0 auto 10px;
  position: relative;
  background: var(--theme-accent);
  border: 3px solid var(--theme-accent-dark);
  box-shadow: 3px 3px 0 var(--theme-accent-shadow);
}
.snapshot-flag::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px; height: 3px;
  background: rgba(255,255,255,0.3);
}
.snapshot-flag::after {
  content: '';
  position: absolute;
  bottom: -14px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 14px solid var(--theme-accent);
}
.snapshot-dots {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--theme-border-dark);
  letter-spacing: 4px;
}
.snapshot-title {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  color: var(--theme-primary-dark);
  text-shadow: 2px 2px 0 var(--theme-shadow);
  margin-bottom: 20px;
  letter-spacing: 2px;
}
.snapshot-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 24px;
}
.snapshot-stat {
  background: var(--theme-bg);
  border: 3px solid var(--theme-border);
  padding: 14px 10px;
  box-shadow: 3px 3px 0 var(--theme-shadow);
}
.snapshot-stat-num {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: var(--theme-accent-dark);
  margin-bottom: 6px;
}
.snapshot-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--theme-text-dim);
}

/* ======== OLD MODE INDICATORS (deprecated in HTML, keep for safety) ======== */

#review-view .mode-indicator, #learn-view .mode-indicator, #dictation-view .mode-indicator {
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 6px 14px;
  display: inline-block;
  margin-bottom: 12px;
}
#learn-view .mode-indicator { background: #e8f4e8; color: var(--theme-success-dark); border: 2px solid var(--theme-success); }
#review-view .mode-indicator { background: #fdf0e0; color: var(--theme-warning); border: 2px solid var(--theme-warning); }
#dictation-view .mode-indicator { background: #e8ecf8; color: var(--theme-accent-dark); border: 2px solid var(--theme-accent); }

/* ======== TOP BAR ======== */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--theme-border);
  position: relative;
}
.top-bar::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0; width: 100%; height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--theme-border) 0px, var(--theme-border) 6px,
    transparent 6px, transparent 12px
  );
}

/* ======== MISC ======== */

.setup-form-group { margin-bottom: 16px; }

/* ======== TOAST / ERROR OVERLAY ======== */

#error-overlay {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--theme-danger);
  color: #fff;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  border: 3px solid var(--theme-danger-shadow);
  box-shadow: 5px 5px 0 var(--theme-danger-shadow);
  max-width: 90%;
  text-align: center;
  cursor: pointer;
  animation: error-slide 0.15s step-end;
}
@keyframes error-slide {
  0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ======== RESPONSIVE ======== */

@media (max-width: 480px) {
  .stats-grid { gap: 10px; }
  .word-display { font-size: 28px; }
  .pixel-btn.btn-lg { padding: 14px 28px; font-size: 16px; }
  .title-text { font-size: 18px; }
  .pixel-input { font-size: 16px; }
  .word-box { padding: 20px 14px 14px; }
  .word-meaning { font-size: 16px; }
  .mistake-list-item { align-items: flex-start; }
  .word-list-right {
    flex-direction: column;
    align-items: flex-end;
    max-width: 46%;
  }
  .word-list-actions { align-items: stretch; }
}

/* ======== VERSION BADGE ======== */

.version-badge {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #b0a090;
  z-index: 999;
  pointer-events: none;
  opacity: 0.6;
  background: rgba(255,255,255,0.4);
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.05);
}

.wechat-float {
  position: fixed;
  left: 12px;
  bottom: 60px;
  z-index: 999;
  font-size: 28px;
  opacity: 0.35;
  text-decoration: none;
  transition: opacity 0.15s step-end, transform 0.1s step-end;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.08));
}
.wechat-float:hover { opacity: 0.8; transform: scale(1.15); }

/* ======== SIDEBAR FLOATING ======== */

.sidebar-float {
  position: fixed;
  left: 12px;
  bottom: 108px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 20px;
  opacity: 0.35;
  text-decoration: none;
  transition: opacity 0.15s step-end, transform 0.1s step-end;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.08));
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
}
.sidebar-btn:hover { opacity: 0.8; transform: scale(1.15); }

.wechat-float:hover { opacity: 0.8; transform: scale(1.15); }

.studio-logo {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 998;
  opacity: 0.25;
  transition: opacity 0.2s;
  pointer-events: none;
}
.studio-logo:hover { opacity: 0.6; }
.studio-logo img {
  width: 80px;
  height: auto;
  image-rendering: pixelated;
}

/* ======== THEME SWATCH GRID ======== */

.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px 8px;
  border: 3px solid var(--theme-border);
  background: var(--theme-bg-card);
  cursor: pointer;
  transition: all 0.05s step-end;
  font-family: var(--font-body);
}
.theme-swatch:hover { border-color: var(--theme-accent); transform: translateY(-2px); }
.theme-swatch.theme-active {
  border-color: var(--theme-primary-dark);
  box-shadow: 0 0 0 2px var(--theme-primary-light);
  background: var(--theme-primary-light);
}
.theme-swatch-icon { font-size: 24px; }
.theme-swatch-dots { display: flex; gap: 4px; }
.theme-swatch-dots i {
  display: block; width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.1);
}
.theme-swatch-name {
  font-size: 12px; font-weight: 700;
  color: var(--theme-text);
}

.theme-icon {
  width: 36px;
  height: 36px;
  position: relative;
  display: inline-block;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.theme-icon,
.theme-icon::before,
.theme-icon::after,
.theme-icon span,
.theme-icon span::before,
.theme-icon span::after {
  box-sizing: border-box;
}
.theme-icon::before,
.theme-icon::after,
.theme-icon span,
.theme-icon span::before,
.theme-icon span::after {
  content: '';
  position: absolute;
  display: block;
}

.theme-icon-0::before {
  width: 24px;
  height: 18px;
  left: 6px;
  top: 10px;
  background: #f5d26a;
  border: 3px solid #c99b45;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.12), inset 4px 4px 0 #fff0a8;
}
.theme-icon-0::after {
  width: 8px;
  height: 4px;
  left: 14px;
  top: 15px;
  background: #fff5c8;
}
.theme-icon-0 span {
  width: 4px;
  height: 4px;
  left: 26px;
  top: 6px;
  background: var(--theme-accent);
  box-shadow: -18px 18px 0 var(--theme-primary), 4px 4px 0 #fff5c8;
}

.theme-icon-1::before {
  width: 0;
  height: 0;
  left: 8px;
  top: 3px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 16px solid #5a9b65;
}
.theme-icon-1::after {
  width: 24px;
  height: 12px;
  left: 6px;
  top: 14px;
  background: #78c088;
  border: 3px solid #408050;
}
.theme-icon-1 span {
  width: 8px;
  height: 10px;
  left: 14px;
  top: 24px;
  background: #7b5738;
  border: 2px solid #5c402c;
}

.theme-icon-2::before {
  width: 24px;
  height: 14px;
  left: 5px;
  top: 11px;
  background: #68a8d8;
  border: 3px solid #3870a0;
  box-shadow: inset 4px 3px 0 #a0d0f8;
}
.theme-icon-2::after {
  width: 0;
  height: 0;
  left: 27px;
  top: 12px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid #3870a0;
}
.theme-icon-2 span {
  width: 4px;
  height: 4px;
  left: 11px;
  top: 15px;
  background: #f0f8ff;
  box-shadow: 8px 12px 0 #a0d0f8, 16px 11px 0 #a0d0f8;
}

.theme-icon-3::before {
  width: 18px;
  height: 18px;
  left: 9px;
  top: 8px;
  background: #a088c8;
  transform: rotate(45deg);
  border: 3px solid #685088;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}
.theme-icon-3::after {
  width: 6px;
  height: 18px;
  left: 15px;
  top: 17px;
  background: #68a088;
  border: 2px solid #508070;
}
.theme-icon-3 span {
  width: 4px;
  height: 4px;
  left: 7px;
  top: 6px;
  background: #f8f4fc;
  box-shadow: 21px 4px 0 #f8f4fc, 5px 22px 0 #c8b0e8;
}

.theme-icon-4::before {
  width: 18px;
  height: 18px;
  left: 9px;
  top: 5px;
  background: #e8c060;
  border: 3px solid #c06a40;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.12);
}
.theme-icon-4::after {
  width: 30px;
  height: 11px;
  left: 3px;
  top: 22px;
  background: repeating-linear-gradient(90deg, #c06a40 0 6px, #60b0c8 6px 12px);
  border: 3px solid #a05030;
}
.theme-icon-4 span {
  width: 6px;
  height: 3px;
  left: 7px;
  top: 15px;
  background: #fff5ec;
  box-shadow: 16px 0 0 #fff5ec;
}

.theme-icon-5::before {
  width: 20px;
  height: 20px;
  left: 10px;
  top: 5px;
  background: #e0c060;
  border: 3px solid #c0a040;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.18);
}
.theme-icon-5::after {
  width: 18px;
  height: 22px;
  left: 17px;
  top: 2px;
  background: #343440;
  border-left: 3px solid #343440;
}
.theme-icon-5 span {
  width: 4px;
  height: 4px;
  left: 5px;
  top: 8px;
  background: #a0e0e8;
  box-shadow: 2px 17px 0 #c0b0f0, 24px 20px 0 #a0e0e8, 17px 3px 0 #c0b0f0;
}

.theme-icon-6::before {
  width: 8px;
  height: 8px;
  left: 14px;
  top: 14px;
  background: #f8e8ec;
  border: 2px solid #c05868;
}
.theme-icon-6::after {
  width: 10px;
  height: 10px;
  left: 7px;
  top: 9px;
  background: #e08898;
  box-shadow: 14px 0 0 #e08898, 7px -6px 0 #f0b8c0, 7px 8px 0 #c06878;
}
.theme-icon-6 span {
  width: 6px;
  height: 14px;
  left: 16px;
  top: 22px;
  background: #68a878;
  border: 2px solid #508860;
}

.theme-icon-7::before {
  width: 30px;
  height: 12px;
  left: 3px;
  top: 21px;
  background: repeating-linear-gradient(90deg, #e0c890 0 6px, #c8a058 6px 12px);
  border: 3px solid #886028;
}
.theme-icon-7::after {
  width: 8px;
  height: 22px;
  left: 13px;
  top: 4px;
  background: #58a058;
  border: 2px solid #408040;
}
.theme-icon-7 span {
  width: 8px;
  height: 4px;
  left: 19px;
  top: 12px;
  background: #58a058;
  border: 2px solid #408040;
  box-shadow: -13px 6px 0 #58a058;
}

.theme-icon-8::before {
  width: 12px;
  height: 20px;
  left: 9px;
  top: 7px;
  background: #60c098;
  border: 3px solid #308060;
  transform: skew(-18deg);
  box-shadow: 12px 5px 0 #90e0c0;
}
.theme-icon-8::after {
  width: 4px;
  height: 22px;
  left: 16px;
  top: 13px;
  background: #40a078;
}
.theme-icon-8 span {
  width: 4px;
  height: 4px;
  left: 27px;
  top: 7px;
  background: #c8b8e8;
  box-shadow: -20px 21px 0 #90e0c0;
}

.theme-icon-9::before {
  width: 24px;
  height: 18px;
  left: 6px;
  top: 12px;
  background: #909098;
  border: 3px solid #585860;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.16), inset 5px 4px 0 #b0b0b8;
  transform: skew(-10deg);
}
.theme-icon-9::after {
  width: 8px;
  height: 8px;
  left: 20px;
  top: 6px;
  background: #7890a8;
  border: 2px solid #405870;
  transform: rotate(45deg);
}
.theme-icon-9 span {
  width: 5px;
  height: 5px;
  left: 10px;
  top: 17px;
  background: #d8b868;
  box-shadow: 16px 7px 0 #707078;
}

/* ======== THEME SCENE DECORATIONS ======== */

.theme-scene {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}

.scene-item {
  position: absolute;
  font-size: 20px;
  opacity: 0.5;
  animation: scene-drift 8s ease-in-out infinite;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.08));
}
.scene-item:nth-child(odd) { animation-duration: 10s; animation-delay: -3s; }
.scene-item:nth-child(3n) { animation-duration: 12s; animation-delay: -5s; }

@keyframes scene-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-8px) rotate(2deg); }
  50% { transform: translateY(4px) rotate(-2deg); }
  75% { transform: translateY(-4px) rotate(1deg); }
}

.scene-item.static { animation: none; }

/* ======== SPEAKER INLINE ======== */

.word-display-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.word-level-badge {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-accent-dark);
  background: var(--theme-accent-light);
  border: 2px solid var(--theme-accent);
  padding: 2px 7px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  white-space: nowrap;
}
.word-level-badge.mastered {
  color: var(--theme-success-dark);
  background: #d8f0d8;
  border-color: var(--theme-success);
}

.speaker-inline {
  display: inline-block;
  font-size: 28px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s step-end;
  flex-shrink: 0;
}
.speaker-inline:hover { transform: scale(1.1); }
.speaker-inline:active { transform: scale(1.2); }

.book-index {
  position: absolute;
  top: 6px;
  left: 8px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-text-dim);
  background: var(--theme-bg);
  border: 1px solid var(--theme-border);
  padding: 2px 6px;
  letter-spacing: 0.3px;
}

.word-state-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-accent-dark);
  background: var(--theme-accent-light);
  border: 2px solid var(--theme-accent);
  padding: 2px 7px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  z-index: 2;
}
.word-state-badge.badge-review {
  color: var(--theme-primary-dark);
  background: var(--theme-primary-light);
  border-color: var(--theme-primary);
}

.eye-toggle-inline {
  display: inline-block;
  font-size: 22px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s step-end;
  flex-shrink: 0;
}
.eye-toggle-inline:hover { transform: scale(1.15); }

.skip-master-btn {
  position: absolute;
  bottom: 6px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-family: var(--font-pixel);
  font-size: 16px;
  color: var(--theme-success-dark);
  background: var(--theme-success);
  border: 2px solid var(--theme-success-shadow);
  border-bottom-width: 4px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  padding: 0;
  line-height: 1;
  opacity: 0.8;
  transition: transform 0.08s step-end, opacity 0.15s, border-bottom-width 0.08s step-end, background 0.08s step-end;
}
.skip-master-btn:hover {
  opacity: 1;
  transform: scale(1.08);
}
.skip-master-btn:active,
.skip-master-btn.pressed {
  border-bottom-width: 2px;
  transform: translateY(2px);
  opacity: 1;
  background: var(--theme-success-shadow);
}

/* ======== DEV PANEL ======== */

#dev-toggle-btn {
  position: fixed;
  bottom: 8px;
  left: 12px;
  z-index: 9990;
  background: var(--theme-bg-card);
  border: 2px solid var(--theme-border-dark);
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--theme-text-dim);
  cursor: pointer;
  padding: 4px 10px;
  opacity: 0.5;
  transition: opacity 0.1s step-end;
}
#dev-toggle-btn:hover { opacity: 0.9; }

#dev-panel {
  position: fixed;
  top: 0; right: 0;
  width: 260px;
  height: 100%;
  background: rgba(40,36,30,0.92);
  border-left: 3px solid var(--theme-border-dark);
  z-index: 9980;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: #d8d4c8;
  font-size: 11px;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.15s step-end;
}
#dev-panel.open {
  transform: translateX(0);
}
#dev-panel-header {
  padding: 10px 12px;
  border-bottom: 2px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#dev-panel-title {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: #a0d0f0;
}
#dev-panel-close {
  background: none; border: 1px solid rgba(255,255,255,0.2);
  color: #c0b8a8; cursor: pointer;
  font-size: 14px; padding: 0 6px; line-height: 1;
}
#dev-queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.dev-queue-item {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: grab;
  user-select: none;
  transition: background 0.05s;
  gap: 8px;
}
.dev-queue-item:hover { background: rgba(255,255,255,0.06); }
.dev-queue-item.current { background: rgba(160,200,240,0.2); border-left: 3px solid #a0d0f0; }
.dev-queue-item.dragging { opacity: 0.5; background: rgba(255,255,255,0.12); }
.dev-queue-item.drag-over { background: rgba(160,200,240,0.25); outline: 1px dashed #a0d0f0; }
.dev-queue-item .dq-idx {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: #807870;
  width: 22px;
  flex-shrink: 0;
}
.dev-queue-item .dq-word {
  font-family: var(--font-word);
  font-size: 12px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-queue-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 0;
  font-weight: 700;
  flex-shrink: 0;
}
.dev-queue-badge.state-learn { background: #3a6b3a; color: #a0e0a0; }
.dev-queue-badge.state-review { background: #6b5a3a; color: #e0c080; }
.dev-queue-badge.state-dictation { background: #3a4a6b; color: #a0c0e0; }

/* ======== LEARN SETTINGS PANEL ======== */

.learn-settings-info {
  font-size: 13px;
  line-height: 1.8;
  color: var(--theme-text-dim);
  padding: 8px 4px;
}

.learn-settings-info strong {
  color: var(--theme-text);
}

/* ======== UI POLISH PASS ======== */

.pixel-btn,
.top-bar .top-title,
.title-text,
.snapshot-title,
.progress-info,
.word-level-badge,
.word-state-badge,
.book-index,
.chapter-select-dropdown,
.version-badge {
  letter-spacing: 0;
}

.modal {
  background:
    radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px),
    rgba(40,30,20,0.58);
  background-size: 12px 12px, auto;
  backdrop-filter: blur(1px);
}

.modal-content,
.help-modal-content,
.pixel-card,
.setup-card {
  box-shadow:
    6px 6px 0 var(--theme-shadow),
    0 0 0 1px rgba(255,255,255,0.24),
    inset 0 0 0 2px var(--theme-bg-card),
    inset 0 0 0 4px var(--theme-border);
}

.modal-content::before,
.help-modal-content::before,
.pixel-card::before,
.setup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10px;
  right: 10px;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--theme-primary-light) 0,
    var(--theme-primary-light) 8px,
    var(--theme-accent-light) 8px,
    var(--theme-accent-light) 16px
  );
  opacity: 0.8;
  pointer-events: none;
}

.modal-content,
.help-modal-content,
.setup-card {
  position: relative;
}

.pixel-card {
  position: relative;
}

.pixel-btn {
  box-shadow: 0 2px 0 rgba(255,255,255,0.22) inset;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.12);
}

.pixel-btn:focus-visible,
.top-bar .back-btn:focus-visible,
.qs-btn:focus-visible,
.chapter-select-dropdown:focus-visible,
.pixel-input:focus-visible,
.theme-swatch:focus-visible {
  outline: 3px solid var(--theme-accent);
  outline-offset: 3px;
}

#dashboard-start-btn {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), transparent 55%),
    var(--theme-primary);
  min-height: 64px;
}

#dashboard-start-btn:hover {
  box-shadow:
    5px 8px 0 var(--theme-primary-shadow),
    0 0 0 4px rgba(126, 184, 216, 0.14);
}

.stats-grid {
  gap: 16px;
}

.stat-card {
  min-height: 136px;
  padding: 18px 14px 16px;
  box-shadow:
    4px 4px 0 var(--theme-shadow),
    inset 0 0 0 2px var(--theme-bg-card),
    inset 0 0 0 4px rgba(255,255,255,0.22);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dotted rgba(0,0,0,0.06);
  pointer-events: none;
}

.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  background: var(--theme-bg);
  border: 2px solid var(--theme-border);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.05);
  font-size: 23px;
}

.stat-card.card-new .stat-icon {
  background: var(--theme-bg);
}

.stat-card .stat-num {
  line-height: 1.25;
}

.stat-card .stat-label {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255,255,255,0.36);
  border: 1px solid rgba(0,0,0,0.04);
  line-height: 1.35;
}

.card-new { border-color: var(--theme-primary-shadow); }
.card-review { border-color: var(--theme-warning-dark); }
.card-done { border-color: var(--theme-success-shadow); }
.card-mastered { border-color: var(--theme-success-dark); }

.card-mistakes {
  border-color: var(--theme-danger-shadow);
  background:
    linear-gradient(180deg, rgba(232,138,138,0.08), transparent 45%),
    var(--theme-bg-card);
}

.mistake-word-row,
.mistake-count-badge {
  border-width: 2px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.04);
}

.progress-bar-wrap,
.learn-progress-bar-wrap {
  box-shadow:
    inset 2px 2px 0 rgba(0,0,0,0.08),
    2px 2px 0 rgba(0,0,0,0.04);
}

.progress-text {
  padding: 5px 8px 0;
}

.chapter-select-card {
  padding: 16px 18px 18px;
  border-color: var(--theme-primary-shadow);
  background:
    linear-gradient(180deg, rgba(240,168,120,0.06), transparent 50%),
    var(--theme-bg-card);
}

.chapter-select-label {
  color: var(--theme-text);
}

.chapter-select-dropdown {
  min-height: 44px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), transparent 60%),
    var(--theme-bg-card);
}

.chapter-word-count {
  padding: 4px 6px;
  border: 1px solid var(--theme-border);
  background: rgba(255,255,255,0.34);
}

.learn-stats {
  border: 3px solid var(--theme-border-dark);
  box-shadow: 4px 4px 0 var(--theme-shadow);
  padding: 10px 14px;
}

.learn-stat-row {
  padding: 3px 0;
  border-bottom: 1px dotted var(--theme-border);
}

.learn-stat-row:last-child {
  border-bottom: 0;
}

.learn-timer {
  border: 3px solid var(--theme-border);
  box-shadow: 2px 2px 0 var(--theme-shadow);
}

.word-box {
  min-height: 184px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.34), transparent 55%),
    var(--theme-bg-card);
}

.word-box::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--theme-border) 0,
    var(--theme-border) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.45;
  pointer-events: none;
}

.word-display {
  margin-top: 18px;
}

.word-meaning,
.word-placeholder-sm {
  max-width: 100%;
}

.speaker-inline,
.eye-toggle-inline {
  padding: 3px 5px;
  border: 1px solid transparent;
}

.speaker-inline:hover,
.eye-toggle-inline:hover {
  background: var(--theme-bg);
  border-color: var(--theme-border);
}

.book-index,
.word-state-badge,
.word-level-badge,
.wl-level,
.wl-mistakes,
.pct-badge {
  box-shadow: 1px 1px 0 rgba(0,0,0,0.06);
}

.skip-master-btn {
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.08);
}

.pixel-input {
  box-shadow:
    inset 3px 3px 0 rgba(0,0,0,0.06),
    inset -2px -2px 0 rgba(255,255,255,0.45),
    2px 2px 0 rgba(0,0,0,0.04);
}

#learn-input.pixel-input {
  min-height: 82px;
  border-color: var(--theme-accent);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 60%),
    var(--theme-bg-card);
}

.hint-row {
  min-height: 38px;
}

.hint-key {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), transparent 55%),
    var(--theme-bg);
  border-width: 3px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.top-bar {
  max-width: 608px;
  margin-left: auto;
  margin-right: auto;
}

.top-bar .back-btn,
.qs-btn {
  box-shadow: 2px 2px 0 var(--theme-shadow);
}

.quick-settings {
  padding: 2px;
  background: rgba(255,255,255,0.22);
  border: 1px solid var(--theme-border);
}

.qs-btn {
  min-width: 30px;
  height: 28px;
}

.settings-panel,
.learn-settings-panel {
  padding-top: 34px;
}

.settings-section {
  margin-bottom: 8px;
}

.settings-section-hd {
  border-width: 3px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.24), transparent 60%),
    var(--theme-bg-card);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.04);
}

.settings-section-bd {
  background:
    radial-gradient(circle, rgba(255,255,255,0.24) 1px, transparent 1px),
    rgba(255,255,255,0.18);
  background-size: 12px 12px, auto;
}

.settings-field {
  padding: 6px 0;
}

.settings-toggle {
  padding: 8px 10px;
  border: 2px solid var(--theme-border);
  background: rgba(255,255,255,0.28);
}

.settings-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--theme-accent);
}

.theme-swatch {
  min-height: 92px;
}

.theme-swatch.theme-active {
  box-shadow:
    3px 3px 0 var(--theme-shadow),
    0 0 0 2px var(--theme-primary-light);
}

.word-list {
  border: 2px solid var(--theme-border);
  background: rgba(255,255,255,0.18);
}

.word-list-item {
  min-height: 58px;
  background: rgba(255,255,255,0.12);
}

.word-list-item:nth-child(even) {
  background: rgba(255,255,255,0.24);
}

.word-list-item:hover {
  background: rgba(126,184,216,0.12);
}

.word-list-actions {
  padding: 8px;
  border: 2px solid var(--theme-border);
  background: var(--theme-bg);
}

.complete-actions {
  margin-top: 18px;
}

.stats-summary-item,
.snapshot-stat {
  box-shadow: 2px 2px 0 var(--theme-shadow);
}

.sidebar-btn,
.wechat-float,
#dev-toggle-btn,
.version-badge {
  opacity: 0.42;
}

@media (max-width: 480px) {
  #app {
    padding-left: 12px;
    padding-right: 12px;
  }

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

  .stat-card {
    min-height: 124px;
    padding: 14px 8px 12px;
  }

  .stat-card .stat-num {
    font-size: 22px;
  }

  .chapter-select-row {
    flex-direction: column;
    align-items: stretch;
  }

  .chapter-word-count {
    align-self: flex-end;
  }

  .quick-settings {
    gap: 2px;
  }

  .qs-btn {
    min-width: 26px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .learn-stats,
  .learn-progress-bar-wrap,
  .word-box,
  .learn-input-full {
    max-width: 100%;
  }

  .settings-toggle {
    align-items: flex-start;
  }
}

/* ======== SILKY MOTION PASS ======== */

.view.view-enter {
  animation: pv-view-enter 520ms var(--motion-silk) both;
  transform-origin: 50% 18%;
}

@keyframes pv-view-enter {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(6px);
  }
  55% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.modal:not(.hidden) {
  animation: pv-modal-fade 260ms ease-out both;
}

.modal-content,
.help-modal-content {
  animation: pv-modal-rise 460ms var(--motion-pop) both;
  transform-origin: 50% 46%;
}

@keyframes pv-modal-fade {
  from { opacity: 0; backdrop-filter: blur(0); }
  to { opacity: 1; backdrop-filter: blur(3px); }
}

@keyframes pv-modal-rise {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.94);
    filter: blur(8px);
  }
  62% {
    opacity: 1;
    transform: translateY(-2px) scale(1.008);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.pixel-btn,
.top-bar .back-btn,
.qs-btn,
.theme-swatch,
.stat-card,
.pixel-card,
.word-list-item,
.settings-section-hd,
.chapter-select-dropdown,
.pixel-input,
.sidebar-btn,
.wechat-float {
  transition-duration: 220ms;
  transition-timing-function: var(--motion-silk);
}

.pixel-btn {
  transition-property: transform, box-shadow, background, border-bottom-width, filter;
  will-change: transform;
}

.pixel-btn:hover {
  transform: translateY(-2px);
  filter: saturate(1.04);
}

.pixel-btn:active {
  transform: translateY(2px) scale(0.985);
}

.stat-card,
.pixel-card,
.theme-swatch,
.word-list-item,
.settings-section-hd {
  transition-property: transform, box-shadow, background, border-color, opacity;
  will-change: transform;
}

.stat-card:hover,
.pixel-card:hover,
.theme-swatch:hover {
  transform: translateY(-4px) scale(1.012);
}

.view-enter .stat-card,
.view-enter .pixel-card,
.view-enter .chapter-select-card,
.view-enter .learn-stats,
.view-enter .learn-progress-bar-wrap,
.view-enter .word-box,
.view-enter .setup-card {
  animation: pv-rise-chain 560ms var(--motion-silk) both;
}

.view-enter .stat-card:nth-child(1) { animation-delay: 40ms; }
.view-enter .stat-card:nth-child(2) { animation-delay: 90ms; }
.view-enter .stat-card:nth-child(3) { animation-delay: 140ms; }
.view-enter .stat-card:nth-child(4) { animation-delay: 190ms; }
.view-enter .pixel-card { animation-delay: 210ms; }
.view-enter .chapter-select-card { animation-delay: 260ms; }

@keyframes pv-rise-chain {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.learn-progress-bar-fill,
.progress-bar-fill {
  transition: width 700ms var(--motion-silk);
}

.word-box {
  transform-origin: 50% 42%;
  will-change: transform, opacity, filter;
}

.word-box.word-card-enter {
  animation: pv-word-enter 460ms var(--motion-pop) both;
}

.word-box.word-card-correct {
  animation: pv-word-correct 520ms var(--motion-snappy) both;
}

.word-box.word-card-wrong {
  animation: pv-word-wrong 430ms var(--motion-silk) both;
}

.word-box.word-card-enter .word-display,
.word-box.word-card-enter .word-meaning,
.word-box.word-card-enter .word-placeholder-lg,
.word-box.word-card-enter .word-placeholder-sm {
  animation: pv-word-content 520ms var(--motion-silk) both;
}

.word-box.word-card-enter .word-meaning,
.word-box.word-card-enter .word-placeholder-sm {
  animation-delay: 65ms;
}

@keyframes pv-word-enter {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.965);
    filter: blur(7px);
  }
  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.006);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes pv-word-content {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pv-word-correct {
  0% { transform: scale(1); }
  38% {
    transform: translateY(-5px) scale(1.018);
    box-shadow:
      5px 8px 0 var(--theme-shadow),
      0 0 0 5px rgba(140,207,142,0.18);
  }
  100% { transform: translateY(0) scale(1); }
}

@keyframes pv-word-wrong {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  36% { transform: translateX(6px); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(3px); }
}

.pixel-input.correct {
  animation: pv-input-correct 520ms var(--motion-snappy);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 260ms var(--motion-silk);
}

.pixel-input.wrong {
  animation: pv-input-wrong 430ms var(--motion-silk);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 260ms var(--motion-silk);
}

@keyframes pv-input-correct {
  0% { transform: scale(1); }
  42% { transform: scale(1.012); box-shadow: 0 0 0 5px rgba(140,207,142,0.16), inset 3px 3px 0 rgba(0,0,0,0.06); }
  100% { transform: scale(1); }
}

@keyframes pv-input-wrong {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.hint-row.hint-row-enter {
  animation: pv-hint-enter 360ms var(--motion-silk) both;
}

@keyframes pv-hint-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.complete-icon {
  animation: pv-complete-pop 760ms var(--motion-snappy) both;
}

@keyframes pv-complete-pop {
  0% { opacity: 0; transform: translateY(20px) scale(0.4) rotate(-8deg); }
  58% { opacity: 1; transform: translateY(-5px) scale(1.12) rotate(3deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

.settings-section-bd:not(.collapsed) {
  animation: pv-section-open 300ms var(--motion-silk) both;
  transform-origin: 50% 0;
}

@keyframes pv-section-open {
  from {
    opacity: 0;
    transform: translateY(-8px) scaleY(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
