/* ============================================================
 *  学礼拜 / Learn Salah — Apple 风样式表
 *  设计令牌：white + navy #0a2540 + gold #c9a227 + Islamic green #0F6E3D
 * ============================================================ */

:root {
  /* 调色板 */
  --bg: #ffffff;
  --bg-soft: #f8f9fb;
  --bg-card: #ffffff;
  --line: #e6e8ec;
  --line-soft: #f0f2f5;

  --text: #0a2540;          /* navy 主文 */
  --text-soft: #4a5566;
  --text-mute: #8b95a3;

  --accent: #0F6E3D;        /* Islamic green — 主按钮 */
  --accent-soft: #e7f4ec;
  --accent-text: #ffffff;

  --gold: #c9a227;          /* HCS gold — 高亮/分隔 */
  --gold-soft: #fdf6df;

  --navy: #0a2540;
  --navy-soft: #1a3458;

  /* 排版 */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
               "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --font-arabic: "Amiri", "Scheherazade New", "Noto Naskh Arabic",
                 "Traditional Arabic", serif;

  /* 圆角 / 阴影 */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.04), 0 1px 1px rgba(10, 37, 64, 0.03);
  --shadow-md: 0 6px 24px rgba(10, 37, 64, 0.06), 0 2px 6px rgba(10, 37, 64, 0.04);
  --shadow-lg: 0 20px 50px rgba(10, 37, 64, 0.08), 0 6px 16px rgba(10, 37, 64, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---- 顶部导航 ---- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 18px;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.appbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 17px; color: var(--navy);
}
.appbar .brand-dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #149859 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 14px;
}
.appbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.appbar .pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 500;
  border: none; cursor: pointer;
}

/* ---- 容器 ---- */
.container {
  max-width: 760px; margin: 0 auto;
  padding: 20px 18px 80px;
}

/* ---- 启动页 / 首屏 Hero ---- */
.hero {
  text-align: center;
  padding: 48px 16px 36px;
}
.hero .badge {
  display: inline-block; padding: 4px 12px;
  background: var(--gold-soft); color: #8a6e10;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.5px;
}
.hero h1 {
  margin: 18px 0 10px;
  font-size: 40px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--navy);
}
.hero h2 {
  margin: 0 0 18px;
  font-size: 18px; font-weight: 400; color: var(--text-soft);
  direction: ltr;
}
.hero .splash {
  margin: 24px auto; max-width: 360px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero .splash img { width: 100%; display: block; }
.hero .desc {
  font-size: 14px; color: var(--text-mute);
  max-width: 520px; margin: 18px auto 24px;
}
.hero .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  text-decoration: none;
  border: none; cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 4px 14px rgba(15, 110, 61, 0.25);
}
.btn.primary:hover { background: #0d5e34; }
.btn.ghost {
  background: var(--bg-card); color: var(--navy);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--bg-soft); }
.btn.gold {
  background: var(--gold); color: var(--navy);
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.3);
}

