/* 阅行世界 ReadWorld · 高保真版式共享样式（DCR-002 全端统一紫色体系）
   Token 唯一真源：../design-tokens.md；全端同一套视觉，仅信息密度/阅读正文为功能差异。
   静态版式：无 JS、无 API、无生产数据；图片均为占位。 */

:root {
  --rw-canvas: #EDEAF8;
  --rw-surface: #FFFFFF;
  --rw-surface-sunken: #F3F0FC;
  --rw-primary: #6B4FE0;
  --rw-primary-deep: #5438C4;
  --rw-primary-soft: #EDE9FB;
  --rw-ink: #2E2A4A;
  --rw-ink-muted: #5B5770;
  --rw-border-control: #7C7568;
  --rw-border-decorative: #D9D2F0;
  --rw-white: #FFFFFF;
  --rw-scrim: rgba(46,42,74,.45);
  --rw-success: #2F7446; --rw-success-soft: #E4F3E8;
  --rw-warning: #8A5A12; --rw-warning-soft: #FBF2E2;
  --rw-danger: #B23A2E;  --rw-danger-soft: #FBEDEB;
  --rw-accent-warm: #E08A3C;
  --rw-font-round: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --rw-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  --rw-font-reading: Georgia, "Times New Roman", "Songti SC", serif;
  --rw-text-xs: 12px; --rw-text-sm: 14px; --rw-text-base: 16px;
  --rw-text-lg: 18px; --rw-text-xl: 22px; --rw-text-2xl: 28px; --rw-text-3xl: 36px;
  --rw-text-display: 40px; --rw-reading-body: 18px;
  --rw-space-1: 4px; --rw-space-2: 8px; --rw-space-3: 12px; --rw-space-4: 16px;
  --rw-space-5: 24px; --rw-space-6: 32px; --rw-space-7: 40px; --rw-space-8: 48px; --rw-space-9: 64px;
  --rw-radius-sm: 14px; --rw-radius-md: 18px; --rw-radius-lg: 24px;
  --rw-radius-xl: 32px; --rw-radius-pill: 999px;
  --rw-shadow-1: 0 8px 24px rgba(46,42,74,.10);
  --rw-shadow-2: 0 16px 40px rgba(46,42,74,.16);
  --rw-motion-fast: 120ms; --rw-motion-base: 180ms; --rw-ease: cubic-bezier(.2,.7,.3,1);
  --rw-content-max: 1200px; --rw-reading-max: 720px;
  --rw-focus-ring: var(--rw-primary);
  --rw-paper: var(--rw-canvas);
}
[data-theme="admin"], [data-theme="adult"], [data-theme="child"] { --rw-paper: var(--rw-canvas); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--rw-canvas); color: var(--rw-ink); font: var(--rw-text-base)/1.7 var(--rw-font-round); }
img { max-width: 100%; display: block; }
a { color: var(--rw-primary); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--rw-focus-ring); outline-offset: 2px; }
.wrap { width: 100%; max-width: var(--rw-content-max); margin: 0 auto; padding: 0 var(--rw-space-4); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 顶栏：全端统一浅紫 + 圆形紫头像 */
.child-header, .site-header { background: var(--rw-canvas); border-bottom: 1px solid var(--rw-border-decorative); }
.child-header .wrap, .site-header .wrap { min-height: 72px; display: flex; align-items: center; gap: var(--rw-space-3); min-width: 0; }
.child-header .wrap > *, .site-header .wrap > * { min-width: 0; }
.brand { font: 800 24px/1 var(--rw-font-round); color: var(--rw-ink); letter-spacing: -.01em; }
.brand small { display: block; font: 500 10px/1.4 var(--rw-font-ui); letter-spacing: .08em; color: var(--rw-ink-muted); margin-top: 4px; }
.nav { display: none; gap: var(--rw-space-5); }
.nav a { color: var(--rw-ink); font-size: 14px; }
.nav a[aria-current="page"] { font-weight: 800; color: var(--rw-primary); }
.header-spacer { flex: 1; }
.menu-btn { display: inline-flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; background: none; border: 0; color: var(--rw-ink); cursor: pointer; font-size: 24px; }
.child-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--rw-primary-soft); display: grid; place-items: center; font-size: 22px; }

