/* ===== ROOT VARIABLES ===== */
:root {
  --font-display: 'Sora', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --blue: #3B82F6;
  --blue-light: #EFF6FF;
  --blue-dark: #1D4ED8;
  --red: #EF4444;
  --red-light: #FEF2F2;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #FFFFFF;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 62px;
  --nav-h: 74px;

  --grad-pink: linear-gradient(135deg, #FF6B9D 0%, #C44569 100%);
  --grad-purple: linear-gradient(135deg, #A855F7 0%, #6D28D9 100%);
  --grad-orange: linear-gradient(135deg, #F97316 0%, #DC2626 100%);
  --grad-blue: linear-gradient(135deg, #38BDF8 0%, #2563EB 100%);
  --grad-green: linear-gradient(135deg, #34D399 0%, #059669 100%);
  --grad-black: linear-gradient(135deg, #4B5563 0%, #111827 100%);
  --grad-rose: linear-gradient(135deg, #FB7185 0%, #E11D48 100%);
  --grad-teal: linear-gradient(135deg, #2DD4BF 0%, #0F766E 100%);
  --grad-indigo: linear-gradient(135deg, #818CF8 0%, #4338CA 100%);
  --pink: #ec4899;
  --pink-light: #fde8f2;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; width: 100%; overflow: hidden; font-family: var(--font-body); background: var(--gray-50); color: var(--gray-900); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
a { text-decoration: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

/* ===== OVERLAY ===== */
.overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.hidden { display: none; }

/* ===== AUTH FLIP CARD ===== */
.flip-wrap { perspective: 1200px; width: 100%; max-width: 370px; }
.flip-card-inner {
  position: relative; width: 100%;
  transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(.4,0,.2,1);
}
.flip-card-inner.flipped { transform: rotateY(180deg); }
.auth-face {
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--white); border-radius: 24px;
  padding: 32px 28px 28px; box-shadow: 0 32px 64px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; gap: 14px;
}
.auth-face.back { position: absolute; inset: 0; transform: rotateY(180deg); border-radius: 24px; }
.auth-logo { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--blue); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 2px; }
.auth-face h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--gray-900); line-height: 1.2; }
.auth-face p.sub { font-size: 13px; color: var(--gray-500); margin-top: -6px; }
.auth-input {
  width: 100%; padding: 13px 15px; font-size: 15px;
  border: 1.5px solid var(--gray-200); border-radius: 12px;
  background: var(--gray-50); outline: none; color: var(--gray-900);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.12); background: var(--white); }
.auth-input::placeholder { color: var(--gray-400); }
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-600); }
.remember-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--blue); }
.auth-btn {
  width: 100%; padding: 14px; font-family: var(--font-display); font-size: 15px; font-weight: 700;
  border: none; border-radius: 12px; background: var(--blue); color: var(--white);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.auth-btn:hover { background: var(--blue-dark); box-shadow: 0 6px 18px rgba(59,130,246,0.4); }
.auth-btn:active { transform: scale(0.98); }
.auth-switch { font-size: 13.5px; color: var(--gray-500); text-align: center; cursor: pointer; }
.auth-switch span { color: var(--blue); font-weight: 600; }
.username-row { display: flex; gap: 8px; }
.username-row .auth-input { flex: 1; }
.random-btn {
  padding: 12px 14px; border: 1.5px solid var(--blue); border-radius: 12px;
  background: var(--blue-light); color: var(--blue); font-size: 13px; font-weight: 700;
  white-space: nowrap; transition: background 0.15s;
}
.random-btn:hover { background: #DBEAFE; }
.username-hint { font-size: 12px; color: var(--gray-400); margin-top: -8px; }

/* ===== GUEST ACTION FLIP CARD ===== */
.guest-flip-wrap { perspective: 1200px; width: 100%; max-width: 370px; }
.guest-card {
  background: var(--white); border-radius: 24px; padding: 30px 24px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
.guest-card .lock-icon { width: 56px; height: 56px; background: var(--blue-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 4px; }
.guest-card h3 { font-family: var(--font-display); font-size: 20px; font-weight: 800; }
.guest-card p { font-size: 14px; color: var(--gray-500); line-height: 1.5; }
.guest-btn-primary { width: 100%; padding: 14px; font-family: var(--font-display); font-size: 15px; font-weight: 700; border: none; border-radius: 12px; background: var(--blue); color: white; box-shadow: 0 4px 14px rgba(59,130,246,0.35); transition: background 0.15s; }
.guest-btn-primary:hover { background: var(--blue-dark); }
.guest-btn-secondary { width: 100%; padding: 13px; font-size: 14px; font-weight: 600; border: 1.5px solid var(--gray-200); border-radius: 12px; background: var(--white); color: var(--gray-700); transition: background 0.15s; }
.guest-btn-secondary:hover { background: var(--gray-50); }
.guest-dismiss { font-size: 13px; color: var(--gray-400); cursor: pointer; }
.guest-dismiss:hover { color: var(--gray-600); }

/* ===== APP LAYOUT ===== */
.app-root { display: none; height: 100dvh; width: 100%; position: relative; overflow: hidden; }
.app-root.visible { display: flex; }

/* Mobile */
.mobile-frame { display: flex; flex-direction: column; flex: 1; height: 100dvh; overflow: hidden; position: relative; }

/* Desktop sidebar hidden on mobile */
.desktop-sidebar { display: none; }

/* ===== HEADER ===== */
.app-header {
  position: relative; z-index: 90;
  padding: calc(var(--safe-top) + 14px) 18px 14px;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.floating-header {
  position: fixed; top: 0; left: 0; width: 100%; padding: max(15px, var(--safe-top)) 20px 15px 20px;
  display: flex; align-items: center; justify-content: space-between; z-index: 40;
  background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,0.9) 60%, rgba(255,255,255,0) 100%);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.5px;
  text-align: center; width: calc(100% - 170px);
}
.header-actions { display: flex; gap: 10px; align-items: center; }
.btn-icon {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--gray-100); display: flex; align-items: center; justify-content: center;
  color: var(--gray-700); cursor: pointer;
}
.btn-icon:hover { background: var(--gray-200); }
.btn-icon i,
.nav-item i,
.drawer-item i,
.action-btn i,
.report-btn-card i,
.comment-send-btn i,
.dc-close-btn i,
.dc-send i,
.compose-fab i {
  font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.btn-text {
  height: 44px; padding: 0 18px; border-radius: 22px; border: none;
  background: var(--white); color: var(--blue); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 4px 18px rgba(59,130,246,0.12);
}
.pwa-install-btn { font-weight: 700; }
.btn-text:hover { background: rgba(59,130,246,0.08); }

#page-comments .comments-body { padding: 0 16px 16px; }

.app-logo { font-family: var(--font-display); font-size: 18px; font-weight: 800; color: var(--gray-900); letter-spacing: -0.01em; }
.app-logo span { color: var(--blue); }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-icon-btn { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--gray-100); display: flex; align-items: center; justify-content: center; color: var(--gray-700); transition: background 0.15s; }
.header-icon-btn:hover { background: var(--gray-200); }

/* Menu Drawer */
.menu-drawer {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  background: rgba(0,0,0,0.5);
}
.menu-drawer.hidden { display: none; }
.drawer-backdrop { display: none; }
.drawer-panel {
  width: 90%; max-width: 420px; background: var(--white);
  border-radius: 28px; padding: 24px 0 30px;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 64px rgba(0,0,0,0.18);
  animation: slideScale 0.3s cubic-bezier(.4,0,.2,1);
  max-height: 85vh; overflow-y: auto;
}
@keyframes slideScale { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-header { padding: 0 20px 16px; border-bottom: 1px solid var(--gray-100); text-align: center; }
.drawer-user { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.drawer-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--grad-blue); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 20px; flex-shrink: 0; }
.drawer-username { font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.drawer-handle { font-size: 13px; color: var(--gray-500); }
.drawer-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.drawer-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  font-size: 16px; font-weight: 500; color: var(--gray-700);
  cursor: pointer; transition: background 0.15s; border: none; background: none; width: 100%; text-align: left;
}
.drawer-item:hover { background: var(--gray-50); }
.drawer-item.active { color: var(--pink); background: var(--pink-light); font-weight: 600; }
.drawer-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.drawer-item i { width: 20px; height: 20px; flex-shrink: 0; }
.drawer-item.danger { color: var(--red); padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--gray-200); }
.drawer-item.danger:hover { background: var(--red-light); }
.drawer-separator { height: 1px; background: var(--gray-100); margin: 8px 0; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 20px calc(var(--safe-bottom) + 10px);
  background: rgba(255,255,255,0.85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--gray-100);
  z-index: 80;
}
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 20px; border-radius: 16px; border: none; background: none;
  font-size: 11px; font-weight: 600; color: var(--gray-400);
  transition: color 0.2s, background 0.2s; flex: 1; max-width: 120px;
}
.nav-btn.active { color: var(--pink); background: var(--pink-light); }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.create-btn { background: var(--pink); color: white; }
.nav-btn.create-btn svg { color: white; }

.floating-nav {
  display: flex;
}
.nav-element { pointer-events: auto; }
.nav-pill {
  display: flex; border-radius: 40px; padding: 5px; gap: 4px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 22px; border-radius: 30px; text-decoration: none;
  color: var(--gray-700); font-size: 11px; font-weight: 600; transition: 0.2s;
  background: transparent; border: none;
}
.nav-item.active { background: var(--pink-light); color: var(--pink); }
.nav-item svg,
.nav-item i {
  width: 22px; height: 22px; margin-bottom: 3px;
}
.nav-circle {
  width: 62px; height: 62px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; color: var(--white);
  background: var(--pink); border: none; box-shadow: 0 12px 30px rgba(236,72,153,0.25);
}
.nav-circle i {
  font-size: 22px; font-weight: 900;
}

/* ===== PAGE CONTENT AREA ===== */
.pages-area { flex: 1; overflow: hidden; position: relative; }
.page { position: absolute; inset: 0; overflow-y: auto; opacity: 0; pointer-events: none; transition: opacity 0.25s; padding-top: calc(max(15px, var(--safe-top)) + 90px); box-sizing: border-box; }
.page.active { opacity: 1; pointer-events: all; }

/* ===== FEED PAGE ===== */
#page-feed {
  overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
#page-feed::-webkit-scrollbar { display: none; }

.feed-slot {
  min-height: calc(100dvh - 140px);
  width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  padding: 14px 16px;
  flex-shrink: 0;
}

.menu-card {
  width: 100%; max-width: 420px; border-radius: 40px; padding: 24px;
  background: var(--white); color: var(--gray-900);
  box-shadow: 0 16px 40px rgba(0,0,0,0.12);
  display: flex; flex-direction: column; gap: 18px;
}
.menu-card-header {
  display: flex; align-items: center; justify-content: space-between;
}
.menu-card-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.menu-card-subtitle { font-size: 14px; color: var(--gray-500); margin-top: 6px; }
.menu-card-body { display: grid; gap: 12px; }
.menu-card-item {
  width: 100%; padding: 16px 18px;
  border-radius: 18px; background: var(--gray-50);
  border: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 15px; font-weight: 700; color: var(--gray-900);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.menu-card-item:hover { background: var(--gray-100); border-color: var(--gray-300); }
.menu-card-item i { width: 20px; height: 20px; color: var(--gray-500); }
.menu-card-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }
.menu-card-item-danger { color: var(--red); border-color: rgba(239,68,68,0.18); background: rgba(254,242,242,0.9); }
.menu-card-item-danger:hover { background: rgba(254,242,242,1); }

.confession-card {
  width: 100%; height: 75%; max-width: 420px; border-radius: 40px; padding: 25px;
  color: white; display: flex; flex-direction: column; position: relative;
  box-shadow: 0 16px 40px rgba(0,0,0,0.12); overflow: hidden;
}
.confession-card::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(0,0,0,0.08); border-radius: inherit;
  pointer-events: none;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-author { font-size: 13px; font-weight: 700; opacity: 0.9; letter-spacing: 0.01em; }
.card-time { font-size: 12px; opacity: 0.65; }
.card-text {
  flex: 1; font-family: var(--font-display); font-size: 20px; font-weight: 600;
  line-height: 1.45; text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex; align-items: center; padding: 10px 0;
}
.card-actions {
  display: flex; align-items: center; gap: 4px; margin-top: 18px;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.18);
}
.action-btn {
  display: flex; align-items: center; gap: 6px; padding: 9px 16px;
  border-radius: 20px; border: none; background: rgba(255,255,255,0.15);
  color: white; font-size: 13px; font-weight: 600; flex: 1; justify-content: center;
  transition: background 0.15s;
}
.action-btn:hover { background: rgba(255,255,255,0.25); }
.action-btn.liked { background: rgba(255,255,255,0.3); }
.action-btn i { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.report-btn-card {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15); color: white; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; flex-shrink: 0;
}
.report-btn-card:hover { background: rgba(255,75,75,0.35); }

/* ===== POST COMPOSER ===== */
.compose-fab {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px); right: 18px;
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--blue); color: white;
  box-shadow: 0 6px 20px rgba(59,130,246,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 70; transition: transform 0.15s, box-shadow 0.15s;
}
.compose-fab:hover { transform: scale(1.05); box-shadow: 0 8px 24px rgba(59,130,246,0.5); }
.compose-fab:active { transform: scale(0.96); }
.compose-fab i { font-size: 18px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }

