﻿:root {
  --bg: #f6f1ea;
  --card: #ffffff;
  --ink: #1c1b1a;
  --muted: #6e6a66;
  --accent: #b2a085;
  --accent-strong: #8b7355;
  --line: #e6e0d8;
  --shadow: 0 14px 40px rgba(50, 40, 25, 0.12);
  --danger: #b76a6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Palatino", serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #fbf7f1 0%, var(--bg) 55%, #efe7dc 100%);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px;
  max-width: 520px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 22px 14px;
}

.topbar .title-wrap {
  display: grid;
  gap: 4px;
}


.title {
  font-size: 28px;
  letter-spacing: 1px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.main {
  flex: 1;
  padding: 0 20px 24px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.35s ease;
}

.tab-panel.active {
  display: block;
}


.search-row {
  display: none;
  margin-bottom: 14px;
}

.search-row.active {
  display: block;
}

.search-row input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffefb;
  font-size: 15px;
}

.card-list {
  display: grid;
  gap: 16px;
}

.record-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
}

.record-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1px solid rgba(226, 217, 204, 0.7);
  pointer-events: none;
}

.card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
}

.card-text {
  min-width: 0;
}

.mood {
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #f0ebe2;
  display: grid;
  place-items: center;
}

.card-text .text {
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f5f1ea;
  color: var(--accent-strong);
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: #f3eee7;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-menu {
  position: relative;
}

.menu-btn {
  font-size: 18px;
}

.menu {
  position: absolute;
  right: 0;
  top: 28px;
  background: var(--card);
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow);
  display: none;
  min-width: 90px;
  z-index: 10;
}

.card-menu.open .menu {
  display: block;
}

.menu-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 8px;
}

.menu-item:hover {
  background: #f4efe8;
}

.card-footer {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.fab {
  position: fixed;
  right: 22px;
  bottom: 92px;
  width: 52px;
  height: 52px;
  border-radius: 20px;
  border: none;
  font-size: 30px;
  background: var(--accent-strong);
  color: white;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.fab:hover {
  transform: translateY(-2px);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 8px 0 14px;
}

.nav-item {
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 10px;
}

.nav-item.active {
  color: var(--accent-strong);
  font-weight: 600;
}

.range-card {
  background: var(--card);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  position: relative;
}

.range-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  border: 1px solid rgba(226, 217, 204, 0.7);
  pointer-events: none;
}

.range-title {
  font-size: 18px;
}

.range-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--line);
  background: #fbf7f1;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--muted);
}

.pill.active {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.custom-range {
  display: none;
  gap: 12px;
}

.custom-range.active {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.custom-range label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.custom-range input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.primary-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--accent-strong);
  color: #fff;
  cursor: pointer;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
}

.ghost-btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.summary-grid {
  margin-top: 20px;
  display: grid;
  gap: 16px;
}

.summary-card {
  background: var(--card);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.summary-card {
  position: relative;
}

.summary-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  border: 1px solid rgba(226, 217, 204, 0.7);
  pointer-events: none;
}

.ai-output {
  margin-top: 16px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-actions {
  display: flex;
  gap: 8px;
}


.summary-text {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.chart-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  align-items: center;
}

.pie {
  width: 160px;
  height: 160px;
  position: relative;
}

.legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.tag-cloud button {
  border: none;
  background: #f5f1ea;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--accent-strong);
  transition: transform 0.2s ease, background 0.2s ease;
}

.tag-cloud button.cloud-item:hover {
  transform: scale(1.08) rotate(0deg);
  background: #efe7dc;
}

.filter-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.list-card {
  margin-top: 20px;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.chat-title {
  font-size: 22px;
}

.chat-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 50vh;
  padding-bottom: 80px;
  overflow-y: auto;
}

.chat-messages::before {
  content: "今天的你想从哪里开始？";
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  align-self: center;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
  box-shadow: var(--shadow);
}

.chat-bubble.user {
  align-self: flex-end;
  background: #fff8ef;
  border: 1px solid #efe2d4;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.chat-input {
  position: sticky;
  bottom: 84px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: transparent;
}

.chat-input input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(139, 115, 85, 0.12);
}

.chat-input input {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 14px;
  background: #fffefb;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(24, 20, 16, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--card);
  width: min(720px, 100%);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: grid;
  max-height: 90vh;
}

.modal-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-actions {
  display: flex;
  gap: 8px;
}

.modal-body {
  padding: 18px;
  overflow: auto;
}

.modal-body textarea {
  width: 100%;
  min-height: 160px;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px;
  font-size: 15px;
}

.field {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.mood-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mood-option {
  border: 1px solid var(--line);
  background: #fbf7f1;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}

.mood-option.active {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

#addCustomMood {
  justify-self: start;
}

.image-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.image-preview img {
  width: 90px;
  height: 70px;
  object-fit: cover;
  border-radius: 12px;
}

.detail {
  display: grid;
  gap: 16px;
}

.detail-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.detail-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.detail-text {
  font-size: 15px;
  line-height: 1.6;
}

.detail-tags,
.detail-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-images img {
  width: 120px;
  height: 90px;
  border-radius: 12px;
  object-fit: cover;
}

.spacer {
  width: 40px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  body {
    background: var(--bg);
  }

  .app-shell {
    max-width: none;
    margin: 0;
  }

  .topbar {
    padding: 22px 16px 10px;
  }

  .main {
    padding: 0 16px 24px;
  }

  .chart-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .card-head {
    grid-template-columns: auto 1fr auto;
  }

  .thumb {
    width: 72px;
    height: 72px;
  }
}
