/* ========== 灯塔时叙 皮肤(琥珀金·灯塔暖光;沿用清风棋院圆角/卡片体系) ========== */
:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --line: #ece6da;
  --text: #2a2620;
  --muted: #8a8276;
  --primary: #d99a2b;
  --primary-dark: #b9791a;
  --accent: #2e4a63;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(60,40,10,.06), 0 4px 16px rgba(60,40,10,.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ---- 顶部导航 ---- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; padding: 6px 16px 8px; }
.topbar-main { display: flex; align-items: center; justify-content: space-between; flex: 1; min-width: 0; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-badge {
  width: 34px; height: 34px; border-radius: 8px; background: linear-gradient(135deg, #d99a2b, #f0b84e);
  color: #2a2620; font-size: 19px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  font-family: "KaiTi", "STKaiti", serif;
}
.logo-text { font-size: 17px; font-weight: 700; display: flex; flex-direction: column; line-height: 1.15; }
.logo-text small { font-size: 10.5px; color: var(--muted); font-weight: 400; letter-spacing: 1px; }
.nav { display: flex; gap: 4px; flex-basis: 100%; }
.nav a { flex: 1; text-align: center; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.nav a:hover { background: #f6ecd8; color: var(--primary-dark); }
.nav a.active { background: #fbeecd; color: var(--primary-dark); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-theme { border: none; background: #f6ecd8; color: var(--primary-dark); width: 34px; height: 34px; border-radius: 8px; font-size: 16px; cursor: pointer; }
.nav-theme:hover { background: #f2e2c0; }

/* ---- 布局 ---- */
.container { max-width: 1100px; width: 100%; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px; border-top: 1px solid var(--line); background: var(--card); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; padding: 14px 18px 10px; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 0 18px 18px; }

/* ---- 首页 ---- */
.hero { background: linear-gradient(120deg, #1b2a3a, #2e4a63 55%, #d99a2b); border-radius: 16px; color: #fff; padding: 30px 28px; margin-bottom: 18px; box-shadow: var(--shadow); }
.hero h1 { font-size: 24px; margin-bottom: 8px; letter-spacing: 1px; }
.hero p { opacity: .92; font-size: 14.5px; max-width: 640px; line-height: 1.7; }
.hero .hero-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

.btn { border: none; cursor: pointer; border-radius: 8px; font-size: 14px; font-weight: 600; padding: 9px 18px; transition: .15s; text-decoration: none; display: inline-block; }
.btn-primary { background: #fff; color: var(--primary-dark); }
.btn-primary:hover { background: #fbeecd; }
.btn-outline { background: transparent; border: 1.5px solid rgba(255,255,255,.7); color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,.14); }
.btn-normal { background: var(--primary); color: #fff; }
.btn-normal:hover { background: var(--primary-dark); }
.btn-ghost { background: #f6ecd8; color: var(--text); }
.btn-ghost:hover { background: #f2e2c0; }
.btn-danger { background: #fbeaea; color: var(--danger); }
.btn-danger:hover { background: #f5d8d8; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: grayscale(1); }

.academy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.academy-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.academy-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(217,154,43,.22); }
.academy-card-head { display: flex; align-items: center; gap: 12px; }
.academy-badge { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 700; flex: none; }
.academy-card.cd .academy-badge { background: linear-gradient(135deg, #d99a2b, #f0b84e); }
.academy-card.pt .academy-badge { background: linear-gradient(135deg, #c0392b, #e8837a); }
.academy-card.moo .academy-badge { background: linear-gradient(135deg, #2e4a63, #4d7a9a); }
.academy-card.cap .academy-badge { background: linear-gradient(135deg, #6a4c93, #9b7bcf); }
.academy-card-title b { font-size: 17px; display: block; }
.academy-card-title small { color: var(--muted); font-size: 12px; }
.academy-card p { margin: 0; font-size: 13.5px; line-height: 1.8; color: var(--muted); flex: 1; }
.academy-enter { font-weight: 700; font-size: 13.5px; color: var(--primary-dark); }

/* ---- 表单/列表通用 ---- */
.quick-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.qf-field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
select, input[type=text], input[type=date], input[type=datetime-local], input[type=number], textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: #fff; color: var(--text); outline: none; font-family: inherit;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
select:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(217,154,43,.18); }
.home-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-item:last-child { border-bottom: none; }
.badge { display: inline-block; padding: 2.5px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-amber { background: #fbeecd; color: var(--primary-dark); }
.badge-blue { background: #e6eef5; color: #2e4a63; }
.badge-purple { background: #efeaf7; color: #6a4c93; }
.badge-red { background: #fbeaea; color: var(--danger); }
.badge-gray { background: #f1ede6; color: var(--muted); }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---- 弹窗 ---- */
.modal-mask { position: fixed; inset: 0; background: rgba(40,30,10,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 420px; padding: 24px; position: relative; box-shadow: 0 18px 50px rgba(0,0,0,.25); }
.modal h3 { margin-bottom: 14px; font-size: 18px; }
.result-detail { color: var(--muted); font-size: 14px; line-height: 1.8; margin-bottom: 18px; white-space: pre-wrap; text-align: left; }
.modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal-close { position: absolute; right: 12px; top: 10px; border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.modal-close:hover { color: var(--text); }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #6a5a3a; }

/* ---- toast ---- */
#toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #2b2620; color: #fff; padding: 10px 20px; border-radius: 24px; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: fadein .2s; }
.toast.err { background: #a94442; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px);} to { opacity: 1; transform: none; } }

/* ---- banner(今日新解锁等) ---- */
.banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fbeecd; border: 1px solid #f0d9a8; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 12px; color: var(--primary-dark); }

/* ---- 倒数日大数字 ---- */
.cd-days { font-size: 30px; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.cd-days.past { color: var(--muted); }
.cd-emoji { font-size: 22px; }

/* ---- 番茄计时器 ---- */
.pomo-clock { font-size: 64px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 2px; color: var(--primary-dark); margin: 8px 0; }
.pomo-clock.break { color: #2e8b57; }
.pomo-mode { text-align: center; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.pomo-big-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* ---- 番茄钟·强制力加强(P0):进度条 / 长按放弃 / 导航锁灰 ---- */
.pomo-progress { height: 6px; background: #f1ede6; border-radius: 4px; overflow: hidden; margin: 4px 0 12px; }
.pomo-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d99a2b, #f0b84e); transition: width .4s linear; }
.pomo-progress.break i { background: linear-gradient(90deg, #2e8b57, #63c08a); }
.pomo-hold { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.pomo-hold .hold-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(0,0,0,.16); transition: width .06s linear; }
.pomo-hold .hold-txt { position: relative; }
body.pomo-locked .nav a { opacity: .45; }
body.pomo-locked .nav a.active { opacity: 1; }
body.pomo-locked .nav a:hover { background: transparent; color: var(--muted); }
body.pomo-locked .logo { opacity: .55; }
body.dark .pomo-progress { background: #2a241b; }
body.dark .pomo-hold .hold-fill { background: rgba(255,255,255,.16); }

/* ---- 番茄钟·立约 / 今日目标 / 近 7 天 ---- */
.pomo-goal-line { text-align: center; font-size: 14.5px; font-weight: 600; color: var(--accent); margin: 2px 0 10px; word-break: break-all; }
.pomo-goalrow { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.pomo-goalbar { flex: 1; min-width: 110px; height: 8px; background: #f1ede6; border-radius: 5px; overflow: hidden; }
.pomo-goalbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2e4a63, #4d7a9a); transition: width .4s; }
.pomo-goalbar i.ok { background: linear-gradient(90deg, #2e8b57, #63c08a); }
#pomo-goal-n { width: 58px; display: inline-block; padding: 3px 6px; font-size: 13px; }
.pomo-week { display: flex; align-items: flex-end; gap: 8px; }
.pw-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.pw-bar { width: 100%; display: flex; align-items: flex-end; justify-content: center; height: 50px; }
.pw-bar i { display: block; width: 70%; max-width: 30px; min-height: 3px; background: linear-gradient(180deg, #f0b84e, #d99a2b); border-radius: 4px 4px 0 0; }
.pw-bar i.empty { background: #e8e2d6; }
.pw-n { font-size: 12px; font-weight: 700; color: var(--primary-dark); }
.pw-d { font-size: 11px; color: var(--muted); }
body.dark .pomo-goalbar { background: #2a241b; }
body.dark .pw-bar i.empty { background: #2f2820; }

/* ---- 日记 ---- */
.mood-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mood-chip { font-size: 22px; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mood-chip.active { border-color: var(--primary); background: #fbeecd; }
.diary-entry { border-left: 3px solid var(--primary); padding: 10px 14px; background: #fcfaf5; border-radius: 0 8px 8px 0; margin-bottom: 10px; }
.diary-entry .de-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.diary-entry .de-text { font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.diary-entry .de-tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.diary-entry .de-imgs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.diary-entry .de-imgs img { max-width: 120px; max-height: 120px; border-radius: 8px; cursor: pointer; }

/* ---- 灯塔胶囊 ---- */
.cap-locked { opacity: .82; }
.cap-countdown { font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.cap-body { white-space: pre-wrap; font-size: 14px; line-height: 1.9; background: #fcfaf5; border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 8px; }
.cap-cat { display: inline-block; font-size: 11.5px; font-weight: 600; color: #6a4c93; background: #efeaf7; border-radius: 20px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
.cap-preview { background: #eef4fb; border-color: #cfe0f2; color: #2e4a63; }
.cap-preview .cap-pre { display: inline-block; margin: 0 6px 2px 0; font-weight: 600; }
.cap-imgs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.cap-imgs img { max-width: 120px; max-height: 120px; border-radius: 8px; cursor: pointer; }
.cap-thumb { position: relative; display: inline-block; margin: 4px 4px 0 0; }
.cap-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.cap-thumb-x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 12px; line-height: 18px; cursor: pointer; padding: 0; }
.cap-thumb-p { position: absolute; left: 0; bottom: 0; right: 0; font-size: 9px; text-align: center; background: rgba(0,0,0,.55); color: #fff; border-radius: 0 0 8px 8px; }
.cap-reply { margin-top: 12px; background: #fcfaf5; border: 1px dashed var(--line); border-radius: 8px; padding: 12px 14px; }
.cap-reply.existing { background: #eef4fb; border-color: #cfe0f2; }
.cap-reply-h { font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-bottom: 8px; }
.cap-reply-b { white-space: pre-wrap; font-size: 14px; line-height: 1.8; }
.cap-reply textarea { width: 100%; min-height: 70px; margin-top: 4px; }
body.dark .cap-cat { background: #2a2436; color: #c4b0e8; }
body.dark .cap-preview { background: #1c2630; border-color: #2f4a63; color: #9cc0e0; }
body.dark .cap-reply { background: #1a160f; border-color: var(--line); }
body.dark .cap-reply.existing { background: #1c2630; border-color: #2f4a63; }
body.dark .cap-reply-h { color: var(--primary); }

/* ---- 暗色模式 ---- */
body.dark {
  --bg: #14110d; --card: #1f1b15; --line: #332c22; --text: #ece6da; --muted: #a99e8c;
  --primary: #e8b04a; --primary-dark: #d99a2b; --accent: #5a7da0;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.35);
}
body.dark .btn-primary { background: #d99a2b; color: #2a2620; }
body.dark .btn-primary:hover { background: #e8b04a; }
body.dark .modal { background: var(--card); }
body.dark select, body.dark input, body.dark textarea { background: var(--card); color: var(--text); border-color: var(--line); }
body.dark .nav a:hover { background: #2a241b; color: var(--primary); }
body.dark .nav a.active { background: #2e261a; color: var(--primary); }
body.dark .nav-theme { background: #2a241b; color: var(--primary); }
body.dark .btn-ghost { background: #2a241b; color: var(--text); }
body.dark .btn-ghost:hover { background: #352d20; }
body.dark .academy-card:hover { box-shadow: 0 10px 30px rgba(232,176,74,.18); }
body.dark .diary-entry, body.dark .cap-body { background: #1a160f; }
body.dark .banner { background: #2e261a; border-color: #4a3c1f; color: var(--primary); }

/* ---- 响应式 ---- */
@media (max-width: 860px) { .nav { overflow-x: auto; } }
@media (max-width: 760px) {
  .container { padding: 10px 10px 32px; }
  .topbar-inner { padding: 0 10px; }
  .logo-text small { display: none; }
  .hero { padding: 18px 16px; border-radius: 12px; }
  .academy-grid { grid-template-columns: 1fr; }
  .quick-form { grid-template-columns: 1fr; }
  .nav { gap: 0; overflow-x: auto; }
  .nav a { padding: 8px 10px; font-size: 14px; white-space: nowrap; }
  .pomo-clock { font-size: 52px; }
}
@media (max-width: 420px) { .quick-form { grid-template-columns: 1fr; } }

/* ---- 番茄钟 v1.4:档位 / 立约 / 全屏强制力 ---- */
.pomo-profile { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0; }
.pomo-profile-btn { border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 20px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.pomo-profile-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pomo-profile-btn:disabled { opacity: .55; cursor: not-allowed; }
.pomo-contract-line { font-size: 15px; margin-bottom: 6px; }
.pomo-contract-goal { font-size: 14px; color: var(--accent); margin-bottom: 6px; word-break: break-all; }
.pomo-contract-rules { font-size: 13px; color: var(--muted); line-height: 1.8; background: #fcfaf5; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.pomo-contract-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; margin-top: 8px; cursor: pointer; }
.pomo-contract-check input { width: auto; margin-top: 3px; accent-color: var(--primary); }
.pomo-giveup-phrase { margin-top: 12px; }
.pomo-giveup-phrase input { width: 100%; }
.modal-actions button:disabled { opacity: .5; cursor: not-allowed; }

/* 全屏 / 沉浸模式 */
body.pomo-fs { overflow: hidden; }
#pomo-card:fullscreen { margin: 0; border-radius: 0; overflow-y: auto; background: var(--bg); }
body.pomo-fs #pomo-card { position: fixed; inset: 0; z-index: 80; margin: 0 !important; border-radius: 0; overflow-y: auto; background: var(--bg); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
#pomo-card:fullscreen .card-body, body.pomo-fs #pomo-card .card-body { max-width: 580px; width: 100%; margin: 0 auto; padding: 22px 20px 30px; }
#pomo-card:fullscreen .card-title, body.pomo-fs #pomo-card .card-title { justify-content: center; font-size: 17px; padding-top: 22px; }
#pomo-card:fullscreen .pomo-clock, body.pomo-fs #pomo-card .pomo-clock { font-size: clamp(56px, 14vw, 110px); margin: 14px 0; }
#pomo-card:fullscreen #pomo-profile, #pomo-card:fullscreen #pomo-profile-desc,
body.pomo-fs #pomo-profile, body.pomo-fs #pomo-profile-desc,
#pomo-card:fullscreen .quick-form, body.pomo-fs #pomo-card .quick-form,
#pomo-card:fullscreen .pomo-goalrow, body.pomo-fs #pomo-card .pomo-goalrow,
#pomo-card:fullscreen #pomo-stat, body.pomo-fs #pomo-card #pomo-stat,
#pomo-card:fullscreen .pomo-big-btns, body.pomo-fs #pomo-card .pomo-big-btns { display: none; }

/* 退出全屏遮罩 */
.pomo-fs-exit { position: fixed; inset: 0; z-index: 90; background: rgba(28, 22, 12, .82); display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.pomo-fs-exit[hidden] { display: none !important; }
.pomo-fs-exit-box { background: var(--card); border-radius: 16px; padding: 28px 24px; max-width: 390px; width: 100%; text-align: center; box-shadow: 0 18px 60px rgba(0, 0, 0, .35); }
.pomo-fs-exit-icon { font-size: 38px; }
.pomo-fs-exit-box h3 { margin: 8px 0; font-size: 19px; }
.pomo-fs-exit-box p { color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.pomo-fs-left { font-size: 44px; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; margin: 10px 0; }
.pomo-fs-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
body.dark .pomo-contract-rules { background: #2a241b; }
body.dark .pomo-fs-exit-box { background: var(--card); }
