/* =========================================================
   Ink Diary · 墨迹日记
   温暖纸张质感 + 墨色文字 + 琥珀强调色
   ========================================================= */
:root {
  --paper: #f7f2ea;
  --paper-2: #fffdf9;
  --paper-3: #f1e9dd;
  --ink: #2b2118;
  --ink-soft: #5b4f43;
  --ink-mute: #8b7f72;
  --line: #e8ddcd;
  --line-soft: #f0e8db;
  --accent: #c9793a;
  --accent-soft: #f6e3d2;
  --accent-deep: #a85f28;
  --sage: #7c9a83;
  --sage-soft: #e3ece5;
  --danger: #b8462f;
  --shadow-sm: 0 1px 2px rgba(43, 33, 24, 0.05), 0 4px 14px -8px rgba(43, 33, 24, 0.18);
  --shadow-md: 0 12px 30px -18px rgba(43, 33, 24, 0.35), 0 2px 6px rgba(43, 33, 24, 0.05);
  --shadow-lg: 0 30px 70px -30px rgba(43, 33, 24, 0.45);
  --radius: 18px;
  --radius-lg: 26px;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.32, 0.72, 0.24, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- 背景氛围 ---------- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.blob-a {
  width: 460px;
  height: 460px;
  background: #f6dcc0;
  top: -180px;
  right: -120px;
}

.blob-b {
  width: 380px;
  height: 380px;
  background: #dfe9df;
  top: 40%;
  left: -180px;
}

.blob-c {
  width: 320px;
  height: 320px;
  background: #f3e7d4;
  bottom: -140px;
  right: 20%;
}

/* ---------- 外框 ---------- */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px 40px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px 10px 18px;
  background: rgba(255, 253, 249, 0.82);
  border: 1px solid rgba(232, 221, 205, 0.9);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(140deg, #352a1e, #1f1913);
  color: #e8b06a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 14px -8px rgba(43, 33, 24, 0.6);
}

.brand-mark.large {
  width: 52px;
  height: 52px;
  border-radius: 17px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.02em;
}

.brand-text small {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.01em;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 420px;
  margin: 0 auto;
  padding: 8px 14px;
  background: var(--paper-3);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-mute);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  background: var(--paper-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 121, 58, 0.12);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--ink);
}

.search-box input::placeholder {
  color: var(--ink-mute);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-switch {
  display: flex;
  padding: 3px;
  background: var(--paper-3);
  border-radius: 999px;
}

.lang-btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  transition: all 0.18s var(--ease);
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.is-active {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.18s, color 0.18s, box-shadow 0.18s, border-color 0.18s;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(140deg, #d4884b, var(--accent-deep));
  color: #fff8ef;
  box-shadow: 0 10px 22px -12px rgba(168, 95, 40, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(140deg, #dd9355, #b46a30);
  box-shadow: 0 14px 26px -12px rgba(168, 95, 40, 0.9);
}

.btn-outline {
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: #fffaf4;
}

.btn-ghost {
  color: var(--ink-soft);
  padding: 8px 12px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--paper-3);
  color: var(--ink);
}

.btn-danger-ghost {
  color: var(--danger);
  padding: 8px 12px;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: #fbe9e5;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 14.5px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--ink-mute);
  font-size: 15px;
  transition: background 0.18s, color 0.18s;
}

.icon-btn:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.link-btn {
  display: block;
  margin: 14px auto 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-deep);
  padding: 4px 8px;
  border-radius: 8px;
}

.link-btn:hover {
  background: var(--accent-soft);
}

/* ---------- 用户区 ---------- */
.user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--paper-3);
  border-radius: 999px;
  transition: background 0.18s;
}

.user-trigger:hover {
  background: #ece2d4;
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, #d4884b, #a85f28);
  color: #fff8ef;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 190px;
  padding: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  animation: pop 0.16s var(--ease);
}

.user-menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}

.user-menu-head strong {
  display: block;
  font-size: 13.5px;
}

.user-menu-head span {
  font-size: 11.5px;
  color: var(--ink-mute);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: left;
}

.menu-item:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: #fbe9e5;
}

/* ---------- 主布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 26px;
  margin-top: 26px;
  align-items: start;
}

.primary {
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-width: 0;
}

.secondary {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 86px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 26px;
  padding: 38px 38px 32px;
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 140% at 90% 0%, #453422 0%, #2a2017 55%, #211a12 100%);
  color: #f6ecdd;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(232, 176, 106, 0.14);
  border: 1px solid rgba(232, 176, 106, 0.28);
  color: #eec38a;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8b06a;
  box-shadow: 0 0 0 3px rgba(232, 176, 106, 0.18);
}

.hero h1 {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.1vw, 38px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0.01em;
  color: #fdf7ec;
}

.hero-sub {
  margin-top: 14px;
  max-width: 44ch;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(246, 236, 221, 0.72);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero .btn-outline {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.22);
  color: #f6ecdd;
}

.hero .btn-outline:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

.hero-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 11.5px;
  color: rgba(246, 236, 221, 0.45);
}

/* Hero 插画 */
.hero-art {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 220px;
}

