:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1d24;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --blue: #dbeafe; --blue-text: #1e40af;
  --purple: #ede9fe; --purple-text: #6d28d9;
  --amber: #fef3c7; --amber-text: #92400e;
  --green: #d1fae5; --green-text: #065f46;
  --gray: #f3f4f6; --gray-text: #4b5563;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --topbar-h: 56px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  overflow: hidden;
}
.hidden { display: none !important; }
svg { width: 1.2em; height: 1.2em; display: inline-block; vertical-align: middle; }

/* ---------- 登录 ---------- */
.login-page {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #eef2f9 0%, #e8ecf4 100%); padding: 20px;
  overflow-y: auto;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px;
  padding: 36px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.08); text-align: center;
}
.login-icon {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 16px;
  background: var(--blue); color: var(--blue-text); display: flex; align-items: center; justify-content: center;
}
.login-icon svg { width: 32px; height: 32px; }
.login-card h1 { font-size: 24px; font-weight: 600; }
.login-sub { color: var(--text-2); font-size: 13px; margin: 4px 0 28px; }
.input-group { text-align: left; margin-bottom: 16px; }
.input-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; background: var(--bg); color: inherit; outline: none; transition: border-color .2s;
}
select:focus { border-color: var(--primary); }
input[type=range] { width: 100%; accent-color: var(--primary); }
#tts-card .btn-primary, #tts-card .btn-secondary { width: auto; padding: 10px 18px; }
input:focus { border-color: var(--primary); }
.btn-primary {
  width: 100%; padding: 13px; background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(.98); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* 记住登录状态 */
.login-remember {
  display: flex; align-items: center; gap: 8px; text-align: left;
  font-size: 13px; color: var(--text-2); margin: -2px 0 18px;
  cursor: pointer; user-select: none;
}
.login-remember input[type=checkbox] {
  width: 16px; height: 16px; margin: 0; flex-shrink: 0;
  accent-color: var(--primary); cursor: pointer;
}

/* 验证码 */
.captcha-hint { color: var(--text-3); font-size: 12px; font-weight: normal; }
.captcha-row { display: flex; gap: 8px; align-items: stretch; }
.captcha-row input[type=text] { flex: 1; min-width: 0; }
.captcha-img {
  width: 150px; height: 46px; flex-shrink: 0; object-fit: cover;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #eef2ff; cursor: pointer;
}
@media (max-width: 420px) {
  .captcha-img { width: 124px; height: 44px; }
}

/* ---------- 布局 ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; z-index: 30;
  padding-top: env(safe-area-inset-top);
}
.icon-btn {
  width: 38px; height: 38px; flex-shrink: 0; border: none; background: transparent; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text);
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn.spinning svg { animation: btn-spin .6s ease; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 4px; }
.notify-bell { position: relative; }
.notify-badge { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-sizing: border-box; }

.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border); z-index: 40;
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.sidebar nav { padding: 12px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sidebar nav::-webkit-scrollbar { width: 5px; }
.sidebar nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 4px;
  border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; color: var(--text-2); text-align: left; transition: all .15s;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--blue); color: var(--blue-text); font-weight: 500; }
.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 8px;
}
.status-dot { width: 8px; height: 8px; background: #10b981; border-radius: 50%; }
.sidebar-overlay { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.4); z-index: 35; }

.content {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  margin-left: var(--sidebar-w);
}
.page { display: none; max-width: 900px; margin: 0 auto; }
.page.active { display: block; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-header h2 { font-size: 20px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; }

/* ---------- 首页 ---------- */
.welcome-banner {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%); color: #fff;
  border-radius: var(--radius); padding: 24px; display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.welcome-banner h2 { font-size: 20px; font-weight: 600; }
.welcome-banner p { font-size: 13px; opacity: .85; margin-top: 4px; }
.welcome-icon svg { width: 48px; height: 48px; opacity: .7; }

/* 实时天气卡片 */
.weather-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px; overflow: hidden;
}
.weather-loading { font-size: 13px; color: var(--text-3); padding: 8px 0; }
.wx-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.wx-head-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.wx-refresh {
  border: 1px solid var(--border); background: transparent; color: var(--text-3);
  border-radius: 7px; padding: 3px 9px; font-size: 11px; cursor: pointer;
}
.wx-refresh:hover { background: var(--surface-2); color: var(--text); }
.wx-main { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.wx-icon {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 16px;
  background: linear-gradient(135deg, #60a5fa 0%, #fbbf24 100%); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.wx-icon svg { width: 40px; height: 40px; }
.wx-now { min-width: 120px; }
.wx-temp { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -1px; }
.wx-temp span { font-size: 18px; font-weight: 500; vertical-align: top; }
.wx-desc { font-size: 14px; color: var(--text); margin-top: 4px; font-weight: 500; }
.wx-city { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.wx-meta {
  margin-left: auto; display: grid; grid-template-columns: repeat(2, auto);
  gap: 8px 24px;
}
.wx-meta div { display: flex; flex-direction: column; gap: 2px; }
.wx-meta span { font-size: 11px; color: var(--text-3); }
.wx-meta b { font-size: 14px; font-weight: 600; color: var(--text); }
.wx-forecast {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.wx-forecast-day {
  display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 8px;
}
.wx-f-label { font-size: 12px; color: var(--text-2); font-weight: 500; width: 100%; text-align: center; }
.wx-f-icon { color: var(--primary); display: flex; }
.wx-f-icon svg { width: 22px; height: 22px; }
.wx-f-desc { font-size: 12px; color: var(--text-2); }
.wx-f-temp { font-size: 12px; color: var(--text); font-weight: 600; width: 100%; text-align: center; }
@media (max-width: 600px) {
  .wx-meta { margin-left: 0; width: 100%; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .wx-forecast-day { gap: 4px; }
  .wx-f-desc { font-size: 11px; }
}

/* 首页天气下方的搜索栏（可直接点击输入） */
.home-search {
  position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px 14px; height: 46px; margin-bottom: 16px; cursor: text;
  border: 1px solid transparent; transition: border-color .15s, box-shadow .15s;
}
.home-search:focus-within, .home-search.open { border-color: var(--primary); box-shadow: 0 4px 18px rgba(139,92,246,.18); }
.home-search > svg { width: 19px; height: 19px; color: var(--primary); flex: 0 0 auto; cursor: pointer; }
.home-search > input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--text); font-size: 14px; font-family: inherit;
}
.home-search > input::placeholder { color: var(--text-3); }
.home-search-kbd {
  font-size: 11px; color: var(--text-3); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px; flex: 0 0 auto;
}
.home-search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 200;
  background: var(--surface); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.24);
  border: 1px solid var(--border); padding: 8px; max-height: 56vh; overflow-y: auto;
  animation: searchIn .16s ease-out;
}
.home-search-results.hidden { display: none; }

.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text-2); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 14px; }
.app-tile {
  background: var(--surface); border: none; border-radius: var(--radius); padding: 18px 8px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; font-size: 13px; color: var(--text);
}
.app-tile:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.app-tile:active { transform: scale(.96); }
.app-tile-icon { width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.app-tile-icon svg { width: 26px; height: 26px; }
.app-tile-icon.blue { background: var(--blue); color: var(--blue-text); }
.app-tile-icon.purple { background: var(--purple); color: var(--purple-text); }
.app-tile-icon.amber { background: var(--amber); color: var(--amber-text); }
.app-tile-icon.green { background: var(--green); color: var(--green-text); }
.app-tile-icon.gray { background: var(--gray); color: var(--gray-text); }

/* ---------- 通用按钮 ---------- */
.btn-secondary {
  padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; color: var(--text); cursor: pointer; transition: all .15s;
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary:active { transform: scale(.97); }
.btn-icon {
  width: 36px; height: 36px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text);
}
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:active { background: var(--surface-2); }
.loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 14px; }

