/* 快乐英语 · 网页版原型样式
   规则：全局最小字号 14px；按钮语义三条（实心=主推进 / 白底描边=次级可点 / 灰=禁用）；
        划句解析窗与单词卡是两个独立浮层，样式共享、互不合并。 */

:root {
  --ink: #17211c;
  --ink-2: #4a564e;
  --muted: #7b8781;
  --paper: #faf8f3;
  --paper-2: #ffffff;
  --line: #e4e0d6;
  --brand: #1f4b3f;
  --brand-2: #2d6a58;
  --gold: #c9b37b;
  --shadow: 0 10px 30px rgba(23, 33, 28, .12);
}

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

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}
[v-cloak] { display: none; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
h1, h2, h3 { font-weight: 650; }

/* ---------- 按钮语义 ---------- */
.btn {
  font-size: 14px; line-height: 1;
  padding: 11px 18px; border-radius: 10px;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  transition: background .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.plain { background: #fff; color: var(--brand); border: 1px solid #cbd6d1; }
.btn.plain:hover { background: #f3f7f5; border-color: var(--brand); }
.btn.sm { padding: 8px 14px; }
.btn[disabled], .btn:disabled {
  background: #eceeec; border-color: #eceeec; color: #9aa39d;
  cursor: not-allowed; transform: none;
}
.icon {
  width: 36px; height: 36px; border-radius: 10px;
  font-size: 20px; line-height: 1; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon:hover { background: rgba(31, 75, 63, .08); }
.icon:disabled { color: #c6ccc8; cursor: not-allowed; background: none; }
.icon.sm { width: 28px; height: 28px; font-size: 16px; }

/* ================= 书架 ================= */
.shelf-wrap { height: 100%; display: flex; flex-direction: column; background:
  radial-gradient(1200px 600px at 10% -10%, #f2eee4 0%, transparent 60%), var(--paper); }

.topbar {
  height: 68px; flex: 0 0 68px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .72); backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(150deg, #2b5c4b, #16362c);
  color: #e9dfc4; font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 22px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.brand h1 { font-size: 17px; letter-spacing: .02em; }
.brand p { font-size: 14px; color: var(--muted); font-family: "Iowan Old Style", Georgia, serif; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.dict-state { font-size: 14px; color: var(--muted); }

.shelf { flex: 1; overflow-y: auto; padding: 26px 22px 44px; }
.sec-title {
  font-size: 15px; font-weight: 650; margin: 6px 0 16px;
  display: flex; align-items: baseline; gap: 10px;
}
.sec-title span { font-weight: 450; font-size: 14px; color: var(--muted); }

.book-row { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 34px; }
.book { width: 196px; cursor: pointer; }
.book:hover .cover { transform: translateY(-4px); box-shadow: 0 18px 34px rgba(23, 33, 28, .22); }
.cover {
  position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 3px 10px 10px 3px;
  background: linear-gradient(135deg, #1b2b45 0%, #243b5e 55%, #1a2942 100%);
  box-shadow: inset 14px 0 22px -16px rgba(0, 0, 0, .85), inset 0 0 0 1px rgba(255, 255, 255, .07), 0 10px 22px rgba(23, 33, 28, .18);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 22px 16px; overflow: hidden; transition: transform .18s, box-shadow .18s;
}
.cover::after {
  content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 1px;
  background: rgba(255, 255, 255, .16);
}
.cover.forest { background: linear-gradient(135deg, #1c3a2c 0%, #2a5842 55%, #173024 100%); }
.cover .frame {
  position: absolute; inset: 12px; border: 1px solid rgba(201, 179, 123, .45); border-radius: 2px;
}
.cover .ct {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: #efe6cf; font-size: 19px; line-height: 1.25; text-align: center;
  letter-spacing: .04em; text-shadow: 0 1px 0 rgba(0, 0, 0, .5);
  max-width: 100%;
}
.cover .ct.small { font-size: 15px; }
.cover .cz { color: rgba(233, 223, 196, .78); font-size: 14px; margin-top: 8px; letter-spacing: .12em; }
.cover .ca {
  position: absolute; bottom: 22px; left: 0; right: 0; text-align: center;
  color: rgba(233, 223, 196, .6); font-size: 14px; letter-spacing: .06em;
  font-family: "Iowan Old Style", Georgia, serif;
}
.cover .badge {
  position: absolute; top: 16px; right: 14px; font-size: 14px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(201, 179, 123, .18); color: #e5d8b4;
  border: 1px solid rgba(201, 179, 123, .45);
}
.cover.empty-cover {
  background: repeating-linear-gradient(45deg, #f4f1ea, #f4f1ea 10px, #eeeae1 10px, #eeeae1 20px);
  box-shadow: inset 0 0 0 1px var(--line); color: var(--muted);
  justify-content: center; gap: 6px;
}
.cover.empty-cover .frame { border-color: #ddd7c9; }
.cover.empty-cover .plus { font-size: 30px; color: #b9b2a2; }
.cover.empty-cover .ct { color: var(--ink-2); text-shadow: none; }
.cover.empty-cover .ca { color: var(--muted); }

.book-meta { padding-top: 12px; }
.book-meta h3 { font-size: 15px; margin-bottom: 4px; }
.book-meta p { font-size: 14px; color: var(--muted); line-height: 1.5; }
.prog { height: 3px; background: #e7e3d9; border-radius: 2px; margin: 9px 0 6px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--brand); }
.prog-t { font-size: 14px; color: var(--muted); }

.empty-state {
  border: 1px dashed #ddd8ca; border-radius: 14px; padding: 30px;
  text-align: center; background: rgba(255, 255, 255, .5);
}
.empty-state p { font-size: 15px; }
.empty-state .muted { font-size: 14px; margin-top: 6px; }
.muted { color: var(--muted); }

/* ================= 阅读 ================= */
.read-wrap { height: 100%; display: flex; flex-direction: column; position: relative; }
.bg-day { background: #f4f2ec; }
.bg-eye { background: #efe6d3; }
.bg-night { background: #161a18; }
.bg-night .readbar, .bg-night .readfoot { background: rgba(24, 29, 26, .92); border-color: #2b322e; }
.bg-night .rb-title b, .bg-night .pager span { color: #e8ece9; }
.bg-night .rb-title span, .bg-night .chip { color: #a9b3ad; }
.bg-night .icon { color: #c3ccc7; }
.bg-night .chip.on { background: #2d6a58; color: #fff; border-color: #2d6a58; }

.readbar {
  height: 64px; flex: 0 0 64px; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .8); backdrop-filter: blur(8px); z-index: 5;
}
.rb-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.rb-title b {
  font-size: 16px; font-family: "Iowan Old Style", Georgia, serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rb-title span { font-size: 14px; color: var(--muted); white-space: nowrap; }
.rb-actions { margin-left: auto; display: flex; gap: 8px; }
.chip {
  font-size: 14px; padding: 8px 13px; border-radius: 999px;
  border: 1px solid #d6dbd7; color: var(--ink-2); background: #fff;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.stage-area {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 8px;
}
.page-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--muted); background: rgba(244, 242, 236, .7);
}
.errbar {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 10px 16px; font-size: 14px; color: #8a2626;
  background: #fdecec; border-top: 1px solid #f3cfcf;
}
.page-stage { position: relative; box-shadow: 0 12px 30px rgba(23, 33, 28, .16); background: #fff; }
.page-canvas { display: block; }

/* 文本层：透明文字，只用于点词与划选 */
.text-layer {
  position: absolute; inset: 0; overflow: hidden;
  user-select: text; -webkit-user-select: text; cursor: text;
}
.tx-item { position: absolute; white-space: pre; color: transparent; }
.wd {
  display: inline-block; color: transparent; overflow: hidden;
  vertical-align: top; border-radius: 2px;
}
.wd:hover { background: rgba(31, 75, 63, .14); }
.wd.sp { pointer-events: none; }
.ocr-line { color: transparent; }
.ocr-wd { position: absolute; }
.text-layer ::selection { background: rgba(31, 75, 63, .26); }

.readfoot {
  height: 60px; flex: 0 0 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px);
}
.foot { font-size: 14px; color: var(--ink-2); padding: 8px 12px; border-radius: 9px; }
.foot:hover { background: rgba(31, 75, 63, .08); }
.pager { display: flex; align-items: center; gap: 8px; }
.pager span { font-size: 14px; color: var(--ink-2); min-width: 76px; text-align: center; }

/* 划选工具条 */
.selbar {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #1f2a25; color: #fff; padding: 9px 12px 9px 16px;
  border-radius: 12px; box-shadow: 0 12px 26px rgba(0, 0, 0, .28); z-index: 8;
  max-width: min(92vw, 640px);
}
.sel-t { font-size: 14px; color: #dfe6e2; font-family: "Iowan Old Style", Georgia, serif; }
.selbar .btn.sm { background: #fff; color: #1f2a25; border-color: #fff; }
.selbar .icon.sm { color: #b9c3bd; }

/* 译文抽屉 */
.trans-drawer {
  position: absolute; right: 0; top: 64px; bottom: 60px; width: min(420px, 44vw);
  background: rgba(255, 255, 255, .97); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 6; box-shadow: -12px 0 28px rgba(23, 33, 28, .08);
}
.td-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
}
.td-head b { font-size: 15px; }
.td-head span { font-size: 14px; color: var(--muted); margin-right: auto; }
.td-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }
.td-row { margin-bottom: 14px; }
.td-row .en { font-size: 14px; color: var(--muted); line-height: 1.6; }
.td-row .zh { font-size: 15px; line-height: 1.7; margin-top: 3px; }
.td-empty { font-size: 14px; color: var(--muted); }

/* ================= 生词本 ================= */
.words-wrap { height: 100%; display: flex; flex-direction: column; background: var(--paper); }
.words-wrap .topbar { height: 64px; flex: 0 0 64px; }
.tabs {
  display: flex; gap: 26px; padding: 0 24px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .6); flex: 0 0 52px; align-items: flex-end;
}
.tab {
  font-size: 15px; color: var(--muted); padding: 12px 0 10px;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.words-body { flex: 1; display: grid; grid-template-columns: 320px 1fr; overflow: hidden; }
.wlist { list-style: none; overflow-y: auto; border-right: 1px solid var(--line); background: rgba(255, 255, 255, .5); }
.wlist li {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  border-bottom: 1px solid #f0ece3; cursor: pointer; position: relative;
}
.wlist li:hover { background: #fff; }
.wlist li.on { background: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.wlist .ww { font-family: "Iowan Old Style", Georgia, serif; font-size: 17px; }
.wlist .cnt { font-size: 14px; color: var(--muted); margin-left: auto; }
.wlist .dot { width: 7px; height: 7px; border-radius: 50%; background: #6aa47f; }
.wlist .wempty { font-size: 14px; color: var(--muted); cursor: default; justify-content: center; }

.wcard { overflow-y: auto; padding: 26px 30px 40px; }
.wcard.empty { display: flex; align-items: center; justify-content: center; }
.wc-head { display: flex; align-items: flex-start; gap: 14px; }
.wc-head h2 {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 30px; letter-spacing: .01em; line-height: 1.15;
}
.ipa { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.ipa span { font-size: 14px; font-family: "Iowan Old Style", Georgia, serif; }
.ipa-us { color: #2d5a8a; }
.ipa-uk { color: #8a4b2d; }
.speak {
  margin-left: auto; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid #d6dbd7; background: #fff; font-size: 17px;
}
.speak:hover { border-color: var(--brand); }
.matched { font-size: 14px; color: var(--muted); margin-top: 8px; }
.trs { margin: 16px 0 0 18px; }
.trs li { font-size: 16px; line-height: 1.85; }
.ex { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.ex-row { display: flex; gap: 14px; padding: 7px 0; align-items: baseline; }
.ex-k { font-size: 14px; color: var(--muted); min-width: 68px; }
.ex-v { font-size: 15px; font-family: "Iowan Old Style", Georgia, serif; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.tg {
  font-size: 14px; padding: 3px 9px; border-radius: 6px;
  background: #eef3f0; color: var(--brand); border: 1px solid #d8e4de;
}
.tg.soft { background: #f6f2e8; color: #8a763c; border-color: #e8dfc8; }
.src { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.src-en { font-size: 15px; line-height: 1.75; font-family: "Iowan Old Style", Georgia, serif; color: var(--ink-2); }
.link { font-size: 14px; color: var(--brand); text-decoration: underline; margin-top: 8px; }
.wc-foot { display: flex; gap: 10px; margin-top: 22px; }

/* ================= 浮层（两个独立浮层，样式共享） ================= */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(18, 26, 22, .38);
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 76px 24px 24px;
  animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.panel {
  position: relative; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(12, 20, 16, .3);
  max-height: calc(100vh - 100px); overflow-y: auto;
  animation: slidein .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slidein { from { transform: translateX(18px); opacity: .4; } to { transform: none; opacity: 1; } }
.wordcard { width: 400px; padding: 26px 26px 22px; }
.wordcard .close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border-radius: 50%; color: var(--muted); font-size: 15px;
}
.wordcard .close:hover { background: #f2f4f2; color: var(--ink); }
.wordcard .wc-head { padding-right: 30px; }
.wordcard h2 { font-size: 27px; }
.wordcard .trs li { font-size: 15px; line-height: 1.8; }
.wordcard .wc-foot { margin-top: 20px; }
.wordcard .wc-foot .btn { flex: 1; text-align: center; }

.parsebox { width: 480px; padding: 24px 26px 20px; }
.parsebox .collapse {
  position: absolute; top: 12px; left: 12px; width: 32px; height: 32px;
  border-radius: 50%; color: var(--muted); font-size: 20px;
}
.parsebox .collapse:hover { background: #f2f4f2; color: var(--ink); }
.pb-label { font-size: 14px; color: var(--muted); margin: 12px 0 6px; letter-spacing: .04em; }
.pb-src { font-size: 16px; line-height: 1.75; font-family: "Iowan Old Style", Georgia, serif; }
.pb-dst { font-size: 17px; line-height: 1.85; color: var(--ink); }
.pb-engine { font-size: 14px; color: var(--muted); margin-top: 10px; }
.pb-foot { display: flex; gap: 10px; margin-top: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(23, 33, 28, .94); color: #fff; font-size: 14px;
  padding: 11px 18px; border-radius: 11px; z-index: 60;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .26);
  animation: fade .18s ease-out;
}

/* ================= 竖屏 / 窄屏 ================= */
@media (max-width: 900px) {
  .words-body { grid-template-columns: 1fr; }
  .wlist { border-right: 0; border-bottom: 1px solid var(--line); max-height: 38vh; }
  .overlay { align-items: flex-end; justify-content: center; padding: 0; }
  .panel {
    width: 100% !important; max-height: 76vh;
    border-radius: 18px 18px 0 0;
    animation: up .22s cubic-bezier(.2, .8, .3, 1);
  }
  @keyframes up { from { transform: translateY(24px); } to { transform: none; } }
  .trans-drawer { width: 100%; top: auto; height: 52vh; border-left: 0; border-top: 1px solid var(--line); }
  .book { width: 152px; }
  .cover .ct { font-size: 16px; }
  .shelf { padding: 18px 16px 36px; }
  .topbar { padding: 0 14px; }
  .dict-state { display: none; }
}
@media (max-width: 620px) {
  .sec-title { font-size: 15px; }
  .book-row { gap: 14px; }
  .book { width: calc(50% - 7px); }
  .wordcard h2 { font-size: 24px; }
}
