/* ===== 词汇闪卡样式 ===== */

/* 页面背景 */
#page-flashcard {
  background: linear-gradient(160deg, #f0f4ff 0%, #e8eeff 30%, #f6f0ff 70%, #fef6f0 100%);
  position: relative;
  overflow: hidden;
}

/* 顶部导航栏 */
.fc-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 0.5px solid rgba(0,0,0,0.06);
}

.fc-back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.05);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.fc-back-btn:active {
  background: rgba(0,0,0,0.1);
  transform: scale(0.92);
}

.fc-header-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink, #111827);
  letter-spacing: -0.2px;
}

.fc-header-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted, #6b7280);
  min-width: 60px;
  text-align: right;
}

/* 进度条 */
.fc-progress-bar {
  height: 3px;
  background: rgba(0,0,0,0.04);
  position: relative;
  overflow: hidden;
}

.fc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a78bfa);
  border-radius: 0 2px 2px 0;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
}

/* 主内容区 */
.fc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 12px;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

/* ===== 3D 卡片容器 ===== */
.fc-card-container {
  width: 100%;
  max-width: 360px;
  height: 420px;
  perspective: 1200px;
  position: relative;
}

/* 卡片翻转包装 */
.fc-card-flipper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
  cursor: pointer;
}

.fc-card-flipper.is-flipped {
  transform: rotateY(180deg);
}

/* 滑动手势位移（不带动画） */
.fc-card-flipper.is-dragging {
  transition: none;
}