.compose-sheet {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.compose-sheet.hidden { display: none; }
.compose-panel {
  width: 100%; background: var(--white); border-radius: 24px 24px 0 0;
  padding: 0 0 calc(var(--safe-bottom) + 16px);
  animation: slideUp 0.3s cubic-bezier(.4,0,.2,1);
  max-height: 95dvh; overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.compose-handle { width: 36px; height: 4px; background: var(--gray-200); border-radius: 2px; margin: 12px auto 0; }
.compose-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: 1px solid var(--gray-100); }
.compose-header h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.compose-post-btn {
  padding: 9px 20px; border-radius: 20px; border: none;
  background: var(--blue); color: white; font-size: 14px; font-weight: 700;
  transition: background 0.15s;
}
.compose-post-btn:hover { background: var(--blue-dark); }
.compose-post-btn:disabled { background: var(--gray-300); cursor: not-allowed; }
.compose-body { padding: 16px 20px; }
.compose-preview-card {
  border-radius: 20px; padding: 22px; color: white; min-height: 130px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; position: relative;
  transition: background 0.3s;
}
.compose-preview-text {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  text-align: center; line-height: 1.45; text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  color: white; width: 100%;
}
.compose-preview-placeholder { color: rgba(255,255,255,0.5); font-size: 15px; font-weight: 400; }
.compose-textarea {
  width: 100%; min-height: 90px; padding: 14px; font-size: 15px; line-height: 1.5;
  border: 1.5px solid var(--gray-200); border-radius: 14px; resize: none;
  outline: none; color: var(--gray-900); background: var(--gray-50);
  transition: border-color 0.2s;
}
.compose-textarea:focus { border-color: var(--blue); background: var(--white); }
.compose-char-count { text-align: right; font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.color-picker-label { font-size: 13px; font-weight: 600; color: var(--gray-500); margin-bottom: 10px; margin-top: 14px; }
.color-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--gray-900); transform: scale(1.12); }

