/*
 * TheClaw — Editorial Soft theme
 * 2026-05-14
 *
 * Direction: 现代少女文学 / 编辑感杂志感。
 * Inspiration: 小红书 / lemon8 / 杂志内页 / 旧书店标签。
 * Restraint > maximalism. One accent color (烟粉) used very sparingly.
 */

/* === Type via Google Fonts === */
/* Imported on the document head so we avoid a render-blocking @import in CSS. */

:root {
  /* Surfaces */
  --surface-page: #FAF7F2;        /* warm offwhite, main background */
  --surface-card: #FFFFFF;
  --surface-soft: #FFFBF5;        /* card hover / subtle elevation */
  --surface-tint: #F5EFE3;        /* cream-tea tint for hero gradients */

  /* Text — deep charcoal, never pure black */
  --ink-strong: #2C2C2C;
  --ink-medium: #5A554F;
  --ink-mute: #8A8278;
  --ink-soft: #BBB3A8;

  /* Hairline borders */
  --line: #E8E0D6;
  --line-strong: #D4CABC;
  --line-faint: #F2EDE5;

  /* The single accent: 浅茶色 (warm, "高级感", not pink) */
  --accent: #C4A882;              /* light tea */
  --accent-deep: #8F7050;         /* deep tea — buttons hover, italic display */
  --accent-soft: #E8DDC8;         /* cream-tea — soft backgrounds */
  --accent-on: #FFFFFF;           /* text/icon on the accent fill */

  /* Soft shadows — never aggressive */
  --shadow-rest: 0 1px 0 var(--line);
  --shadow-soft: 0 8px 28px rgba(60, 40, 38, 0.05);
  --shadow-hover: 0 16px 48px rgba(60, 40, 38, 0.08);

  /* Typography */
  --font-display: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-deco: "Cormorant Garamond", "EB Garamond", "Playfair Display", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
               "Hiragino Sans GB", "Microsoft Yahei", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "Menlo", monospace;

  /* Type scale (mobile-first) */
  --size-display: clamp(2.25rem, 8vw, 3.75rem);   /* hero */
  --size-h1: clamp(1.75rem, 5.5vw, 2.5rem);
  --size-h2: clamp(1.375rem, 4vw, 1.75rem);
  --size-h3: 1.125rem;
  --size-body: 1rem;
  --size-small: 0.875rem;
  --size-tiny: 0.75rem;

  /* Line heights */
  --lh-tight: 1.15;
  --lh-display: 1.25;
  --lh-body: 1.7;

  /* Spacing (generous) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --space-9: 112px;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 24px;
  --r-pill: 999px;

  /* Motion */
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-emph: cubic-bezier(0.32, 0.0, 0.0, 1.0);
  --dur-fast: 180ms;
  --dur-base: 320ms;
  --dur-page: 520ms;
}

/* === Apply theme only to user-facing pages (.public-shell, .user-shell) === */

body.public-shell,
body.user-shell {
  background: var(--surface-page);
  color: var(--ink-strong);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
  margin: 0;
}

/* Editorial decorative type for English captions and eyebrow */
body.public-shell .eyebrow,
body.user-shell .eyebrow,
body.public-shell [data-eyebrow],
body.user-shell [data-eyebrow] {
  font-family: var(--font-deco);
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: var(--size-tiny);
  color: var(--accent-deep);
  margin: 0 0 var(--space-3);
  display: inline-block;
}

/* Display headings: serif, restrained weight */
body.public-shell h1,
body.user-shell h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--size-h1);
  line-height: var(--lh-display);
  letter-spacing: 0.005em;
  color: var(--ink-strong);
  margin: 0 0 var(--space-4);
}

body.public-shell h2,
body.user-shell h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--size-h2);
  line-height: var(--lh-display);
  color: var(--ink-strong);
  margin: 0 0 var(--space-3);
}

body.public-shell h3,
body.user-shell h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--size-h3);
  line-height: 1.4;
  color: var(--ink-strong);
  margin: 0 0 var(--space-3);
}

body.public-shell h4,
body.user-shell h4 {
  font-family: var(--font-body);
  font-size: var(--size-small);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: var(--space-5) 0 var(--space-3);
}