/* 飞出动画 */
.fc-card-flipper.swipe-out-left {
  animation: swipeOutLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.fc-card-flipper.swipe-out-right {
  animation: swipeOutRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes swipeOutLeft {
  to { transform: translateX(-120vw) rotate(-25deg); opacity: 0; }
}
@keyframes swipeOutRight {
  to { transform: translateX(120vw) rotate(25deg); opacity: 0; }
}

/* 新卡片入场 — 不用 forwards，由 JS 在 animationend 后移除类 */
.fc-card-flipper.card-enter {
  animation: cardEnter 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardEnter {
  from {
    transform: translateY(50px) scale(0.94);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* 卡片正面和背面 */
.fc-card-front,
.fc-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 24px;
  overflow: hidden;
}

/* ===== 卡片正面 ===== */
.fc-card-front {
  background: #ffffff;
  box-shadow:
    0 2px 8px rgba(99, 102, 241, 0.06),
    0 12px 40px rgba(99, 102, 241, 0.1),
    0 0 0 0.5px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
}

/* 正面标签行 */
.fc-front-tags {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fc-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.fc-tag-type {
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  color: #6366f1;
}

.fc-tag-pos {
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  color: #3b82f6;
}

.fc-tag-sentiment-pos {
  background: linear-gradient(135deg, #dcfce7, #d1fae5);
  color: #16a34a;
}

.fc-tag-sentiment-neg {
  background: linear-gradient(135deg, #fee2e2, #fce7f3);
  color: #dc2626;
}

.fc-tag-sentiment-neutral {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  color: #6b7280;
}

.fc-tag-freq {
  background: linear-gradient(135deg, #fef3c7, #fef9c3);
  color: #d97706;
  margin-left: auto;
}

/* 正面词语 */
.fc-front-word {
  font-size: 42px;
  font-weight: 700;
  color: var(--ink, #111827);
  letter-spacing: 6px;
  text-align: center;
  line-height: 1.3;
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 正面底部提示 */
.fc-front-hint {
  position: absolute;
  bottom: 28px;
  font-size: 13px;
  color: var(--text-muted, #9ca3af);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.fc-front-hint svg {
  opacity: 0.5;
}

/* ===== 卡片背面 ===== */
.fc-card-back {
  background: #ffffff;
  box-shadow:
    0 2px 8px rgba(99, 102, 241, 0.06),
    0 12px 40px rgba(99, 102, 241, 0.1),
    0 0 0 0.5px rgba(0,0,0,0.04);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 背面词语小标题 */
.fc-back-word-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.fc-back-word {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #111827);
}

.fc-back-tags {
  display: flex;
  gap: 6px;
}

/* 释义区 */
.fc-section {
  margin-bottom: 14px;
}

.fc-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #6366f1;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fc-section-label::before {
  content: '';
  width: 3px;
  height: 12px;
  background: linear-gradient(180deg, #6366f1, #a78bfa);
  border-radius: 2px;
}

.fc-definition {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink, #111827);
  padding: 10px 14px;
  background: linear-gradient(135deg, #f8faff, #f5f3ff);
  border-radius: 12px;
  margin-bottom: 6px;
  border-left: 3px solid #c7d2fe;
}

.fc-definition-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #6366f1;
  color: white;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* 例句区 */
.fc-example {
  font-size: 13px;
  line-height: 1.7;
  color: #4b5563;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border-radius: 12px;
  margin-bottom: 6px;
  position: relative;
  border-left: 3px solid #fbbf24;
}

.fc-example::before {
  content: '"';
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 28px;
  color: #fbbf24;
  opacity: 0.4;
  font-family: Georgia, serif;
  line-height: 1;
}

.fc-example-text {
  padding-left: 16px;
}

/* 关联词区 */
.fc-related-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fc-related-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #059669;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(5, 150, 105, 0.12);
}

/* 用法说明 */
.fc-usage-note {
  font-size: 13px;
  color: var(--muted, #6b7280);
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fc-usage-note::before {
  content: '💡';
  font-size: 14px;
}

/* ===== 滑动指示器 ===== */
.fc-swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 20;
}

.fc-indicator-icon {
  font-size: 18px;
}

.fc-swipe-indicator.left {
  right: 16px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1.5px solid rgba(239, 68, 68, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.fc-swipe-indicator.right {
  left: 16px;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1.5px solid rgba(34, 197, 94, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ===== 底部操作栏 ===== */
.fc-actions {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 32px;
  padding: 12px 24px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%;
}

.fc-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

.fc-action-btn:active {
  transform: scale(0.88);
}

/* 左右按钮 — 大圆形 */
.fc-btn-unknown .fc-action-btn-circle,
.fc-btn-known .fc-action-btn-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
}

.fc-btn-unknown .fc-action-btn-circle {
  background: #ffffff;
  border: 2px solid rgba(239, 68, 68, 0.18);
  color: #ef4444;
  box-shadow:
    0 2px 8px rgba(239, 68, 68, 0.08),
    0 8px 24px rgba(239, 68, 68, 0.06);
}

.fc-btn-unknown:hover .fc-action-btn-circle {
  transform: scale(1.06);
  box-shadow:
    0 4px 12px rgba(239, 68, 68, 0.12),
    0 12px 32px rgba(239, 68, 68, 0.08);
  background: linear-gradient(135deg, #fff5f5, #ffe4e6);
}

.fc-btn-known .fc-action-btn-circle {
  background: #ffffff;
  border: 2px solid rgba(34, 197, 94, 0.18);
  color: #22c55e;
  box-shadow:
    0 2px 8px rgba(34, 197, 94, 0.08),
    0 8px 24px rgba(34, 197, 94, 0.06);
}

.fc-btn-known:hover .fc-action-btn-circle {
  transform: scale(1.06);
  box-shadow:
    0 4px 12px rgba(34, 197, 94, 0.12),
    0 12px 32px rgba(34, 197, 94, 0.08);
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

/* 中间翻转按钮 — 小圆形 */
.fc-btn-flip .fc-action-btn-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 2px solid rgba(99, 102, 241, 0.15);
  color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s;
}

.fc-btn-flip:hover .fc-action-btn-circle {
  transform: scale(1.08) rotate(20deg);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

.fc-action-label {
  font-size: 11px;
  font-weight: 500;
  margin-top: 8px;
  color: var(--muted, #6b7280);
  letter-spacing: 0.2px;
}

.fc-btn-unknown .fc-action-label { color: #f87171; }
.fc-btn-known .fc-action-label { color: #4ade80; }

/* ===== 完成页面 ===== */
.fc-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  text-align: center;
  animation: liftIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.fc-done-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: doneBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

@keyframes doneBounce {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.fc-done-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink, #111827);
  margin-bottom: 8px;
}

.fc-done-subtitle {
  font-size: 14px;
  color: var(--muted, #6b7280);
  margin-bottom: 32px;
}

/* 统计卡片 */
.fc-stats-card {
  width: 100%;
  max-width: 320px;
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  margin-bottom: 32px;
}

.fc-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.fc-stat-item {
  text-align: center;
}

.fc-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink, #111827);
  line-height: 1.2;
}

.fc-stat-value.text-green { color: #22c55e; }
.fc-stat-value.text-red { color: #ef4444; }
.fc-stat-value.text-purple { color: #6366f1; }

.fc-stat-label {
  font-size: 12px;
  color: var(--muted, #6b7280);
  margin-top: 4px;
}

/* 正确率圆环 */
.fc-accuracy-ring {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  position: relative;
}

.fc-accuracy-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.fc-accuracy-ring .ring-bg {
  fill: none;
  stroke: #f3f4f6;
  stroke-width: 8;
}

.fc-accuracy-ring .ring-fill {
  fill: none;
  stroke: url(#accuracyGradient);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fc-accuracy-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink, #111827);
}

/* 完成页面按钮 */
.fc-done-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.fc-done-btn {
  width: 100%;
  padding: 14px 24px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.fc-done-btn:active {
  transform: scale(0.97);
}

.fc-done-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.fc-done-btn-secondary {
  background: #f3f4f6;
  color: var(--ink, #111827);
}

/* ===== 加载态 ===== */
.fc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
}

.fc-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fc-loading-text {
  font-size: 14px;
  color: var(--muted, #6b7280);
}

/* ===== 空状态 ===== */
.fc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  text-align: center;
  padding: 40px;
}

.fc-empty-icon {
  font-size: 48px;
}

.fc-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink, #111827);
}

.fc-empty-desc {
  font-size: 14px;
  color: var(--muted, #6b7280);
  line-height: 1.6;
}

/* ===== 触摸反馈层 ===== */
.fc-touch-feedback {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 24px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s;
}

.fc-touch-feedback.left {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), transparent 40%);
  opacity: 1;
}

.fc-touch-feedback.right {
  background: linear-gradient(-90deg, rgba(34, 197, 94, 0.1), transparent 40%);
  opacity: 1;
}

/* ===== 不认识的词入口 ===== */
.fc-unknown-entry {
  display: flex;
  justify-content: center;
  padding: 0 20px;
  margin-bottom: -4px;
}

.fc-unknown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid rgba(239, 68, 68, 0.15);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ef4444;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.fc-unknown-btn:active {
  transform: scale(0.95);
  background: rgba(239, 68, 68, 0.08);
}

.fc-unknown-btn svg {
  opacity: 0.7;
}

/* ===== 减少动画 ===== */
@media (prefers-reduced-motion: reduce) {
  .fc-card-flipper {
    transition-duration: 0.01ms;
  }
  .fc-card-flipper.card-enter {
    animation: none;
  }
  .fc-card-flipper.swipe-out-left,
  .fc-card-flipper.swipe-out-right {
    animation-duration: 0.01ms;
  }
  .fc-done {
    animation: none;
  }
  .fc-done-icon {
    animation: none;
  }
  .fc-front-hint {
    animation: none;
  }
}
