* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
	font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
	background: #f4f5f7; color: #1f2329;
	font-size: 14px;
}
button { font-family: inherit; }

/* ---------- 按钮 ---------- */
.btn {
	border: 1px solid #d8dbe0; border-radius: 8px;
	padding: 8px 16px; font-size: 14px; cursor: pointer;
	background: #fff; color: #1f2329;
	transition: all .15s;
}
.btn:hover { border-color: #9db8ff; color: #2f6bff; }
.btn.primary { background: linear-gradient(135deg, #4d8dff, #3670e0); border: none; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { background: #f05656; border: none; color: #fff; }
.btn.danger:hover { background: #e04343; color: #fff; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.25); color: inherit; }
.btn.ghost:hover { background: rgba(255,255,255,.12); color: inherit; }
.btn.sm { padding: 5px 11px; font-size: 13px; }

/* ---------- 登录 ---------- */
.login-wrap {
	position: fixed; inset: 0;
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, #1d2b4f 0%, #101829 60%, #0b1120 100%);
}
.login-card {
	width: 340px; padding: 40px 34px 30px;
	background: rgba(255,255,255,.06);
	border: 1px solid rgba(255,255,255,.12);
	border-radius: 18px; text-align: center;
	backdrop-filter: blur(14px);
}
.login-logo { font-size: 42px; margin-bottom: 8px; }
.login-title { color: #fff; font-size: 21px; font-weight: 700; letter-spacing: 1px; }
.login-sub { color: #8fa0bd; font-size: 13px; margin: 6px 0 26px; }
.login-card input {
	width: 100%; height: 44px; padding: 0 14px;
	border-radius: 10px; border: 1px solid rgba(255,255,255,.2);
	background: rgba(0,0,0,.28); color: #fff; font-size: 15px; outline: none;
	text-align: center; letter-spacing: 2px;
}
.login-card input:focus { border-color: #6aa8ff; }
.login-card button {
	width: 100%; height: 44px; margin-top: 14px;
	border: none; border-radius: 10px; cursor: pointer;
	background: linear-gradient(135deg, #4d8dff, #3670e0);
	color: #fff; font-size: 15px; font-weight: 600;
}
.login-card button:hover { filter: brightness(1.1); }
.login-err { color: #ff8a8a; font-size: 13px; margin-top: 10px; min-height: 18px; }
.login-hint { color: #6b7c99; font-size: 12px; margin-top: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
	height: 58px; background: linear-gradient(90deg, #1c2740, #223052);
	display: flex; align-items: center; justify-content: space-between;
	padding: 0 22px; color: #fff;
	box-shadow: 0 2px 10px rgba(0,0,0,.18);
	position: relative; z-index: 10;
}
.brand { font-size: 17px; font-weight: 700; cursor: pointer; }
.top-actions { display: flex; gap: 8px; }
.top-actions .btn { color: #d7e0f2; }

/* ---------- 列表 ---------- */
.list-view { padding: 26px 30px 40px; max-width: 1280px; margin: 0 auto; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.list-head h2 { font-size: 20px; }
.book-grid {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 20px;
}
.book-card {
	background: #fff; border-radius: 14px; overflow: hidden;
	border: 1px solid #e8eaee;
	box-shadow: 0 2px 10px rgba(30,40,80,.05);
	transition: transform .15s, box-shadow .15s;
	display: flex; flex-direction: column;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(30,40,80,.12); }
.book-cover {
	aspect-ratio: 700 / 1060; background: #eef0f4;
	display: flex; align-items: center; justify-content: center;
	color: #aab2c0; font-size: 34px; overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-meta { padding: 12px 14px; }
.book-name { font-size: 15px; font-weight: 600; margin-bottom: 4px;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-info { color: #8a93a2; font-size: 12px; }
.book-actions {
	display: flex; gap: 6px; padding: 0 14px 14px; flex-wrap: wrap;
}
.book-actions .btn { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.empty-tip { text-align: center; color: #99a1ae; padding: 90px 0; font-size: 15px; }

/* ---------- 编辑器 ---------- */
.edit-view { padding: 16px 22px 30px; max-width: 1500px; margin: 0 auto; }
.edit-back { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.edit-title { font-size: 17px; font-weight: 700; }
.edit-body { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .edit-body { grid-template-columns: 1fr; } }

.panel {
	background: #fff; border: 1px solid #e8eaee; border-radius: 14px;
	padding: 18px 20px;
	box-shadow: 0 2px 10px rgba(30,40,80,.04);
}
.panel h3 { font-size: 15px; margin-bottom: 14px; color: #2b3140; }
.right-panel { position: sticky; top: 16px; }
@media (max-width: 1100px) { .right-panel { position: static; } }

.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 13px; color: #6a7280; margin-bottom: 5px; }
.field input[type=text], .field input[type=number], .field input[type=password] {
	width: 100%; height: 36px; padding: 0 11px;
	border: 1px solid #dfe3e9; border-radius: 8px;
	font-size: 14px; outline: none; background: #fbfcfd;
}
.field input:focus { border-color: #7aa2ff; background: #fff; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin-bottom: 13px; }
.color-inp { display: flex; align-items: center; gap: 8px; }
.color-inp input[type=color] {
	width: 42px; height: 36px; padding: 2px; border: 1px solid #dfe3e9; border-radius: 8px;
	background: #fbfcfd; cursor: pointer;
}
.color-inp input[type=text] { flex: 1; height: 36px; padding: 0 10px;
	border: 1px solid #dfe3e9; border-radius: 8px; font-size: 13px; outline: none; background: #fbfcfd; }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.checks label {
	display: flex; align-items: center; gap: 7px;
	font-size: 13.5px; color: #3d4452; cursor: pointer;
	padding: 7px 9px; border: 1px solid #e8eaee; border-radius: 8px;
}
.checks label:hover { border-color: #b9ccff; background: #f6f9ff; }
.checks input { accent-color: #3670e0; width: 15px; height: 15px; }

.save-bar {
	display: flex; align-items: center; justify-content: space-between;
	margin-top: 8px; padding-top: 14px; border-top: 1px solid #f0f1f4;
}
.save-hint { font-size: 12px; color: #98a1ae; }

/* 预览 */
.preview-box {
	border: 1px solid #e8eaee; border-radius: 10px; overflow: hidden;
	background: #111; height: 480px; margin-bottom: 20px;
}
#previewFrame { width: 100%; height: 100%; border: none; background: #111; }

/* 上传 */
.pages-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.page-count { font-size: 12px; color: #98a1ae; font-weight: 400; }
.upload-box {
	border: 2px dashed #ccd3de; border-radius: 12px;
	padding: 24px; text-align: center; cursor: pointer;
	transition: all .15s; background: #fafbfc;
}
.upload-box:hover, .upload-box.drag { border-color: #4d8dff; background: #f0f6ff; }
.upload-ico { font-size: 26px; color: #4d8dff; }
.upload-txt { font-size: 14px; color: #3d4452; margin: 6px 0 3px; }
.upload-sub { font-size: 12px; color: #98a1ae; }
.upload-progress { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.upload-progress .bar { flex: 1; height: 8px; background: #eceff4; border-radius: 4px; overflow: hidden; }
#uploadBar { height: 100%; width: 0; background: linear-gradient(90deg, #4d8dff, #3670e0); transition: width .2s; }
.upload-progress span { font-size: 12px; color: #6a7280; white-space: nowrap; }

/* 页面网格 */
.pages-grid {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 12px; margin-top: 14px;
}
.page-cell {
	border: 1px solid #e8eaee; border-radius: 9px; overflow: hidden;
	background: #fff; position: relative; cursor: grab;
	transition: box-shadow .12s, opacity .12s;
}
.page-cell:active { cursor: grabbing; }
.page-cell.dragging { opacity: .4; }
.page-cell.dragover { outline: 2px dashed #4d8dff; outline-offset: 1px; }
.page-cell img { width: 100%; aspect-ratio: 700/1060; object-fit: cover; display: block; pointer-events: none; }
.page-cell .idx {
	position: absolute; left: 4px; top: 4px;
	background: rgba(0,0,0,.62); color: #fff; font-size: 11px;
	padding: 1px 7px; border-radius: 5px;
}
.page-cell .del {
	position: absolute; right: 4px; top: 4px;
	width: 22px; height: 22px; border-radius: 50%;
	border: none; background: rgba(0,0,0,.55); color: #fff;
	cursor: pointer; font-size: 12px; line-height: 1;
	opacity: 0; transition: opacity .12s;
}
.page-cell:hover .del { opacity: 1; }
.page-cell .del:hover { background: #e04343; }

/* ---------- 弹窗 ---------- */
.modal-mask {
	position: fixed; inset: 0; z-index: 200;
	background: rgba(15,20,35,.5);
	display: flex; align-items: center; justify-content: center;
	backdrop-filter: blur(3px);
}
.modal {
	background: #fff; border-radius: 14px; width: 380px; max-width: 92vw;
	overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal.small { width: 330px; }
.modal-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 15px 18px; font-weight: 600; border-bottom: 1px solid #f0f1f4;
}
.modal-x { background: none; border: none; font-size: 15px; color: #98a1ae; cursor: pointer; }
.modal-body { padding: 20px 18px; }
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack input {
	height: 40px; padding: 0 12px;
	border: 1px solid #dfe3e9; border-radius: 9px; outline: none; font-size: 14px;
}
.form-stack input:focus { border-color: #7aa2ff; }
.modal-err { color: #e04343; font-size: 13px; min-height: 16px; }
.qr-code { display: flex; justify-content: center; margin-bottom: 16px; }
.qr-code img, .qr-code canvas { border-radius: 6px; }
.share-url { display: flex; gap: 8px; }
.share-url input { flex: 1; height: 36px; padding: 0 10px;
	border: 1px solid #dfe3e9; border-radius: 8px; font-size: 12.5px; background: #f7f8fa; }
.confirm-text { font-size: 14.5px; line-height: 1.6; color: #2b3140; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Toast ---------- */
.toast {
	position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
	background: rgba(28,32,42,.94); color: #fff;
	padding: 10px 20px; border-radius: 9px; font-size: 14px;
	opacity: 0; pointer-events: none; transition: all .25s; z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
