:root {
  --bg: #09090b;
  --bg-elevated: #131317;
  --bg-raised: #18181d;
  --border: #232329;
  --border-soft: #1a1a1f;
  --text: #f7f7f8;
  --text-dim: #93939d;
  --text-faint: #5c5c66;
  --accent: #6d7bff;
  --accent-dim: #2a2d5c;
  --ban: #ff4438;
  --ban-dim: #3d0e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 24px -12px rgba(0,0,0,0.6);
  --shadow-pop: 0 20px 60px -12px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04) inset;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

/* Global safety net: [hidden] must always win, no matter what display
   value a more specific class rule sets elsewhere in this file. */
[hidden] { display: none !important; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background:
    radial-gradient(680px 420px at 50% -8%, rgba(109,123,255,0.10), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  letter-spacing: -0.01em;
}

::selection { background: var(--accent-dim); color: var(--text); }

button, input, textarea { font-family: inherit; }

a { color: inherit; }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: 84px;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  background: rgba(9,9,11,0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
  z-index: 5;
}
.logo { color: var(--text); display: flex; transition: transform 0.2s ease; cursor: pointer; }
.logo:hover { transform: rotate(-4deg) scale(1.04); }
.nav-icons { display: flex; gap: 2px; background: var(--bg-elevated); padding: 4px; border-radius: 999px; border: 1px solid var(--border-soft); }
.nav-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 9px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.nav-icon:hover { background: var(--bg-raised); color: var(--text); }
.nav-icon:active { transform: scale(0.92); }
.nav-icon.active { color: var(--text); background: var(--bg-raised); }
.nav-icon.menu { margin-left: auto; background: none; border: 1px solid var(--border-soft); }

.menu-wrap { position: relative; margin-left: auto; }
.menu-wrap .nav-icon.menu { margin-left: 0; }
.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 20;
  animation: fadeIn 0.12s ease;
}
.menu-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.menu-dropdown a:hover { background: var(--bg-raised); color: var(--text); }
.menu-dropdown a svg { flex-shrink: 0; color: var(--text-faint); }
.menu-dropdown a:hover svg { color: var(--accent); }

/* Composer bar (feed entry point) */
.composer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 16px 8px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: text;
  transition: border-color 0.15s, background 0.15s;
}
.composer-bar:hover { border-color: var(--border); background: var(--bg-raised); }
.composer-placeholder { color: var(--text-faint); flex: 1; font-size: 15px; }
.avatar {
  border-radius: 50%;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}
.avatar.small { width: 36px; height: 36px; }
.avatar.large { width: 96px; height: 96px; margin: 0 auto; }
.post-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: not-allowed;
}
.post-btn.primary {
  background: var(--text);
  color: #000;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.post-btn.primary:hover { opacity: 0.88; }
.post-btn.primary:active { transform: scale(0.97); }
.post-btn.primary.danger { background: var(--ban); color: #fff; }
.post-btn.full { width: 100%; }

/* Strike banner */
.strike-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 12px 16px;
  padding: 14px;
  background: var(--ban-dim);
  border: 1px solid #5c1a15;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
}
.strike-icon { display: flex; align-items: center; color: var(--ban); flex-shrink: 0; }
.strike-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.strike-text p { margin: 0; font-size: 13px; color: #e5a39d; }
.strike-dismiss {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.strike-dismiss:hover { background: rgba(255,255,255,0.06); }

/* Posts */
.post {
  display: flex;
  gap: 12px;
  padding: 16px;
  margin: 0 16px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
}
.post:hover { border-color: var(--border); background: var(--bg-raised); }
.post-main { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.post-head .username { font-weight: 600; }
.verified-badge { color: var(--accent); flex-shrink: 0; margin-left: -2px; }
.post-head .time { color: var(--text-faint); font-size: 13px; margin-left: auto; }
.post-text { font-size: 15px; line-height: 1.5; margin: 4px 0 10px; white-space: pre-wrap; word-wrap: break-word; }
.post-image { max-width: 100%; border-radius: 12px; margin-bottom: 8px; display: block; border: 1px solid var(--border-soft); }
.post-actions { display: flex; gap: 6px; color: var(--text-dim); margin: 0 -6px; }
.post-actions svg { width: 19px; height: 19px; }
.post-actions button {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; padding: 7px; border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}
.post-actions button:hover { background: var(--bg-raised); color: var(--text); }
.post-meta { color: var(--text-faint); font-size: 13px; margin-top: 8px; }

.post.removed { background: #150707; border-color: #2a0e0c; }
.post.removed:hover { background: #1a0808; }
.post.removed .post-text { color: var(--text-faint); font-style: italic; }
.removed-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ban);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--ban);
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 6px;
}

/* Empty state views (Liked / Search) */
.empty-view {
  text-align: center;
  padding: 64px 24px 40px;
  margin: 0 16px;
  animation: fadeIn 0.2s ease;
}
.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  margin-bottom: 18px;
}
.empty-icon.error { color: var(--ban); border-color: #3a1512; background: var(--ban-dim); }
.empty-view h3 { font-size: 18px; margin: 0 0 6px; color: var(--text); }
.empty-view p { font-size: 14.5px; color: var(--text-dim); margin: 0 auto; max-width: 380px; line-height: 1.55; }
.empty-detail-box {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  margin: 20px auto 0;
  max-width: 380px;
}
.empty-detail-row {
  display: flex; justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid #1a1a1a;
}
.empty-detail-row:last-child { border-bottom: none; }
.empty-detail-row span { color: var(--text-faint); }
.empty-detail-row strong { text-align: right; }
.down-dot { color: var(--ban); }
.empty-fineprint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 16px;
  max-width: 380px;
}

/* Modals */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6,6,8,0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
  animation: pop 0.18s cubic-bezier(.2,.8,.3,1.2);
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-header-spacer { width: 52px; }
.modal-title { font-weight: 700; font-size: 15px; }
.text-btn { background: none; border: none; color: var(--text); font-size: 15px; cursor: pointer; padding: 6px 8px; border-radius: 8px; transition: background 0.15s; }
.text-btn:hover { background: var(--bg-raised); }

.composer-body { display: flex; gap: 12px; padding: 16px; }
.composer-input-wrap { flex: 1; min-width: 0; }
.composer-username { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
#postText {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.45;
}
.attach-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-dim);
  transition: border-color 0.15s, color 0.15s;
}
.attach-btn:hover { border-color: var(--text-faint); color: var(--text); }
.attach-btn.center { display: flex; justify-content: center; margin: 16px auto; width: fit-content; }
.attach-hint { font-size: 12px; color: var(--text-faint); }
#imagePreview { max-width: 100%; border-radius: 12px; margin-top: 10px; border: 1px solid var(--border-soft); }