body.public-shell p,
body.user-shell p {
  margin: 0 0 var(--space-3);
  color: var(--ink-medium);
}

body.public-shell .muted,
body.user-shell .muted,
body.public-shell .lead,
body.user-shell .lead {
  color: var(--ink-mute);
}

body.public-shell .lead,
body.user-shell .lead {
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Soft links */
body.public-shell a,
body.user-shell a {
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-soft),
              color var(--dur-fast) var(--ease-soft);
}

body.public-shell a:hover,
body.user-shell a:hover {
  border-bottom-color: var(--accent);
}

/* === Public layout (login / bind / landing) === */

body.public-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.public-shell .public-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-faint);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

body.public-shell .public-brand {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--ink-strong);
  letter-spacing: 0.04em;
  border: none;
}

body.public-shell .public-nav nav {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  flex-wrap: wrap;
}

body.public-shell .public-nav nav a {
  color: var(--ink-medium);
  font-size: var(--size-small);
  letter-spacing: 0.03em;
  border: none;
  transition: color var(--dur-fast) var(--ease-soft);
}

body.public-shell .public-nav nav a:hover {
  color: var(--accent-deep);
  border-bottom: 1px solid var(--accent);
}

body.public-shell .public-main {
  flex: 1;
  padding: var(--space-6) var(--space-5) var(--space-8);
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}

/* === User dashboard layout === */

body.user-shell {
  min-height: 100dvh;
}

body.user-shell .user-topbar {
  background: var(--surface-page);
  border-bottom: 1px solid var(--line-faint);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(250, 247, 242, 0.92);
}

body.user-shell .user-brand {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  color: var(--ink-strong);
  border: none;
  letter-spacing: 0.05em;
}

body.user-shell .user-nav {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}

body.user-shell .user-nav a {
  font-size: var(--size-small);
  color: var(--ink-mute);
  padding: var(--space-1) var(--space-2);
  /* Defensive resets — override any framework defaults that fill .active */
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  position: relative;
  letter-spacing: 0.03em;
  transition: color var(--dur-fast) var(--ease-soft);
  text-decoration: none;
}

body.user-shell .user-nav a:hover {
  color: var(--ink-strong);
  background: transparent !important;
}

body.user-shell .user-nav a.active,
body.user-shell .user-nav a.active:hover,
body.user-shell .user-nav a.active:focus {
  color: var(--accent-deep);
  background: transparent !important;
  font-weight: 600;
}

body.user-shell .user-nav a.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  width: 18px;
  height: 1px;
  background: var(--accent);
}

body.user-shell .user-account {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--size-small);
  color: var(--ink-mute);
}

body.user-shell .user-main {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--space-7) var(--space-5) var(--space-9);
}

/* === Page head === */

body.public-shell .page-head,
body.user-shell .page-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-7);
  border-bottom: 1px solid var(--line-faint);
  padding-bottom: var(--space-5);
}

body.public-shell .page-head h1,
body.public-shell .page-head h2,
body.user-shell .page-head h1,
body.user-shell .page-head h2 {
  margin: 0;
}

/* === Card / Panel === */

body.public-shell .panel,
body.user-shell .panel {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--dur-base) var(--ease-soft),
              transform var(--dur-base) var(--ease-soft);
}

body.public-shell .panel + .panel,
body.user-shell .panel + .panel {
  margin-top: var(--space-5);
}

body.user-shell .panel:hover {
  box-shadow: var(--shadow-hover);
}

body.public-shell .bind-card,
body.user-shell .bind-card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-7) var(--space-6);
  box-shadow: var(--shadow-soft);
  max-width: 480px;
  margin: var(--space-7) auto;
}

/* === Forms === */

body.public-shell label,
body.user-shell label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--size-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: var(--space-4) 0 var(--space-2);
  font-weight: 500;
}

