/* ═══════════════════════════════════════════════════════════════════
   甜筒 Web — Design System + App Styles
   Colors match the Flutter mobile app exactly
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────── */
:root {
  --white:       #FFFFFF;
  --yellow:      #FACC5C;
  --coral:       #E87471;
  --teal:        #5ECFC8;
  --purple:      #6B67B3;
  --purple-light:#8B87CC;
  --purple-dark: #5553A0;
  --text-dark:   #1F2041;
  --text-body:   #3D3D5C;
  --text-sec:    #888899;
  --text-hint:   #B0B0C0;
  --bg:          #F8F7FC;
  --bg-card:     #FFFFFF;
  --border:      #EDEDF5;
  --shadow-sm:   0 2px 8px rgba(107,103,179,0.08);
  --shadow-md:   0 4px 20px rgba(107,103,179,0.14);
  --shadow-lg:   0 8px 40px rgba(107,103,179,0.18);
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --nav-h:       64px;
  --header-h:    56px;
  --transition:  0.2s ease;
}

/* ── 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', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(107,103,179,0.06);
}
#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; }
.nav-item.active { color: var(--purple); }
.nav-item.active svg { stroke: var(--purple); }

.nav-publish { flex: 1; }
.publish-btn {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(107,103,179,0.4);
  color: white;
  transition: transform 0.15s, box-shadow 0.15s;
}
.publish-btn:active { transform: scale(0.93); box-shadow: 0 2px 8px rgba(107,103,179,0.3); }
.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.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  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;
}
.header-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-dark);
  transition: background var(--transition);
}
.header-btn:active { background: var(--bg); }
.header-btn svg { width: 22px; height: 22px; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius-xl);
  font-size: 15px; font-weight: 600;
  transition: all 0.15s;
  border: none; cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  box-shadow: 0 4px 16px rgba(107,103,179,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(107,103,179,0.45); }
.btn-secondary {
  background: var(--bg);
  color: var(--purple);
  border: 1.5px solid var(--border);
}
.btn-ghost { background: none; color: var(--purple); }
.btn-coral {
  background: linear-gradient(135deg, var(--coral), #f09490);
  color: white;
  box-shadow: 0 4px 16px rgba(232,116,113,0.35);
}
.btn-teal {
  background: linear-gradient(135deg, var(--teal), #7cd9d4);
  color: white;
  box-shadow: 0 4px 14px rgba(94,207,200,0.35);
}
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 20px; }
.btn-lg { padding: 15px 32px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  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); }

.input-wrap {
  display: flex; align-items: center;
  background: var(--bg);
  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(--purple);
  box-shadow: 0 0 0 3px rgba(107,103,179,0.12);
}
.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,32,65,0.88);
  backdrop-filter: blur(12px);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  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(94,207,200,0.92); }
.toast.error   { background: rgba(232,116,113,0.92); }
@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(--purple);
  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, #f0eef8 25%, #e8e6f0 50%, #f0eef8 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(--purple-light), var(--teal));
  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 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 500;
  background: rgba(107,103,179,0.1);
  color: var(--purple);
}

/* ── 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.5; }
.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;
  background: var(--white);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden; position: relative; padding: 40px 32px;
}
.splash-circles {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.splash-circle {
  position: absolute; border-radius: 50%;
  opacity: 0; animation: circleFloat 1.2s ease forwards;
}
.splash-circle-1 {
  width: 280px; height: 280px;
  background: var(--yellow);
  top: -60px; left: -80px;
  animation-delay: 0.1s;
}
.splash-circle-2 {
  width: 200px; height: 200px;
  background: var(--coral);
  top: 60px; right: -60px;
  animation-delay: 0.2s;
}
.splash-circle-3 {
  width: 160px; height: 160px;
  background: var(--teal);
  bottom: 80px; left: -30px;
  animation-delay: 0.3s;
}
@keyframes circleFloat {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 0.85; transform: scale(1); }
}
.splash-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  animation: splashFadeUp 0.8s 0.4s ease both;
}
@keyframes splashFadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.splash-logo {
  display: flex; align-items: center; gap: 14px;
}
.splash-cone { width: 52px; height: 60px; }
.splash-title {
  font-size: 42px; font-weight: 900;
  color: var(--text-dark);
  letter-spacing: 6px;
  font-family: 'Noto Sans SC', serif;
}
.splash-sub {
  font-size: 15px; color: var(--text-sec);
  text-align: center; line-height: 1.6;
  max-width: 260px;
}
.splash-btn {
  margin-top: 8px;
  width: 220px;
  padding: 16px;
  background: var(--purple);
  color: white;
  font-size: 16px; font-weight: 700;
  border-radius: var(--radius-xl);
  box-shadow: 0 6px 24px rgba(107,103,179,0.4);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none;
}
.splash-btn:hover { box-shadow: 0 8px 30px rgba(107,103,179,0.5); transform: translateY(-1px); }
.splash-btn:active { transform: translateY(0) scale(0.97); }

/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGE (Login / Register)
   ═══════════════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  background: var(--white);
  display: flex; flex-direction: column;
  padding: 0 28px;
  position: relative; overflow: hidden;
}
.auth-bg-shapes {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.auth-shape {
  position: absolute; border-radius: 50%; opacity: 0.7;
}
.auth-shape-1 { width: 200px; height: 200px; background: var(--yellow); top: -60px; right: -50px; }
.auth-shape-2 { width: 140px; height: 140px; background: var(--teal);   top: 100px; left: -60px; }
.auth-shape-3 { width: 120px; height: 120px; background: var(--coral);  bottom: 100px; right: -30px; }

.auth-header {
  position: relative; z-index: 1;
  padding-top: max(60px, env(safe-area-inset-top, 0px));
  padding-bottom: 40px;
}
.auth-header .back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-sec); font-size: 14px;
  padding: 8px 0; cursor: pointer;
  background: none; border: none;
}
.auth-header .back-btn svg { width: 18px; height: 18px; }

.auth-mini-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.auth-mini-logo .mini-cone { width: 34px; height: 40px; }
.auth-mini-logo span { font-size: 24px; font-weight: 900; color: var(--text-dark); letter-spacing: 4px; }

.auth-headline { font-size: 26px; font-weight: 800; color: var(--text-dark); line-height: 1.3; }
.auth-subline   { font-size: 14px; color: var(--text-sec); margin-top: 6px; }

.auth-form {
  position: relative; z-index: 1;
  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 14px; height: 52px;
  background: var(--teal); color: white;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
  border: none; transition: opacity 0.15s;
}
.otp-send-btn:disabled { opacity: 0.6; cursor: not-allowed; }

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

.auth-footer {
  position: relative; z-index: 1;
  margin-top: auto; padding: 24px 0;
  text-align: center;
}
.auth-footer p { font-size: 12px; color: var(--text-hint); line-height: 1.6; }
.auth-footer a { color: var(--purple); }

/* ═══════════════════════════════════════════════════════════════════
   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.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  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; gap: 8px;
  flex: 1;
}
.home-logo .logo-cone { width: 26px; height: 30px; }
.home-logo span { font-size: 18px; font-weight: 900; color: var(--text-dark); letter-spacing: 3px; }
.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(--purple); border-radius: 2px;
}

/* Waterfall grid */
.waterfall-grid {
  padding: 12px 10px;
  columns: 2; column-gap: 10px;
}
@media (min-width: 640px)  { .waterfall-grid { columns: 3; } }
@media (min-width: 960px)  { .waterfall-grid { columns: 4; } }
@media (min-width: 1200px) { .waterfall-grid { columns: 5; } }