/* 按钮：胶囊 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--rw-space-2); min-height: 48px; padding: 0 var(--rw-space-5); border-radius: var(--rw-radius-pill); font: 800 15px/1 var(--rw-font-round); cursor: pointer; border: 1px solid transparent; transition: background var(--rw-motion-fast) var(--rw-ease), transform var(--rw-motion-fast); text-decoration: none; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--rw-primary); color: var(--rw-white); }
.btn-primary:hover { background: var(--rw-primary-deep); }
.btn-secondary { background: var(--rw-surface); color: var(--rw-primary); border-color: var(--rw-primary); }
.btn-secondary:hover { background: var(--rw-primary-soft); }
.btn-text { background: transparent; color: var(--rw-primary); padding: 0 var(--rw-space-2); }
.btn-danger { background: var(--rw-danger); color: var(--rw-white); }
.btn-wide { width: 100%; }
.btn-black { background: var(--rw-primary); color: var(--rw-white); border-radius: var(--rw-radius-pill); }

/* 排版：全端圆润粗体 */
.section { padding: var(--rw-space-8) 0; }
.section-tight { padding: var(--rw-space-5) 0; }
h1, h2, h3 { margin: 0 0 var(--rw-space-3); font-family: var(--rw-font-round); color: var(--rw-ink); }
h1 { font-size: var(--rw-text-display); font-weight: 800; line-height: 1.15; }
h2 { font-size: var(--rw-text-2xl); font-weight: 800; }
h3 { font-size: var(--rw-text-lg); font-weight: 800; }
.display { font-family: var(--rw-font-round); font-weight: 800; font-size: 40px; line-height: 1.15; letter-spacing: -.01em; color: var(--rw-ink); }
.lede { color: var(--rw-ink-muted); font-size: 17px; max-width: 60ch; }
.muted { color: var(--rw-ink-muted); }
.small { font-size: var(--rw-text-sm); }
.tiny { font-size: 11px; letter-spacing: .06em; color: var(--rw-ink-muted); }
.rule { border-top: 1px solid var(--rw-border-decorative); margin: var(--rw-space-5) 0; }

/* 卡片/插画位：超大圆角 + 柔和阴影 */
.grid { display: grid; gap: var(--rw-space-5); grid-template-columns: 1fr; }
.card { background: var(--rw-surface); border: 0; border-radius: var(--rw-radius-xl); padding: var(--rw-space-4); box-shadow: var(--rw-shadow-1); }
.card .thumb { aspect-ratio: 16/10; background: var(--rw-primary-soft); border-radius: var(--rw-radius-lg); display: grid; place-items: center; color: var(--rw-primary); font-size: var(--rw-text-sm); margin-bottom: var(--rw-space-3); background-image: radial-gradient(circle at 28% 26%, rgba(107,79,224,.16), transparent 62%); }
.spacer { height: var(--rw-space-4); }

/* 徽章/胶囊 */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: var(--rw-text-xs); padding: 6px 12px; border-radius: var(--rw-radius-pill); background: var(--rw-primary-soft); color: var(--rw-primary); font-weight: 700; }
.badge-muted { background: var(--rw-surface-sunken); color: var(--rw-ink-muted); }
.badge-success { background: var(--rw-success-soft); color: var(--rw-success); }
.badge-warn { background: var(--rw-warning-soft); color: var(--rw-warning); }
.badge-danger { background: var(--rw-danger-soft); color: var(--rw-danger); }
.badge-check::before { content: "✓ "; }
.badge-lock::before { content: "🔒 "; }
.chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--rw-radius-pill); border: 1px solid var(--rw-primary); background: var(--rw-surface); color: var(--rw-primary); font-size: var(--rw-text-sm); font-weight: 700; }
.chip[aria-pressed="true"] { background: var(--rw-primary); color: var(--rw-white); }

