/* ═══════════════════════════════════════════════════════════════════
   甜筒 Web — 阁楼网格风格（白底方格 · 像素点缀）
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────── */
:root {
  --white:                  #FFFFFF;
  --bg:                     #FFFFFF;
  --grid-line:              #EEF2F6;
  --grid-size:              40px;
  --surface:                #FFFFFF;
  --surface-low:            #FAFAFA;
  --surface-mid:            #F5F5F5;
  --surface-high:           #EEEEEE;
  --surface-highest:        #E5E5E5;
  --surface-variant:        #F0F4F8;
  --bg-card:                rgba(255, 255, 255, 0.92);

  --primary:                #333333;
  --primary-light:          #666666;
  --primary-dark:           #1A1A1A;
  --primary-container:      #F5F5F5;

  --secondary:              #333333;
  --secondary-light:        #666666;
  --secondary-dark:         #1A1A1A;
  --secondary-container:    #FFF9E5;
  --on-secondary-container: #555555;

  --tertiary:               #888888;
  --tertiary-container:     #FFF9E5;
  --tertiary-fixed:         #FFE5EC;

  --accent-green:           #22C55E;
  --accent-orange:          #FFB347;
  --coral:                  #E87471;
  --yellow:                 #FFF9E5;
  --teal:                   #EEF2F6;

  --text-dark:              #333333;
  --text-body:              #555555;
  --text-sec:               #666666;
  --text-hint:              #999999;

  --border:                 #E5E7EB;
  --border-glass:           rgba(238, 242, 246, 0.9);
  --outline:                #CCCCCC;
  --outline-variant:        #E5E7EB;

  --gradient-pill:          linear-gradient(90deg, #FFF9E5 0%, #FFE5EC 100%);
  --gradient-btn:           linear-gradient(90deg, #333333 0%, #555555 100%);
  --glow-center:            radial-gradient(ellipse 55% 45% at 50% 42%, rgba(255, 214, 190, 0.35), transparent 68%);

  --shadow-sm:   0 1px 8px rgba(0, 0, 0, 0.04);
  --shadow-md:   0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg:   0 12px 40px rgba(0, 0, 0, 0.08);

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  --font-mono:   'SF Mono', 'Menlo', 'Consolas', monospace;

  --nav-h:       64px;
  --header-h:    56px;
  --transition:  0.2s ease;
}

/* ── 方格背景（全站） ─────────────────────────────────────────────── */
.page-grid-bg {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-attachment: fixed;
}

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Noto Sans SC', 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-dark);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.page-grid-bg {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-attachment: fixed;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ── App Shell ─────────────────────────────────────────────────────── */
#app { min-height: 100vh; display: flex; flex-direction: column; }
#page-container { flex: 1; min-height: 100vh; }

/* ── Bottom Navigation ─────────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.05);
}
#bottom-nav.hidden { display: none; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  padding: 6px 0;
  color: var(--text-hint);
  transition: color var(--transition);
  position: relative;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item span { font-size: 10px; font-weight: 500; letter-spacing: 0.03em; }

/* Active nav item — pill with secondary-container */
.nav-item.active {
  color: var(--on-secondary-container);
}
.nav-item.active svg { stroke: var(--on-secondary-container); }
.nav-item.active::before {
  content: '';
  position: absolute;
  inset: 2px 4px;
  background: var(--gradient-pill);
  border-radius: var(--radius-full);
  z-index: -1;
}

.nav-publish { flex: 1; }
.publish-btn {
  width: 46px; height: 46px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  color: white;
  transition: transform 0.15s, box-shadow 0.15s;
}
.publish-btn:active { transform: scale(0.92); box-shadow: 0 3px 10px rgba(59,99,118,0.25); }
.publish-btn svg { stroke: white; }

/* ── Common Page Header ────────────────────────────────────────────── */
.page-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 12px;
}
.page-header .header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  font-family: 'Quicksand', 'Be Vietnam Pro', sans-serif;
}
.header-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--primary);
  transition: background var(--transition);
}
.header-btn:active { background: var(--surface-mid); }
.header-btn svg { width: 22px; height: 22px; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 26px;
  border-radius: var(--radius-full);
  font-size: 15px; font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.15s;
  border: none; cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--gradient-btn);
  color: white;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-secondary {
  background: var(--white);
  color: var(--text-dark);
  border: 1.5px solid var(--border);
}
.btn-ghost { background: none; color: var(--text-sec); }
.btn-coral {
  background: linear-gradient(135deg, var(--coral), #f09490);
  color: white;
  box-shadow: 0 4px 16px rgba(232,116,113,0.32);
}
.btn-teal {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
  color: white;
  box-shadow: 0 4px 14px rgba(59,99,118,0.28);
}
.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-lg { padding: 16px 34px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.52; cursor: not-allowed; transform: none; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ── Form Elements ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-sec); letter-spacing: 0.03em; }