/* ===== HIGHLIGHTS PAGE ===== */
#page-highlights { padding: 16px; }
.page-title { font-family: var(--font-display); font-size: 22px; font-weight: 800; margin-bottom: 16px; padding: 0 2px; }
.highlights-date-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 24px; padding: 0 8px; }
.date-nav-btn { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--gray-300); background: var(--white); color: var(--gray-700); font-size: 18px; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.date-nav-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.date-display { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--gray-900); cursor: pointer; padding: 8px 16px; border-radius: 20px; background: var(--gray-100); transition: all 0.15s; min-width: 120px; text-align: center; }
.date-display:hover { background: var(--gray-200); color: var(--blue); }
.highlights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.highlight-card {
  border-radius: 20px; padding: 20px; color: white;
  aspect-ratio: 3/4; display: flex; flex-direction: column;
  cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transition: transform 0.2s;
}
.highlight-card:hover { transform: scale(1.02); }
.highlight-card::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.08); }
.highlight-rank {
  font-size: 12px; font-weight: 800; opacity: 0.8;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.highlight-text {
  flex: 1; font-family: var(--font-display); font-size: 13px; font-weight: 600;
  line-height: 1.4; margin: 10px 0; display: -webkit-box;
  -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.highlight-stats { font-size: 12px; opacity: 0.8; font-weight: 600; }

/* ===== PROFILE PAGE ===== */
#page-profile { padding: 0; }
.profile-scroll { padding: 70px 16px calc(var(--nav-h) + 30px); }
.profile-hero { background: none; border-radius: 0; padding: 32px 24px; text-align: center; margin-bottom: 20px; box-shadow: none; }
.profile-avatar-large {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--grad-blue); margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 36px; font-weight: 800; font-family: var(--font-display);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.profile-username-large { font-family: var(--font-display); font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.profile-bio-text { font-size: 15px; color: var(--gray-600); line-height: 1.5; margin-bottom: 20px; }
.profile-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 16px; }
.stat-item { text-align: center; }
.stat-num { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--blue); }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 2px; font-weight: 600; }
.profile-section-title { font-family: var(--font-display); font-size: 24px; font-weight: 800; margin-top: 30px; margin-bottom: 30px; color: var(--gray-700); text-align: center; }
  .profile-posts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.profile-grid-post:hover { transform: scale(1.02); }
