/* ============ 基础 ============ */
:root {
  --bg: #fff7f2;
  --bg2: #ffeede;
  --card: rgba(255, 255, 255, .78);
  --card-solid: #fffdfb;
  --line: rgba(120, 90, 70, .12);
  --text: #3a2c25;
  --text-2: #8a746a;
  --muted: #a3908a;
  --accent: #ff7a59;
  --accent-2: #b06bff;
  --accent-soft: rgba(255, 122, 89, .12);
  --private: #8b5cf6;
  --public: #ff7a59;
  --shadow: 0 10px 30px rgba(180, 130, 100, .14);
  --shadow-lg: 0 22px 60px rgba(170, 120, 90, .22);
  --radius: 20px;
  --grad: linear-gradient(135deg, #ff9a6c 0%, #ff6f91 55%, #b06bff 100%);
}
[data-theme="dark"] {
  --bg: #161317;
  --bg2: #201b22;
  --card: rgba(38, 32, 40, .78);
  --card-solid: #241f28;
  --line: rgba(255, 255, 255, .09);
  --text: #f2ebe8;
  --text-2: #c3b6b3;
  --muted: #8e8189;
  --accent: #ff8a6a;
  --accent-soft: rgba(255, 138, 106, .16);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Segoe UI, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 15% -10%, var(--bg2), transparent 60%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }

.orbs { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.orbs i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; }
.orbs i:nth-child(1) { width: 320px; height: 320px; background: #ffb199; top: -80px; left: -60px; }
.orbs i:nth-child(2) { width: 280px; height: 280px; background: #ffc3e1; bottom: -60px; right: -40px; }
.orbs i:nth-child(3) { width: 220px; height: 220px; background: #cbb2ff; top: 45%; right: -80px; opacity: .38; }
[data-theme="dark"] .orbs i { opacity: .18; }

/* ============ 顶栏 ============ */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 20px 8px; max-width: 880px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
  font-size: 24px; background: var(--card-solid); box-shadow: var(--shadow);
}
.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: .5px; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 13px; background: var(--card);
  backdrop-filter: blur(10px); box-shadow: var(--shadow); font-size: 17px;
  display: grid; place-items: center; transition: transform .15s;
}
.icon-btn:active { transform: scale(.92); }

/* ============ 布局 ============ */
.main { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 8px 20px 120px; }
.view { animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card {
  background: var(--card); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; letter-spacing: 1px; }

/* ============ 分区切换 ============ */
.scope-tabs {
  position: relative; display: flex; gap: 6px; padding: 5px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.scope-tab {
  flex: 1; padding: 10px 0; border-radius: 12px; font-size: 14px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: color .2s;
}
.scope-tab.is-active { color: var(--text); font-weight: 600; }
.tab-ink {
  position: absolute; top: 5px; left: 5px; height: calc(100% - 10px); width: calc(50% - 5px);
  background: var(--card-solid); border-radius: 12px; box-shadow: var(--shadow);
  transition: transform .28s cubic-bezier(.4, 1.2, .4, 1);
}
.scope-tabs[data-scope="private"] .tab-ink { transform: translateX(100%); }

/* ============ 日历 ============ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 16px; font-weight: 600; letter-spacing: .5px; }
.round-btn {
  width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft);
  color: var(--accent); font-size: 18px; line-height: 1; display: grid; place-items: center;
}
.round-btn:active { transform: scale(.9); }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.cal-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 13px; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 14px; color: var(--text); transition: background .15s, transform .15s;
}
.cal-cell.is-empty { color: transparent; pointer-events: none; }
.cal-cell.is-weekend { color: var(--text-2); }
.cal-cell.is-today { font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-cell.is-sel { background: var(--grad); color: #fff; }
.cal-cell.is-sel .dot { background: rgba(255, 255, 255, .9) !important; }
.cal-cell:active { transform: scale(.92); }
.cal-dots { display: flex; gap: 3px; height: 6px; align-items: center; }
.dot { width: 5px; height: 5px; border-radius: 50%; display: block; }
.dot-public { background: var(--public); }
.dot-private { background: var(--private); }
.cal-legend { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 12px; }
.cal-legend span { display: flex; align-items: center; gap: 5px; }
.cal-legend .text-btn { margin-left: auto; }

/* ============ 当天 ============ */
.day-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 18px 2px 12px; }
.day-date { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.day-sub { font-size: 12px; }
.entry-list { display: grid; gap: 12px; }
.entry-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); animation: fade .3s ease; cursor: pointer;
  transition: transform .15s;
}
.entry-card:active { transform: scale(.995); }
.entry-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.entry-mood { font-size: 22px; }
.entry-time { font-size: 12px; color: var(--muted); }
.entry-badge { font-size: 10px; padding: 2px 7px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); margin-left: auto; }
.entry-text {
  font-size: 15px; line-height: 1.8; color: var(--text-2); white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.entry-actions { display: flex; gap: 8px; margin-top: 12px; }
.chip {
  font-size: 12px; padding: 6px 12px; border-radius: 20px; background: var(--accent-soft);
  color: var(--accent); display: flex; align-items: center; gap: 4px;
}
.chip.plain { background: transparent; border: 1px solid var(--line); color: var(--text-2); }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-emoji { font-size: 40px; display: block; margin-bottom: 10px; opacity: .8; }

/* ============ 锁屏 ============ */
.lock-card { text-align: center; padding: 30px 20px; }
.lock-emoji { font-size: 44px; margin-bottom: 6px; }
.lock-card h2 { margin: 6px 0 8px; font-size: 18px; }
.lock-card p { font-size: 13px; line-height: 1.7; margin: 0 0 16px; }
.lock-card .field { margin-bottom: 10px; }

/* ============ 表单 ============ */
.field {
  width: 100%; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card-solid); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.primary-btn {
  width: 100%; padding: 13px; border-radius: 14px; background: var(--grad); color: #fff;
  font-weight: 600; letter-spacing: 1px; box-shadow: var(--shadow); transition: transform .15s;
}
.primary-btn:active { transform: scale(.97); }
.ghost-btn {
  padding: 9px 15px; border-radius: 13px; background: var(--accent-soft); color: var(--accent);
  font-size: 13px; transition: transform .15s;
}
.ghost-btn:active { transform: scale(.95); }
.ghost-btn.sm { padding: 7px 12px; font-size: 12px; }
.ghost-btn.wide { width: 100%; margin-top: 10px; }
.text-btn { background: none; color: var(--muted); font-size: 12px; padding: 8px; text-decoration: underline; }
.date-field { width: auto; flex: 1; padding: 9px 12px; font-size: 14px; }

/* ============ 编辑器 ============ */
.editor-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.editor-top .primary-btn { width: auto; padding: 10px 22px; }
.mood-picker { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.mood-btn {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 15px; font-size: 22px;
  display: grid; place-items: center; border: 1.5px solid transparent; transition: transform .15s;
  background: var(--card-solid);
}
.mood-btn.is-on { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.editor-card { padding: 6px 6px 10px; }
.editor {
  width: 100%; min-height: 190px; border: none; outline: none; resize: vertical;
  background: transparent; padding: 12px; font-size: 16px; line-height: 1.85; color: var(--text);
}
.editor::placeholder { color: var(--muted); }
.editor-foot { display: flex; justify-content: space-between; padding: 0 12px; font-size: 11px; }

/* ============ 录音 ============ */
.voice-row { display: flex; align-items: center; gap: 14px; }
.mic-btn {
  width: 58px; height: 58px; border-radius: 50%; font-size: 24px; flex: 0 0 auto;
  background: var(--grad); color: #fff; box-shadow: var(--shadow); display: grid; place-items: center;
  transition: transform .15s;
}
.mic-btn.is-rec { animation: pulse 1.2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 122, 89, .5), var(--shadow); }
  70% { box-shadow: 0 0 0 18px rgba(255, 122, 89, 0), var(--shadow); }
  100% { box-shadow: 0 0 0 0 rgba(255, 122, 89, 0), var(--shadow); }
}
.voice-info { flex: 1; min-width: 0; }
.voice-status { font-size: 13px; color: var(--text-2); }
.voice-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
.voice-tip { font-size: 11px; line-height: 1.7; margin-top: 10px; }
.cue-preview {
  margin-top: 12px; max-height: 170px; overflow-y: auto; padding: 10px 12px;
  border-radius: 13px; background: var(--accent-soft); font-size: 12px; line-height: 1.9; color: var(--text-2);
}
.cue-preview b { color: var(--accent); font-weight: 500; margin-right: 6px; font-variant-numeric: tabular-nums; }

/* ============ 阅读 / 歌词 ============ */
.rd-title { flex: 1; text-align: center; font-weight: 600; font-size: 15px; }
.lyric-wrap {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px;
}
.lyric-stage {
  height: 46vh; min-height: 260px; overflow-y: auto;
  padding: min(42%, 200px) 26px;
  text-align: left; scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.cue {
  display: block; font-size: 20px; line-height: 1.7; margin: 14px 0; color: var(--text);
  opacity: .12; filter: blur(3px); transform: translateY(6px);
  transition: opacity .45s ease, filter .45s ease, transform .45s ease, color .3s;
}
.cue.is-past { opacity: .42; filter: blur(0); transform: none; }
.cue.is-cur {
  opacity: 1; filter: blur(0); transform: none; font-weight: 600;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.player { display: flex; align-items: center; gap: 14px; }
.play-btn {
  width: 50px; height: 50px; border-radius: 50%; background: var(--grad); color: #fff;
  font-size: 18px; display: grid; place-items: center; flex: 0 0 auto; box-shadow: var(--shadow);
}
.speak-btn { margin-left: 8px; }
.speak-btn.is-on { background: var(--accent); color: #fff; }
.modal .card-label { margin-top: 12px; }
.player-main { flex: 1; min-width: 0; }
.progress { height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; cursor: pointer; }
.progress i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 5px; }
.player-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.tip { font-size: 12px; line-height: 1.7; }

/* ============ FAB ============ */
.fab {
  position: fixed; right: 20px; bottom: calc(26px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; background: var(--grad); color: #fff;
  font-size: 26px; box-shadow: var(--shadow-lg); z-index: 20; display: grid; place-items: center;
  transition: transform .18s;
}
.fab:active { transform: scale(.9) rotate(90deg); }

/* ============ 弹层 ============ */
.modal-root { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(40, 25, 20, .42); backdrop-filter: blur(3px); animation: fade .2s; }
.modal {
  position: relative; width: 100%; max-width: 420px; max-height: 84vh; overflow-y: auto;
  background: var(--card-solid); border-radius: 24px; padding: 22px; box-shadow: var(--shadow-lg);
  animation: pop .26s cubic-bezier(.3, 1.3, .5, 1);
}
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 14px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.modal .field { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .primary-btn { flex: 1; }
.modal-actions .ghost-btn { flex: 1; }
.menu-list { display: grid; gap: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 15px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px; text-align: left; width: 100%;
}
.menu-item:active { transform: scale(.98); }
.menu-item span:first-child { font-size: 18px; }
.menu-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.share-box {
  width: 100%; min-height: 96px; border-radius: 13px; border: 1px solid var(--line);
  background: var(--card); padding: 10px; font-size: 11px; line-height: 1.6; color: var(--text-2);
  word-break: break-all; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: rgba(40, 28, 24, .92); color: #fff; padding: 11px 20px; border-radius: 30px;
  font-size: 13px; z-index: 99; opacity: 0; pointer-events: none; transition: .28s; max-width: 82vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 手机端 ============ */
@media (max-width: 600px) {
  .topbar { padding: 14px 16px 6px; }
  .main { padding: 6px 16px 130px; }
  .brand-badge { width: 42px; height: 42px; font-size: 22px; }
  .brand-text h1 { font-size: 17px; }
  .day-date { font-size: 20px; }
  .lyric-stage { height: 44vh; padding: 46% 20px; }
  .cue { font-size: 18px; }
  .fab { right: 16px; }
  .cal-cell { font-size: 13px; }
}
@media (min-width: 720px) {
  .main { padding-bottom: 100px; }
  .lyric-stage { padding: 22% 40px; }
  .cue { font-size: 22px; }
}
