/* ========== 每日一记 · DailyCard 样式 ========== */
:root {
  --bg: #f7f5f1;
  --card: #ffffff;
  --ink: #2d2a26;
  --ink-2: #6b655d;
  --line: #eae6df;
  --primary: #5b6cff;
  --primary-soft: #eef0ff;
  --coral: #ff7e5f;
  --orange: #ffb03a;
  --green: #2ec4a0;
  --red: #ef476f;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(45, 42, 38, 0.06);
  --shadow-lg: 0 8px 30px rgba(45, 42, 38, 0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ========== 顶部导航 ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  font-size: 30px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #8b7bff);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-text strong { font-size: 17px; letter-spacing: 0.5px; }
.logo-text small { font-size: 11px; color: var(--ink-2); }

.tabs { display: flex; gap: 6px; }
.tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 999px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s;
}
.tab:hover { background: var(--primary-soft); color: var(--primary); }
.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91, 108, 255, 0.35);
}

/* ========== 布局 ========== */
main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }
.view { display: none; animation: fadeIn 0.25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ========== 录音台 ========== */
.prompt-card {
  background: linear-gradient(135deg, #fff 0%, #fff7ef 100%);
  border: 1px solid #fbe3cc;
  border-radius: var(--radius);
  padding: 22px 26px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.prompt-label {
  display: inline-block;
  font-size: 12px;
  color: var(--orange);
  background: #fff1dd;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  letter-spacing: 1px;
}
.prompt-text { font-size: 20px; font-weight: 600; line-height: 1.6; color: #4a3f31; }
.prompt-refresh {
  margin-top: 12px;
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline dotted;
}
.prompt-refresh:hover { color: var(--primary); }

.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 0 10px;
}
.record-btn {
  position: relative;
  width: 150px; height: 150px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--coral), var(--orange));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(255, 126, 95, 0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}
.record-btn:hover { transform: scale(1.04); box-shadow: 0 14px 36px rgba(255, 126, 95, 0.55); }
.record-btn:active { transform: scale(0.97); }
.mic-icon { width: 52px; height: 52px; }

.record-btn.recording {
  background: linear-gradient(145deg, #e0566f, var(--red));
  box-shadow: 0 10px 30px rgba(239, 71, 111, 0.5);
}
.record-pulse { display: none; }
.record-btn.recording .record-pulse {
  display: block;
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid rgba(239, 71, 111, 0.55);
  animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}

.timer {
  margin-top: 26px;
  font-size: 42px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: 2px;
}
.record-status { margin-top: 6px; color: var(--ink-2); font-size: 14px; }

.tip-bar {
  margin: 18px auto 30px;
  max-width: 520px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-2);
  background: #f0fdf9;
  border: 1px solid #d3f2e8;
  border-radius: 12px;
  padding: 10px 16px;
}

/* ========== 语音 / 文字 模式切换 ========== */
.mode-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}
.mode-tab {
  border: 1px solid #e0dcf5;
  background: #fff;
  color: var(--ink-2);
  padding: 8px 24px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-tab:hover { color: var(--primary); border-color: var(--primary); }
.mode-tab.active {
  background: linear-gradient(135deg, var(--primary), #8b7bff);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(91, 108, 255, 0.35);
}

/* ========== 文字记录面板 ========== */
.text-panel {
  max-width: 560px;
  margin: 26px auto 0;
}
.text-input {
  width: 100%;
  min-height: 170px;
  border: 1px solid #e0dcf5;
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.7;
  font-family: inherit;
  resize: vertical;
  background: #fff;
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 108, 255, 0.14);
}
.text-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.text-count {
  font-size: 13px;
  color: var(--ink-2);
}
.text-submit {
  background: linear-gradient(135deg, var(--primary), #8b7bff);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 30px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(91, 108, 255, 0.35);
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.text-submit:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(91, 108, 255, 0.45); }
.text-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.today-section h3 { font-size: 17px; margin-bottom: 14px; }
.count-badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  vertical-align: middle;
}
.empty-hint {
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  padding: 40px 0;
}
.card-list { display: flex; flex-direction: column; gap: 14px; }

/* ========== 卡片 ========== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
  animation: fadeIn 0.3s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.card-date { font-size: 12px; color: var(--ink-2); }
.card-del {
  border: none;
  background: none;
  color: #c9c3b9;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 6px;
}
.card-del:hover { color: var(--red); background: #fff0f3; }

.card-summary { font-size: 17px; font-weight: 700; line-height: 1.5; margin-bottom: 8px; }
.card-facts { font-size: 14px; color: var(--ink); line-height: 1.65; margin-bottom: 8px; }
.card-lesson {
  font-size: 13px;
  background: #f4fdf9;
  border-left: 3px solid var(--green);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
  color: #1f6b57;
}
.card-follow {
  font-size: 13px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  margin-bottom: 10px;
  color: #4650c9;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
}
.tag.emotion { background: #ffedf1; color: #d6336c; }
.tag.keyword { background: #eef3ff; color: #4a5fd0; }
.raw-toggle {
  border: none;
  background: none;
  color: var(--ink-2);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline dotted;
  padding: 0;
}
.card-raw {
  margin-top: 10px;
  padding: 12px;
  background: #faf8f4;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
  white-space: pre-wrap;
}

/* ========== 卡片墙（瀑布流） ========== */
.wall-head { margin-bottom: 18px; }
.wall-head h2 { font-size: 22px; }
.wall-sub { color: var(--ink-2); font-size: 13px; }
.masonry {
  columns: 3 320px;
  column-gap: 16px;
}
.masonry .card {
  break-inside: avoid;
  margin-bottom: 16px;
  display: inline-block;
  width: 100%;
}

/* ========== 搜索 ========== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.search-bar input {
  flex: 1;
  padding: 13px 18px;
  font-size: 15px;
  border: 2px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #fff;
  transition: border 0.2s;
}
.search-bar input:focus { border-color: var(--primary); }
.search-bar button {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 0 26px;
  border-radius: 14px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.search-bar button:hover { background: #4a5ce8; }

/* ========== 日历热力图 ========== */
.calendar-wrap {
  margin-top: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.calendar-head h3 { font-size: 17px; }
.hm-legend { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-2); }
.hm-months {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-2);
  margin-left: 32px;
  margin-bottom: 4px;
}
.heatmap {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column;
  gap: 3px;
  min-width: 680px;
}
.hm-cell {
  width: 13px; height: 13px;
  border-radius: 3px;
  background: #ecece8;
  cursor: pointer;
  transition: transform 0.1s;
}
.hm-cell:hover { transform: scale(1.4); outline: 1px solid var(--primary); }
.hm-cell.l1 { background: #c3d3ff; }
.hm-cell.l2 { background: #8ba2ff; }
.hm-cell.l3 { background: #5b6cff; }
.hm-cell.l4 { background: #3d2fd0; }

.day-section { margin-top: 26px; }
.day-section h3 { font-size: 17px; margin-bottom: 14px; }

/* ========== Toast / Overlay ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  background: rgba(45, 42, 38, 0.92);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s;
  max-width: 86vw;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.55);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: grid;
  place-items: center;
}
.overlay-box {
  background: #fff;
  border-radius: 20px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
}
.overlay-box p { margin-top: 16px; font-size: 16px; font-weight: 600; }
.overlay-sub { font-size: 13px !important; color: var(--ink-2); font-weight: 400 !important; }
.spinner {
  width: 46px; height: 46px;
  margin: 0 auto;
  border: 4px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 用户区 ========== */
.user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--primary-soft);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.user-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.user-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
#logoutBtn:hover { border-color: var(--red); color: var(--red); background: #fff0f3; }

/* ========== 登录 / 弹窗 ========== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #f7f5f1 0%, #eef0ff 60%, #e6f9f3 100%);
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth-box {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 24px;
  padding: 40px 34px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.auth-logo {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  font-size: 34px;
  background: linear-gradient(135deg, var(--primary), #8b7bff);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(91, 108, 255, 0.35);
}
.auth-box h1 { font-size: 22px; letter-spacing: 1px; }
.auth-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin: 8px 0 24px;
  line-height: 1.5;
}
.auth-box input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  border: 2px solid var(--line);
  border-radius: 12px;
  outline: none;
  margin-bottom: 12px;
  background: #fff;
  transition: border 0.2s;
  text-align: center;
}
.auth-box input:focus { border-color: var(--primary); }
.auth-error {
  font-size: 13px;
  color: var(--red);
  background: #fff0f3;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.auth-btn {
  width: 100%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 2px;
}
.auth-btn:hover { background: #4a5ce8; }
.auth-btn:active { transform: scale(0.98); }
.auth-btn.ghost {
  background: #fff;
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-weight: 400;
  letter-spacing: 0;
}
.auth-btn.ghost:hover { background: var(--bg); color: var(--ink); }
.auth-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ========== 响应式 ========== */
@media (max-width: 720px) {
  .topbar { flex-direction: column; padding: 12px 14px; gap: 10px; }
  .tabs { width: 100%; justify-content: space-between; }
  .tab { flex: 1; text-align: center; padding: 8px 6px; font-size: 13px; }
  main { padding: 16px 14px 70px; }
  .record-btn { width: 128px; height: 128px; }
  .prompt-text { font-size: 17px; }
  .user-area { width: 100%; justify-content: center; }
  .auth-box { padding: 32px 22px; }
}