.profile-grid-post::before {
  content: '';
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.08);
  pointer-events: none;
}
.profile-grid-post span {
  position: relative; z-index: 1;
}

/* ===== COMMENTS VIEW (FULL PAGE MOBILE) ===== */
#page-comments { display: flex; flex-direction: column; padding: 0; }
#page-comments.active { display: flex; }
.comments-body { flex: 1; overflow-y: auto; padding: 70px 16px 100px; display: flex; flex-direction: column; gap: 0; }
.comment-post-preview { display: none; }
.comment-post-preview-text { display: none; }
.comments-list-area { display: none; }
.comments-section-label { display: none; }
.comment-item { padding: 16px; border-bottom: none; display: none; }
.comment-item:nth-child(2n) { display: none; }
.comment-item:nth-child(3n) { display: none; }
.comment-item:nth-child(4n) { display: none; }
.comment-item.reply { display: none; }
.comment-user { display: none; }
.comment-text { display: none; }
.comment-mention { display: none; }
.comment-time { display: none; }
.comment-reply-btn { display: none; }

/* Post Card in Comments Page */
.confession-page-post-card {
  border-radius: 28px; padding: 24px; color: white; display: flex; flex-direction: column;
  box-shadow: 0 16px 40px rgba(0,0,0,0.12); overflow: hidden; margin-bottom: 24px; position: relative;
}
.confession-page-post-card::before {
  content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.08); border-radius: inherit; pointer-events: none;
}
.confession-page-post-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; position: relative; z-index: 1; }
.confession-page-post-author { font-size: 13px; font-weight: 700; opacity: 0.9; letter-spacing: 0.01em; }
.confession-page-post-time { font-size: 12px; opacity: 0.65; }
.confession-page-post-text {
  font-family: var(--font-display); font-size: 18px; font-weight: 600; line-height: 1.45;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2); padding: 10px 0; flex: 1; position: relative; z-index: 1;
}
.confession-page-post-actions {
  display: flex; align-items: center; gap: 4px; margin-top: 18px; position: relative; z-index: 1;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.18);
}
.confession-page-action-btn {
  display: flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 20px;
  border: none; background: rgba(255,255,255,0.15); color: white; font-size: 13px; font-weight: 600;
  flex: 1; justify-content: center; transition: background 0.15s; cursor: pointer;
}
.confession-page-action-btn:hover { background: rgba(255,255,255,0.25); }
.confession-page-action-btn.liked { background: rgba(255,255,255,0.3); }
.confession-page-action-btn i { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; }
.confession-page-report-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,0.15);
  color: white; display: flex; align-items: center; justify-content: center; transition: background 0.15s;
  flex-shrink: 0; cursor: pointer; margin-left: 4px;
}
.confession-page-report-btn:hover { background: rgba(255,75,75,0.35); }