/* 搜索框：圆形紫按钮 */
.searchbox { display: flex; align-items: center; background: var(--rw-surface); border-radius: var(--rw-radius-pill); padding: 6px 6px 6px 20px; box-shadow: var(--rw-shadow-1); }
.searchbox input { flex: 1 1 0; min-width: 0; width: 100%; min-height: 44px; border: 0; background: transparent; font-size: 15px; color: var(--rw-ink); outline: none; font-family: var(--rw-font-round); }
.searchbox .go { min-width: 44px; min-height: 44px; border-radius: 50%; border: 0; background: var(--rw-primary); color: var(--rw-white); cursor: pointer; }

/* 进度 */
.progress { height: 8px; background: var(--rw-primary-soft); border-radius: var(--rw-radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--rw-primary); border-radius: var(--rw-radius-pill); }

/* 阅读正文：衬线仅此一处（可读性例外） */
.reading { max-width: var(--rw-reading-max); margin: 0 auto; }
.reading-body { font: var(--rw-reading-body)/1.78 var(--rw-font-reading); color: var(--rw-ink); }
.reading-body p { margin: 0 0 var(--rw-space-4); }
.reading-body h2 { font-family: var(--rw-font-round); font-size: 24px; color: var(--rw-ink); }
.reading-body .word { border-bottom: 2px dotted var(--rw-primary); cursor: help; }
.article-meta { display: flex; flex-wrap: wrap; gap: var(--rw-space-2); margin-bottom: var(--rw-space-4); }
.audio-bar { display: flex; align-items: center; gap: var(--rw-space-3); background: var(--rw-primary-soft); border-radius: var(--rw-radius-lg); padding: var(--rw-space-3); margin-bottom: var(--rw-space-5); }
.audio-bar .play { min-width: 48px; min-height: 48px; border-radius: 50%; border: 0; background: var(--rw-primary); color: var(--rw-white); font-size: 18px; cursor: pointer; }
.audio-bar .progress { flex: 1; }
.source-note { border-top: 1px solid var(--rw-border-decorative); padding-top: var(--rw-space-3); margin-top: var(--rw-space-6); font-size: var(--rw-text-xs); color: var(--rw-ink-muted); }

/* 练习 */
.question-card { max-width: 680px; margin: 0 auto; }
.option { display: flex; align-items: flex-start; gap: var(--rw-space-3); min-height: 48px; padding: var(--rw-space-3); border: 2px solid var(--rw-border-decorative); border-radius: var(--rw-radius-md); background: var(--rw-surface); margin-bottom: var(--rw-space-2); }
.option input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--rw-primary); }
.feedback { background: var(--rw-success-soft); color: var(--rw-ink); border-radius: var(--rw-radius-lg); padding: var(--rw-space-4); margin-top: var(--rw-space-4); }
.feedback-warn { background: var(--rw-warning-soft); }

/* 家庭/儿童 */
.task-row { display: flex; align-items: center; gap: var(--rw-space-2); padding: var(--rw-space-3) 0; border-bottom: 1px solid var(--rw-border-decorative); }
.notice { background: var(--rw-surface-sunken); border-radius: var(--rw-radius-xl); padding: var(--rw-space-4); }
.consent { border-radius: var(--rw-radius-xl); background: var(--rw-surface); padding: var(--rw-space-5); box-shadow: var(--rw-shadow-1); }

