:root {
      --bg: #f7f5f0;
      --surface: #ffffff;
      --border: #e0dbd0;
      --text: #2a2420;
      --text-secondary: #8a8078;
      --accent: #5c4a3a;
      --accent-light: #f0ebe0;
      --success: #3d6b4f;
      --success-bg: #edf5f0;
      --error: #8b3a3a;
      --error-bg: #fdf0f0;
      --unread: #e8e0f0;
      --radius: 8px;
      --shadow: 0 2px 12px rgba(60,40,20,0.08);
    }

    [data-theme="dark"] {
      --bg: #1a1714;
      --surface: #242018;
      --border: #3a3530;
      --text: #e8e0d8;
      --text-secondary: #9a9088;
      --accent: #c8a87a;
      --accent-light: #2a2418;
      --success: #5a9a70;
      --success-bg: #1a2a20;
      --error: #c87a7a;
      --error-bg: #2a1818;
      --unread: #2a2438;
      --shadow: 0 2px 12px rgba(0,0,0,0.3);
    }

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

    body {
      font-family: 'Noto Sans SC', sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 48px 16px 80px;
    }

    /* 漂浮留言墙 */
    #bubble-layer {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 0;
      overflow: hidden;
    }

    .bubble {
      position: absolute;
      top: 0;
      left: 0;
      pointer-events: auto;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      color: var(--text-secondary);
      line-height: 1.4;
      opacity: 0.22;
      cursor: default;
      user-select: none;
      white-space: nowrap;
      max-width: 200px;
      overflow: hidden;
      text-overflow: ellipsis;
      transition: opacity 0.3s;
      will-change: transform;
    }

    .bubble-hover {
      opacity: 0.9 !important;
      z-index: 2;
      white-space: normal;
      max-width: 240px;
      cursor: text;
    }

    body.has-bubbles .card {
      box-shadow: var(--shadow);
    }

    /* 顶部 */
    header {
      text-align: center;
      margin-bottom: 40px;
      position: relative;
      z-index: 1;
    }

    header h1 {
      font-family: 'Noto Serif SC', serif;
      font-weight: 300;
      font-size: 2rem;
      letter-spacing: 0.08em;
      color: var(--accent);
      margin-bottom: 10px;
    }

    header p {
      font-size: 0.9rem;
      color: var(--text-secondary);
      line-height: 1.7;
    }

    /* 卡片容器 */
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 32px;
      width: 100%;
      max-width: 560px;
      position: relative;
      z-index: 1;
    }

    /* 表单 */
    .form-group {
      margin-bottom: 20px;
    }

    label {
      display: block;
      font-size: 0.8rem;
      color: var(--text-secondary);
      margin-bottom: 6px;
      letter-spacing: 0.03em;
    }

    textarea, input[type="text"], input[type="url"] {
      width: 100%;
      font-family: 'Noto Sans SC', sans-serif;
      font-size: 0.95rem;
      color: var(--text);
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 12px 14px;
      outline: none;
      transition: border-color 0.2s;
      resize: vertical;
    }

    textarea { min-height: 140px; }

    textarea:focus, input:focus {
      border-color: var(--accent);
      background: var(--surface);
    }

    .char-count {
      text-align: right;
      font-size: 0.75rem;
      color: var(--text-secondary);
      margin-top: 4px;
    }
    .char-count.over { color: var(--error); }

    .tip {
      font-size: 0.75rem;
      color: var(--text-secondary);
      margin-top: 5px;
    }

    .tip-link {
      color: var(--accent);
      text-decoration: none;
    }

    .tip-link:hover { text-decoration: underline; }

    /* 提交按钮 */
    .submit-btn {
      width: 100%;
      padding: 13px;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: var(--radius);
      font-family: 'Noto Sans SC', sans-serif;
      font-size: 0.95rem;
      letter-spacing: 0.05em;
      cursor: pointer;
      transition: opacity 0.2s, transform 0.1s;
      margin-top: 4px;
    }

    .submit-btn:hover { opacity: 0.88; }
    .submit-btn:active { transform: scale(0.99); }
    .submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

    /* 反馈 */
    .feedback {
      margin-top: 16px;
      padding: 14px 16px;
      border-radius: var(--radius);
      font-size: 0.9rem;
      line-height: 1.6;
    }
    .feedback.hidden { display: none; }
    .feedback.success {
      background: var(--success-bg);
      border: 1px solid #b8d8c4;
      color: var(--success);
    }
    .feedback.error {
      background: var(--error-bg);
      border: 1px solid #e8c0c0;
      color: var(--error);
    }
    .feedback strong { display: block; margin-bottom: 4px; }
    .feedback button {
      margin-top: 10px;
      background: none;
      border: 1px solid currentColor;
      color: inherit;
      padding: 5px 12px;
      border-radius: 4px;
      cursor: pointer;
      font-size: 0.85rem;
    }

    /* 发送确认预览 */
    .sent-preview {
      margin: 8px 0;
      padding: 10px 12px;
      background: rgba(255,255,255,0.6);
      border-radius: 6px;
      border-left: 3px solid var(--success);
    }

    .sent-content {
      font-size: 0.88rem;
      line-height: 1.5;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .sent-img-link {
      font-size: 0.8rem;
      color: var(--success);
      text-decoration: none;
      display: inline-block;
      margin-top: 4px;
    }

    .send-another-btn {
      margin-top: 10px;
      background: none;
      border: 1px solid currentColor;
      color: inherit;
      padding: 5px 12px;
      border-radius: 4px;
      cursor: pointer;
      font-size: 0.85rem;
      font-family: inherit;
    }

    /* 历史记录 */
    .history-section {
      margin-top: 24px;
      border-top: 1px solid var(--border);
      padding-top: 20px;
    }

    .history-toggle {
      background: none;
      border: none;
      color: var(--text-secondary);
      font-size: 0.85rem;
      cursor: pointer;
      padding: 0;
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    #history-list {
      display: none;
      margin-top: 16px;
    }

    .history-item {
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
    }
    .history-item:last-child { border-bottom: none; }

    .history-content {
      font-size: 0.9rem;
      line-height: 1.6;
      white-space: pre-wrap;
    }

    .history-time {
      font-size: 0.75rem;
      color: var(--text-secondary);
      display: block;
      margin-top: 6px;
    }

    .history-img-link {
      font-size: 0.8rem;
      color: var(--accent);
      text-decoration: none;
      display: inline-block;
      margin-top: 4px;
    }

    .loading, .empty {
      color: var(--text-secondary);
      font-size: 0.85rem;
      padding: 8px 0;
    }

    .history-reply {
      margin-top: 8px;
      background: var(--accent-light);
      border-left: 2px solid var(--accent);
      border-radius: 0 6px 6px 0;
      padding: 8px 10px;
    }

    .history-reply-label {
      font-size: 0.72rem;
      color: var(--accent);
      font-weight: 500;
      display: block;
      margin-bottom: 3px;
    }

    .history-reply-content {
      font-size: 0.88rem;
      line-height: 1.5;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text);
    }

    .history-reply-time {
      font-size: 0.72rem;
      color: var(--text-secondary);
      display: block;
      margin-top: 4px;
    }

    /* 置顶消息 */
    .pinned-toggle {
      background: none;
      border: none;
      font-size: 0.75rem;
      color: var(--text-secondary);
      cursor: pointer;
      padding: 2px 0;
      font-family: inherit;
      opacity: 0.7;
    }

    .pinned-toggle:hover { opacity: 1; color: var(--accent); }

    .pinned-list {
      margin-top: 6px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }

    .pinned-item {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
    }

    .pinned-item:last-child { border-bottom: none; }

    .pinned-content {
      font-size: 0.9rem;
      line-height: 1.6;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text);
    }

    .pinned-time {
      font-size: 0.72rem;
      color: var(--text-secondary);
      display: block;
      margin-top: 4px;
    }

    /* 装饰线 */
    .divider {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 24px;
    }
    .divider::before, .divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border);
    }
    .divider span {
      font-size: 0.75rem;
      color: var(--text-secondary);
      letter-spacing: 0.08em;
    }

    @media (max-width: 600px) {
      header h1 { font-size: 1.6rem; }
      .card { padding: 24px 20px; }
    }