body.public-shell input[type="text"],
body.public-shell input[type="email"],
body.public-shell input[type="password"],
body.public-shell input[type="number"],
body.public-shell input[type="search"],
body.public-shell input:not([type]),
body.public-shell textarea,
body.public-shell select,
body.user-shell input[type="text"],
body.user-shell input[type="email"],
body.user-shell input[type="password"],
body.user-shell input[type="number"],
body.user-shell input[type="search"],
body.user-shell input:not([type]),
body.user-shell textarea,
body.user-shell select {
  width: 100%;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: var(--size-body);
  color: var(--ink-strong);
  transition: border-color var(--dur-fast) var(--ease-soft),
              background var(--dur-fast) var(--ease-soft);
  box-sizing: border-box;
}

/* 2026-05-18: 去掉原生 <select> 的浏览器 chrome（上下箭头 / 系统渐变），
   换成自定义下拉箭头，跟旁边的 text input 视觉统一。 */
body.public-shell select,
body.user-shell select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* 自定义 caret —— 一个朝下的小三角 SVG，颜色用 ink-mute */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238a8278' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 38px;
  cursor: pointer;
}

/* 2026-05-18: file input 跟 text input 视觉统一。原生 input[type=file]
   有 "Choose File" 按钮的灰色 chrome，看起来跟旁边的米色文本框格格不入。 */
body.public-shell input[type="file"],
body.user-shell input[type="file"] {
  width: 100%;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: var(--size-small);
  color: var(--ink-medium);
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease-soft),
              background var(--dur-fast) var(--ease-soft);
}
body.public-shell input[type="file"]::-webkit-file-upload-button,
body.user-shell input[type="file"]::-webkit-file-upload-button {
  background: var(--surface-tint);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-family: var(--font-body);
  font-size: var(--size-small);
  color: var(--ink-strong);
  cursor: pointer;
  margin-right: 12px;
  transition: background var(--dur-fast) var(--ease-soft);
}
body.public-shell input[type="file"]::-webkit-file-upload-button:hover,
body.user-shell input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--accent-soft);
}

body.public-shell input:focus,
body.public-shell textarea:focus,
body.public-shell select:focus,
body.public-shell input[type="file"]:focus,
body.user-shell input:focus,
body.user-shell textarea:focus,
body.user-shell select:focus,
body.user-shell input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-card);
}

body.public-shell .hp-field,
body.user-shell .hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

/* === Buttons === */

body.public-shell button,
body.public-shell .button,
body.user-shell button,
body.user-shell .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 24px;
  /* Primary fill is deep tea, not charcoal — keeps page visually light */
  background: var(--accent-deep);
  color: var(--surface-card);
  border: none;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: var(--size-small);
  letter-spacing: 0.08em;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-soft),
              transform var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft);
  font-weight: 500;
}

body.public-shell button:hover,
body.public-shell .button:hover,
body.user-shell button:hover,
body.user-shell .button:hover {
  /* Hover slightly darker tea */
  background: #6F5538;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border: none;
}

body.public-shell button:active,
body.public-shell .button:active,
body.user-shell button:active,
body.user-shell .button:active {
  transform: translateY(0);
}

body.public-shell button.secondary,
body.public-shell .button.secondary,
body.user-shell button.secondary,
body.user-shell .button.secondary {
  background: transparent;
  color: var(--ink-strong);
  border: 1px solid var(--line-strong);
}

body.public-shell button.secondary:hover,
body.public-shell .button.secondary:hover,
body.user-shell button.secondary:hover,
body.user-shell .button.secondary:hover {
  background: var(--surface-soft);
  border-color: var(--ink-medium);
  color: var(--ink-strong);
}

body.public-shell button:disabled,
body.user-shell button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

body.public-shell .actions,
body.user-shell .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-5);
}

/* === Notice / Status === */

body.public-shell .notice,
body.user-shell .notice {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--space-3) var(--space-4);
  color: var(--ink-strong);
  font-size: var(--size-small);
  margin: var(--space-4) 0;
}

body.public-shell .badge,
body.user-shell .badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: var(--size-tiny);
  font-family: var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-medium);
}

body.user-shell .trial-box {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  margin-bottom: var(--space-5);
  font-size: var(--size-small);
  color: var(--ink-medium);
  flex-wrap: wrap;
}

