:root {
  --bg: #fff7ed;
  --card: #ffffff;
  --ink: #292524;
  --sub: #78716c;
  --line: #ede5dc;
  --brand: #f97316;
  --brand-2: #fb923c;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(180, 100, 40, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
  padding: 14px 16px 10px;
}
.app-header h1 { margin: 0 0 10px; font-size: 20px; }

.tabs { display: flex; gap: 6px; }
.tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.tab.active { background: #fff; color: var(--brand); font-weight: 600; }

main { max-width: 520px; margin: 0 auto; padding: 14px 14px 70px; }

.view { display: none; }
.view.active { display: block; animation: fade 0.25s ease; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
h2 { font-size: 16px; margin: 0 0 10px; }
.hint { font-size: 13px; color: var(--sub); line-height: 1.7; }

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--sub);
}
.field-row input[type="date"] { width: auto; flex: 1; }

input[type="date"], input[type="text"], input[type="password"], input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  background: #fffdfa;
  color: var(--ink);
  outline: none;
  font-family: inherit;
}
input:focus { border-color: var(--brand); }

label.field { display: block; font-size: 13px; color: var(--sub); margin: 12px 0; }
label.field input { margin-top: 6px; }

/* 录音区 */
.record-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}
.record-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.record-btn:active { transform: scale(0.94); }
.record-btn.recording { animation: pulse 1.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.45); }
  70% { box-shadow: 0 0 0 16px rgba(249, 115, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}
.mic-icon { width: 34px; height: 34px; }
.record-status { font-size: 13px; color: var(--sub); }
.record-timer {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.audio-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff3e8;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
}
.audio-info { flex: 1; font-size: 13px; color: var(--sub); }

.icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 8px;
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.05); }
.ic-play, .ic-pause { width: 24px; height: 24px; display: block; }

.btn {
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn.block { display: block; width: 100%; padding: 12px; font-size: 15px; }
.btn.danger { color: #b91c1c; border-color: #fecaca; background: #fff5f5; }

textarea {
  width: 100%;
  min-height: 130px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  font-family: inherit;
  background: #fffdfa;
  color: var(--ink);
  outline: none;
  margin-top: 4px;
}
textarea:focus { border-color: var(--brand); }

.transcribe-status { font-size: 13px; color: var(--brand); margin: 8px 2px; }

/* 标签（心情 / 天气） */
.tag-section { margin-top: 14px; }
.tag-label { font-size: 13px; color: var(--sub); margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13.5px;
  cursor: pointer;
}
.tag::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tag-c, #ccc);
  margin-right: 6px;
}
.tag.on {
  border-color: var(--tag-c, var(--brand));
  background: #fff7ed;
  font-weight: 600;
}
.tag.readonly { cursor: default; }

/* 日历 */
.cal-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 10px;
}
#cal-title { flex: 1; text-align: center; font-weight: 600; font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head-cell {
  text-align: center;
  font-size: 12px;
  color: var(--sub);
  padding: 4px 0;
}
.cal-cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
}
.cal-cell.empty { cursor: default; }
.cal-cell:hover { background: #fff3e8; }
.cal-cell.today { border: 1.5px solid var(--brand); }
.cal-cell.selected {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-weight: 700;
}
.cal-dot {
  position: absolute;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e7d9c9;
}
.cal-cell.has:not(.selected) .cal-dot { background: var(--brand); }
.cal-cell.selected .cal-dot { background: rgba(255, 255, 255, 0.85); }

.day-title { margin: 16px 2px 10px; font-size: 14px; color: var(--sub); }

/* 日记条目 */
.entry-item {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.entry-item:active { transform: scale(0.99); }
.entry-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.entry-time { font-weight: 600; color: var(--ink); }
.entry-snippet {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-snippet.voice-only { color: var(--sub); font-style: italic; }

.empty-hint { text-align: center; color: var(--sub); font-size: 14px; padding: 40px 0; }

/* 详情 */
.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
#detail-date { font-weight: 600; font-size: 15px; }
.detail-text {
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0;
}
#detail-audio .audio-info { color: var(--sub); }

/* 设置 */
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--sub);
  margin: 10px 0;
}
.stats { font-size: 13px; color: var(--sub); }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1; }

/* toast 与确认弹窗 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(41, 37, 36, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  max-width: 86vw;
  text-align: center;
  animation: fade 0.2s ease;
}
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 320px;
}
#confirm-text { font-size: 15px; line-height: 1.6; margin-bottom: 18px; }

.hidden { display: none !important; }

/* 安装提示 */
.install-tip {
  background: #ffedd5;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.install-tip button {
  margin-left: 8px;
  border: none;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12.5px;
}