.input-wrap {
  display: flex; align-items: center;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrap:focus-within {
  border-color: var(--outline);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}
.input-wrap input, .input-wrap textarea {
  flex: 1; padding: 14px 0;
  font-size: 15px; color: var(--text-dark);
  background: none; border: none; outline: none;
}
.input-wrap input::placeholder,
.input-wrap textarea::placeholder { color: var(--text-hint); }
.input-icon { color: var(--text-hint); display: flex; margin-right: 10px; }
.input-icon svg { width: 18px; height: 18px; }

textarea { resize: none; }

/* ── Toast ─────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
  width: min(320px, 90vw);
}
.toast {
  background: rgba(31, 27, 22, 0.88);
  backdrop-filter: blur(12px);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-md);
  max-width: 100%;
}
.toast.success { background: rgba(51, 51, 51, 0.92); }
.toast.error   { background: rgba(186, 26, 26, 0.90); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Loading ───────────────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  display: flex; align-items: center; justify-content: center;
  min-height: 40vh;
}

.skeleton {
  background: linear-gradient(90deg, #f5f5f5 25%, #eeeeee 50%, #f5f5f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Avatar ────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700;
  font-size: 0.4em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm  { width: 32px;  height: 32px;  font-size: 13px; }
.avatar-md  { width: 44px;  height: 44px;  font-size: 16px; }
.avatar-lg  { width: 72px;  height: 72px;  font-size: 24px; }
.avatar-xl  { width: 88px;  height: 88px;  font-size: 30px; }

/* ── Tag / Badge ───────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500;
  background: rgba(0, 0, 0, 0.05);
  color: var(--secondary);
}

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px;
  gap: 12px;
}
.empty-state .empty-icon { font-size: 48px; opacity: 0.4; }
.empty-state .empty-title { font-size: 16px; font-weight: 600; color: var(--text-sec); }
.empty-state .empty-sub   { font-size: 14px; color: var(--text-hint); text-align: center; }

/* ═══════════════════════════════════════════════════════════════════
   SPLASH PAGE（欢迎页）
   ═══════════════════════════════════════════════════════════════════ */
.splash-page {
  min-height: 100vh;
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px 80px;
  overflow: hidden;
}
.splash-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-center);
  pointer-events: none;
  z-index: 0;
}
.splash-content {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; max-width: 420px; width: 100%;
  animation: splashFadeUp 0.7s ease both;
}
@keyframes splashFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.splash-terminal {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-sec);
  margin-bottom: 4px;
}
.splash-terminal .dot { color: var(--accent-green); margin-right: 6px; }
.splash-title {
  font-size: 32px; font-weight: 700;
  color: var(--text-dark);
  text-align: center;
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.splash-title .cursor {
  display: inline-block;
  width: 2px; height: 1.1em;
  background: #FF9A8B;
  margin-left: 4px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.splash-sub {
  font-size: 14px; color: var(--text-sec);
  text-align: center; line-height: 1.75;
  max-width: 320px;
}
.splash-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--gradient-pill);
  border-radius: var(--radius-full);
  font-size: 13px; color: var(--text-body);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm);
}
.splash-status {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px;
  font-size: 12px; color: var(--text-hint);
}
.splash-status .online { color: var(--text-sec); }
.splash-status .online::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-green);
  margin-right: 6px; vertical-align: middle;
}
.splash-btn {
  margin-top: 12px;
  min-width: 200px;
  padding: 14px 32px;
  background: var(--primary);
  color: white;
  font-size: 15px; font-weight: 600;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none;
}
.splash-btn:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.splash-btn:active { transform: translateY(0) scale(0.97); }
/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGE (Login / Register)
   ═══════════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  position: relative;
  display: flex; flex-direction: column;
  align-items: center;
  padding: max(48px, env(safe-area-inset-top, 0px)) 24px 32px;
}
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-center);
  pointer-events: none;
  opacity: 0.6;
}
.auth-inner {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column;
  flex: 1;
}

