/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #14161c;
  --bg-2: #1c1f28;
  --bg-3: #252a36;
  --line: #313747;
  --text: #e6e9f0;
  --text-2: #9aa3b5;
  --accent: #6c8cff;
  --accent-2: #8a6cff;
  --danger: #ff6b6b;
  --ok: #4ecb8d;
  --warn: #f0a94e;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  overflow: hidden;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
kbd {
  background: #333a4d; border-radius: 4px; padding: 0 5px;
  font-family: Consolas, monospace; font-size: 12px; border: 1px solid #454e66;
}

/* ========== 登录 ========== */
.auth-view {
  height: 100%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, #232a45 0%, var(--bg) 55%);
}
.auth-card {
  width: 380px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 34px 32px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.auth-logo { font-size: 30px; font-weight: 700; text-align: center; }
.auth-sub { text-align: center; color: var(--text-2); font-size: 13px; margin: 6px 0 22px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: 9px; border: 1px solid var(--line);
  background: transparent; color: var(--text-2); font-size: 15px;
}
.auth-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#auth-form label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
#auth-form input[type=text], #auth-form input[type=password] {
  width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font-size: 15px; outline: none;
}
#auth-form input:focus { border-color: var(--accent); }
.auth-check { display: flex; align-items: flex-start; gap: 8px; line-height: 1.5; }
.auth-check input { margin-top: 4px; }
.auth-check b { color: var(--warn); }
.btn-primary {
  width: 100%; padding: 11px; border-radius: 9px; border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 16px; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.auth-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 20px; text-align: center; }
.auth-foot { text-align: center; color: var(--text-2); font-size: 12px; margin-top: 18px; }

/* ========== 主框架 ========== */
.app-view { display: flex; height: 100%; }
.sidebar {
  width: 200px; background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; flex-shrink: 0;
}
.logo { font-size: 21px; font-weight: 700; padding: 0 10px 18px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-radius: 10px; border: none; background: transparent; color: var(--text-2);
  font-size: 15px; text-align: left;
}
.nav-btn span { font-size: 17px; }
.nav-btn:hover { background: var(--bg-3); color: var(--text); }
.nav-btn.active { background: var(--bg-3); color: #fff; font-weight: 600; }
.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 12px; }
.fish-btn {
  width: 100%; padding: 9px; border-radius: 9px; border: 1px dashed var(--warn);
  background: transparent; color: var(--warn); font-size: 13px; margin-bottom: 10px;
}
.fish-btn.on { background: rgba(240,169,78,.15); border-style: solid; }
.user-box { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.user-name { color: var(--text-2); font-size: 13px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link {
  background: none; border: none; color: var(--accent); font-size: 13px; padding: 4px;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: var(--danger); }

.main { flex: 1; overflow-y: auto; padding: 28px 32px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h2 { font-size: 22px; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 4px; }

/* ========== 通用卡片/按钮 ========== */
.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; margin-bottom: 14px;
}
.btn {
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); font-size: 14px;
}
.btn:hover { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.book-card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; cursor: pointer; transition: transform .12s, border-color .12s;
}
.book-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.book-card .bc-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.book-card .bc-meta { color: var(--text-2); font-size: 12.5px; }
.book-card .bc-actions { margin-top: 12px; display: flex; gap: 8px; }
.book-card .bc-actions button { font-size: 12.5px; padding: 5px 10px; }
.empty { color: var(--text-2); text-align: center; padding: 60px 0; font-size: 14px; }
.empty .big { font-size: 44px; display: block; margin-bottom: 12px; }
.upload-zone {
  border: 2px dashed var(--line); border-radius: 12px; padding: 30px; text-align: center;
  color: var(--text-2); cursor: pointer; margin-bottom: 20px; transition: border-color .15s;
}
.upload-zone:hover { border-color: var(--accent); color: var(--text); }
.upload-zone .big { font-size: 34px; display: block; margin-bottom: 8px; }
input[type=text], input[type=search], textarea, select {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; outline: none; font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }

/* TXT 导入对话框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  width: 460px; padding: 26px;
}
.modal h3 { margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 12px; }
.modal input[type=text] { width: 100%; margin-top: 6px; }
.modal .modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal .modal-btns button { flex: 1; }
.modal-check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }

/* ========== 搜索 ========== */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-bar input { flex: 1; padding: 13px 16px; font-size: 16px; }
.search-bar button { padding: 0 26px; }
.search-item {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 18px; margin-bottom: 12px;
}
.search-item .si-title { font-size: 16px; color: var(--accent); text-decoration: none; font-weight: 600; }
.search-item .si-title:hover { text-decoration: underline; }
.search-item .si-url { color: var(--ok); font-size: 12.5px; margin: 4px 0; word-break: break-all; }
.search-item .si-snippet { color: var(--text-2); font-size: 13.5px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 20px; margin-left: 8px; vertical-align: middle; }
.badge-safe { background: rgba(78,203,141,.15); color: var(--ok); border: 1px solid rgba(78,203,141,.4); }
.badge-warn { background: rgba(240,169,78,.15); color: var(--warn); border: 1px solid rgba(240,169,78,.4); }
.si-reasons { color: var(--warn); font-size: 12.5px; margin-top: 6px; }
.si-actions { margin-top: 10px; display: flex; gap: 10px; align-items: center; }
.switch-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; }