.paper-stack {
  position: relative;
  width: 100%;
  max-width: 250px;
  aspect-ratio: 0.82;
}

.paper-card {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(160deg, #fffdf8, #f6ecdc);
}

.paper-back {
  transform: rotate(7deg) translate(10px, 6px);
  opacity: 0.35;
}

.paper-front {
  transform: rotate(-4deg);
  padding: 20px 20px 16px;
  box-shadow: 0 26px 40px -22px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: floaty 7s ease-in-out infinite;
}

.paper-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #a8957f;
  letter-spacing: 0.08em;
}

.paper-date {
  font-weight: 700;
}

.paper-mood {
  font-size: 15px;
}

.paper-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.paper-lines .line {
  height: 7px;
  border-radius: 999px;
  background: #e9dfcd;
}

.line.w-90 { width: 90%; }
.line.w-80 { width: 80%; }
.line.w-70 { width: 70%; }

.paper-doodle {
  width: 100%;
  height: auto;
  margin-top: auto;
}

.paper-wave {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 26px;
  padding: 0 2px;
}

.paper-wave span {
  flex: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, #d9a06a, #b8783f);
  opacity: 0.85;
  animation: wave 1.6s ease-in-out infinite;
}

.paper-wave span:nth-child(1) { height: 30%; animation-delay: 0s; }
.paper-wave span:nth-child(2) { height: 62%; animation-delay: 0.1s; }
.paper-wave span:nth-child(3) { height: 44%; animation-delay: 0.2s; }
.paper-wave span:nth-child(4) { height: 88%; animation-delay: 0.3s; }
.paper-wave span:nth-child(5) { height: 54%; animation-delay: 0.4s; }
.paper-wave span:nth-child(6) { height: 96%; animation-delay: 0.5s; }
.paper-wave span:nth-child(7) { height: 40%; animation-delay: 0.6s; }
.paper-wave span:nth-child(8) { height: 70%; animation-delay: 0.7s; }
.paper-wave span:nth-child(9) { height: 34%; animation-delay: 0.8s; }

.pen-float {
  position: absolute;
  right: -6px;
  top: 8%;
  width: 8px;
  height: 120px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8b06a, #b8783f 70%, #6b4a2a);
  transform: rotate(24deg);
  box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.7);
  opacity: 0.9;
}

/* ---------- 统计卡 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 16px;
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: 11.5px;
  color: var(--ink-mute);
}

/* ---------- 列表 ---------- */
.list-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.01em;
}

.muted {
  color: var(--ink-mute);
}

.small {
  font-size: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.16s var(--ease);
}

.chip:hover {
  border-color: #d7c7b2;
  color: var(--ink);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fbf4e8;
}

.chip-row.compact .chip {
  padding: 5px 10px;
  font-size: 12px;
}

.chip-row.compact .chip.is-active {
  background: var(--accent-soft);
  border-color: #e3b98e;
  color: var(--accent-deep);
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.22s var(--ease), box-shadow 0.22s, border-color 0.22s;
  text-align: left;
  animation: rise 0.32s var(--ease) both;
}

.entry-card:hover {
  transform: translateY(-3px);
  border-color: #e2d3bf;
  box-shadow: var(--shadow-md);
}

.entry-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.entry-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-mute);
  letter-spacing: 0.03em;
}

.entry-mood {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--paper-3);
  font-size: 14px;
}

.entry-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-excerpt {
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.4em;
}

.entry-thumb {
  margin-top: 12px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper-3);
  border: 1px solid var(--line-soft);
}

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

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: #4d6b54;
  font-size: 11px;
  font-weight: 500;
}

.entry-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  color: var(--ink-mute);
}

.media-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 600;
}

.media-pill.voice {
  background: #e8eef6;
  color: #4a6584;
}

.entry-words {
  margin-left: auto;
}

/* 空态 */
.list-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 46px 20px;
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

.state-illustration {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 22px;
  background: var(--paper-3);
  font-size: 26px;
  margin-bottom: 6px;
}

.list-state h3 {
  font-family: var(--font-display);
  font-size: 18px;
}

.list-state p {
  font-size: 13px;
  color: var(--ink-mute);
  max-width: 36ch;
}

.list-state .btn {
  margin-top: 12px;
}

.list-footer {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}

/* ---------- 侧栏 ---------- */
.panel {
  padding: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-head h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-3);
  color: var(--ink-mute);
  font-size: 10.5px;
  font-weight: 600;
}

.week-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 108px;
}

