/* 儒医堂英语教练 · 杂交风统一样式
   宣纸米灰 + 朱砂红 + 古铜金 + 游戏化 */

:root {
  --bg-main: #FBF7EE;
  --bg-card: #FFFCF5;
  --bg-elev: #F5EFDF;
  --brand-red: #8B0000;
  --brand-red-light: #A03030;
  --brand-gold: #C9A961;
  --brand-gold-dark: #A8894A;
  --accent-yellow: #FFF8DC;
  --ink-dark: #1A1A1A;
  --ink-mid: #4A4A4A;
  --ink-light: #8A8A8A;
  --border-soft: rgba(139, 0, 0, 0.12);
  --shadow-soft: 0 2px 12px rgba(139, 0, 0, 0.08);

  --word-new: #3B82F6;
  --word-l1: #FEF3C7;
  --word-l2: #FDE68A;
  --word-l3: #FCD34D;
  --word-known: transparent;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg-main);
  color: var(--ink-dark);
  font-family: -apple-system, "PingFang SC", "Songti SC", "Source Han Serif SC", serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 20% 20%, rgba(139,0,0,0.02) 0%, transparent 30%),
    radial-gradient(circle at 80% 60%, rgba(201,169,97,0.03) 0%, transparent 30%);
  padding-bottom: 70px;
}

a { color: var(--brand-red); text-decoration: none; }

/* 顶部标题栏 */
.top-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 20;
}

.brand-seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--brand-red); color: white;
  font-family: "Songti SC", serif; font-weight: bold; font-size: 12px;
  border-radius: 4px;
  letter-spacing: 1px;
  line-height: 1; text-align: center;
  flex-shrink: 0;
}
.brand-seal::before { content: "儒"; }

.top-bar h1 {
  font-family: "Songti SC", "Source Han Serif SC", serif;
  font-size: 17px; font-weight: 600;
  color: var(--ink-dark); flex: 1;
}

.streak-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--brand-red); color: white;
  font-size: 12px; border-radius: 12px;
  font-weight: 600;
}

/* 内容容器 */
.container {
  max-width: 640px; margin: 0 auto;
  padding: 14px 16px;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.card-title {
  font-family: "Songti SC", serif;
  font-size: 15px; font-weight: 600;
  color: var(--brand-red);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--brand-gold);
  border-image: linear-gradient(90deg, var(--brand-gold) 0%, transparent 80%) 1;
}

.card-title small {
  font-size: 11px; color: var(--ink-light);
  font-weight: normal; margin-left: 8px;
}

/* 进度条 */
.progress {
  height: 8px; background: var(--bg-elev); border-radius: 4px;
  overflow: hidden; margin: 6px 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-gold) 0%, var(--brand-gold-dark) 100%);
  transition: width 0.4s ease;
}
.progress-row {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0; font-size: 13px;
}
.progress-row .label { width: 90px; color: var(--ink-mid); }
.progress-row .progress { flex: 1; }
.progress-row .value { font-size: 12px; color: var(--ink-light); min-width: 60px; text-align: right; }

/* 修为等级徽章 */
.level-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--brand-gold) 0%, var(--brand-gold-dark) 100%);
  color: white; font-family: "Songti SC", serif; font-weight: 600;
  border-radius: 20px; font-size: 13px;
  box-shadow: 0 2px 8px rgba(201,169,97,0.4);
}

/* 六卡宫格 */
.grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.grid-item {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: block; color: var(--ink-dark);
}
.grid-item:active { transform: scale(0.97); }
.grid-item .icon { font-size: 26px; display: block; margin-bottom: 6px; }
.grid-item .name {
  font-family: "Songti SC", serif; font-size: 14px; font-weight: 600;
  color: var(--ink-dark); margin-bottom: 2px;
}
.grid-item .en { font-size: 10px; color: var(--ink-light); font-family: Georgia, serif; }
.grid-item .badge {
  display: inline-block; background: var(--brand-red); color: white;
  font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-top: 4px;
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border: none; border-radius: 8px;
  background: var(--brand-red); color: white;
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn.btn-gold { background: linear-gradient(135deg, var(--brand-gold), var(--brand-gold-dark)); }
.btn.btn-ghost {
  background: transparent; color: var(--brand-red);
  border: 1px solid var(--brand-red);
}
.btn.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.btn-block { width: 100%; }

/* 输入框 */
.input, .textarea, .select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-family: inherit; font-size: 14px;
  background: white; color: var(--ink-dark);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--brand-red);
}
.textarea { min-height: 80px; resize: vertical; }