body.user-shell .trial-box span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* === Quota box (P1-7) === */
body.user-shell .quota-box {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-card);
  margin-bottom: var(--space-5);
}
body.user-shell .quota-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
body.user-shell .quota-plan-badge {
  font-size: var(--size-tiny);
  font-weight: 600;
  background: var(--accent-deep);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
body.user-shell .quota-label {
  font-size: var(--size-small);
  color: var(--ink-mute);
}
body.user-shell .quota-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}
body.user-shell .quota-item {
  flex: 1;
  min-width: 120px;
}
body.user-shell .quota-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
body.user-shell .quota-unit {
  font-size: var(--size-small);
  color: var(--ink-mute);
  margin-left: var(--space-1);
}
body.user-shell .quota-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  margin-top: var(--space-2);
  overflow: hidden;
}
body.user-shell .quota-fill {
  height: 100%;
  background: var(--accent-deep);
  border-radius: 3px;
  transition: width 0.3s;
}

/* === Stat grid / status list === */

body.user-shell .status-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3) var(--space-5);
  font-size: var(--size-small);
  color: var(--ink-medium);
  margin: var(--space-5) 0;
}

body.user-shell .status-list span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--line-faint);
}

body.user-shell .status-list span strong {
  color: var(--ink-strong);
  font-weight: 500;
  font-family: var(--font-display);
  font-size: 1.0625rem;
}

/* === Metric cards (used on weekly-report / realtime) === */

body.public-shell .cards.admin-metric-cards,
body.user-shell .cards.admin-metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

body.public-shell .cards.admin-metric-cards .card,
body.user-shell .cards.admin-metric-cards .card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

body.public-shell .cards.admin-metric-cards .card span,
body.user-shell .cards.admin-metric-cards .card span {
  font-size: var(--size-tiny);
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.public-shell .cards.admin-metric-cards .card strong,
body.user-shell .cards.admin-metric-cards .card strong {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 500;
  color: var(--ink-strong);
}

/* === Persona picker (used on personas / bind) === */

body.public-shell .persona-category-block,
body.user-shell .persona-category-block {
  margin: var(--space-6) 0;
}

body.public-shell .persona-category-title,
body.user-shell .persona-category-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line-faint);
}

body.public-shell .persona-category-title strong,
body.user-shell .persona-category-title strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink-strong);
}

body.public-shell .persona-category-title span,
body.user-shell .persona-category-title span {
  font-size: var(--size-small);
  color: var(--ink-mute);
}

body.public-shell .persona-select-grid,
body.user-shell .persona-select-grid,
body.user-shell .persona-picker-form .persona-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
}

body.public-shell .persona-choice,
body.user-shell .persona-choice {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-soft),
              background var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft);
  position: relative;
}

body.public-shell .persona-choice strong,
body.user-shell .persona-choice strong {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--ink-strong);
}

body.public-shell .persona-choice span,
body.user-shell .persona-choice span {
  font-size: var(--size-tiny);
  color: var(--ink-mute);
  line-height: 1.5;
}

body.public-shell .persona-choice:hover,
body.user-shell .persona-choice:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

body.public-shell .persona-choice input[type="radio"],
body.user-shell .persona-choice input[type="radio"] {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

body.public-shell .persona-choice:has(input:checked),
body.user-shell .persona-choice:has(input:checked) {
  background: var(--surface-tint);
  border-color: var(--accent);
}

/* ── Persona fold (collapsible sections on bind page) ── */

body.public-shell .persona-fold,
body.user-shell .persona-fold {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0;
  margin: var(--space-3) 0;
  background: var(--surface-card);
}

body.public-shell .persona-fold summary,
body.user-shell .persona-fold summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--ink-strong);
  padding: var(--space-3) var(--space-4);
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

body.public-shell .persona-fold summary::-webkit-details-marker,
body.user-shell .persona-fold summary::-webkit-details-marker { display: none; }

body.public-shell .persona-fold summary::after,
body.user-shell .persona-fold summary::after {
  content: "展开";
  margin-left: auto;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--size-tiny);
  color: var(--accent-deep);
  letter-spacing: 0.04em;
}

body.public-shell .persona-fold[open] summary::after,
body.user-shell .persona-fold[open] summary::after {
  content: "收起";
}