.note-card {
  break-inside: avoid;
  margin-bottom: 10px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
.note-card:active { transform: scale(0.98); }
.note-card:hover  { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.note-card-img {
  width: 100%; aspect-ratio: auto;
  overflow: hidden; background: #f0eef8;
  position: relative;
}
.note-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.note-card:hover .note-card-img img { transform: scale(1.03); }

.note-card-body { padding: 10px 12px 12px; }
.note-card-title {
  font-size: 13px; font-weight: 600; color: var(--text-dark);
  line-height: 1.4;
  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-likes {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-sec);
  flex-shrink: 0;
}
.note-card-likes svg { width: 13px; height: 13px; }
.note-card-likes.liked { color: var(--coral); }
.note-card-likes.liked svg { stroke: var(--coral); fill: var(--coral); }

/* skeleton cards */
.skeleton-card { break-inside: avoid; margin-bottom: 10px; }
.skeleton-img  { width: 100%; aspect-ratio: 3/4; border-radius: var(--radius-md); }
.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: #000; overflow: hidden;
  position: relative;
}
.image-slider { display: flex; transition: transform 0.3s ease; }
.image-slider-item {
  flex-shrink: 0; width: 100vw;
  max-height: 75vw;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.image-slider-item img { width: 100%; height: 100%; object-fit: cover; }
.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(255,255,255,0.5);
  transition: all 0.2s;
}
.image-dot.active { width: 18px; border-radius: 3px; background: white; }

.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 14px;
  border-radius: 20px;
  border: 1.5px solid var(--purple);
  color: var(--purple);
  font-size: 13px; font-weight: 600;
  background: none; cursor: pointer;
  transition: all 0.15s;
}
.detail-follow-btn.following {
  background: var(--purple); color: white;
  border-color: var(--purple);
}