.auth-header {
  padding-bottom: 32px;
}

.auth-brand {
  font-size: 24px; font-weight: 700; color: var(--text-dark);
  letter-spacing: 4px; margin-bottom: 16px;
}

.auth-headline { font-size: 24px; font-weight: 700; color: var(--text-dark); line-height: 1.35; }
.auth-subline   { font-size: 14px; color: var(--text-sec); margin-top: 8px; line-height: 1.6; }

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

.otp-row { display: flex; gap: 10px; }
.otp-row .input-wrap { flex: 1; }
.otp-send-btn {
  flex-shrink: 0;
  padding: 0 16px; height: 52px;
  background: var(--white);
  color: var(--text-dark);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  white-space: nowrap; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.otp-send-btn:hover:not(:disabled) { background: var(--surface-low); border-color: var(--outline); }
.otp-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-submit { margin-top: 8px; }

.auth-footer {
  margin-top: auto; padding: 28px 0 0;
  text-align: center;
}
.auth-footer p { font-size: 12px; color: var(--text-hint); line-height: 1.6; }
.auth-footer a { color: var(--text-sec); text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════════════════════ */
.home-page { padding-bottom: calc(var(--nav-h) + 16px); }

.home-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}
.home-header-top {
  height: 56px;
  display: flex; align-items: center; gap: 12px;
}
.home-logo {
  display: flex; align-items: center;
  flex: 1;
}
.home-logo span {
  font-size: 18px; font-weight: 600; color: var(--text-dark); letter-spacing: 4px;
  font-family: 'Quicksand', 'Noto Sans SC', sans-serif;
}
.home-tabs {
  display: flex; gap: 0;
  height: 40px;
  border-bottom: none;
}
.home-tab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: var(--text-sec);
  cursor: pointer; position: relative;
  border: none; background: none;
  transition: color var(--transition);
}
.home-tab.active { color: var(--text-dark); font-weight: 700; }
.home-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px;
  background: var(--secondary);
  border-radius: 2px;
}

/* 笔记网格：手机 / 窄屏 Web 2 列，桌面 Web 5 列 */
.notes-feed {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 14px 16px 24px;
  width: 100%;
}

@media (min-width: 840px) {
  .notes-feed {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    padding: 14px 24px 28px;
    max-width: 1440px;
    margin: 0 auto;
  }
}

.note-card {
  margin-bottom: 0;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.22s, box-shadow 0.22s;
  display: block;
}
.note-card:active { transform: scale(0.98); }
.note-card:hover  { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.note-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f5f5 0%, #eeeeee 100%);
  position: relative;
}
.note-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.3s ease;
}
.note-card-img img.img-loaded { opacity: 1; }
.note-card:hover .note-card-img img { transform: scale(1.04); }

