/* ============ 星瞳吃书 · 纸书风设计系统 ============ */
:root {
  --paper: #f2e8d5;
  --paper-2: #e9dcc3;
  --card: #fffdf7;
  --ink: #33291f;
  --muted: #8d7f6d;
  --line: #e3d5bc;
  --accent: #b04a2f;
  --accent-d: #8f3a23;
  --accent-soft: #f6ddd0;
  --ok: #4d9a6a;
  --warn: #c98a2d;
  --danger: #d4493b;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 2px 10px rgba(70,45,20,.07);
  --shadow-md: 0 8px 26px rgba(70,45,20,.12);
  --serif: Georgia, "Songti SC", "SimSun", serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--paper); color: var(--ink); font-size: 14px; }
#app { min-height: 100vh; }
.boot { padding: 80px; text-align: center; color: var(--muted); }
::selection { background: var(--accent-soft); }

button { font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; background: var(--accent); color: #fff; transition: .15s; }
button:hover { background: var(--accent-d); }
button.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
button.ghost:hover { border-color: var(--accent); color: var(--accent); }
button.soft { background: var(--accent-soft); color: var(--accent-d); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea, select { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); outline: none; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.75; }
a { color: var(--accent); cursor: pointer; }

/* 顶栏 */
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 22px; max-width: 1080px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--serif); }
.logo .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 16px; font-weight: 800; position: relative; overflow: hidden; }
.logo .mark::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50% 0 50% 0; background: var(--paper); bottom: -6px; right: -4px; }
.logo .name { font-size: 19px; font-weight: 700; }
.logo .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.topbar .spacer { flex: 1; }

/* 认证页 */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 380px; max-width: 94vw; background: var(--card); border-radius: var(--radius-lg); padding: 30px; box-shadow: var(--shadow-md); border: 1px solid var(--line); }
.auth-card .brand { text-align: center; margin-bottom: 18px; }
.auth-card .brand .big { width: 54px; height: 54px; border-radius: 16px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-size: 26px; font-weight: 800; position: relative; overflow: hidden; }
.auth-card .brand .big::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50% 0 50% 0; background: var(--paper); bottom: -8px; right: -6px; }
.auth-card .brand h1 { font-family: var(--serif); margin: 10px 0 2px; font-size: 22px; }
.auth-card .brand p { color: var(--muted); margin: 0; font-size: 12px; }
.auth-card .field { margin-bottom: 13px; }
.auth-card .field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* 主页容器 */
.page { max-width: 1080px; margin: 0 auto; padding: 10px 22px 60px; display: flex; flex-direction: column; gap: 18px; }