/* Instagram Style Comments */
.instagram-comments-section { position: relative; z-index: 1; }
.instagram-comments-header { font-size: 18px; font-weight: 800; color: var(--gray-900); margin-bottom: 16px; }
.instagram-comments-list { display: flex; flex-direction: column; gap: 14px; }

.instagram-comment { padding: 12px 0; border-bottom: 1px solid var(--gray-200); }
.instagram-comment:last-child { border-bottom: none; margin-bottom: 20px; }
.instagram-comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.instagram-comment-user { font-weight: 700; font-size: 14px; color: var(--gray-900); }
.instagram-comment-text { font-size: 14px; color: var(--gray-700); line-height: 1.5; word-wrap: break-word; }
.instagram-comment-footer { display: flex; align-items: center; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--gray-500); }
.instagram-comment-time { cursor: default; }
.instagram-comment-reply-btn {
  background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 12px; font-weight: 600;
  padding: 0; transition: color 0.15s;
}
.instagram-comment-reply-btn:hover { color: var(--blue); }
.instagram-replies { margin-top: 12px; margin-left: 20px; padding-top: 12px; border-left: 2px solid var(--gray-200); display: flex; flex-direction: column; gap: 12px; }
.instagram-reply { display: flex; gap: 8px; }
.instagram-reply-content { flex: 1; }
.instagram-reply-user { font-weight: 700; font-size: 13px; color: var(--gray-900); }
.instagram-reply-text { font-size: 13px; color: var(--gray-700); line-height: 1.5; word-wrap: break-word; }
.instagram-reply-footer { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 11px; color: var(--gray-500); }
.instagram-reply-time { cursor: default; }
.instagram-reply-btn {
  background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 11px; font-weight: 600;
  padding: 0; transition: color 0.15s;
}
.instagram-reply-btn:hover { color: var(--blue); }\n.comment-item:hover { display: none; }
.comment-item:nth-child(2n) { display: none; }
.comment-item:nth-child(3n) { display: none; }
.comment-item:nth-child(4n) { display: none; }
.comment-item.reply { display: none; }
.comment-user { display: none; }
.comment-text { display: none; }
.comment-mention { display: none; }
.comment-time { display: none; }
.comment-reply-btn { display: none; }
.comment-reply-btn:hover { display: none; }
.comments-input-bar {
  flex-shrink: 0; padding: 10px 16px calc(var(--safe-bottom) + 10px);
  display: flex; gap: 10px; align-items: flex-end;
  border-top: 1px solid var(--gray-100);
  background: rgba(255,255,255,0.95); backdrop-filter: blur(12px);
}
.comment-input-field {
  flex: 1; padding: 10px 14px; border-radius: 20px; border: 1.5px solid var(--gray-200);
  background: var(--gray-50); outline: none; font-size: 14px; resize: none; max-height: 90px;
  transition: border-color 0.2s;
  line-height: 1.4;
}
.comment-input-field:focus { border-color: var(--blue); background: var(--white); }
.comment-send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--blue); color: white; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s; box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}
.comment-send-btn:hover { background: var(--blue-dark); }
.reply-indicator {
  padding: 6px 14px; background: var(--blue-light); border-radius: 8px;
  font-size: 12px; color: var(--blue); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; border-top: 1px solid var(--gray-100);
  padding-top: 8px;
}
.reply-indicator button { background: none; border: none; color: var(--gray-400); font-size: 14px; cursor: pointer; margin-left: auto; }
.reply-indicator-wrap { flex-shrink: 0; background: var(--white); border-top: 1px solid var(--gray-100); padding: 8px 16px 0; display: none; }