.note-card-body { padding: 10px 12px 12px; }
.note-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-dark);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 8px;
}
.note-card-footer {
  display: flex; align-items: center; gap: 6px;
  justify-content: space-between;
}
.note-card-author {
  display: flex; align-items: center; gap: 5px;
  min-width: 0;
}
.note-card-author span {
  font-size: 11px; color: var(--text-sec);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-card-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.note-card-action {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 6px; border: none; background: none;
  font-size: 11px; color: var(--text-sec); cursor: pointer;
  border-radius: 8px; transition: color 0.15s, background 0.15s;
}
.note-card-action svg { width: 14px; height: 14px; flex-shrink: 0; }
.note-card-action:hover { background: var(--surface-low); color: var(--text-dark); }
.note-card-action.active { color: var(--coral); font-weight: 600; }
.note-card-action.active svg { stroke: var(--coral); }
.note-card-action.collect.active { color: #B8860B; }
.note-card-action.collect.active svg { fill: #B8860B; stroke: #B8860B; }
.note-card-tap { cursor: pointer; }

/* skeleton cards */
.skeleton-card { margin-bottom: 0; }
.skeleton-img  { width: 100%; aspect-ratio: 3/4; border-radius: var(--radius-lg); }
.skeleton-line { height: 12px; border-radius: 6px; margin-top: 8px; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }

/* load more */
.load-more-area {
  display: flex; align-items: center; justify-content: center;
  padding: 24px 0; color: var(--text-hint); font-size: 13px; gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════════
   NOTE DETAIL PAGE
   ═══════════════════════════════════════════════════════════════════ */
.detail-page { padding-bottom: 80px; }

.detail-images {
  background: var(--surface-high); overflow: hidden;
  position: relative;
}
.image-slider { display: flex; transition: transform 0.3s ease; }
.image-slider-item {
  flex-shrink: 0;
  background: var(--surface-high);
}
.image-slider-item img { width: 100%; height: auto; display: block; }
.image-dots {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px;
}
.image-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  transition: all 0.2s;
}
.image-dot.active { width: 18px; border-radius: 3px; background: var(--secondary); }

.detail-body { padding: 20px 16px 0; }
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.detail-author {
  display: flex; align-items: center; gap: 10px;
}
.detail-author-info { display: flex; flex-direction: column; }
.detail-author-name { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.detail-author-time { font-size: 11px; color: var(--text-hint); }
.detail-follow-btn {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--secondary);
  color: var(--secondary);
  font-size: 13px; font-weight: 600;
  background: none; cursor: pointer;
  transition: all 0.15s;
}
.detail-follow-btn.following {
  background: var(--secondary); color: white;
  border-color: var(--secondary);
}

.detail-title {
  font-size: 20px; font-weight: 800; color: var(--text-dark);
  margin-bottom: 12px; line-height: 1.4;
  font-family: 'Quicksand', sans-serif;
}
.detail-content { font-size: 15px; color: var(--text-body); line-height: 1.75; white-space: pre-wrap; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.detail-stats {
  display: flex; justify-content: space-around; align-items: flex-start;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.detail-stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-sec);
  cursor: pointer; padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  min-width: 52px;
}
.detail-stat:hover { background: var(--surface-low); }
.detail-stat svg { width: 20px; height: 20px; }
.detail-stat.liked { color: var(--coral); font-weight: 600; }
.detail-stat.liked svg { stroke: var(--coral); fill: var(--coral); }
.detail-stat.collected { color: #B8860B; font-weight: 600; }
.detail-stat.collected svg { stroke: #B8860B; fill: #B8860B; }

/* Comments section */
.comments-section { padding: 20px 16px 0; }
.comments-title { font-size: 16px; font-weight: 700; color: var(--text-dark); margin-bottom: 16px; }
.comment-item {
  display: flex; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-name { font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; }
.comment-text { font-size: 14px; color: var(--text-body); line-height: 1.6; }
.comment-meta { display: flex; gap: 12px; align-items: center; margin-top: 5px; }
.comment-time { font-size: 11px; color: var(--text-hint); }
.comment-delete { font-size: 11px; color: var(--text-hint); cursor: pointer; }
.comment-delete:hover { color: var(--coral); }

/* Comment input bar */
.comment-input-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255, 248, 244, 0.90);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  display: flex; gap: 10px; align-items: center;
  box-shadow: 0 -4px 20px rgba(96,94,90,0.06);
  z-index: 60;
}
.comment-input {
  flex: 1;
  background: var(--surface-mid);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  resize: none;
  max-height: 80px;
}
.comment-input:focus { border-color: var(--secondary); }
.comment-send-btn {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; border: none;
  transition: transform 0.15s;
  box-shadow: 0 4px 12px rgba(59,99,118,0.28);
}
.comment-send-btn:active { transform: scale(0.92); }
.comment-send-btn svg { width: 16px; height: 16px; stroke: white; }

/* ═══════════════════════════════════════════════════════════════════
   PUBLISH PAGE
   ═══════════════════════════════════════════════════════════════════ */
.publish-page { padding-bottom: 30px; }

.image-picker-area { padding: 16px; }
.image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}
.image-preview-item {
  aspect-ratio: 1; border-radius: var(--radius-md);
  overflow: hidden; position: relative; background: var(--surface-mid);
}
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: rgba(31,27,22,0.5); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; cursor: pointer; border: none; font-size: 12px;
}
.image-add-btn {
  aspect-ratio: 1; border-radius: var(--radius-md);
  border: 2px dashed var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer;
  color: var(--text-hint); font-size: 12px;
  transition: all 0.15s; background: var(--surface-mid);
}
.image-add-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.image-add-btn svg { width: 24px; height: 24px; }

.publish-form { padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }

.title-input {
  width: 100%; border: none; outline: none;
  font-size: 20px; font-weight: 700; color: var(--text-dark);
  background: none; font-family: 'Quicksand', sans-serif; padding: 4px 0;
  border-bottom: 2px solid var(--border);
  transition: border-color 0.2s;
}
.title-input:focus { border-color: var(--secondary); }
.title-input::placeholder { color: var(--text-hint); font-weight: 400; }

.content-input {
  width: 100%; min-height: 160px;
  border: 1.5px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; font-size: 15px;
  outline: none; resize: none; font-family: inherit;
  color: var(--text-dark); background: var(--surface-mid);
  transition: border-color 0.2s;
  line-height: 1.75;
}
.content-input:focus { border-color: var(--secondary); background: white; }
.content-input::placeholder { color: var(--text-hint); }

.char-count { font-size: 11px; color: var(--text-hint); text-align: right; }

.publish-submit-bar {
  padding: 16px;
  position: sticky; bottom: 0;
  background: rgba(255, 248, 244, 0.90);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}

/* Upload progress */
.upload-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--surface-mid);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-sec);
}
.upload-progress .spinner { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════════════════════════════
   SEARCH PAGE
   ═══════════════════════════════════════════════════════════════════ */
.search-page { padding-bottom: calc(var(--nav-h) + 16px); }

.search-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 248, 244, 0.82);
  backdrop-filter: blur(24px);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.search-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface-mid); border-radius: var(--radius-full);
  padding: 10px 18px; border: 1.5px solid transparent;
  transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--secondary); }