/* 吃书大卡 */
.eat-hero { background: linear-gradient(150deg, #3d2c1e, #7a4a2d 60%, var(--accent)); border-radius: var(--radius-lg); padding: 30px 30px 26px; color: #fff; box-shadow: var(--shadow-md); }
.eat-hero h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 24px; }
.eat-hero .d { opacity: .85; font-size: 13px; margin-bottom: 18px; line-height: 1.7; }
.eat-hero .inputs { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 10px; margin-bottom: 10px; }
.eat-hero input, .eat-hero select { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.eat-hero input::placeholder { color: rgba(255,255,255,.6); }
.eat-hero input:focus, .eat-hero select:focus { border-color: #fff; }
.eat-hero textarea { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #fff; }
.eat-hero textarea::placeholder { color: rgba(255,255,255,.6); }
.eat-hero .bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.eat-hero .bar .upload { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.eat-hero .eat-btn { background: #fff; color: var(--accent-d); font-weight: 700; padding: 12px 26px; border-radius: 26px; margin-left: auto; font-size: 15px; }
.eat-hero .eat-btn:hover { background: #f5e6d8; }
.eat-hero .tips { font-size: 11px; opacity: .7; margin-top: 10px; }

/* 吃书动画 */
.eat-mask { position: fixed; inset: 0; background: rgba(30,18,8,.55); display: grid; place-items: center; z-index: 60; backdrop-filter: blur(2px); }
.eat-box { width: 320px; max-width: 90vw; background: var(--card); border-radius: var(--radius-lg); padding: 30px 26px; text-align: center; box-shadow: var(--shadow-md); }
.book-anim { width: 120px; height: 90px; margin: 0 auto 16px; position: relative; }
.book-anim .bk { position: absolute; inset: 0; border-radius: 6px 12px 12px 6px; background: var(--accent); box-shadow: inset -8px 0 0 rgba(0,0,0,.15); }
.book-anim .bite { position: absolute; background: var(--card); border-radius: 50%; }
.book-anim .bite.b1 { width: 26px; height: 26px; right: -6px; top: 12px; }
.book-anim .bite.b2 { width: 18px; height: 18px; right: -2px; bottom: 14px; }
.eat-box .phase { font-weight: 700; font-size: 16px; margin-bottom: 6px; color: var(--accent-d); }
.eat-box .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.eat-box .bar { height: 8px; background: var(--paper-2); border-radius: 6px; overflow: hidden; }
.eat-box .bar div { height: 100%; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); width: 12%; border-radius: 6px; transition: width .5s; }
.eat-box .marks { margin-top: 10px; font-size: 12px; color: var(--warn); letter-spacing: 2px; }

/* 报告 */
.report { display: flex; flex-direction: column; gap: 16px; }
.r-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 26px; display: flex; gap: 20px; align-items: center; }
.r-head .ring { flex: none; position: relative; width: 92px; height: 92px; }
.r-head .ring svg { transform: rotate(-90deg); }
.r-head .ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 24px; font-weight: 800; color: var(--accent-d); font-family: var(--serif); }
.r-head .t { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.r-head .a { color: var(--muted); font-size: 13px; margin: 3px 0 8px; }
.r-head .tagline { font-size: 15px; line-height: 1.7; }
.r-head .acts { margin-left: auto; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--accent-d); }
.card h3 .ic { font-size: 17px; }
.score-bars { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.sb .lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; justify-content: space-between; }
.sb .track { height: 8px; background: var(--paper-2); border-radius: 6px; overflow: hidden; }
.sb .track div { height: 100%; background: linear-gradient(90deg, var(--warn), var(--accent)); border-radius: 6px; }
.summary-text { font-size: 14px; line-height: 1.9; color: #4a3d2f; white-space: pre-wrap; }
.acts { display: flex; flex-direction: column; gap: 8px; }
.act { display: flex; gap: 12px; align-items: flex-start; }
.act .idx { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.act .t { font-weight: 600; }
.act .d { font-size: 13px; color: #4a3d2f; margin-top: 2px; line-height: 1.6; }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.char { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fffdf7; }
.char .nm { font-weight: 700; font-family: var(--serif); font-size: 16px; }
.char .role { display: inline-block; font-size: 11px; background: var(--accent-soft); color: var(--accent-d); padding: 2px 8px; border-radius: 10px; margin: 6px 0; }
.char .row { font-size: 12px; color: #5a4c3b; margin: 3px 0; line-height: 1.6; }
.char .row b { color: var(--accent-d); }
.quotes { display: flex; flex-direction: column; gap: 10px; }
.quote { border-left: 3px solid var(--accent); padding: 8px 14px; background: var(--paper); border-radius: 0 10px 10px 0; }
.quote .q { font-family: var(--serif); font-size: 14px; font-style: italic; line-height: 1.7; }
.quote .c { font-size: 11px; color: var(--muted); margin-top: 4px; }
.two-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .two-list { grid-template-columns: 1fr; } }
.two-list .hl { padding-left: 20px; margin: 4px 0; line-height: 1.7; font-size: 13px; position: relative; }
.two-list .hl::before { content: "★"; position: absolute; left: 0; color: var(--warn); }
.two-list .hl.cr::before { content: "✕"; color: var(--danger); }
.r-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-text, .notes-text { font-size: 14px; line-height: 1.9; color: #4a3d2f; }
.insp { display: flex; flex-direction: column; gap: 8px; }
.insp .it { background: var(--paper); border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.7; }
.insp .it::before { content: "💡 "; }

/* 书库 */
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.lib-head h2 { margin: 0; font-family: var(--serif); font-size: 24px; }
.lib-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lib-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; transition: .15s; }
.lib-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lib-card .top { display: flex; align-items: center; gap: 10px; }
.lib-card .score { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-d); display: grid; place-items: center; font-weight: 800; font-size: 16px; font-family: var(--serif); flex: none; }
.lib-card .tt { font-weight: 700; font-size: 15px; }
.lib-card .au { font-size: 12px; color: var(--muted); }
.lib-card .tl { font-size: 12px; color: #5a4c3b; line-height: 1.6; flex: 1; }
.lib-card .ft { display: flex; align-items: center; justify-content: space-between; }
.lib-card .dt { font-size: 11px; color: var(--muted); }
.lib-card .ops { display: flex; gap: 6px; }
.lib-card .ops button { padding: 5px 10px; font-size: 12px; }

/* 弹窗/提示 */
.modal-mask { position: fixed; inset: 0; background: rgba(30,18,8,.45); display: grid; place-items: center; z-index: 70; }
.modal { width: 460px; max-width: 94vw; max-height: 86vh; overflow: auto; background: var(--card); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-md); }
.modal h3 { margin: 0 0 14px; font-family: var(--serif); }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #2b1f14; color: #fff; padding: 10px 18px; border-radius: 24px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.placeholder { color: var(--muted); text-align: center; padding: 40px 10px; }
.loading { display: inline-flex; align-items: center; gap: 6px; }

/* 内联吃书状态条（取代全屏遮罩） */
.eat-status { background: linear-gradient(135deg, #3d2c1e, #7a4a2d); color: #fff; border-radius: var(--radius); padding: 16px 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.eat-status .es-body { flex: 1; min-width: 0; }
.eat-status .es-phase { font-size: 16px; font-weight: 700; }
.eat-status .es-sub { font-size: 12px; opacity: .8; margin-top: 3px; }
.eat-status .es-bar { height: 6px; background: rgba(255,255,255,.2); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.eat-status .es-bar div { height: 100%; background: linear-gradient(90deg, var(--accent-soft), #fff); width: 5%; border-radius: 4px; transition: width .4s; }
.eat-status .es-acts { display: flex; gap: 8px; flex: none; }
.eat-status .es-acts button { padding: 7px 14px; font-size: 13px; background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.eat-status .es-acts button:hover { background: rgba(255,255,255,.28); }
.eat-status .es-acts button.danger { background: rgba(220,80,70,.85); border-color: rgba(255,255,255,.4); }
.eat-status .es-acts button.danger:hover { background: rgba(220,80,70,1); }

/* 日志框 */
.log-box { background: #241a12; color: #e8dcc8; border-radius: 12px; padding: 12px 14px; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.85; max-height: 260px; overflow: auto; box-shadow: inset 0 0 20px rgba(0,0,0,.35); }
.log-line { display: flex; gap: 8px; white-space: pre-wrap; word-break: break-all; }
.log-line .ts { color: #8d7a5c; flex: none; }
.log-line.ok .msg { color: #8fcf9f; }
.log-line.warn .msg { color: #e8b45e; }
.log-line.err .msg { color: #ff8f7a; }
.log-line.info .msg { color: #cbb89b; }
.log-line.progress .msg { color: #7fb8e8; }
.log-empty { color: #6d5c45; text-align: center; padding: 14px 0; }
.eat-zone { border: 2px dashed rgba(255,255,255,.35); border-radius: 14px; padding: 18px; text-align: center; cursor: pointer; transition: .2s; margin-bottom: 10px; }
.eat-zone:hover, .eat-zone.drag { border-color: #fff; background: rgba(255,255,255,.08); }
.eat-zone .big { font-size: 30px; }
.eat-zone .t { font-weight: 700; margin: 6px 0 2px; }
.eat-zone .s { font-size: 12px; opacity: .7; }
.parse-info { display: flex; gap: 14px; font-size: 12px; opacity: .9; margin-top: 8px; flex-wrap: wrap; }
.parse-info .pi { background: rgba(255,255,255,.12); padding: 3px 10px; border-radius: 10px; }

/* 手机适配 */
@media (max-width: 700px) {
  .topbar { padding: 10px 14px; }
  .eat-hero { padding: 20px 16px; }
  .eat-hero .inputs { grid-template-columns: 1fr; }
  .eat-hero .bar { flex-wrap: wrap; }
  .eat-hero .eat-btn { margin-left: 0; width: 100%; }
  .r-head { flex-direction: column; align-items: flex-start; text-align: left; }
  .r-head .acts { margin-left: 0; flex-direction: row; }
  .page { padding: 8px 12px 40px; }
  .chars { grid-template-columns: 1fr; }
}