body.public-shell .persona-fold summary .muted,
body.user-shell .persona-fold summary .muted {
  font-weight: 400;
  font-size: var(--size-tiny);
  color: var(--ink-mute);
}

body.public-shell .persona-fold[open],
body.user-shell .persona-fold[open] {
  background: var(--surface-soft);
}

body.public-shell .persona-fold > .persona-chip-wrap,
body.user-shell .persona-fold > .persona-chip-wrap {
  padding: 0 var(--space-4) var(--space-4);
}

/* ── Persona chip picker (compact name tags) ── */

body.public-shell .persona-chip-section,
body.user-shell .persona-chip-section {
  margin: var(--space-4) 0;
}

body.public-shell .persona-chip-label,
body.user-shell .persona-chip-label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--ink-strong);
  margin: 0 0 var(--space-2);
}

body.public-shell .persona-chip-label .muted,
body.user-shell .persona-chip-label .muted {
  font-weight: 400;
  font-size: var(--size-tiny);
  color: var(--ink-mute);
  margin-left: var(--space-2);
}

body.public-shell .persona-chip-wrap,
body.user-shell .persona-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.public-shell .persona-chip,
body.user-shell .persona-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink-medium);
  transition: all var(--dur-fast) var(--ease-soft);
  white-space: nowrap;
}

body.public-shell .persona-chip:hover,
body.user-shell .persona-chip:hover {
  border-color: var(--accent);
  color: var(--ink-strong);
  box-shadow: var(--shadow-soft);
}

body.public-shell .persona-chip.is-active,
body.user-shell .persona-chip.is-active,
body.public-shell .persona-chip:has(input:checked),
body.user-shell .persona-chip:has(input:checked) {
  background: var(--accent, #8b7355);
  border-color: var(--accent, #8b7355);
  color: #fff;
  font-weight: 500;
}

body.public-shell .persona-chip input[type="radio"],
body.user-shell .persona-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* 2026-05-19: 注册页"自己写一个"按钮 — 点立刻 submit 跳到 /custom-persona。
   继承 .persona-chip 的样式，再把 <button> 的原生差异（font-family / 内边距）抹平。 */
body.public-shell button.persona-chip.persona-chip-action,
body.user-shell button.persona-chip.persona-chip-action {
  font-family: var(--font-display);
  background: var(--accent, #8b7355);
  border-color: var(--accent, #8b7355);
  color: #fff;
  font-weight: 500;
  padding: 8px 18px;
}
body.public-shell button.persona-chip.persona-chip-action:hover,
body.user-shell button.persona-chip.persona-chip-action:hover {
  filter: brightness(1.05);
  color: #fff;
}

/* ── Persona pick grid (bind page / dashboard persona switcher) ── */

body.public-shell .persona-fold > .persona-pick-grid,
body.user-shell .persona-fold > .persona-pick-grid {
  padding: 0 var(--space-4) var(--space-4);
}

.persona-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.persona-pick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-4) var(--space-3);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-soft);
}

.persona-pick-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.persona-pick-card.is-active,
.persona-pick-card:has(input:checked) {
  border-color: var(--accent, #8b7355);
  background: var(--surface-tint);
  box-shadow: 0 0 0 2px var(--accent, #8b7355);
}

.persona-pick-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.persona-pick-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: var(--space-2);
  border: 2px solid var(--line-faint);
}

.persona-pick-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-tint);
  color: var(--ink-mute);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
}

.persona-pick-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--ink-strong);
  margin-bottom: 2px;
}

.persona-pick-tagline {
  font-size: var(--size-tiny);
  color: var(--ink-mute);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Persona card avatar (personas browse page) ── */

.persona-card-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line-faint);
  flex-shrink: 0;
}

/* ── Landing page persona sample with avatars ── */

.landing-persona-sample-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line-faint);
}

@media (max-width: 760px) {
  .persona-pick-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
  .persona-pick-avatar {
    width: 52px;
    height: 52px;
  }
  .persona-card-avatar {
    width: 56px;
    height: 56px;
  }
}

/* === Table === */

body.public-shell table.mini-table,
body.user-shell table.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--size-small);
}