.week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}

.week-bar-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  flex: 1;
}

.week-bar {
  width: 100%;
  max-width: 20px;
  min-height: 4px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #e0b183, #c9793a);
  transition: height 0.5s var(--ease);
}

.week-bar.is-zero {
  background: var(--paper-3);
}

.week-day {
  font-size: 10px;
  color: var(--ink-mute);
  text-transform: uppercase;
}

.week-count {
  position: absolute;
  top: -2px;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-deep);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 24px;
}

.tag-cloud .tag {
  background: var(--paper-3);
  color: var(--ink-soft);
  font-size: 11.5px;
  padding: 4px 10px;
}

.tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.tips-list li {
  display: flex;
  gap: 9px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.tips-list li span {
  flex-shrink: 0;
}

/* ---------- 页脚 ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-mute);
}

.footer-links {
  display: flex;
  gap: 14px;
}

.footer-links a:hover {
  color: var(--accent-deep);
}

/* ---------- 遮罩与弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(32, 24, 17, 0.5);
  backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}

.sheet {
  width: 100%;
  max-width: 700px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: sheetIn 0.28s var(--ease);
  overflow: hidden;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 12px;
}

.sheet-head h2 {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.3;
}

.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--paper-2);
}

.spacer {
  flex: 1;
}

/* ---------- 编辑器 ---------- */
.editor-sheet {
  max-width: 720px;
}

.editor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  padding: 4px 24px 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field > span,
.field-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink-mute);
  text-transform: uppercase;
}

.field input {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  font-size: 13.5px;
  font-weight: 400;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 121, 58, 0.12);
}

.field-date input {
  width: 156px;
}

.title-input {
  margin: 4px 24px 0;
  padding: 6px 0 12px;
  width: calc(100% - 48px);
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s;
}

.title-input:focus {
  border-bottom-color: var(--accent);
}

.title-input::placeholder {
  color: #c9bca9;
}

.editor-tabs {
  display: flex;
  gap: 4px;
  margin: 16px 24px 0;
  padding: 4px;
  background: var(--paper-3);
  border-radius: 999px;
  align-self: flex-start;
}

.tab-btn {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-mute);
  transition: all 0.18s var(--ease);
}

.tab-btn:hover {
  color: var(--ink);
}

.tab-btn.is-active {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 14px 24px 18px;
  min-height: 0;
}

#entryContent {
  width: 100%;
  min-height: 210px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 14px;
  line-height: 1.85;
  resize: vertical;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

#entryContent:focus {
  border-color: var(--accent);
  background: #fffdf9;
  box-shadow: 0 0 0 4px rgba(201, 121, 58, 0.1);
}

.word-count {
  margin-top: 6px;
  text-align: right;
  font-size: 11.5px;
  color: var(--ink-mute);
}

.tag-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 16px;
}

.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.tag-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 121, 58, 0.1);
}

.tag-input-wrap input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  padding: 3px 2px;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: #4d6b54;
  font-size: 11.5px;
  font-weight: 500;
}

.tag-chip button {
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  color: #5f7d66;
  font-size: 11px;
  line-height: 1;
}

.tag-chip button:hover {
  background: rgba(77, 107, 84, 0.16);
}

.hint {
  font-size: 11px;
  color: var(--ink-mute);
}

/* ---------- 手写画布 ---------- */
.draw-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tool-group,
.size-group {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--paper-3);
  border-radius: 12px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  transition: all 0.16s var(--ease);
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.tool-btn.is-active {
  background: var(--ink);
  color: #fbf4e8;
  box-shadow: var(--shadow-sm);
}

.tool-btn.wide {
  background: var(--paper-3);
  border-radius: 10px;
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.size-btn span {
  display: block;
  border-radius: 50%;
  background: currentColor;
}

.color-swatches {
  display: flex;
  gap: 5px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(43, 33, 24, 0.12);
  transition: transform 0.15s var(--ease), border-color 0.15s;
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.is-active {
  border-color: var(--ink);
  transform: scale(1.08);
}

.tool-spacer {
  flex: 1;
}

.canvas-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffdf8;
  box-shadow: inset 0 1px 3px rgba(43, 33, 24, 0.04);
}

#drawCanvas {
  display: block;
  width: 100%;
  height: 320px;
  cursor: crosshair;
  touch-action: none;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  font-size: 12.5px;
  color: #bcae9b;
  pointer-events: none;
  transition: opacity 0.2s;
}

.canvas-empty.is-hidden {
  opacity: 0;
}

.draw-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

/* ---------- 语音 ---------- */
.voice-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.voice-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 170px;
  padding: 22px;
  border-radius: 18px;
  background: radial-gradient(120% 140% at 20% 0%, #3d2f21, #241c14 70%);
  color: #f3e8d7;
  overflow: hidden;
}

