:root {
  --bg: #0f1117; --card: #171a23; --card2: #1d212d; --border: #262b38;
  --text: #e8ebf2; --muted: #8b93a7; --accent: #7c5cff; --accent2: #9d86ff;
  --green: #34d399; --red: #f87171; --amber: #fbbf24; --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.hidden { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent2); text-decoration: none; }

/* 通用布局 */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: 70px; }
.view { padding: 16px; }
.navbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 58px; display: flex;
  background: #14161e; border-top: 1px solid var(--border); z-index: 50;
}
.navbar button {
  flex: 1; background: none; border: 0; color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.navbar button.active { color: var(--accent2); }
.navbar .ic { font-size: 19px; line-height: 1; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.h { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.spread { justify-content: space-between; }

input, textarea, select {
  width: 100%; background: var(--card2); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; outline: none; font-size: 15px;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.7; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 11px 16px;
  font-size: 15px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: #3a2028; color: #ffb4b4; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.fab { position: fixed; right: 20px; bottom: 76px; width: 52px; height: 52px; border-radius: 50%; font-size: 26px; z-index: 40; box-shadow: 0 6px 20px rgba(124,92,255,.4); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.avatar { width: 42px; height: 42px; border-radius: 10px; background: linear-gradient(135deg, #7c5cff, #4b3cc9); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex: 0 0 42px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.badge.free { background: #23283a; color: var(--muted); }
.badge.vip { background: rgba(124,92,255,.18); color: var(--accent2); }
.badge.svip { background: rgba(251,191,36,.16); color: var(--amber); }
.badge.lifetime { background: rgba(52,211,153,.15); color: var(--green); }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%) translateY(10px);
  background: #242a3a; border: 1px solid var(--border); padding: 9px 16px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: 80%; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: #5b2a33; color: #ffc9c9; }

.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 20px; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; width: 100%; max-width: 400px; }
.modal h3 { margin-bottom: 14px; }

/* 写作页 */
.editor-title { font-size: 18px; font-weight: 700; background: transparent; border: 0; padding: 8px 0; }
.editor-body { min-height: 40vh; background: transparent; border: 0; font-size: 16px; }
.word-count { text-align: right; color: var(--muted); font-size: 12px; }

/* 阅读页 */
.reader-body { font-size: 17px; line-height: 2; white-space: pre-wrap; word-break: break-word; }
.reader-body .speaking { background: rgba(124,92,255,.25); border-radius: 4px; }

/* 登录 */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 28px; }
.logo { font-size: 30px; font-weight: 800; text-align: center; margin-bottom: 6px; background: linear-gradient(90deg, #9d86ff, #7c5cff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.slogan { text-align: center; color: var(--muted); margin-bottom: 24px; }
.tab-row { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-row button { flex: 1; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 9px; color: var(--muted); }
.tab-row button.active { color: #fff; border-color: var(--accent); background: rgba(124,92,255,.15); }
.code-row { display: flex; gap: 8px; }
.code-row button { flex: 0 0 110px; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 图形 / 滑块验证码 */
.cap-box { margin: 12px 0 4px; }
.cap-loading { font-size: 12px; color: var(--muted); padding: 10px 0; }
.cap-loading.err { color: #f87171; }
.cap-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cap-refresh { background: none; border: 0; color: var(--accent2); font-size: 12px; padding: 2px 4px; }
.cap-stage { position: relative; width: 100%; max-width: 320px; aspect-ratio: 2 / 1; background-size: 100% 100%; background-repeat: no-repeat; border-radius: 8px; overflow: hidden; user-select: none; }
.cap-piece { position: absolute; left: 0; aspect-ratio: 1; background-size: 100% 100%; border-radius: 6px; pointer-events: none; }
.cap-track { position: relative; height: 36px; margin-top: 8px; border-radius: 8px; background: var(--card2); border: 1px solid var(--border); overflow: hidden; }
.cap-thumb { position: absolute; left: 0; top: 0; width: 46px; height: 34px; border-radius: 7px; background: linear-gradient(180deg, #8d76ff, #6a4ff0); color: #fff; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
.cap-thumb:active { cursor: grabbing; }
.cap-text-row { display: flex; gap: 8px; align-items: center; }
.cap-img { height: 48px; border-radius: 6px; flex: 0 0 auto; }
.cap-text-row input { flex: 1; }