body.public-shell table.mini-table th,
body.user-shell table.mini-table th {
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--size-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--line);
}

body.public-shell table.mini-table td,
body.user-shell table.mini-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--line-faint);
  color: var(--ink-medium);
  vertical-align: top;
}

body.public-shell table.mini-table tr:hover td,
body.user-shell table.mini-table tr:hover td {
  background: var(--surface-soft);
}

/* === Bullet lists === */

body.public-shell .user-bullet-list,
body.user-shell .user-bullet-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0;
}

body.public-shell .user-bullet-list li,
body.user-shell .user-bullet-list li {
  position: relative;
  padding: var(--space-2) 0 var(--space-2) var(--space-5);
  border-bottom: 1px solid var(--line-faint);
  font-size: var(--size-small);
  color: var(--ink-medium);
  line-height: 1.6;
}

body.public-shell .user-bullet-list li:last-child,
body.user-shell .user-bullet-list li:last-child {
  border-bottom: none;
}

body.public-shell .user-bullet-list li::before,
body.user-shell .user-bullet-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* === Detail summary === */

body.user-shell details {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  background: var(--surface-card);
}

body.user-shell details[open] {
  background: var(--surface-soft);
}

body.user-shell details summary {
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--size-small);
  font-weight: 500;
  color: var(--ink-strong);
  list-style: none;
}

body.user-shell details summary::-webkit-details-marker {
  display: none;
}

body.user-shell details summary::before {
  content: "+ ";
  color: var(--accent-deep);
  margin-right: var(--space-1);
}

body.user-shell details[open] summary::before {
  content: "− ";
}

body.user-shell details pre {
  margin-top: var(--space-3);
  background: var(--surface-page);
  border-radius: var(--r-sm);
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-medium);
  border: 1px solid var(--line-faint);
}

/* === Landing hero (claw-hero / companion-hero) — keep simple === */

body.public-shell .claw-hero,
body.public-shell .companion-hero {
  padding: var(--space-8) 0 var(--space-7);
  text-align: left;
}

body.public-shell .claw-hero h1,
body.public-shell .companion-hero h1 {
  font-size: var(--size-display);
  line-height: var(--lh-display);
  letter-spacing: -0.005em;
  margin-bottom: var(--space-4);
}

body.public-shell .claw-bind {
  padding: var(--space-7) 0;
}

/* === Privacy / Terms page === */

body.public-shell .claw-privacy {
  padding: var(--space-7) 0;
}

body.public-shell .privacy-card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-7) var(--space-6);
  box-shadow: var(--shadow-soft);
  max-width: 680px;
  margin: 0 auto;
}

body.public-shell .privacy-card h2 {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line-faint);
}

body.public-shell .privacy-card h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

body.public-shell .privacy-card ul {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
  color: var(--ink-medium);
  line-height: var(--lh-body);
}

body.public-shell .privacy-card ul li {
  margin-bottom: var(--space-2);
}

body.public-shell .privacy-card ul li strong {
  color: var(--ink-strong);
}

body.public-shell .privacy-card .contact-email {
  font-size: 1.0625rem;
  font-weight: 500;
}

body.public-shell .privacy-card .contact-email a {
  color: var(--accent-deep);
  border-bottom: 1px solid var(--accent-soft);
}

body.public-shell .privacy-agree {
  font-size: var(--size-small);
  text-align: center;
  margin: var(--space-4) 0 var(--space-3);
}

/* === Reusable utilities === */

body.public-shell .divider,
body.user-shell .divider {
  height: 1px;
  background: var(--line);
  margin: var(--space-6) 0;
}

body.public-shell .divider-fine,
body.user-shell .divider-fine {
  height: 1px;
  background: var(--line-faint);
  margin: var(--space-5) 0;
}

body.public-shell .stack > * + *,
body.user-shell .stack > * + * {
  margin-top: var(--space-4);
}

/* === Animations === */

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

body.public-shell main > *,
body.user-shell main > * {
  animation: fade-in var(--dur-page) var(--ease-soft) both;
}

body.public-shell main > *:nth-child(2),
body.user-shell main > *:nth-child(2) { animation-delay: 80ms; }