.voice-visual.is-recording {
  box-shadow: inset 0 0 0 1px rgba(232, 176, 106, 0.35);
}

.voice-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 62px;
  width: 100%;
  max-width: 320px;
}

.voice-bars span {
  flex: 1;
  max-width: 8px;
  min-height: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f0c48d, #c9793a);
  opacity: 0.35;
  transition: height 0.12s linear, opacity 0.2s;
}

.voice-visual.is-recording .voice-bars span {
  opacity: 0.95;
}

.voice-status {
  font-size: 12.5px;
  color: rgba(243, 232, 215, 0.65);
  text-align: center;
}

.voice-timer {
  font-family: "SF Mono", "Roboto Mono", Menlo, monospace;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #f7ead6;
}

.voice-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff3e4;
}

.voice-visual.is-recording .rec-dot {
  background: #ffd6a8;
  animation: pulse 1.2s ease-in-out infinite;
}

.voice-playback audio,
.view-audio audio {
  width: 100%;
  height: 40px;
}

/* ---------- 查看 ---------- */
.view-sheet {
  max-width: 640px;
}

.view-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 24px 14px;
}

.view-body {
  padding: 0 24px 18px;
  overflow-y: auto;
  min-height: 0;
}

.view-content {
  font-size: 14.5px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.view-drawing {
  margin-top: 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fffdf8;
}

.view-drawing img {
  width: 100%;
}

.view-audio {
  margin-top: 16px;
  padding: 12px;
  border-radius: 14px;
  background: var(--paper-3);
}

/* ---------- 登录 ---------- */
.auth-sheet {
  max-width: 400px;
  padding: 30px 28px 26px;
  position: relative;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-brand .brand-mark {
  margin-bottom: 4px;
}

.auth-brand h2 {
  font-family: var(--font-display);
  font-size: 23px;
}

.auth-brand p {
  font-size: 12.5px;
}

.auth-sheet form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-sheet .field input {
  padding: 11px 13px;
  background: var(--paper);
}

.form-error {
  padding: 9px 12px;
  border-radius: 10px;
  background: #fbe9e5;
  color: var(--danger);
  font-size: 12.5px;
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(360px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 15px;
  border-radius: 14px;
  background: rgba(38, 29, 21, 0.96);
  color: #f7ecdc;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.24s var(--ease);
  pointer-events: auto;
}

.toast.is-out {
  animation: toastOut 0.2s ease forwards;
}

.toast .toast-icon {
  flex-shrink: 0;
  font-size: 14px;
  line-height: 1.35;
}

.toast.success .toast-icon { color: #9ed3a8; }
.toast.error .toast-icon { color: #f2a795; }
.toast.info .toast-icon { color: #eec38a; }

/* ---------- 动画 ---------- */
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes floaty {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(-2.5deg) translateY(-7px); }
}

@keyframes wave {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .secondary {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) 240px;
  }
}

@media (max-width: 880px) {
  .app-shell {
    padding: 12px 16px 30px;
  }

  .topbar {
    flex-wrap: wrap;
    border-radius: 22px;
    padding: 10px 12px;
    gap: 10px;
  }

  .search-box {
    order: 3;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .admin-link {
    display: none;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 28px 24px 24px;
  }

  .hero-art {
    display: none;
  }

  .entry-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .secondary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .tips-panel {
    grid-column: 1 / -1;
  }

  .editor-meta {
    gap: 12px 18px;
  }
}

@media (max-width: 620px) {
  .brand-text small {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secondary {
    grid-template-columns: minmax(0, 1fr);
  }

  .secondary .tips-panel {
    grid-column: auto;
  }

  .overlay {
    padding: 0;
    align-items: flex-end;
  }

  .sheet {
    max-width: 100%;
    max-height: 94vh;
    border-radius: 22px 22px 0 0;
    animation: sheetUp 0.28s var(--ease);
  }

  @keyframes sheetUp {
    from { transform: translateY(40px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
  }

  .auth-sheet {
    border-radius: 22px 22px 0 0;
    padding: 26px 20px 22px;
  }

  .sheet-head {
    padding: 18px 18px 10px;
  }

  .editor-meta {
    padding: 2px 18px 10px;
  }

  .title-input {
    margin: 2px 18px 0;
    width: calc(100% - 36px);
    font-size: 19px;
  }

  .editor-tabs {
    margin: 14px 18px 0;
  }

  .tab-panel {
    padding: 12px 18px 16px;
  }

  .sheet-foot {
    padding: 12px 18px;
  }

  #drawCanvas {
    height: 260px;
  }

  .color-swatches {
    order: 5;
    width: 100%;
  }

  .toast-host {
    right: 12px;
    left: 12px;
    bottom: 12px;
    max-width: none;
  }

  .section-head h2 {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