/* ===== REPORT MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-sheet {
  width: 100%; max-width: 500px; background: var(--white);
  border-radius: 24px 24px 0 0; padding: 20px 20px calc(var(--safe-bottom) + 20px);
  animation: slideUp 0.3s cubic-bezier(.4,0,.2,1);
}
.modal-handle { width: 36px; height: 4px; background: var(--gray-200); border-radius: 2px; margin: 0 auto 16px; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.modal-sub { font-size: 13px; color: var(--gray-500); margin-bottom: 18px; }
.report-option {
  width: 100%; padding: 14px 0; border: none; background: none;
  font-size: 15px; color: var(--gray-700); text-align: left; border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: color 0.15s;
}
.report-option:hover { color: var(--red); }
.report-option:last-of-type { border-bottom: none; }
.modal-cancel {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--gray-100); color: var(--gray-700); font-size: 15px; font-weight: 600;
  margin-top: 12px; transition: background 0.15s;
}
.modal-cancel:hover { background: var(--gray-200); }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: calc(var(--safe-top) + 100px); left: 50%; transform: translateX(-50%); z-index: 600; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--gray-900); color: white; padding: 12px 20px;
  border-radius: 20px; font-size: 14px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ===== EMPTY STATE ===== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; color: var(--gray-400); padding: 40px; text-align: center; }
.empty-state svg { width: 48px; height: 48px; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--gray-600); }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* ===== DESKTOP LAYOUT ===== */
@media (min-width: 768px) {
  .app-root { flex-direction: row; }
  .mobile-frame { flex: 1; }
  .compose-fab { right: calc(400px + 18px); }

  /* Desktop sidebar */
  .desktop-sidebar {
    display: flex; flex-direction: column;
    width: 260px; flex-shrink: 0;
    border-right: 1px solid var(--gray-200);
    background: var(--white);
    padding: 28px 16px calc(var(--safe-bottom) + 20px);
    overflow-y: auto;
    height: 100dvh;
  }
  .sidebar-logo { font-family: var(--font-display); font-size: 20px; font-weight: 800; margin-bottom: 32px; padding: 0 8px; color: var(--gray-900); }
  .sidebar-logo span { color: var(--blue); }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 14px; border: none; background: none;
    font-size: 15px; font-weight: 500; color: var(--gray-600);
    cursor: pointer; transition: background 0.15s, color 0.15s; text-align: left; width: 100%;
  }
  .sidebar-link:hover { background: var(--gray-50); color: var(--gray-900); }
  .sidebar-link.active { background: var(--pink-light); color: var(--pink); font-weight: 700; }
  .sidebar-link svg { width: 20px; height: 20px; }
  .sidebar-link.danger { color: var(--red); margin-top: auto; }
  .sidebar-link.danger:hover { background: var(--red-light); }
  .sidebar-sep { height: 1px; background: var(--gray-100); margin: 8px 8px; }
  .sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px; margin-top: auto; }
  .sidebar-user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad-blue); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 13px; flex-shrink: 0; }
  .sidebar-user-name { font-size: 14px; font-weight: 700; }
  .sidebar-user-handle { font-size: 12px; color: var(--gray-500); }

  /* Hide mobile-only elements */
  .app-header { display: none; }
  .bottom-nav { display: none; }
  .compose-fab { bottom: 28px; }

  /* Desktop comments sidebar */
  .desktop-comments-panel {
    display: flex; flex-direction: column;
    width: 380px; flex-shrink: 0;
    border-left: 1px solid var(--gray-200);
    background: var(--white); height: 100dvh;
    transform: translateX(0); /* always visible on desktop when open */
  }
  .desktop-comments-panel.collapsed { width: 0; overflow: hidden; border: none; }
  
  /* Desktop feed needs full height */
  .mobile-frame { border-right: 1px solid var(--gray-100); }
  #page-feed { height: 100%; }
  
  /* Desktop highlights wider */
  .highlights-grid { grid-template-columns: repeat(3, 1fr); }
  
  /* Profile page max width */
  .profile-scroll { max-width: 520px; margin: 0 auto; }
}

