/* ===== 基础重置与布局 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --error: #ef4444;
  --error-bg: #fee2e2;
  --warning: #f59e0b;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --app-width: 390px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 16px;
  color: var(--text);
}

/* ===== APP 容器（手机模拟） ===== */
.app-container {
  width: 100%;
  max-width: var(--app-width);
  background: var(--bg);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  min-height: 680px;
  position: relative;
}

.view {
  display: none;
  flex-direction: column;
  min-height: 680px;
  padding: 0 20px 28px;
}

.view.active {
  display: flex;
}

/* ===== 头部 ===== */
.app-header {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 20px 16px 18px;
  margin: 0 -20px 20px;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ===== 状态栏 ===== */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

#accuracy-text {
  font-weight: 600;
  color: var(--primary);
}

/* ===== 单词卡片 ===== */
.word-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0 0 20px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.word-card.correct-flash {
  animation: cardSuccess 0.5s ease;
}

@keyframes cardSuccess {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.03); box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3); }
  100% { transform: scale(1); }
}

.scene-image-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  overflow: hidden;
}

.scene-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scene-image-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 0.95rem;
  color: var(--primary-dark);
  font-weight: 600;
  text-align: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.card-check {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 40px;
  height: 40px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: bold;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-check.show {
  opacity: 1;
  transform: scale(1);
}

.word-en {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  margin: 16px 20px 6px;
  line-height: 1.2;
}

.word-phonetic {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-style: italic;
}

.speak-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  margin-bottom: 14px;
}

.btn-speak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-speak-example {
  background: #0ea5e9;
}

.btn-speak-example:hover {
  background: #0284c7;
}

.btn-speak:hover {
  background: var(--primary-dark);
}

.btn-speak:active {
  transform: scale(0.96);
}

.btn-speak.speaking {
  animation: pulse 0.8s infinite;
}

.btn-speak.speaking:not(.btn-speak-example) {
  background: var(--primary-light);
}

.btn-speak-example.speaking {
  background: #38bdf8;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

.example-block {
  margin: 0 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border-left: 3px solid var(--primary-light);
  text-align: left;
}

.example-en {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 6px;
}

.example-en mark {
  background: #fef08a;
  color: var(--primary-dark);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
  font-style: normal;
}

.example-cn {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== 选项区 ===== */
.options-area {
  flex: 1;
}

.options-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 12px;
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  line-height: 1.4;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  background: #f5f3ff;
}

.option-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.option-btn:disabled {
  cursor: not-allowed;
}

.option-btn.correct {
  background: var(--success-bg);
  border-color: var(--success);
  color: #15803d;
  font-weight: 600;
}

.option-btn.wrong {
  background: var(--error-bg);
  border-color: var(--error);
  color: #b91c1c;
  animation: shake 0.4s ease;
}

.option-btn.hint-flash {
  animation: hintFlash 0.6s ease 3;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes hintFlash {
  0%, 100% { border-color: var(--success); background: var(--success-bg); }
  50%       { border-color: var(--border); background: var(--card-bg); }
}

/* ===== 操作按钮 ===== */
.action-row {
  margin-top: 20px;
  text-align: center;
}

.btn-hint {
  background: transparent;
  border: 1.5px dashed var(--warning);
  color: var(--warning);
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-hint:hover {
  background: #fffbeb;
}

.btn-hint:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== 学习报告 ===== */
.report-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 24px 32px;
  text-align: center;
  box-shadow: var(--shadow);
  margin: 20px 0 32px;
}

.report-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.report-card h2 {
  font-size: 1.25rem;
  color: var(--text);
  margin-bottom: 28px;
}

.report-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.stat-correct .stat-num { color: var(--success); }
.stat-wrong .stat-num   { color: var(--error); }

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-divider {
  width: 1px;
  height: 56px;
  background: var(--border);
}

.report-accuracy {
  font-size: 1rem;
  color: var(--primary);
  font-weight: 600;
}

.report-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: #f5f3ff;
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== 响应式 ===== */
@media (max-width: 420px) {
  body {
    padding: 0;
    align-items: stretch;
  }

  .app-container {
    border-radius: 0;
    min-height: 100vh;
    max-width: 100%;
  }

  .view {
    min-height: 100vh;
  }
}
