:root {
  --ink: #0b0f16;
  --panel: #121a27;
  --line: #253247;
  --text: #f4f1e8;
  --mut: #9aa7ba;
  --gold: #e8b45a;
  --green: #4ade80;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif; overscroll-behavior: none; }
body { overflow: hidden; }
#app { height: 100dvh; width: 100vw; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

/* 入口 */
#gate { overflow-y: auto; background: radial-gradient(circle at 20% 0%, rgba(232,180,90,.14), transparent 35%), radial-gradient(circle at 90% 15%, rgba(35,60,110,.35), transparent 40%), #0b0f16; }
.gate-inner { min-height: 100%; max-width: 560px; margin: 0 auto; padding: 48px 22px 40px; display: flex; flex-direction: column; justify-content: center; }
.brand { text-align: center; }
.brand-mark { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px; background: linear-gradient(145deg, #1b2a44, #0f1725); border: 1px solid #2b3f5e; color: var(--gold); font-size: 30px; display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 40px rgba(0,0,0,.45); }
h1 { font-size: 44px; margin: 0 0 8px; letter-spacing: -.03em; }
.tagline { color: var(--mut); font-size: 15px; margin: 0 0 26px; }
.test-note { text-align: center; color: var(--gold); background: rgba(232,180,90,.10); border: 1px solid rgba(232,180,90,.28); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; margin: 0 auto 22px; }
.age-grid { display: grid; gap: 12px; }
.age-btn { text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 18px; padding: 16px 18px; display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; font: inherit; }
.age-btn b { font-size: 26px; color: var(--gold); }
.age-btn span { color: var(--mut); font-size: 13px; }
.age-btn em { font-style: normal; font-size: 12px; color: #7f8da3; }
.age-btn.primary { border-color: rgba(232,180,90,.55); background: linear-gradient(135deg, rgba(232,180,90,.12), var(--panel)); }
.age-btn:active { transform: scale(.99); }
.cta { margin-top: 16px; width: 100%; border: 0; border-radius: 16px; padding: 15px; background: linear-gradient(135deg, #e8b45a, #c98a2e); color: #241704; font-size: 16px; font-weight: 800; font-family: inherit; }
.cta:active { opacity: .88; }
.cta.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); margin-top: 8px; }
.tiny { text-align: center; color: #637086; font-size: 11.5px; margin-top: 18px; }

/* 竖滑流 */
#feed { background: #000; }
.feed-top { position: absolute; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: linear-gradient(180deg, rgba(0,0,0,.55), transparent); pointer-events: none; }
.feed-top > * { pointer-events: auto; }
.feed-brand { font-weight: 900; letter-spacing: -.02em; color: #fff; font-size: 17px; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.28); color: #fff; font-size: 17px; display: flex; align-items: center; justify-content: center; font-family: inherit; }
.feed-list { height: 100dvh; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; }
.feed-list::-webkit-scrollbar { display: none; }
.card { position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000; }
.card video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.28), transparent 28%, transparent 58%, rgba(0,0,0,.78)); pointer-events: none; }
.card-info { position: absolute; left: 16px; right: 86px; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 4; }
.tags { display: flex; gap: 6px; margin-bottom: 8px; }
.tags span { font-size: 11px; font-weight: 800; color: #1b2430; background: var(--gold); border-radius: 999px; padding: 3px 9px; }
.tags span.sub { background: rgba(255,255,255,.18); color: #fff; }
.card-info h3 { font-size: 20px; line-height: 1.35; margin: 0 0 7px; text-shadow: 0 2px 12px rgba(0,0,0,.65); }
.kp { font-size: 12.5px; color: rgba(255,255,255,.78); margin: 0; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.actions { position: absolute; right: 12px; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 5; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.act { width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(10,14,22,.5); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-family: inherit; backdrop-filter: blur(8px); }
.act b { font-size: 19px; line-height: 1; font-weight: 500; }
.act.on { border-color: var(--gold); color: var(--gold); background: rgba(232,180,90,.14); }
.play-hint { position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%,-50%); border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.45); color: #fff; border-radius: 999px; padding: 10px 18px; font-family: inherit; font-size: 13px; }
.feed-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--mut); font-size: 16px; line-height: 1.8; }
.feed-empty span { font-size: 12px; color: #5f6c80; }
.sound-hint { position: fixed; z-index: 30; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(232,180,90,.92); color: #241704; font-size: 12.5px; font-weight: 700; padding: 8px 14px; border-radius: 999px; }

/* 家长中心 */
#parent { background: #0b0f16; overflow-y: auto; }
.parent-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: rgba(11,15,22,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.parent-top h2 { font-size: 18px; margin: 0; }
.parent-panel { padding: 14px 16px 60px; max-width: 620px; margin: 0 auto; }
#pinGate { margin: 40px auto; max-width: 360px; }
.parent-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 0 auto 14px; max-width: 620px; }
.parent-card h3 { margin: 0 0 14px; font-size: 15px; color: var(--gold); }
.parent-card label { display: block; font-size: 13px; color: var(--mut); margin: 12px 0; }
.parent-card input, .parent-card select { width: 100%; margin-top: 6px; background: #0c131e; border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px 12px; font: inherit; }
.pin { text-align: center; font-size: 26px; letter-spacing: 14px; padding-left: 26px !important; }
.inline { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.inline input { width: 72px !important; margin: 0 !important; }
.metric-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.metric-row div { background: #0c131e; border: 1px solid var(--line); border-radius: 14px; padding: 14px 8px; text-align: center; }
.metric-row b { display: block; font-size: 26px; color: var(--gold); }
.metric-row span { font-size: 11.5px; color: var(--mut); }
.small { font-size: 12.5px; line-height: 1.7; }
.muted { color: var(--mut); }
.error { color: #f87171; font-size: 12.5px; }
.muted-card { opacity: .85; }

/* 休息页 */
.rest-view { background: radial-gradient(circle at 50% 20%, #1a2740, #0b0f16 60%); }
.rest-inner { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.rest-icon { font-size: 52px; margin-bottom: 12px; }
.rest-inner h2 { margin: 0 0 8px; }
.rest-inner p { max-width: 320px; }
.rest-inner .cta { max-width: 260px; }

/* toast */
.toast { position: fixed; z-index: 100; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(10px); background: rgba(20,28,42,.96); border: 1px solid var(--line); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 900px) {
  .feed-list { max-width: 520px; margin: 0 auto; border-left: 1px solid #1a2333; border-right: 1px solid #1a2333; }
  .feed-top { max-width: 520px; left: 50%; transform: translateX(-50%); }
}

/* 入口链接 / 源管理 / 搜索 */
.gate-links { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.text-btn { background: transparent; border: 0; color: var(--mut); font: inherit; font-size: 12.5px; padding: 6px 10px; text-decoration: underline; text-underline-offset: 3px; }
.feed-actions { display: flex; gap: 8px; }
.page-view { background: #0b0f16; overflow-y: auto; }
.page-body { padding: 14px 16px 60px; max-width: 760px; margin: 0 auto; }
.url-input { width: 100%; margin-top: 8px; background: #0c131e; border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 11px 12px; font: inherit; font-size: 13px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .cta { flex: 1; }
.source-preview { margin-top: 12px; padding: 12px; border: 1px solid rgba(232,180,90,.4); border-radius: 12px; background: rgba(232,180,90,.06); font-size: 12.5px; line-height: 1.7; }
.source-preview b { color: var(--gold); }
.source-preview code { color: #c7d2fe; font-size: 11.5px; word-break: break-all; }
.source-list { display: flex; flex-direction: column; gap: 8px; }
.source-row { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: #0c131e; }
.source-row-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.source-row-head b { font-size: 13.5px; }
.source-meta { color: var(--mut); font-size: 11.5px; margin-top: 4px; line-height: 1.7; word-break: break-all; }
.source-actions { display: flex; gap: 6px; margin-top: 8px; }
.source-actions button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 11.5px; }
.source-actions button.danger { color: #f87171; border-color: rgba(248,113,113,.35); }
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 10.5px; font-weight: 800; }
.badge.ok { color: #4ade80; background: rgba(74,222,128,.10); border: 1px solid rgba(74,222,128,.3); }
.badge.local { color: var(--gold); background: rgba(232,180,90,.10); border: 1px solid rgba(232,180,90,.3); }
.search-form { display: flex; gap: 8px; align-items: stretch; }
.search-form .url-input { margin-top: 0; }
.search-form .cta { width: auto; padding-left: 18px; padding-right: 18px; margin-top: 0; white-space: nowrap; }
.search-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.search-card { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); background: #0c131e; border-radius: 12px; padding: 8px; color: var(--text); text-align: left; font: inherit; }
.search-card img { width: 54px; height: 86px; object-fit: cover; border-radius: 8px; background: #000; flex: 0 0 auto; }
.search-card-main { min-width: 0; flex: 1; }
.search-card-title { font-size: 13.5px; font-weight: 700; line-height: 1.4; }
.search-card-meta { font-size: 11.5px; color: var(--mut); margin-top: 4px; line-height: 1.6; }
.search-card .play-dot { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--gold); flex: 0 0 auto; }
.empty-hint { text-align: center; color: var(--mut); font-size: 13px; padding: 30px 0; }
.tags span.src { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }

/* 多孩子 */
.profile-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.profile-chip { border: 1px solid var(--line); background: #0c131e; color: var(--text); border-radius: 999px; padding: 8px 13px; font: inherit; font-size: 12.5px; }
.profile-chip small { color: var(--mut); margin-left: 3px; }
.profile-chip.active { border-color: var(--gold); color: var(--gold); background: rgba(232,180,90,.1); }
.profile-add { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.profile-add .compact { margin-top: 8px; }
.profile-add .cta { grid-column: 1 / -1; margin-top: 0; }
.profile-add .url-input { margin-top: 8px; }

/* 试卷分析 */
.paper-file { width: 100%; margin: 8px 0 2px; color: var(--mut); font-size: 12px; }
.weak-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.weak-chip { border: 1px solid rgba(232,180,90,.35); background: rgba(232,180,90,.08); color: var(--gold); border-radius: 999px; padding: 4px 10px; font-size: 11.5px; }
.paper-q { border-left: 3px solid var(--line); padding: 6px 10px; margin: 6px 0; font-size: 12.5px; line-height: 1.6; }
.paper-q b { display: block; color: var(--text); font-weight: 600; }
.paper-q span { color: var(--mut); }

/* 受限留言 */
.sheet { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.62); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: min(540px, 100%); max-height: 78vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h3 { margin: 0; font-size: 16px; color: var(--gold); }
.comment-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.comment-item { background: #0c131e; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; }
.comment-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.preset-btn { border: 1px solid rgba(232,180,90,.35); background: rgba(232,180,90,.08); color: var(--gold); border-radius: 999px; padding: 7px 11px; font: inherit; font-size: 12px; }
.comment-row { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 12.5px; }
.comment-row small { display: block; color: var(--mut); font-size: 11px; margin-top: 2px; }
.comment-row-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.comment-row-actions button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 11px; }

/* 扫码 */
.scan-video { width: 100%; max-height: 320px; margin-top: 10px; border-radius: 12px; background: #000; object-fit: cover; }