/* ========== 写作 ========== */
.work-list-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 15px 18px; margin-bottom: 10px; cursor: pointer;
}
.work-list-item:hover { border-color: var(--accent); }
.work-list-item .wl-title { font-size: 16px; font-weight: 600; }
.work-list-item .wl-meta { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }
.editor-wrap { display: flex; flex-direction: column; height: calc(100vh - 56px); }
.editor-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.editor-bar input.title-input {
  flex: 1; font-size: 18px; font-weight: 600; padding: 10px 14px;
}
.editor-status { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.editor-status.saving { color: var(--warn); }
.editor-status.saved { color: var(--ok); }
.editor-textarea {
  flex: 1; width: 100%; resize: none; font-size: 17px; line-height: 2;
  padding: 26px 34px; border-radius: 12px; background: var(--bg-2);
}
.word-count { font-weight: 700; color: var(--accent); }

/* ========== 历史 ========== */
.history-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.history-tab {
  padding: 8px 20px; border-radius: 20px; border: 1px solid var(--line);
  background: transparent; color: var(--text-2);
}
.history-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.hist-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 16px; margin-bottom: 9px; cursor: pointer;
}
.hist-item:hover { border-color: var(--accent); }
.hist-item .h-title { font-size: 15px; }
.hist-item .h-sub { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.hist-item .h-time { color: var(--text-2); font-size: 12.5px; }

/* ========== 设置 ========== */
.settings-section h3 { font-size: 16px; margin-bottom: 14px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: none; }
.settings-row .sr-label { font-size: 14.5px; }
.settings-row .sr-desc { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 20px; transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: var(--text-2); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); background: #fff; }

/* ========== 阅读器 ========== */
.reader-view {
  position: fixed; inset: 0; z-index: 300;
  /* 阅读器背后的衬底（透明背景时透出） */
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(108,140,255,.10), transparent 60%),
    radial-gradient(900px 500px at 90% 100%, rgba(138,108,255,.10), transparent 60%),
    repeating-linear-gradient(45deg, #101218 0 28px, #0e1016 28px 56px);
  display: flex; flex-direction: column;
}
.reader-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  background: rgba(20,22,28,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.rb-btn {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 14px; font-size: 13.5px;
}
.rb-btn:hover { border-color: var(--accent); }
.rb-title { font-weight: 600; font-size: 14.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-select { max-width: 220px; padding: 7px 10px; font-size: 13px; }
.rb-status { color: var(--text-2); font-size: 12.5px; margin-left: auto; }
.reader-scroll { flex: 1; overflow-y: auto; padding: 40px 20px 80px; }
.reader-page {
  margin: 0 auto; padding: 48px 56px; border-radius: 14px;
  max-width: var(--r-width, 760px);
  background: rgba(var(--r-bg-r, 26), var(--r-bg-g, 26), var(--r-bg-b, 36), var(--r-alpha, .92));
  color: var(--r-color, #d8d4c8);
  font-size: var(--r-fontsize, 20px);
  line-height: var(--r-line, 1.9);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  transition: background .2s;
}
.reader-chapter-title { font-size: 1.35em; text-align: center; margin-bottom: 1.4em; font-weight: 700; }
.reader-content p { margin-bottom: 1.1em; text-indent: 2em; }
.reader-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 3em; padding-top: 1.5em; border-top: 1px solid rgba(128,128,128,.25);
}
.reader-footer .btn-primary { width: auto; padding: 9px 26px; font-size: 15px; }
.reader-footer span { font-size: .75em; opacity: .7; }
.reader-style-panel {
  position: fixed; top: 64px; right: 22px; z-index: 350; width: 290px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.rsp-title { font-weight: 700; margin-bottom: 14px; font-size: 15px; }
.reader-style-panel label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 13px; }
.reader-style-panel input[type=range] { width: 100%; margin-top: 6px; accent-color: var(--accent); }
.reader-style-panel input[type=color] { width: 100%; height: 34px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; }

/* ========== 摸鱼老板键伪装（Excel 风） ========== */
.boss-overlay {
  position: fixed; inset: 0; z-index: 9999; background: #fff; color: #222;
  font-family: "Microsoft YaHei", sans-serif; display: flex; flex-direction: column;
}
.boss-titlebar {
  background: #217346; color: #fff; padding: 6px 12px; display: flex;
  align-items: center; gap: 8px; font-size: 13.5px;
}
.boss-doc-name { flex: 1; }
.boss-win-ctrl { letter-spacing: 6px; font-size: 14px; }
.boss-ribbon {
  display: flex; gap: 22px; padding: 8px 16px; border-bottom: 1px solid #d0d0d0;
  font-size: 13.5px; background: #f7f7f7; color: #444;
}
.boss-formula {
  padding: 6px 14px; border-bottom: 1px solid #d0d0d0; font-family: Consolas, monospace;
  font-size: 13px; color: #333; background: #fafafa;
}
.boss-grid { flex: 1; overflow: auto; }
.boss-grid table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.boss-grid th, .boss-grid td {
  border: 1px solid #d9d9d9; padding: 4px 10px; min-width: 96px; text-align: right;
  font-family: Consolas, monospace;
}
.boss-grid th { background: #f0f0f0; font-weight: normal; color: #555; text-align: center; position: sticky; top: 0; }
.boss-grid td:first-child, .boss-grid th:first-child {
  background: #f0f0f0; text-align: center; color: #555; font-family: "Microsoft YaHei";
  position: sticky; left: 0; min-width: 44px;
}
.boss-statusbar {
  background: #f3f3f3; border-top: 1px solid #d0d0d0; padding: 5px 14px;
  display: flex; gap: 26px; font-size: 12.5px; color: #555;
}
.boss-hint { margin-left: auto; color: #c8c8c8; cursor: default; }
.fish-badge {
  position: fixed; left: 14px; bottom: 12px; z-index: 400;
  background: rgba(240,169,78,.92); color: #3d2b00; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

/* ========== Toast ========== */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: rgba(30,34,44,.96); border: 1px solid var(--line); color: var(--text);
  padding: 11px 22px; border-radius: 10px; font-size: 14px; z-index: 9000;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 80vw;
}