.search-input-wrap svg { width: 18px; height: 18px; color: var(--text-hint); flex-shrink: 0; }
.search-input-wrap input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 15px; color: var(--text-dark); font-family: inherit;
}
.search-input-wrap input::placeholder { color: var(--text-hint); }
.search-cancel-btn {
  color: var(--text-sec); font-size: 14px; white-space: nowrap;
  background: none; border: none; cursor: pointer;
}

.search-section { padding: 20px 16px; }
.search-section-title {
  font-size: 15px; font-weight: 700; color: var(--text-dark);
  margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.search-section-title button { font-size: 13px; color: var(--text-hint); background: none; border: none; cursor: pointer; }

.search-history { display: flex; flex-wrap: wrap; gap: 8px; }
.history-tag {
  padding: 6px 16px; background: var(--surface-mid); border-radius: var(--radius-full);
  font-size: 13px; color: var(--text-body);
  cursor: pointer; border: 1px solid var(--border);
  transition: all 0.15s;
}
.history-tag:hover { border-color: var(--secondary); color: var(--secondary); }

/* ═══════════════════════════════════════════════════════════════════
   PROFILE PAGE
   ═══════════════════════════════════════════════════════════════════ */
.profile-page { padding-bottom: calc(var(--nav-h) + 16px); }

.profile-cover-wrap {
  position: relative;
  margin-bottom: 0;
}
.profile-cover {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  min-height: 100%;
  background: linear-gradient(135deg, #FFF3D6 0%, #E8F8F6 45%, #F0EEFF 100%);
  background-size: cover;
  background-position: center top;
  z-index: 0;
}
.profile-cover.has-image { background-color: var(--surface-mid); }
.profile-cover-inner {
  position: relative;
  z-index: 1;
  min-height: 248px;
  padding-bottom: 8px;
}
.profile-cover-edit {
  position: absolute; right: 12px; top: 12px;
  padding: 6px 14px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-body);
  cursor: pointer; box-shadow: var(--shadow-sm);
}
.profile-cover-edit:hover { border-color: var(--coral); color: var(--coral); }

.profile-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 148px 20px 0;
  position: relative;
}
.profile-cover-identity {
  padding: 52px 20px 12px;
}
.profile-cover-identity .profile-name { margin-bottom: 4px; }
.profile-cover-identity .profile-id { margin-bottom: 0; }
.profile-cover-identity .profile-bio { margin-top: 8px; margin-bottom: 0; }
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar-wrap .avatar {
  border: 4px solid white;
  box-shadow: var(--shadow-md);
}
.profile-avatar-wrap.is-me { cursor: pointer; }
.profile-avatar-camera {
  position: absolute; right: 0; bottom: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: white;
  border: 2px solid white;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.profile-avatar-camera svg { width: 14px; height: 14px; stroke: white; }

.profile-body { padding: 0 20px; }
.profile-name { font-size: 22px; font-weight: 800; color: var(--text-dark); margin-bottom: 4px; font-family: 'Quicksand', sans-serif; }
.profile-id   { font-size: 12px; color: var(--text-hint); margin-bottom: 10px; }
.profile-bio  { font-size: 14px; color: var(--text-body); line-height: 1.7; margin-bottom: 16px; }

.profile-stats {
  display: flex; gap: 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 0; padding: 14px 20px;
  background: var(--bg);
}
.profile-stat {
  flex: 1; text-align: center; cursor: pointer;
  padding: 4px 0;
}
.profile-stat + .profile-stat { border-left: 1px solid var(--border); }
.profile-stat-num  { font-size: 20px; font-weight: 800; color: var(--text-dark); font-family: 'Quicksand', sans-serif; }
.profile-stat-label { font-size: 12px; color: var(--text-hint); }

.profile-edit-btn {
  padding: 8px 22px; border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-dark);
  background: white; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.profile-follow-btn {
  padding: 8px 22px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
}
.profile-follow-btn.follow   { background: var(--secondary); color: white; }
.profile-follow-btn.unfollow { background: var(--surface-mid); color: var(--text-sec); border: 1.5px solid var(--border); }

.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: 20px -20px 0;
}
.profile-tab {
  flex: 1; padding: 12px; text-align: center;
  font-size: 14px; font-weight: 500; color: var(--text-sec);
  cursor: pointer; position: relative;
  background: none; border: none;
  transition: color 0.15s;
}
.profile-tab.active { color: var(--text-dark); font-weight: 700; }
.profile-tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px; background: var(--secondary); border-radius: 2px;
}
.profile-tab svg { width: 18px; height: 18px; margin: 0 auto; display: block; }