body.public-shell main > *:nth-child(3),
body.user-shell main > *:nth-child(3) { animation-delay: 160ms; }

body.public-shell main > *:nth-child(4),
body.user-shell main > *:nth-child(4) { animation-delay: 240ms; }

body.public-shell main > *:nth-child(5),
body.user-shell main > *:nth-child(5) { animation-delay: 320ms; }

body.public-shell main > *:nth-child(n+6),
body.user-shell main > *:nth-child(n+6) { animation-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  body.public-shell main > *,
  body.user-shell main > * {
    animation: none;
  }
}

/* === Mobile bottom tab bar === */

body.user-shell .user-tabbar {
  display: none; /* desktop hides; shown via media query below */
}

@media (max-width: 720px) {
  body.user-shell {
    /* leave room at the bottom for the fixed tab bar */
    padding-bottom: 72px;
  }
  body.user-shell .user-tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  body.user-shell .user-tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    border: none;
    color: var(--ink-mute);
    font-size: 11px;
    letter-spacing: 0.04em;
    transition: color var(--dur-fast) var(--ease-soft);
    text-decoration: none;
    position: relative;
  }
  body.user-shell .user-tabbar a:hover { color: var(--ink-strong); }
  body.user-shell .user-tabbar a.active { color: var(--accent-deep); }
  body.user-shell .user-tabbar a.active::after {
    content: "";
    position: absolute;
    top: -2px;
    left: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
    transform: translateX(-50%);
  }
  body.user-shell .user-tabbar .tabbar-icon {
    width: 22px;
    height: 22px;
  }
  /* Desktop nav hidden on mobile (theme has this already, double-safety) */
  body.user-shell .user-nav { display: none !important; }
  body.user-shell .user-topbar {
    /* simplify top bar on mobile: just brand + account */
    justify-content: space-between;
    flex-wrap: nowrap;
  }
}

/* === Mobile === */

@media (max-width: 640px) {
  body.public-shell .public-main,
  body.user-shell .user-main {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  body.public-shell .bind-card,
  body.user-shell .bind-card {
    padding: var(--space-5) var(--space-4);
    margin: var(--space-5) 0;
    box-shadow: none;
    border: 1px solid var(--line);
  }

  body.public-shell .panel,
  body.user-shell .panel {
    padding: var(--space-5) var(--space-4);
  }

  body.public-shell .public-nav,
  body.user-shell .user-topbar {
    padding: var(--space-3) var(--space-4);
    flex-wrap: nowrap;
    gap: var(--space-3);
  }

  body.public-shell .public-nav nav,
  body.user-shell .user-nav {
    display: none;
  }

  body.user-shell .user-account {
    font-size: var(--size-tiny);
    gap: var(--space-2);
  }

  /* 2026-05-18: 邮箱在窄屏上截断，避免顶栏挤爆。退出按钮始终可见。 */
  body.user-shell .user-account > span {
    max-width: 7em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  body.user-shell .user-main {
    padding-top: var(--space-5);
  }

  body.user-shell .status-list {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }
}

/* === Very tiny phones (≤ 380px) — hide email entirely === */
@media (max-width: 380px) {
  body.user-shell .user-account > span {
    display: none;
  }
}

/* === Age confirmation checkbox === */
body.public-shell .age-confirm-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  margin: var(--space-4) 0;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--size-body);
  color: var(--ink-strong);
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease-soft),
              border-color var(--dur-fast) var(--ease-soft);
}
body.public-shell .age-confirm-label:hover {
  background: var(--surface-tint);
}
body.public-shell .age-confirm-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-deep);
  flex-shrink: 0;
  cursor: pointer;
}
body.public-shell .age-confirm-label span {
  line-height: 1.4;
}