/* ---------- 文件管理 ---------- */
.pathbar {
  background: var(--surface); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px;
  font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  box-shadow: var(--shadow); word-break: break-all;
}
.pathbar button { border: none; background: transparent; color: var(--primary); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.file-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--surface-2); }
.file-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.file-icon svg { width: 20px; height: 20px; }
.file-icon.dir { background: var(--blue); color: var(--blue-text); }
.file-icon.video { background: var(--purple); color: var(--purple-text); }
.file-icon.text { background: var(--amber); color: var(--amber-text); }
.file-icon.audio { background: var(--green); color: var(--green-text); }
.file-icon.other { background: var(--gray); color: var(--gray-text); }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.file-actions { display: flex; gap: 4px; }
.file-actions button {
  border: none; background: transparent; color: var(--text-2); cursor: pointer; padding: 6px;
  border-radius: 6px; display: flex; align-items: center;
}
.file-actions button:hover { background: var(--surface); color: var(--primary); }
.file-actions button.danger:hover { color: var(--danger); }
.file-actions svg { width: 17px; height: 17px; }
.upload-progress { margin-top: 12px; }
.upload-item { background: var(--surface); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 13px; }
.upload-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.upload-bar-fill { height: 100%; background: var(--primary); transition: width .2s; }

/* ---------- 影音 ---------- */
.media-hint, .reader-hint { font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.media-browser { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video-player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; }
.video-player-header {
  background: var(--surface); padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px;
}
.video-player-header .btn-icon { border: none; }
#video-player { width: 100%; max-height: 70vh; display: block; background: #000; }

/* ---------- 阅读器 ---------- */
.bookshelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }
.book-item {
  background: var(--surface); border-radius: var(--radius); padding: 16px 12px; text-align: center;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .15s;
}
.book-item:hover { transform: translateY(-3px); }
.book-cover {
  width: 100%; aspect-ratio: 3/4; background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 12px;
  margin-bottom: 10px; color: #fff;
}
.book-cover svg { width: 32px; height: 32px; }
.book-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-size { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.reader-view { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.reader-header {
  padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.reader-header .btn-icon { border: none; }
.reader-header span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-content { padding: 24px; min-height: 50vh; white-space: pre-wrap; word-wrap: break-word; font-size: 18px; line-height: 1.8; }
.reader-content.theme-sepia { background: #f5ecd7; color: #4a3f35; }
.reader-content.theme-dark { background: #1f2023; color: #d1d5db; }
.reader-controls {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2);
}
.font-settings { padding: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.font-settings label { font-size: 13px; display: flex; align-items: center; gap: 12px; }
.font-settings input[type=range] { flex: 1; }
.theme-switch { display: flex; gap: 8px; }
.theme-switch button { flex: 1; padding: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 13px; }
.theme-switch button.active { border-color: var(--primary); color: var(--primary); background: var(--blue); }

/* ---------- 系统状态 ---------- */
.system-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }
.sys-card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.sys-card h4 { font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 12px; }
.sys-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.sys-row span:last-child { font-weight: 500; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 6px 0 12px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }
.progress-fill.warn { background: #f59e0b; }
.progress-fill.danger { background: var(--danger); }
.process-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.process-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.process-item:last-child { border-bottom: none; }
.process-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.process-cpu { width: 60px; text-align: right; color: var(--text-2); }
.process-mem { width: 60px; text-align: right; color: var(--text-2); }
.process-kill { border: none; background: transparent; color: var(--danger); cursor: pointer; padding: 4px; }
.process-kill svg { width: 16px; height: 16px; }

/* ---------- 设置 ---------- */
.settings-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
  box-shadow: var(--shadow); max-width: 500px;
}
.settings-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.settings-hint { font-size: 12px; color: var(--text-2); margin-bottom: 16px; }
.settings-card .btn-primary { width: auto; padding: 10px 20px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row code { background: var(--surface-2); padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.form-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.form-msg.success { color: #059669; }
.form-msg.error { color: var(--danger); }

/* 数据用量（仅管理员） */
.usage-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.usage-box { background: var(--surface-2); border-radius: 10px; padding: 12px; text-align: center; }
.usage-box .u-val { font-size: 17px; font-weight: 700; color: var(--text); word-break: break-all; }
.usage-box .u-lbl { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.usage-box.up .u-val { color: #2563eb; }
.usage-box.down .u-val { color: #059669; }
.usage-subtitle { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 0 8px; }
.usage-list { display: flex; flex-direction: column; }
.usage-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.usage-row:last-child { border-bottom: none; }
.usage-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.usage-row-head .u-name { color: var(--text); font-weight: 500; }
.usage-row-head .u-num { color: var(--text-2); font-variant-numeric: tabular-nums; }
.usage-row .progress { margin: 6px 0 0; height: 5px; }
@media (max-width: 420px) {
  .usage-summary { grid-template-columns: repeat(2, 1fr); }
}

/* 二维码分享 */
.share-body { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.share-qr-wrap { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; flex-shrink: 0; line-height: 0; }
.share-qr-wrap img { width: 180px; height: 180px; display: block; }
.share-meta { flex: 1; min-width: 200px; }
.share-meta .info-row { border-bottom: none; padding-bottom: 4px; color: var(--primary); font-weight: 600; }
.share-url-box { background: var(--surface-2); border-radius: 8px; padding: 10px; word-break: break-all; }
.share-url-box code { font-size: 12px; color: var(--text); line-height: 1.6; }
#share-note { margin: 10px 0 14px; }

/* ---------- 弹窗 / Toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: var(--surface); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 340px; }
.modal-card h3 { font-size: 17px; margin-bottom: 14px; }
.modal-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f2937; color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; box-shadow: 0 4px 20px rgba(0,0,0,.2);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 全局悬浮播放器（简约玻璃小圆标） ---------- */
.np-ball {
  position: fixed; z-index: 145; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: grab;
  background: rgba(30, 41, 59, .72); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 4px 16px rgba(15,23,42,.18); touch-action: none; user-select: none;
  opacity: .95; transition: opacity .3s, transform .15s, width .25s, height .25s, background .25s;
}
.np-ball:hover { opacity: 1; transform: scale(1.05); }
.np-ball.dragging { cursor: grabbing; opacity: 1; transform: scale(1.1); z-index: 210; }
/* 暂停态：收敛得更小更淡；隐藏态：淡出且不占交互 */
.np-ball.idle { width: 38px; height: 38px; opacity: .5; }
.np-ball.idle .np-ico { width: 17px; height: 17px; }
.np-ball.hidden { opacity: 0; transform: scale(.6); pointer-events: none; }
/* 待续播态：稍大、带柔和呼吸描边与播放三角，明确提示可点按继续 */
.np-ball.resume { width: 50px; height: 50px; opacity: 1; background: rgba(37, 99, 235, .9); border-color: rgba(255,255,255,.35); box-shadow: 0 6px 22px rgba(37,99,235,.42); }
.np-ball.resume .np-ico { width: 23px; height: 23px; }
.np-ball.resume::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid rgba(37,99,235,.6); animation: np-pulse 2.2s ease-out infinite; pointer-events: none; }
.np-ico { display: flex; align-items: center; justify-content: center; width: 21px; height: 21px; pointer-events: none; }
.np-ico svg { width: 100%; height: 100%; display: block; }
.np-ring { position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid rgba(148,163,184,.45); opacity: 0; }
.np-ball.pulse .np-ring { animation: np-pulse 2s ease-out infinite; }
@keyframes np-pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.3); opacity: 0; } }
.np-panel {
  position: fixed; z-index: 144; width: 274px; padding: 16px;
  background: rgba(30, 41, 59, .92); color: #fff;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.14); border-radius: 16px;
  box-shadow: 0 10px 32px rgba(15,23,42,.28);
}
.np-panel .np-close { color: rgba(255,255,255,.6); }
.np-panel .np-src { background: rgba(255,255,255,.14); color: #fff; }
.np-panel .np-ctrls button { border-color: rgba(255,255,255,.16); color: #fff; }
.np-panel .np-ctrls button:hover { background: rgba(255,255,255,.1); }
.np-panel .np-prog input[type=range] { accent-color: #93c5fd; }
.np-panel.hidden { display: none; }
.np-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.np-src { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--blue); color: var(--blue-text); }
.np-close { border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--text-3); padding: 3px 5px; }
.np-title { font-size: 15px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-sub { font-size: 12px; opacity: .6; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-prog { display: flex; align-items: center; gap: 9px; margin: 13px 0; }
.np-prog input[type=range] { flex: 1; min-width: 0; accent-color: #2563eb; height: 18px; cursor: pointer; }
.np-time { font-size: 11px; opacity: .65; white-space: nowrap; }
/* 控制栏两行三列：一行放不下时改为两栏，保证「定时」等文字按钮完整显示 */
.np-ctrls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.np-ctrls button {
  min-width: 0; border: 1px solid rgba(255,255,255,.14); background: transparent; color: #fff;
  border-radius: 9px; padding: 8px 4px; font-size: 12px; cursor: pointer; white-space: nowrap; overflow: hidden;
}
.np-ctrls button:hover { background: rgba(255,255,255,.12); }
.np-ctrls #np-toggle { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.16); }
.np-ctrls #np-prev, .np-ctrls #np-next, .np-ctrls #np-open, .np-ctrls #np-stop { font-size: 14px; }
.np-ctrls #np-sleep.on { color: #7dd3fc; border-color: rgba(125,211,252,.5); background: rgba(56,189,248,.12); }
.np-ctrls .np-icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.np-ctrls .np-icon-btn svg { width: 17px; height: 17px; display: block; }

/* 定时关闭弹出菜单：默认在面板上方弹出，空间不足时加 .below 改到下方 */
.np-sleep-menu {
  position: absolute; right: 14px; bottom: calc(100% + 6px); z-index: 146;
  min-width: 150px; padding: 6px;
  max-height: min(50vh, 320px); overflow-y: auto;
  background: rgba(30, 41, 59, .97); border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; box-shadow: 0 8px 26px rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.np-sleep-menu.below { bottom: auto; top: calc(100% + 6px); }
.np-sleep-menu .np-sleep-title { font-size: 11px; opacity: .5; padding: 5px 10px 7px; }
.np-sleep-menu div[data-mins] { font-size: 13px; padding: 9px 11px; border-radius: 8px; cursor: pointer; }
.np-sleep-menu div[data-mins]:hover { background: rgba(255,255,255,.12); }

/* ---------- 插件持久 pane ---------- */
.plugin-pane { display: block; }
.plugin-pane.hidden { display: none; }

/* ---------- 插件全屏弹窗 ---------- */
.plugin-popout {
  position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column;
  background: var(--bg);
}
.popout-bar {
  height: 50px; flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px; gap: 12px;
  padding-top: env(safe-area-inset-top);
}
.popout-title { flex: 1; font-size: 16px; font-weight: 600; }
.popout-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.popout-body .plugin-pane { max-width: 900px; margin: 0 auto; padding: 16px; }
body.popout-open { overflow: hidden; }

/* ---------- 插件独立浏览器窗口（window.open 打开）---------- */
body.plugin-window .topbar,
body.plugin-window .sidebar,
body.plugin-window .sidebar-overlay,
body.plugin-window .menu-btn { display: none !important; }
body.plugin-window .content { margin-left: 0; padding: 0; height: 100vh; overflow: hidden; }
body.plugin-window #page-plugin { height: 100vh; }
body.plugin-window #plugin-container { height: 100vh; }
body.plugin-window .plugin-pane { height: 100vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
body.plugin-window .plugin-pane .rd-app { max-width: 860px; margin: 0 auto; }
/* 独立窗口里"全屏阅读"按钮无意义，隐藏它 */
body.plugin-window .rd-popout-btn { display: none !important; }

/* ---------- 响应式：手机 ---------- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 20px rgba(0,0,0,.1); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .content { margin-left: 0; padding: 14px; }
  .welcome-banner { padding: 20px; }
  .welcome-banner h2 { font-size: 18px; }
  .welcome-icon svg { width: 38px; height: 38px; }
  .app-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .app-tile { padding: 14px 4px 12px; }
  .app-tile-icon { width: 44px; height: 44px; }
  .file-actions { flex-direction: column; gap: 0; }
  .bookshelf { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .reader-content { padding: 18px; }
  .system-grid { grid-template-columns: 1fr; }
  .process-cpu, .process-mem { display: none; }
  /* 悬浮播放器：手机上给得更宽更大，触控更从容，且不溢出屏幕 */
  .np-panel { width: min(320px, calc(100vw - 24px)); padding: 18px; border-radius: 18px; }
  .np-head { margin-bottom: 11px; }
  .np-title { font-size: 16px; }
  .np-sub { font-size: 13px; }
  .np-prog { margin: 15px 0; }
  .np-ctrls { gap: 9px; }
  .np-ctrls button { padding: 11px 4px; font-size: 13px; }
  .np-ctrls #np-prev, .np-ctrls #np-next, .np-ctrls #np-open, .np-ctrls #np-stop { font-size: 15px; }
  .np-sleep-menu { min-width: 160px; }
  .np-sleep-menu div[data-mins] { font-size: 14px; padding: 10px 12px; }
}

/* ---------- 应用中心 ---------- */
.store-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.store-card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.store-card-head { display: flex; align-items: center; gap: 12px; }
.store-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.store-icon svg { width: 24px; height: 24px; }
.store-icon.blue { background: var(--blue); color: var(--blue-text); }
.store-icon.purple { background: var(--purple); color: var(--purple-text); }
.store-icon.amber { background: var(--amber); color: var(--amber-text); }
.store-icon.green { background: var(--green); color: var(--green-text); }
.store-icon.gray { background: var(--gray); color: var(--gray-text); }
.store-name { font-size: 15px; font-weight: 600; }
.store-version { font-size: 11px; color: var(--text-3); }
.store-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; flex: 1; }
.store-actions { display: flex; gap: 8px; }
.store-actions button { flex: 1; padding: 9px; border-radius: 8px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.store-actions .install { background: var(--primary); color: #fff; border-color: var(--primary); }
.store-actions .danger { color: var(--danger); }
.store-badge { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: var(--green); color: var(--green-text); }
.store-badge.off { background: var(--gray); color: var(--gray-text); }
@media (max-width: 768px) { .store-list { grid-template-columns: 1fr; } }

/* ---------- 注册 / 用户管理 ---------- */
.login-switch { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 14px; }
.login-switch a { color: var(--primary); text-decoration: none; font-weight: 500; }
.login-switch a:hover { text-decoration: underline; }
.user-list { display: flex; flex-direction: column; gap: 12px; }
.user-card { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.user-card.banned { opacity: .7; }
.user-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-meta { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.user-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.user-actions .btn-secondary { padding: 7px 12px; font-size: 12px; }
.user-actions .danger { color: var(--danger); }
.user-badge { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 20px; background: var(--gray); color: var(--text-2); }
.user-badge.admin { background: var(--blue); color: var(--blue-text); }
.user-badge.banned { background: #fee2e2; color: #b91c1c; }
.user-empty { background: var(--surface); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--text-2); }
@media (max-width: 768px) {
  .user-card { flex-direction: column; align-items: stretch; }
  .user-actions { flex-wrap: wrap; }
  .user-actions .btn-secondary { flex: 1; }
}

/* ---------- 访客模式 ---------- */
.guest-entry { margin-top: 20px; text-align: center; }
.guest-or { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin-bottom: 14px; }
.guest-or::before, .guest-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.btn-guest { width: 100%; padding: 11px 16px; border-radius: 10px; border: 1px dashed var(--primary); background: transparent; color: var(--primary); font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-guest:hover { background: rgba(79, 70, 229, .06); }
.guest-note { font-size: 11px; color: var(--text-3); margin-top: 10px; line-height: 1.6; }
body.guest-mode #weather-card { display: none; }
body.guest-mode .sidebar-footer { opacity: .75; }

/* ============ 全局搜索命令面板 ============ */
.search-overlay { position: fixed; inset: 0; z-index: 3000; background: rgba(15,23,42,.5); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.search-overlay.hidden { display: none; }
.search-modal { width: 100%; max-width: 620px; background: var(--surface); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.28); overflow: hidden; display: flex; flex-direction: column; max-height: 74vh; animation: searchIn .16s ease-out; }
@keyframes searchIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.search-input-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.search-input-row svg { width: 21px; height: 21px; color: var(--primary); flex: 0 0 auto; }
.search-input-row input { flex: 1; border: none; outline: none; background: transparent; color: var(--text); font-size: 16px; font-family: inherit; min-width: 0; }
.search-input-row input::placeholder { color: var(--text-3); }
.search-esc { font-size: 11px; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
.search-results { overflow-y: auto; flex: 1; padding: 8px; min-height: 90px; }
.search-hint, .search-noresult { text-align: center; color: var(--text-3); font-size: 13px; padding: 28px 12px; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; }
.search-item.active { background: var(--primary); color: #fff; }
.search-icon { font-size: 19px; width: 26px; text-align: center; flex: 0 0 auto; }
.search-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.search-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-desc { font-size: 12px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-kind { font-size: 11px; opacity: .6; border: 1px solid currentColor; border-radius: 6px; padding: 2px 7px; flex: 0 0 auto; }
.search-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); }
.search-foot b { color: var(--text-2); font-weight: 600; }
@media (max-width: 600px) { .search-overlay { padding: 8vh 10px 10px; } .search-foot { gap: 10px; } }