.profile-notes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding-top: 2px;
}

@media (min-width: 840px) {
  .profile-notes-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
.profile-note-thumb {
  aspect-ratio: 1; overflow: hidden; cursor: pointer; position: relative;
  background: var(--surface-mid);
}
.profile-note-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.2s ease;
}
.profile-note-thumb img.img-loaded { opacity: 1; }
.profile-note-thumb:hover img { transform: scale(1.05); }

/* ═══════════════════════════════════════════════════════════════════
   FOLLOW LIST PAGE
   ═══════════════════════════════════════════════════════════════════ */
.follow-list-page { padding-bottom: calc(var(--nav-h) + 16px); }

.follow-user-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.follow-user-item:active { background: var(--surface-low); }
.follow-user-info { flex: 1; min-width: 0; }
.follow-user-name { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.follow-user-bio  { font-size: 12px; color: var(--text-hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.follow-toggle-btn {
  padding: 6px 16px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
.follow-toggle-btn.follow   { background: var(--secondary); color: white; border: none; }
.follow-toggle-btn.unfollow { background: none; color: var(--text-sec); border: 1.5px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════════
   DRAFT PAGE
   ═══════════════════════════════════════════════════════════════════ */
.draft-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.draft-item:active { background: var(--surface-low); }
.draft-thumb {
  width: 70px; height: 70px; border-radius: var(--radius-md);
  overflow: hidden; flex-shrink: 0; background: var(--surface-mid);
}
.draft-thumb img { width: 100%; height: 100%; object-fit: cover; }
.draft-info { flex: 1; min-width: 0; }
.draft-title { font-size: 14px; font-weight: 600; color: var(--text-dark); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-preview { font-size: 12px; color: var(--text-sec); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.draft-time { font-size: 11px; color: var(--text-hint); margin-top: 6px; }
.draft-delete-btn {
  flex-shrink: 0; display: flex; align-items: center;
  color: var(--text-hint); background: none; border: none; cursor: pointer; padding: 4px;
  transition: color 0.15s;
}
.draft-delete-btn:hover { color: var(--coral); }
.draft-delete-btn svg { width: 18px; height: 18px; }

/* ═══════════════════════════════════════════════════════════════════
   NOTIFICATIONS PAGE
   ═══════════════════════════════════════════════════════════════════ */
.notif-page { padding-bottom: calc(var(--nav-h) + 16px); }
.notif-item {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.notif-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-icon.like    { background: rgba(232,116,113,0.12); color: var(--coral); }
.notif-icon.comment { background: rgba(59,99,118,0.10);   color: var(--secondary); }
.notif-icon.follow  { background: rgba(109,93,52,0.10);   color: var(--tertiary); }
.notif-icon svg { width: 18px; height: 18px; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; color: var(--text-dark); line-height: 1.6; }
.notif-text strong { font-weight: 700; }
.notif-time { font-size: 11px; color: var(--text-hint); margin-top: 3px; }
.notif-thumb {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  overflow: hidden; flex-shrink: 0; background: var(--surface-mid);
}
.notif-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════════════════════════════════════════════════════════════
   EDIT PROFILE PAGE
   ═══════════════════════════════════════════════════════════════════ */
.edit-profile-page { padding-bottom: 30px; }
.profile-bg-edit-section { padding: 16px 20px 0; }
.profile-bg-preview {
  height: 120px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #FFF3D6 0%, #E8F8F6 100%);
  background-size: cover; background-position: center;
  position: relative; cursor: pointer; overflow: hidden;
}
.profile-bg-preview-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.18);
  color: white; font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity 0.2s;
}
.profile-bg-preview:hover .profile-bg-preview-overlay { opacity: 1; }

.avatar-edit-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 30px 20px 20px; gap: 10px;
}
.avatar-edit-btn { position: relative; cursor: pointer; }
.avatar-edit-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,0.32);
  display: flex; align-items: center; justify-content: center;
}
.avatar-edit-overlay svg { width: 22px; height: 22px; stroke: white; }
.avatar-edit-label { font-size: 13px; color: var(--text-sec); }

/* ═══════════════════════════════════════════════════════════════════
   MODAL / OVERLAY
   ═══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(31,27,22,0.38);
  backdrop-filter: blur(6px); z-index: 200;
  display: flex; align-items: flex-end;
  animation: overlayIn 0.2s ease;
}
.modal-overlay.center { align-items: center; justify-content: center; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-sheet {
  width: 100%; background: rgba(255,248,244,0.96);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 0 0 max(24px, env(safe-area-inset-bottom, 0px));
  animation: sheetIn 0.3s ease;
  max-height: 90vh; overflow-y: auto;
}
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-card {
  background: rgba(255,248,244,0.96);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  padding: 28px 24px; width: min(340px, 92vw);
  animation: cardIn 0.25s ease;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 12px auto 20px;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text-dark); margin-bottom: 16px; text-align: center; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.modal-action-btn {
  width: 100%; padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 500;
  text-align: center; cursor: pointer; border: none;
  background: var(--surface-mid); color: var(--text-dark);
  transition: background 0.15s;
}
.modal-action-btn:active { background: var(--surface-high); }
.modal-action-btn.danger { color: var(--coral); }

/* ═══════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); }
.divider-thick { height: 8px; background: var(--surface-mid); }
.text-center { text-align: center; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.scroll-x { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.scroll-x::-webkit-scrollbar { display: none; }

.pull-indicator {
  display: flex; align-items: center; justify-content: center;
  height: 48px; gap: 8px; font-size: 13px; color: var(--text-hint);
}

.img-placeholder {
  background: linear-gradient(135deg, #f5f5f5, #eeeeee);
  min-height: 120px;
}

/* Responsive max width */
@media (min-width: 768px) {
  .detail-page, .publish-page, .search-page { max-width: 640px; margin: 0 auto; }
  .comment-input-bar { max-width: 640px; left: 50%; transform: translateX(-50%); }
  .auth-page { max-width: 420px; margin: 0 auto; }
}