/* === Math Captcha (2026-05-14) === */
body.public-shell .math-captcha {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: var(--space-2) 0 var(--space-3);
}
body.public-shell .math-captcha-q {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--ink-strong);
  letter-spacing: 0.05em;
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-width: 110px;
  text-align: center;
}
body.public-shell .math-captcha input[type="text"],
body.public-shell .math-captcha input:not([type]) {
  flex: 1;
  margin: 0;
  background: var(--surface-card);
  padding: 12px 14px;
  font-size: var(--size-body);
  letter-spacing: 0.04em;
}
body.public-shell .math-captcha input:focus {
  border-color: var(--accent);
  background: var(--surface-card);
}
@media (max-width: 480px) {
  body.public-shell .math-captcha {
    flex-direction: column;
    align-items: stretch;
  }
  body.public-shell .math-captcha-q { text-align: left; min-width: 0; }
}

/* === Dark mode — auto (system preference) === */

@media (prefers-color-scheme: dark) {
  :root {
    --surface-page: #1a1816;
    --surface-card: #242220;
    --surface-soft: #1e1c1a;
    --surface-tint: #2a2724;

    --ink-strong: #e8e0d6;
    --ink-medium: #b0a89e;
    --ink-mute: #8a8278;
    --ink-soft: #5a554f;

    --line: #3a3632;
    --line-strong: #4a4640;
    --line-faint: #2a2724;

    --accent: #C4A882;
    --accent-deep: #d4b892;
    --accent-soft: #3a3228;

    --shadow-rest: 0 1px 0 rgba(0,0,0,0.25);
    --shadow-soft: 0 8px 28px rgba(0,0,0,0.22);
    --shadow-hover: 0 16px 48px rgba(0,0,0,0.30);
  }

  /* Dark nav / topbar backdrop overrides */
  body.public-shell .public-nav {
    background: rgba(26, 24, 22, 0.88);
  }
  body.user-shell .user-topbar {
    background: rgba(26, 24, 22, 0.92);
  }

  /* Mobile tab bar dark */
  body.user-shell .user-tabbar {
    background: rgba(36, 34, 32, 0.96);
  }
}

/* === Light mode — manual toggle overrides system dark preference === */

[data-theme="light"] {
  --surface-page: #FAF7F2;
  --surface-card: #FFFFFF;
  --surface-soft: #FFFBF5;
  --surface-tint: #F5EFE3;

  --ink-strong: #2C2C2C;
  --ink-medium: #5A554F;
  --ink-mute: #8A8278;
  --ink-soft: #BBB3A8;

  --line: #E8E0D6;
  --line-strong: #D4CABC;
  --line-faint: #F2EDE5;

  --accent: #C4A882;
  --accent-deep: #8F7050;
  --accent-soft: #E8DDC8;

  --shadow-rest: 0 1px 0 var(--line);
  --shadow-soft: 0 8px 28px rgba(60, 40, 38, 0.05);
  --shadow-hover: 0 16px 48px rgba(60, 40, 38, 0.08);
}

[data-theme="light"] body.public-shell .public-nav {
  background: rgba(250, 247, 242, 0.85);
}
[data-theme="light"] body.user-shell .user-topbar {
  background: rgba(250, 247, 242, 0.92);
}
[data-theme="light"] body.user-shell .user-tabbar {
  background: rgba(255, 255, 255, 0.96);
}

/* === Dark mode — manual toggle via data-theme === */

[data-theme="dark"] {
  --surface-page: #1a1816;
  --surface-card: #242220;
  --surface-soft: #1e1c1a;
  --surface-tint: #2a2724;

  --ink-strong: #e8e0d6;
  --ink-medium: #b0a89e;
  --ink-mute: #8a8278;
  --ink-soft: #5a554f;

  --line: #3a3632;
  --line-strong: #4a4640;
  --line-faint: #2a2724;

  --accent: #C4A882;
  --accent-deep: #d4b892;
  --accent-soft: #3a3228;

  --shadow-rest: 0 1px 0 rgba(0,0,0,0.25);
  --shadow-soft: 0 8px 28px rgba(0,0,0,0.22);
  --shadow-hover: 0 16px 48px rgba(0,0,0,0.30);
}

[data-theme="dark"] body.public-shell .public-nav {
  background: rgba(26, 24, 22, 0.88);
}
[data-theme="dark"] body.user-shell .user-topbar {
  background: rgba(26, 24, 22, 0.92);
}
[data-theme="dark"] body.user-shell .user-tabbar {
  background: rgba(36, 34, 32, 0.96);
}