/* ---- 目录列表 ---- */
.toc-title {
  margin: 8px 0 4px;
  font-size: 22px; font-weight: 700; color: var(--navy);
}
.toc-sub {
  font-size: 13px; color: var(--text-mute); margin-bottom: 18px;
  direction: ltr;
}
.toc {
  list-style: none;
  display: grid; gap: 8px;
}
.toc-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--text);
  border: 1px solid transparent;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s;
}
.toc-item:hover { border-color: var(--line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.toc-item .num {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 8px;
  background: var(--bg-soft); color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--line-soft);
}
.toc-item.done .num {
  background: var(--accent); color: white;
  border-color: var(--accent);
}
.toc-item .body { flex: 1; min-width: 0; }
.toc-item .zh { font-size: 15px; font-weight: 600; color: var(--navy); }
.toc-item .en {
  font-size: 12px; color: var(--text-mute);
  direction: ltr; margin-top: 2px;
}
.toc-item .ar {
  font-family: var(--font-arabic);
  font-size: 18px; color: var(--accent);
  direction: rtl; unicode-bidi: isolate;
}
.toc-item .check {
  width: 22px; height: 22px;
  flex-shrink: 0;
}

/* ---- 课程页 ---- */
.lesson-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: 18px;
}
.lesson-header {
  padding: 20px 22px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-soft) 100%);
  border-bottom: 1px solid var(--line-soft);
}
.lesson-header .crumb {
  font-size: 12px; color: var(--text-mute);
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 8px;
}
.lesson-header .crumb a { color: var(--accent); text-decoration: none; }
.lesson-header h1 {
  font-size: 26px; font-weight: 700; color: var(--navy);
  letter-spacing: -0.3px;
}
.lesson-header .en {
  font-size: 14px; color: var(--text-soft); margin-top: 4px; direction: ltr;
}
.lesson-header .ar {
  font-family: var(--font-arabic);
  font-size: 30px; color: var(--accent); margin-top: 8px;
  direction: rtl;
}
.lesson-header .label-tag {
  display: inline-block; margin-top: 10px;
  padding: 3px 10px;
  background: var(--gold-soft); color: #8a6e10;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}

.lesson-section {
  padding: 18px 22px;
  border-top: 1px solid var(--line-soft);
}
.lesson-section:first-of-type { border-top: none; }
.lesson-section h3 {
  font-size: 14px; font-weight: 600; color: var(--text-soft);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.6px;
}
.intro-text {
  font-size: 15px; line-height: 1.85; color: var(--text);
  white-space: pre-wrap;
  background: var(--bg-soft); padding: 16px 18px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold);
}

.img-card {
  margin: 14px 0;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  padding: 8px;
  text-align: center;
}
.img-card img {
  width: 100%; max-width: 480px;
  height: auto; display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: white;
}
.img-card .caption {
  font-size: 12px; color: var(--text-mute); margin-top: 6px;
  direction: ltr;
}

/* ---- 音频播放器 ---- */
.audio-list { display: grid; gap: 8px; }
.audio-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
}
.audio-row .play {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 110, 61, 0.25);
}
.audio-row .play.playing {
  background: var(--gold); color: var(--navy);
}
.audio-row .play svg { width: 14px; height: 14px; }
.audio-row .label { flex: 1; font-size: 14px; color: var(--text); }
.audio-row .time { font-size: 12px; color: var(--text-mute); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- 底部导航 ---- */
.lesson-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 22px;
}
.lesson-nav .nav-btn {
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none; color: var(--navy);
  font-size: 14px; font-weight: 600;
  display: flex; flex-direction: column;
  transition: background .15s, border-color .15s;
}
.lesson-nav .nav-btn:hover { background: var(--bg-soft); border-color: var(--text-mute); }
.lesson-nav .nav-btn.disabled { opacity: 0.4; pointer-events: none; }
.lesson-nav .nav-btn.next { align-items: flex-end; }
.lesson-nav .nav-btn .hint {
  font-size: 11px; font-weight: 500; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.lesson-nav .nav-btn .zh { margin-top: 2px; }
.lesson-nav .nav-btn .en { font-size: 12px; font-weight: 400; color: var(--text-soft); direction: ltr; }

/* ---- 进度条 ---- */
.progress {
  height: 4px; background: var(--line-soft);
  border-radius: 999px; overflow: hidden; margin-top: 10px;
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), #149859);
  transition: width .25s ease;
}

/* ---- 完成 toggle ---- */
.complete-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  margin-top: 18px;
  border: 1px solid #c8e5d5;
}
.complete-row input { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.complete-row label { font-size: 14px; color: var(--accent); font-weight: 600; cursor: pointer; }

/* ---- 响应式 ---- */
@media (max-width: 480px) {
  .hero h1 { font-size: 32px; }
  .hero h2 { font-size: 16px; }
  .lesson-header h1 { font-size: 22px; }
  .container { padding: 16px 14px 80px; }
  .lesson-section { padding: 16px; }
  .lesson-header { padding: 18px; }
}

/* ---- 隐藏 ---- */
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--text-mute); }