.composer-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
}
.composer-note { font-size: 12px; color: var(--text-faint); }

.profile-body { padding: 24px 16px; text-align: center; }
.profile-hint { color: var(--text-faint); font-size: 13px; margin-top: 8px; }

/* Ban modal styling */
.ban-modal { text-align: center; padding: 32px 24px 24px; }
.ban-icon { display: flex; align-items: center; justify-content: center; color: var(--ban); margin-bottom: 8px; }
.ban-icon.pulse { animation: pulse 0.9s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.ban-modal h2 { margin: 4px 0 6px; font-size: 20px; }
.ban-reason { color: var(--text-dim); font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.ban-reason strong { color: var(--ban); }
.ban-detail-box {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  margin-bottom: 14px;
}
.ban-detail-row {
  display: flex; justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid #1a1a1a;
}
.ban-detail-row strong { text-align: right; }
.ban-detail-row:last-child { border-bottom: none; }
.ban-detail-row span { color: var(--text-faint); }
.ban-fineprint {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
  margin-bottom: 18px;
}
.blink { color: var(--ban); animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.ban-modal.severe { border-color: #5c1a15; }
.ban-modal.maximum { border-color: var(--ban); box-shadow: 0 0 40px rgba(255,59,48,0.25); }

.site-footer { text-align: center; padding: 34px 0 70px; }
.site-footer a { color: var(--text-faint); font-size: 13px; text-decoration: none; transition: color 0.15s; }
.site-footer a:hover { color: var(--text-dim); }
.footer-dot { color: var(--text-faint); margin: 0 8px; font-size: 13px; }

/* Support chat */
.support-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(109,123,255,0.45), 0 0 0 1px rgba(255,255,255,0.08) inset;
  z-index: 40;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.support-fab:hover { transform: scale(1.07) translateY(-1px); box-shadow: 0 10px 28px rgba(109,123,255,0.55), 0 0 0 1px rgba(255,255,255,0.08) inset; }
.support-fab:active { transform: scale(0.98); }

.support-page-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}
.support-back {
  display: inline-block;
  margin: 20px 0 0;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
}
.support-back:hover { color: var(--text); }

.support-panel {
  width: 100%;
  max-width: 480px;
  height: 640px;
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}
.support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-raised);
}
.support-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}
.support-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #37c98a;
  display: inline-block;
}
.support-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.support-msg {
  max-width: 80%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.4;
}
.support-msg.bot {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.support-msg.user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.support-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border-soft);
}
.support-input-row input {
  flex: 1;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}
.support-input-row input:focus { border-color: var(--accent); }
.support-send {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.1s, opacity 0.15s;
}
.support-send:hover { opacity: 0.9; }
.support-send:active { transform: scale(0.92); }

/* Focus visibility for keyboard users */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== Desktop: give the feed some breathing room on wide viewports ===== */
@media (min-width: 860px) {
  .app { max-width: 680px; padding-top: 4px; }
  .topbar { border-radius: 0 0 var(--radius) var(--radius); }
  .post:hover { transform: translateY(-1px); }
}

/* ===== Tablet / small desktop ===== */
@media (max-width: 720px) {
  .app { max-width: 100%; }
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .app { padding-bottom: 88px; }
  .topbar { padding: 12px 14px; }
  .nav-icons { gap: 0; }
  .nav-icon { padding: 8px; }
  .menu-dropdown { right: -6px; }
  .composer-bar { margin: 12px 12px 6px; padding: 12px 14px; }
  .post { margin: 0 10px 8px; padding: 14px; border-radius: var(--radius-sm); }
  .post-text { font-size: 14.5px; }
  .strike-banner { margin: 10px 12px; }
  .modal { border-radius: 20px 20px 0 0; align-self: flex-end; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-overlay:has(.ban-modal) { align-items: center; padding: 16px; }
  .modal-overlay:has(.ban-modal) .modal { border-radius: 22px; align-self: center; }
  .support-fab { bottom: 18px; right: 16px; width: 50px; height: 50px; font-size: 20px; }
  .support-panel { margin: 0; height: 100vh; max-height: 100vh; border-radius: 0; border: none; }
  .support-page-wrap { padding: 0; }
  .support-back { margin: 14px 0 0 14px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
