/* ========== CSS Custom Properties / 马卡龙配色 ========== */
:root {
  --pink: #FF8FA3;
  --pink-light: #FFD1DC;
  --pink-bg: #FFF0F3;
  --mint: #6ECB9A;
  --mint-light: #B7E4C7;
  --mint-bg: #F0FAF3;
  --lavender: #B794D2;
  --lavender-light: #E1D5F2;
  --peach: #FFB5A7;
  --peach-light: #FFD7CF;
  --butter: #FFD166;
  --butter-light: #FFE8A1;
  --sky: #89CFF0;
  --sky-light: #C5E4F7;

  --day-color: var(--pink-light);
  --day-color-light: var(--lavender-light);
  --day-color-lighter: var(--mint-light);

  --bg: #FFF8F3;
  --bg-gradient: linear-gradient(135deg, #FFF8F3 0%, #FFF0F5 50%, #F0FAF3 100%);
  --card-bg: #FFFFFF;
  --card-shadow: 0 4px 20px rgba(255, 143, 163, 0.12), 0 1px 3px rgba(0,0,0,0.03);
  --card-shadow-hover: 0 8px 30px rgba(255, 143, 163, 0.18), 0 2px 8px rgba(0,0,0,0.05);
  --text-primary: #5D4E52;
  --text-secondary: #9E8A8E;
  --text-hint: #C4B5B8;
  --border: #FFE4E8;
  --border-focus: #FF8FA3;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;

  --font-rounded: "Nunito", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-system: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;

  --header-height: 60px;
  --date-nav-height: 52px;
}

/* ========== Day Colors ========== */
.monday { --day-color: #FFE4E8; --day-color-light: #F8EBF2; --day-color-lighter: #F0FAF3; }
.tuesday { --day-color: #D4F1D4; --day-color-light: #E3F5E8; --day-color-lighter: #EDE7F6; }
.wednesday { --day-color: #EDE7F6; --day-color-light: #F3EEF8; --day-color-lighter: #FFEED9; }
.thursday { --day-color: #FFEED9; --day-color-light: #FFF2E5; --day-color-lighter: #FFFBE6; }
.friday { --day-color: #FFFBE6; --day-color-light: #FFFDEB; --day-color-lighter: #E3F2FD; }
.saturday { --day-color: #E3F2FD; --day-color-light: #EDF6FC; --day-color-lighter: #FBE9E7; }
.sunday { --day-color: #FBE9E7; --day-color-light: #FDF0EE; --day-color-lighter: #FFE4E8; }

/* ========== Reset ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  font-family: var(--font-rounded);
  background: var(--bg-gradient);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========== Header ========== */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1.5px solid var(--border);
  padding: 0 16px;
  height: var(--header-height);
}
.header-inner {
  max-width: 1024px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 100%;
}
.logo-area { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-icon { flex-shrink: 0; }
.app-title {
  font-size: 20px; font-weight: 900;
  font-family: var(--font-rounded);
  color: var(--pink);
  letter-spacing: -0.5px;
}

.section-tabs {
  display: flex; gap: 4px;
  background: #FFF0F3;
  border-radius: var(--radius);
  padding: 3px;
  flex: 1; justify-content: center;
}
.section-tab {
  border: none; background: none;
  font-family: var(--font-rounded);
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
  padding: 6px 18px; border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.section-tab .tab-icon { font-size: 15px; }
.section-tab.active {
  background: white; color: var(--pink);
  box-shadow: 0 2px 8px rgba(255,143,163,0.2);
}

.header-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
  border: none; background: none;
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { background: #FFF0F3; color: var(--pink); }

/* ========== Date Navigator ========== */
.date-nav {
  position: sticky; top: var(--header-height); z-index: 99;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.date-btn, .btn-today {
  border: none; background: white;
  width: 36px; height: 36px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: all 0.2s;
}
.date-btn:hover, .btn-today:hover { color: var(--pink); box-shadow: var(--card-shadow); }
.btn-today {
  width: auto; padding: 0 14px;
  font-family: var(--font-rounded); font-size: 13px; font-weight: 700;
  color: var(--pink);
}
.date-display {
  display: flex; flex-direction: column; align-items: center;
  min-width: 130px;
}
.date-text {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
}
.weekday-text {
  font-size: 12px; font-weight: 600;
  color: var(--pink);
}

/* ========== Main Content ========== */
.main-content {
  max-width: 1024px; margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ========== Section Panels ========== */
.section-panel { display: none; }
.section-panel.active { display: block; }

/* ========== Cards ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.3s;
  display: flex; flex-direction: column;
}
.card:hover { box-shadow: var(--card-shadow-hover); }
.card-header {
  padding: 14px 18px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-title { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.card-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.card-actions {
  display: flex; gap: 8px; align-items: center;
  padding-top: 4px; flex-wrap: wrap;
}

/* ========== Work Grid (Desktop 3 columns) ========== */
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* ========== Textarea ========== */
.input-textarea {
  width: 100%; border: 2px solid #FFE4E8;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-system); font-size: 14px;
  line-height: 1.7; color: var(--text-primary);
  background: #FFFAFB; resize: vertical;
  min-height: 100px;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.input-textarea:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,143,163,0.15);
  background: white;
}
.input-textarea::placeholder { color: var(--text-hint); }

/* ========== Input Fields ========== */
.input-field {
  width: 100%; border: 2px solid #FFE4E8;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-system); font-size: 14px;
  color: var(--text-primary);
  background: #FFFAFB;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.input-field:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,143,163,0.15);
  background: white;
}
.input-field::placeholder { color: var(--text-hint); }

/* ========== Buttons ========== */
.btn-save, .btn-upload, .btn-add-task, .btn-add-entry {
  border: none;
  font-family: var(--font-rounded);
  font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.btn-save {
  background: linear-gradient(135deg, #FF8FA3, #FFB5A7);
  color: white;
  margin-left: auto;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,143,163,0.35); }
.btn-save:active { transform: translateY(0); }

.btn-upload {
  background: #F8F4F5;
  color: var(--text-secondary);
}
.btn-upload:hover { background: #FFF0F3; color: var(--pink); }

.btn-add-task, .btn-add-entry {
  background: var(--mint-bg);
  color: var(--mint);
  font-size: 13px;
}
.btn-add-task:hover, .btn-add-entry:hover {
  background: var(--mint-light);
  transform: translateY(-1px);
}

.btn-cancel {
  border: 2px solid #FFE4E8;
  background: white;
  font-family: var(--font-rounded);
  font-size: 13px; font-weight: 700;
  padding: 8px 18px; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
}

/* ========== Image Area ========== */
.image-area {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  min-height: 40px;
  background: #FFFAFB;
  border-radius: var(--radius-sm);
  padding: 8px;
  border: 2px dashed #FFE4E8;
}
.image-area:empty::after {
  content: '📷 拖拽图片到此处或点击下方按钮上传';
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-hint);
  font-size: 12px;
  padding: 16px 0;
}
.image-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 2px solid #FFE4E8;
  cursor: grab;
  transition: transform 0.2s;
  background: #F8F4F5;
}
.image-item:active { cursor: grabbing; }
.image-item.dragging {
  opacity: 0.5; transform: scale(0.95);
}
.image-item.drag-over {
  border-color: var(--pink);
  border-style: solid;
  transform: scale(1.05);
}
.image-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.image-item .btn-remove-img {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.45);
  color: white; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; line-height: 1;
  transition: background 0.2s;
  z-index: 2;
}
.image-item .btn-remove-img:hover { background: rgba(255,0,0,0.6); }

/* ========== Tasks ========== */
.tasks-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  background: #FFFAFB;
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 2px solid #FFE4E8;
  animation: taskAppear 0.3s ease;
}
@keyframes taskAppear {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.task-header {
  display: flex; gap: 8px; align-items: center;
}
.task-status-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #DDD;
  background: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  flex-shrink: 0;
}
.task-status-btn.status-pending { border-color: #CCC; }
.task-status-btn.status-progress {
  border-color: var(--butter); background: var(--butter-light);
  animation: pulse 1.5s ease-in-out infinite;
}
.task-status-btn.status-done {
  border-color: var(--mint); background: var(--mint);
  color: white;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.task-status-btn .check-icon {
  opacity: 0; transform: scale(0) rotate(-45deg);
  transition: all 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  color: white;
  font-size: 14px; font-weight: bold;
}
.task-status-btn.status-done .check-icon {
  opacity: 1; transform: scale(1) rotate(0);
}
.task-text-input {
  flex: 1; border: none; background: none;
  font-family: var(--font-system); font-size: 13px;
  color: var(--text-primary);
  padding: 2px 0;
}
.task-text-input:focus { outline: none; }
.task-text-input::placeholder { color: var(--text-hint); }
.task-actions { display: flex; gap: 4px; align-items: center; }
.btn-task-action {
  border: none; background: none;
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
  font-size: 14px;
}
.btn-task-action:hover { background: #FFF0F3; color: var(--pink); }
.btn-task-action.delete:hover { background: #FFE4E8; color: #E05555; }
.task-images { margin-top: 8px; }

/* 任务日期功能 */
.task-add-row { display: flex; gap: 8px; align-items: center; }
.task-date-input {
  border: 2px solid #FFE4E8;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-family: var(--font-system);
  font-size: 13px;
  color: var(--text-primary);
  background: white;
  cursor: pointer;
  flex-shrink: 0;
}
.task-date-input:focus { outline: none; border-color: var(--pink); }

.task-group-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 4px 4px;
  letter-spacing: 0.5px;
}
.task-group-header:first-child { padding-top: 0; }

.overdue-header {
  color: #E65100;
  background: #FFF3E0;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 4px;
}

.task-date-badge {
  font-size: 11px;
  color: var(--pink);
  background: #FFE4E8;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.task-item.task-done .task-text-input {
  text-decoration: line-through;
  color: var(--text-hint);
}

/* ========== Life Panel ========== */
.life-categories {
  display: flex; gap: 6px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.life-categories::-webkit-scrollbar { display: none; }
.life-cat-tab {
  border: 2px solid #FFE4E8;
  background: white;
  font-family: var(--font-rounded);
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
  padding: 8px 14px; border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s;
  display: flex; align-items: center; gap: 4px;
}
.life-cat-tab .cat-emoji { font-size: 16px; }
.life-cat-tab.active {
  background: var(--pink);
  color: white;
  border-color: var(--pink);
  box-shadow: 0 4px 12px rgba(255,143,163,0.3);
}
.life-cat-tab:hover:not(.active) { border-color: var(--pink-light); }

.life-panel { display: none; }
.life-panel.active { display: block; }
.life-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.life-title { font-size: 18px; font-weight: 800; }
.entries-list { display: flex; flex-direction: column; gap: 12px; }

.entry-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  animation: entryAppear 0.3s ease;
}
@keyframes entryAppear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.entry-header {
  display: flex; align-items: center; justify-content: space-between;
}
.entry-time {
  font-size: 12px; font-weight: 600;
  color: var(--text-hint);
}
.entry-actions { display: flex; gap: 4px; }
.entry-body { font-size: 14px; color: var(--text-primary); line-height: 1.7; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.entry-tag {
  background: #FFF0F3;
  color: var(--pink);
  font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
}
.entry-tag.mint { background: var(--mint-bg); color: var(--mint); }
.entry-tag.lavender { background: #F3EEF8; color: var(--lavender); }
.entry-tag.peach { background: #FFF2E5; color: var(--peach); }

/* ========== Modals ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  width: 100%; max-width: 520px;
  max-height: 85vh;
  display: flex; flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1.5px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 800; }
.btn-close {
  border: none; background: none;
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer;
}
.btn-close:hover { background: #F8F4F5; }
.modal-body {
  padding: 20px; overflow-y: auto;
  flex: 1; display: flex; flex-direction: column; gap: 14px;
}
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1.5px solid var(--border);
}

/* ========== History ========== */
.history-date-picker {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}
.history-date-picker label {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.date-input {
  border: 2px solid #FFE4E8;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-rounded);
  font-size: 14px;
  color: var(--text-primary);
  background: #FFFAFB;
  flex: 1;
}
.date-input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,143,163,0.15);
}
.history-content { max-height: 55vh; overflow-y: auto; }

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

.history-section { margin-bottom: 18px; }
.history-section h3 {
  font-size: 14px; font-weight: 800;
  margin-bottom: 8px;
  color: var(--pink);
}
.history-item {
  background: #FFFAFB;
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1.5px solid #FFE4E8;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.history-item-header {
  display: flex; justify-content: space-between;
  margin-bottom: 4px;
}
.history-item-label {
  font-size: 12px; font-weight: 700;
  color: var(--text-hint);
}
.history-images {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 6px;
}
.history-images img {
  width: 60px; height: 60px;
  border-radius: 8px; object-fit: cover;
  border: 2px solid #FFE4E8;
}

/* ========== Preview ========== */
.preview-container {
  position: relative;
  max-width: 90vw; max-height: 90vh;
  animation: zoomIn 0.25s ease;
}
@keyframes zoomIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.preview-container img {
  max-width: 90vw; max-height: 85vh;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.btn-close-preview {
  position: absolute; top: -40px; right: 0;
  border: none; background: rgba(0,0,0,0.4);
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* ========== Toast ========== */
.toast-container {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--text-primary); color: white;
  padding: 10px 20px; border-radius: var(--radius);
  font-family: var(--font-rounded); font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: toastIn 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55),
             toastOut 0.3s ease 2s forwards;
  pointer-events: auto;
  white-space: nowrap;
}
.toast.success { background: var(--mint); }
.toast.error { background: #E05555; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ========== Edit Entry Form ========== */
.edit-form-group {
  display: flex; flex-direction: column; gap: 4px;
}
.edit-form-group label {
  font-size: 13px; font-weight: 700;
  color: var(--text-secondary);
}

/* ========== Responsive - Mobile ========== */
@media (max-width: 768px) {
  :root { --header-height: 54px; --date-nav-height: 48px; }

  .app-title { font-size: 17px; }
  .section-tab { font-size: 13px; padding: 5px 12px; }
  .section-tab .tab-icon { display: none; }

  .date-text { font-size: 14px; }
  .weekday-text { font-size: 11px; }

  .main-content { padding: 14px 10px 100px; }

  /* Work grid: single column on mobile */
  .work-grid { grid-template-columns: 1fr; gap: 12px; }

  .card-body { padding: 12px 14px; }
  .card-title { font-size: 15px; }

  .input-textarea { font-size: 15px; min-height: 80px; }
  .btn-save, .btn-upload, .btn-add-task, .btn-add-entry {
    font-size: 14px; padding: 10px 18px;
  }

  /* Bottom bar */
  .header-actions { display: none; }
  .mobile-bottom-bar {
    display: flex;
    justify-content: space-around;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1.5px solid var(--border);
    padding: 6px 16px 10px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
  }
  .bottom-bar-btn {
    border: none; background: none;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-family: var(--font-rounded);
    font-size: 11px; font-weight: 700;
    color: var(--text-secondary);
    padding: 6px 12px; border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.2s;
  }
  .bottom-bar-btn:active { background: #FFF0F3; color: var(--pink); }
  .bottom-bar-btn .bb-icon { font-size: 20px; }

  .life-cat-tab { font-size: 12px; padding: 6px 10px; }
  .life-cat-tab .cat-emoji { font-size: 14px; }
  .life-title { font-size: 16px; }

  .image-area { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }

  .task-status-btn { width: 32px; height: 32px; }
  .task-text-input { font-size: 15px; }

  .modal-card { max-width: 95vw; border-radius: var(--radius-lg); }
  .modal-body { padding: 16px; }

  .history-images img { width: 50px; height: 50px; }
}

@media (min-width: 769px) {
  .mobile-bottom-bar { display: none; }
}

/* Tablet (768-1024px): 2 columns */
@media (min-width: 769px) and (max-width: 1024px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== Dark mode support (optional gentle) ========== */
@media (prefers-color-scheme: dark) {
  /* Keep the light macaron theme — it's the identity of this app */
}

/* ========== Focus visible ========== */
:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ========== 统计面板 - 日历模式 ========== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.cal-nav-btn {
  width: 38px; height: 38px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.cal-nav-btn:hover { background: #FFE4E8; border-color: var(--pink); color: var(--pink); }
.cal-nav-btn:active { transform: scale(0.92); }
.cal-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-primary);
  min-width: 140px;
  text-align: center;
}

/* 月度摘要 */
.cal-summary {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cal-summary-item {
  flex: 1;
  min-width: 100px;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: center;
}
.cal-summary-item.expense { background: linear-gradient(135deg, #FFF0F3, #FFE4E8); }
.cal-summary-item.weight  { background: linear-gradient(135deg, #F4ECFF, #E8D8FF); }
.cal-summary-item.exercise{ background: linear-gradient(135deg, #FFF8E1, #FFF3C4); }
.cal-summary-item .cs-value {
  font-size: 20px; font-weight: 900; display: block;
}
.cal-summary-item.expense .cs-value { color: #FF6B85; }
.cal-summary-item.weight .cs-value { color: #8B5CF6; }
.cal-summary-item.exercise .cs-value { color: #E8A838; }
.cal-summary-item .cs-label {
  font-size: 11px; color: var(--text-hint); margin-top: 2px;
}

/* 日历主体 */
.calendar-wrap {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
  overflow: hidden;
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}
.calendar-weekdays span {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-hint);
  padding: 4px 0;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* 日期格子 */
.cal-day {
  aspect-ratio: 1;
  border-radius: 10px;
  padding: 4px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  background: #FAFBFC;
  border: 1.5px solid transparent;
  min-height: 56px;
}
.cal-day:hover {
  background: #FFF0F3;
  border-color: #FFD4DC;
}
.cal-day:active { transform: scale(0.95); }
.cal-day.empty {
  background: transparent;
  cursor: default;
}
.cal-day.empty:hover { background: transparent; border-color: transparent; }
.cal-day.today {
  background: linear-gradient(135deg, #FFE4E8, #FFD4DC);
  border-color: var(--pink);
}
.cal-day.today .cal-day-num { color: var(--pink); }
.cal-day.has-data {
  background: #F8F9FF;
}
.cal-day.has-data:hover {
  background: #FFF0F3;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  line-height: 1.2;
}
.cal-day-tags {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
  width: 100%;
  align-items: center;
}
.cal-tag {
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  border-radius: 4px;
  padding: 0 4px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-tag.expense { background: #FFE4E8; color: #FF6B85; }
.cal-tag.weight  { background: #EDE7F6; color: #8B5CF6; }
.cal-tag.exercise{ background: #FFF3C4; color: #E8A838; }

/* 图例 */
.cal-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-hint);
  font-weight: 600;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* 日历详情弹层 */
.cal-detail {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.cal-detail.active { display: flex; }
.cal-detail-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 22px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.cal-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-detail-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
}
.cal-detail-close {
  width: 32px; height: 32px;
  border: none; background: #F5F5F5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}
.cal-detail-close:hover { background: #FFE4E8; color: var(--pink); }
.cal-detail-section {
  margin-bottom: 14px;
}
.cal-detail-section:last-child { margin-bottom: 0; }
.cal-detail-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cal-detail-items {
  background: #FAFBFC;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.cal-detail-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-hint);
  font-size: 14px;
}

/* 手机端日历 */
@media (max-width: 768px) {
  .cal-title { font-size: 17px; min-width: 110px; }
  .cal-summary-item { min-width: 80px; padding: 8px 10px; }
  .cal-summary-item .cs-value { font-size: 17px; }
  .calendar-wrap { padding: 8px; }
  .calendar-grid { gap: 2px; }
  .cal-day { min-height: 48px; border-radius: 8px; padding: 2px 1px; }
  .cal-day-num { font-size: 11px; }
  .cal-tag { font-size: 8px; padding: 0 2px; }
  .calendar-weekdays span { font-size: 10px; }
  .cal-nav-btn { width: 34px; height: 34px; }
}

/* ==================== 学习板块 ==================== */
.study-intro {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 2px 16px;
}
.study-intro-icon {
  font-size: 34px; line-height: 1;
  background: var(--sky-light);
  width: 56px; height: 56px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
}
.study-title { font-size: 18px; font-weight: 800; color: var(--text-primary); }
.study-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.study-card { width: 100%; }
.study-images:empty::after {
  content: '📷 还没有照片，点下方「拍照」记录今天的单词~';
}
.btn-study-upload {
  border: none;
  font-family: var(--font-rounded);
  font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
  background: #F8F4F5; color: var(--text-secondary);
}
.btn-study-upload:hover { background: #FFF0F3; color: var(--pink); }
#btn-study-camera { background: var(--sky-light); color: #4A93B8; }
#btn-study-camera:hover { background: var(--sky); color: white; }

/* 朗读控制条 */
.study-player {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(135deg, #FFF0F3, #F3EEF8);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.btn-play-all {
  border: none;
  background: linear-gradient(135deg, #B794D2, #89CFF0);
  color: white;
  font-family: var(--font-rounded);
  font-size: 13px; font-weight: 800;
  padding: 9px 16px; border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(137,207,240,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-play-all:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(137,207,240,0.4); }
.btn-play-all:disabled { opacity: 0.55; cursor: default; }
.btn-player {
  border: 1.5px solid #E1D5F2;
  background: white;
  color: var(--lavender);
  font-family: var(--font-rounded);
  font-size: 12px; font-weight: 700;
  padding: 8px 12px; border-radius: 20px;
  cursor: pointer;
}
.btn-player:disabled { opacity: 0.4; cursor: default; }
.rate-label {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
}
.rate-select {
  border: 1.5px solid var(--lavender-light);
  background: white; color: var(--text-primary);
  border-radius: 12px; padding: 5px 8px;
  font-family: var(--font-rounded); font-size: 12px; font-weight: 700;
}

/* 单词卡片 */
.study-words {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.word-card {
  position: relative;
  background: #FFFAFB;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  animation: entryAppear 0.3s ease;
  min-width: 0;
}
.word-card:hover {
  border-color: var(--lavender);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(183,148,210,0.2);
}
.word-card.playing {
  border-color: var(--sky);
  background: #F0FAFF;
  box-shadow: 0 0 0 3px rgba(137,207,240,0.2);
}
.word-card-word {
  font-family: var(--font-rounded);
  font-size: 17px; font-weight: 900;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.3;
}
.word-card-phonetic {
  font-size: 12px; color: var(--lavender);
  margin-top: 3px; min-height: 18px;
  word-break: break-word;
}
.word-card-example-hint {
  font-size: 11px; color: var(--text-hint);
  margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.word-card-play {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--pink-bg);
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.word-card-play:hover { background: var(--pink-light); }
.word-card-delete {
  position: absolute; bottom: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: transparent;
  color: var(--text-hint); font-size: 13px;
  cursor: pointer; opacity: 0.6;
}
.word-card-delete:hover { color: #E05555; opacity: 1; }
.study-empty {
  grid-column: 1 / -1;
  text-align: center; color: var(--text-hint);
  padding: 28px 12px; font-size: 14px;
}
.study-tip {
  font-size: 12px; color: var(--text-hint); line-height: 1.6;
  background: #FFFAFB; border-radius: 10px; padding: 8px 10px;
}

/* 例句弹窗 */
.word-modal { max-width: 560px; }
.word-detail-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.word-detail-text { min-width: 0; }
.word-big {
  font-family: var(--font-rounded);
  font-size: 28px; font-weight: 900; color: var(--pink);
  word-break: break-word; line-height: 1.2;
}
.word-phonetic { font-size: 14px; color: var(--lavender); margin-top: 4px; }
.word-meaning { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.btn-word-speak {
  flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 50%;
  border: none; background: linear-gradient(135deg, #FF8FA3, #FFB5A7);
  color: white; font-size: 20px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,143,163,0.35);
  transition: transform 0.2s;
}
.btn-word-speak:hover { transform: scale(1.06); }
.example-box {
  background: var(--mint-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1.5px solid var(--mint-light);
}
.example-label {
  font-size: 13px; font-weight: 800; color: #4E9E74;
  margin-bottom: 8px;
}
.example-label span { font-size: 11px; font-weight: 600; color: #7FB896; }
.example-text {
  font-family: var(--font-rounded);
  font-size: 16px; line-height: 2; color: var(--text-primary);
}
.ex-word {
  border: none; background: transparent;
  font-family: var(--font-rounded);
  font-size: 16px; font-weight: 700;
  color: var(--text-primary);
  padding: 1px 2px; border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
}
.ex-word:hover, .ex-word.speaking {
  background: white; color: #3E9E6D;
  box-shadow: 0 2px 6px rgba(110,203,154,0.3);
}
.example-empty { font-size: 13px; color: #7FB896; }
.btn-example-read {
  margin-top: 10px;
  border: 1.5px solid var(--mint-light);
  background: white; color: #4E9E74;
  font-family: var(--font-rounded);
  font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 16px; cursor: pointer;
}
.btn-example-read:hover { background: var(--mint-light); color: white; }

@media (max-width: 768px) {
  .study-intro-icon { width: 46px; height: 46px; font-size: 28px; }
  .study-title { font-size: 16px; }
  .study-subtitle { font-size: 12px; }
  .study-player { gap: 6px; }
  .btn-play-all { font-size: 12px; padding: 8px 12px; }
  .btn-player { font-size: 11px; padding: 7px 10px; }
  .rate-label { margin-left: 0; }
  .study-words { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .word-card-word { font-size: 16px; }
  .word-big { font-size: 24px; }
  .example-text, .ex-word { font-size: 15px; }
}