.detail-title { font-size: 20px; font-weight: 800; color: var(--text-dark); margin-bottom: 12px; line-height: 1.4; }
.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; gap: 20px; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.detail-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-sec);
  cursor: pointer; padding: 4px 0;
  transition: color 0.15s;
}
.detail-stat svg { width: 18px; height: 18px; }
.detail-stat.liked { color: var(--coral); }
.detail-stat.liked svg { stroke: var(--coral); fill: var(--coral); }

/* 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.5; }
.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: white;
  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(0,0,0,0.06);
  z-index: 60;
}
.comment-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
  resize: none;
  max-height: 80px;
}
.comment-input:focus { border-color: var(--purple); }
.comment-send-btn {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; border: none;
  transition: transform 0.15s;
}
.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-sm);
  overflow: hidden; position: relative; background: var(--bg);
}
.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(0,0,0,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-sm);
  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(--bg);
}
.image-add-btn:hover { border-color: var(--purple); color: var(--purple); }
.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: inherit; padding: 4px 0;
  border-bottom: 2px solid var(--border);
  transition: border-color 0.2s;
}
.title-input:focus { border-color: var(--purple); }
.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(--bg);
  transition: border-color 0.2s;
  line-height: 1.7;
}
.content-input:focus { border-color: var(--purple); 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,255,255,0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}

/* Upload progress */
.upload-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg);
  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,255,255,0.95);
  backdrop-filter: blur(20px);
  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(--bg); border-radius: var(--radius-xl);
  padding: 10px 16px; border: 1.5px solid transparent;
  transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--purple); }
.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 14px; background: var(--bg); border-radius: 20px;
  font-size: 13px; color: var(--text-body);
  cursor: pointer; border: 1px solid var(--border);
  transition: all 0.15s;
}
.history-tag:hover { border-color: var(--purple); color: var(--purple); }

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

.profile-header-bg {
  height: 140px;
  background: linear-gradient(135deg, var(--purple) 0%, var(--teal) 100%);
  position: relative;
}
.profile-header-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0 20px 16px;
  transform: translateY(50%);
  display: flex; align-items: flex-end; justify-content: space-between;
}
.profile-avatar-wrap {
  position: relative;
}
.profile-avatar-wrap .avatar {
  border: 4px solid white;
  box-shadow: var(--shadow-md);
}

.profile-body { padding: 0 20px; margin-top: 52px; }
.profile-name { font-size: 22px; font-weight: 800; color: var(--text-dark); margin-bottom: 4px; }
.profile-id   { font-size: 12px; color: var(--text-hint); margin-bottom: 10px; }
.profile-bio  { font-size: 14px; color: var(--text-body); line-height: 1.6; margin-bottom: 16px; }

.profile-stats {
  display: flex; gap: 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 0 -20px; padding: 14px 20px;
}
.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); }
.profile-stat-label { font-size: 12px; color: var(--text-hint); }

.profile-edit-btn {
  padding: 8px 20px; border-radius: 20px;
  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 20px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
}
.profile-follow-btn.follow   { background: var(--purple); color: white; }
.profile-follow-btn.unfollow { background: var(--bg); 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(--purple); border-radius: 2px;
}
.profile-tab svg { width: 18px; height: 18px; margin: 0 auto; display: block; }

.profile-notes-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 2px; padding-top: 2px;
}
.profile-note-thumb {
  aspect-ratio: 1; overflow: hidden; cursor: pointer; position: relative;
  background: var(--bg);
}
.profile-note-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.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(--bg); }
.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 14px; border-radius: 20px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
.follow-toggle-btn.follow   { background: var(--purple); 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(--bg); }
.draft-thumb {
  width: 70px; height: 70px; border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0; background: var(--bg);
}
.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.4; 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(94,207,200,0.12);  color: var(--teal); }
.notif-icon.follow { background: rgba(107,103,179,0.12); color: var(--purple); }
.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.5; }
.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-sm);
  overflow: hidden; flex-shrink: 0; background: var(--bg);
}
.notif-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════════════════════════════════════════════════════════════
   EDIT PROFILE PAGE
   ═══════════════════════════════════════════════════════════════════ */
.edit-profile-page { padding-bottom: 30px; }
.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.35);
  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(0,0,0,0.45);
  backdrop-filter: blur(4px); 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: white;
  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: white; border-radius: var(--radius-xl);
  padding: 28px 24px; width: min(340px, 92vw);
  animation: cardIn 0.25s ease;
}
@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(--bg); color: var(--text-dark);
  transition: background 0.15s;
}
.modal-action-btn:active { background: var(--border); }
.modal-action-btn.danger { color: var(--coral); }

/* ═══════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); }
.divider-thick { height: 8px; background: var(--bg); }
.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; }

/* Scrollable with hidden scrollbar */
.scroll-x { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.scroll-x::-webkit-scrollbar { display: none; }

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

/* Image loading placeholder */
.img-placeholder {
  background: linear-gradient(135deg, #f0eef8, #e8e6f0);
  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; }
}