/* 后台：紫色化，保留信息密度 */
body.admin-body { background: var(--rw-canvas); font-family: var(--rw-font-round); }
.admin-shell { display: grid; grid-template-columns: 64px 1fr; min-height: 100vh; }
.admin-rail { background: var(--rw-primary-deep); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 6px; }
.admin-rail .logo { width: 38px; height: 38px; border-radius: var(--rw-radius-sm); background: var(--rw-white); color: var(--rw-primary-deep); display: grid; place-items: center; font-weight: 800; margin-bottom: var(--rw-space-4); }
.admin-rail a { width: 44px; height: 44px; display: grid; place-items: center; color: rgba(255,255,255,.78); border-radius: var(--rw-radius-sm); font-size: 18px; }
.admin-rail a[aria-current="page"] { background: rgba(255,255,255,.22); color: var(--rw-white); }
.admin-side { background: var(--rw-primary-soft); padding: var(--rw-space-5) var(--rw-space-4); }
.admin-side h2 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--rw-primary-deep); margin-bottom: var(--rw-space-4); }
.admin-side ul { list-style: none; margin: 0; padding: 0; }
.admin-side li { min-height: 44px; display: flex; align-items: center; padding: 0 14px; border-radius: var(--rw-radius-md); font-size: 14px; color: var(--rw-primary-deep); font-weight: 600; }
.admin-side li[aria-current="page"] { background: var(--rw-white); color: var(--rw-primary); font-weight: 800; }
.admin-main { padding: var(--rw-space-5) var(--rw-space-4); min-width: 0; }
.admin-main h1 { font-size: 28px; font-weight: 800; }
.admin-topbar { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 12px 24px; background: var(--rw-surface); border-bottom: 1px solid var(--rw-border-decorative); font-size: 12px; color: var(--rw-ink-muted); }
.breadcrumb { font-size: 12px; color: var(--rw-ink-muted); margin-bottom: var(--rw-space-3); }
.statusbar { display: flex; flex-wrap: wrap; gap: var(--rw-space-2); margin-bottom: var(--rw-space-5); }
.statusbar span { padding: 8px 14px; min-height: 36px; display: inline-flex; align-items: center; border-radius: var(--rw-radius-pill); background: var(--rw-surface); color: var(--rw-ink-muted); font-size: 13px; font-weight: 600; }
.statusbar span[aria-current="step"] { background: var(--rw-primary); color: var(--rw-white); }
.fab { width: 52px; height: 52px; border-radius: 50%; background: var(--rw-primary); color: var(--rw-white); border: 0; font-size: 28px; cursor: pointer; box-shadow: var(--rw-shadow-2); }
.table-scroll { overflow-x: auto; background: var(--rw-surface); border-radius: var(--rw-radius-lg); box-shadow: var(--rw-shadow-1); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--rw-border-decorative); white-space: nowrap; }
th { color: var(--rw-primary-deep); font-weight: 800; background: var(--rw-primary-soft); }
.metric-grid { display: grid; grid-template-columns: 1fr; gap: var(--rw-space-4); }
.metric { background: var(--rw-surface); border-radius: var(--rw-radius-lg); padding: var(--rw-space-4); box-shadow: var(--rw-shadow-1); }
.metric strong { display: block; font-size: 28px; color: var(--rw-primary); }
.admin-filter { background: var(--rw-surface); border-radius: var(--rw-radius-lg); padding: var(--rw-space-4); box-shadow: var(--rw-shadow-1); }
.admin-filter input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--rw-primary); }

.site-footer { padding: var(--rw-space-5) 0; color: var(--rw-ink-muted); font-size: var(--rw-text-sm); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: var(--rw-space-4); }

@media (min-width: 768px) {
  .nav { display: flex; }
  .menu-btn { display: none; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .display { font-size: 48px; }
}
@media (min-width: 1024px) {
  .admin-shell { grid-template-columns: 64px 200px 1fr; }
  .admin-main { padding: var(--rw-space-6); }
  .article-layout { display: grid; grid-template-columns: minmax(0, var(--rw-reading-max)) 260px; gap: var(--rw-space-8); justify-content: center; align-items: start; }
  .article-layout .reading { margin: 0; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1440px) {
  .display { font-size: 56px; }
  .metric-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