/* 名片面板（独立卡片） */
.card-panel {
  padding: 16px 32px;
}

@media (max-width: 600px) {
  .card-panel { padding: 14px 20px; }
}

.card-section-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.card-section-toggle:hover { color: var(--accent); }

.card-fields {
  margin-top: 14px;
}

.card-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-nickname {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-bio {
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-save-btn {
  margin-top: 14px;
  padding: 8px 20px;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius);
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, color 0.2s;
}

.card-save-btn:hover {
  background: var(--accent);
  color: #fff;
}

.card-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.card-tip {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 6px;
  opacity: 0.7;
}

/* 语言菜单 */
.lang-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  overflow: hidden;
  z-index: 100;
  min-width: 110px;
}

.lang-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  gap: 10px;
  transition: background 0.1s;
}

.lang-menu-item:hover { background: var(--accent-light); }

.lang-menu-item.active {
  color: var(--accent);
  font-weight: 500;
}

.lang-menu-check {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* 公开留言板 */
.public-board {
  width: 100%;
  max-width: 560px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.public-board-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.public-board-title {
  font-family: 'Noto Serif SC', serif;
  font-weight: 300;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin: 0;
}

.public-board-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.public-board-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.public-msg {
  background: var(--surface);
  padding: 14px 16px;
}

.public-msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.public-msg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.public-msg-nickname {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}

.public-msg-anon {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.public-msg-content {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.public-msg-time {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 6px;
}