.form-row { margin-bottom: 12px; }
.form-row label {
  display: block; font-size: 13px; color: var(--ink-mid);
  margin-bottom: 4px; font-weight: 500;
}

/* 短语卡片 */
.phrase-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
}
.phrase-thumb {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--bg-elev) center/cover no-repeat;
  position: relative;
}
.phrase-thumb::after {
  content: "▶"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 32px;
  background: rgba(0,0,0,0.15);
  opacity: 0.8; transition: opacity 0.2s;
}
.phrase-thumb:active::after { opacity: 1; background: rgba(0,0,0,0.3); }
.phrase-body { padding: 12px 14px; }
.phrase-en {
  font-family: Georgia, "Playfair Display", serif;
  font-size: 17px; font-weight: 600;
  color: var(--ink-dark);
  margin-bottom: 4px;
}
.phrase-cn {
  font-family: "Songti SC", serif;
  font-size: 14px; color: var(--brand-red);
  margin-bottom: 6px;
}
.phrase-meta {
  font-size: 11px; color: var(--ink-light);
  display: flex; gap: 8px; align-items: center;
}
.phrase-actions {
  display: flex; gap: 8px; margin-top: 10px;
}
.phrase-actions .btn { flex: 1; }

/* 队列状态 */
.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}
.task-url { color: var(--ink-mid); font-size: 12px; word-break: break-all; margin-bottom: 4px; }
.task-status {
  display: inline-block; padding: 2px 8px;
  font-size: 11px; border-radius: 8px;
  background: var(--bg-elev); color: var(--ink-mid);
}
.task-status.pending { background: #FEF3C7; color: #92400E; }
.task-status.running { background: #DBEAFE; color: #1E40AF; }
.task-status.succeeded { background: #D1FAE5; color: #065F46; }
.task-status.failed { background: #FEE2E2; color: #991B1B; }

/* 底部 Tab */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-soft);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 100;
}
.bottom-nav a {
  flex: 1; text-align: center;
  padding: 6px 2px;
  color: var(--ink-light);
  font-size: 11px;
  font-family: "Songti SC", serif;
}
.bottom-nav a .icon { font-size: 20px; display: block; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--brand-red); }
.bottom-nav a.active .icon { transform: scale(1.05); }

/* LingQ 单词高亮 */
.w-l0 { color: var(--word-new); border-bottom: 1px dashed var(--word-new); cursor: pointer; }
.w-l1 { background: var(--word-l1); padding: 0 2px; border-radius: 3px; cursor: pointer; }
.w-l2 { background: var(--word-l2); padding: 0 2px; border-radius: 3px; cursor: pointer; }
.w-l3 { background: var(--word-l3); padding: 0 2px; border-radius: 3px; cursor: pointer; }

/* 空状态 */
.empty {
  text-align: center; padding: 40px 20px;
  color: var(--ink-light);
}
.empty .icon { font-size: 48px; margin-bottom: 8px; }

/* 提示条 */
.hint {
  background: var(--accent-yellow);
  border-left: 3px solid var(--brand-gold);
  padding: 10px 12px;
  font-size: 13px; color: var(--ink-mid);
  border-radius: 4px;
  margin-bottom: 12px;
}

/* 印章 */
.seal-stamp {
  display: inline-block;
  padding: 2px 8px;
  background: var(--brand-red);
  color: white;
  font-family: "Songti SC", serif;
  font-size: 11px;
  border-radius: 3px;
  transform: rotate(-3deg);
  font-weight: 600;
  letter-spacing: 1px;
}

/* 加载 */
.loading {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--brand-gold); border-top-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