@media (min-width: 1100px) {
  .desktop-sidebar { width: 280px; }
  .desktop-comments-panel { width: 420px; }
  .compose-fab { right: calc(440px + 18px); }
}

/* ===== DESKTOP COMMENTS PANEL STYLES ===== */
.desktop-comments-panel {
  display: none; /* hidden by default, shown on desktop when open */
}
@media (min-width: 768px) {
  .desktop-comments-panel { display: flex; }
  .desktop-comments-panel.collapsed { display: none; }
}

.dc-header {
  padding: 20px 18px 14px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.dc-header h3 { font-family: var(--font-display); font-size: 17px; font-weight: 800; }
.dc-close-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--gray-100); display: flex; align-items: center; justify-content: center; color: var(--gray-500); }
.dc-post-preview { padding: 14px 18px; border-bottom: 1px solid var(--gray-100); flex-shrink: 0; }
.dc-post-card { border-radius: 16px; padding: 16px; color: white; }
.dc-post-card-text { font-family: var(--font-display); font-size: 14px; font-weight: 600; line-height: 1.4; }
.dc-comments-scroll { flex: 1; overflow-y: auto; padding: 12px 18px; display: flex; flex-direction: column; gap: 2px; }
.dc-input-area { flex-shrink: 0; padding: 10px 18px calc(var(--safe-bottom) + 10px); border-top: 1px solid var(--gray-100); }
.dc-reply-bar { background: var(--blue-light); border-radius: 8px; padding: 6px 12px; margin-bottom: 8px; font-size: 12px; color: var(--blue); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.dc-reply-bar.hidden { display: none; }
.dc-reply-bar button { background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: 14px; }
.dc-input-row { display: flex; gap: 8px; align-items: flex-end; }
.dc-input { flex: 1; padding: 10px 14px; border-radius: 20px; border: 1.5px solid var(--gray-200); background: var(--gray-50); outline: none; font-size: 14px; resize: none; max-height: 80px; }
.dc-input:focus { border-color: var(--blue); background: var(--white); }
.dc-send { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dc-send:hover { background: var(--blue-dark); }

/* ===== HELPERS ===== */
.hidden { display: none !important; }
