* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #edfaff;
  --bg-2: #d7f3fb;
  --text: #071f2a;
  --muted: #6f8790;
  --card: rgba(255, 255, 255, 0.72);
  --card-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(8, 56, 74, 0.12);
  --cyan: #00bce7;
  --cyan-dark: #0287a8;
  --blue: #1d7fff;
  --danger: #ec4b4b;
  --success: #14a86b;
  --shadow: 0 24px 80px rgba(0, 70, 90, 0.14);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 112px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 188, 231, 0.24), transparent 34%),
    radial-gradient(circle at bottom right, rgba(29, 127, 255, 0.18), transparent 36%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.45;
  pointer-events: none;
}

.orb-one {
  top: 80px;
  left: -120px;
  background: rgba(0, 188, 231, 0.3);
}

.orb-two {
  right: -120px;
  bottom: 70px;
  background: rgba(29, 127, 255, 0.24);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 70px;
}

/* Topbar + brand */

.topbar {
  position: sticky;
  top: 16px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}

.app-topbar {
  justify-content: flex-start;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.compact-brand {
  flex: 1 1 auto;
}

.brand-logo {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 16px 34px rgba(0, 188, 231, 0.32);
}

.brand h1 {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.brand p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* Hamburger sidebar */

.hamburger-btn {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(7, 31, 42, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 14px 34px rgba(0, 70, 90, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: 0.2s ease;
}

.hamburger-btn:hover {
  background: #ffffff;
  border-color: rgba(0, 188, 231, 0.35);
  transform: translateY(-2px);
}

.hamburger-btn span {
  width: 25px;
  height: 3px;
  display: block;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #071f2a;
  opacity: 1;
}

.app-sidebar {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 700;
  width: min(390px, calc(100% - 36px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 0 34px 100px rgba(0, 45, 65, 0.26);
  transform: translateX(calc(-100% - 30px));
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
}

.app-sidebar.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.app-sidebar::-webkit-scrollbar {
  width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
  background: rgba(0, 188, 231, 0.08);
  border-radius: 999px;
}

.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(2, 135, 168, 0.28);
  border-radius: 999px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 650;
  background: rgba(7, 31, 42, 0.34);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.sidebar-brand .brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  font-size: 26px;
}

.sidebar-brand h1 {
  font-size: 22px;
}

.sidebar-close-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  transition: 0.2s ease;
}

.sidebar-close-btn:hover {
  transform: translateY(-2px);
}

.sidebar-auth {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.sidebar-auth #loginBtn {
  width: 100%;
}

/* Premium sidebar account row */

.sidebar-account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    radial-gradient(circle at top left, rgba(0, 188, 231, 0.12), transparent 44%),
    rgba(255, 255, 255, 0.78);
  box-shadow: 0 16px 36px rgba(0, 70, 90, 0.1);
}

.sidebar-account-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 18px;
  object-fit: cover;
  background: rgba(0, 188, 231, 0.12);
  box-shadow: 0 12px 26px rgba(0, 188, 231, 0.18);
}

.sidebar-account-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.sidebar-account-meta strong,
.sidebar-account-meta span {
  display: block;
}

.sidebar-account-meta strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-meta span {
  max-width: 100%;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout-btn {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(236, 75, 75, 0.22);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--danger);
  box-shadow: 0 12px 26px rgba(236, 75, 75, 0.1);
  transition: 0.2s ease;
}

.sidebar-logout-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.sidebar-logout-btn:hover {
  color: #fff;
  border-color: rgba(236, 75, 75, 0.32);
  background: linear-gradient(135deg, #ff6b6b, var(--danger));
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(236, 75, 75, 0.22);
}

.sidebar-links {
  display: grid;
  gap: 10px;
}

.sidebar-links a,
.sidebar-links button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px 15px;
  background: rgba(237, 250, 255, 0.7);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
  transition: 0.2s ease;
}

.sidebar-links a:hover,
.sidebar-links button:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 188, 231, 0.28);
  background: rgba(255, 255, 255, 0.9);
}

.sidebar-links a::after,
.sidebar-links button::after {
  content: "↗";
  color: var(--cyan-dark);
}

/* Old auth styles */

.auth-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
}

.user-box img {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(0, 188, 231, 0.12);
}

.user-meta {
  min-width: 0;
}

.user-meta strong,
.user-meta span {
  display: block;
}

.user-meta strong {
  max-width: 160px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta span {
  max-width: 190px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Buttons */

.btn {
  border: 0;
  outline: 0;
  border-radius: 999px;
  padding: 11px 17px;
  font-size: 13px;
  font-weight: 800;
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  box-shadow: 0 14px 30px rgba(0, 188, 231, 0.28);
}

.ghost-btn {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.desktop-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Layout */

.main-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 22px;
  margin-top: 24px;
}

.left-panel,
.feed-panel,
.profile-page-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.glass-card,
.composer,
.thread-card,
.public-profile-card,
.profile-editor-card {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.glass-card {
  padding: 22px;
  border-radius: 30px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
  color: var(--cyan-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.intro-card h2,
.page-hero h2 {
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.intro-card p,
.roadmap-card li,
.profile-hint,
.public-profile-bio,
.page-hero p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.intro-card p,
.page-hero p {
  margin-top: 12px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-top img {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  object-fit: cover;
  background: rgba(0, 188, 231, 0.12);
}

.profile-top h3 {
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.profile-top p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-form {
  display: grid;
  gap: 10px;
}

.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.input-field,
.bio-field,
.modal-textarea {
  width: 100%;
  border: 1px solid var(--line);
  outline: 0;
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.bio-field {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.stats-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats-card div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.65);
}

.stats-card strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stats-card span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.roadmap-card h3 {
  margin-bottom: 12px;
  font-size: 17px;
  letter-spacing: -0.03em;
}

.roadmap-card ul {
  list-style: none;
  display: grid;
  gap: 10px;
}

.roadmap-card li {
  position: relative;
  padding-left: 22px;
}

.roadmap-card li::before {
  content: "↗";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--cyan-dark);
  font-weight: 900;
}

textarea {
  width: 100%;
  min-height: 136px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}

textarea::placeholder,
input::placeholder {
  color: #8ba4ad;
}

#charCount,
#modalCharCount {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* Feed */

.feed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 2px 0;
}

.feed-top h2 {
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  transition: 0.2s ease;
}

.pill.active {
  color: #fff;
  border-color: rgba(0, 188, 231, 0.2);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 12px 24px rgba(0, 188, 231, 0.2);
}

.status-msg {
  display: none !important;
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status-msg.success {
  color: var(--success);
}

.status-msg.error {
  color: var(--danger);
}

/* Public profile */

.public-profile-card {
  padding: 22px;
  border-radius: 32px;
  background: var(--card-strong);
  animation: popIn 0.25s ease both;
}

.public-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.public-profile-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.public-profile-main img {
  width: 76px;
  height: 76px;
  border-radius: 26px;
  object-fit: cover;
  background: rgba(0, 188, 231, 0.12);
  box-shadow: 0 14px 30px rgba(0, 188, 231, 0.18);
}

.public-profile-main h3 {
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.public-profile-main p {
  margin-top: 7px;
  color: var(--cyan-dark);
  font-size: 13px;
  font-weight: 900;
}

.public-profile-bio {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.public-profile-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.public-profile-stat {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  transition: 0.2s ease;
}

.public-profile-stat:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 188, 231, 0.24);
  background: rgba(255, 255, 255, 0.88);
}

.public-profile-follow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.follow-btn {
  min-width: 132px;
}

.follow-btn.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 14px 30px rgba(0, 188, 231, 0.28);
}

.follow-btn.ghost-btn {
  color: var(--cyan-dark);
  border: 1px solid rgba(0, 188, 231, 0.24);
  background: rgba(255, 255, 255, 0.76);
}

.follow-btn.ghost-btn:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 14px 30px rgba(0, 188, 231, 0.22);
}

/* Threads */

.threads-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.thread-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  animation: popIn 0.25s ease both;
}

.thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.thread-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}

.thread-user:hover strong {
  color: var(--cyan-dark);
}

.thread-user img {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 999px;
  object-fit: cover;
  background: rgba(0, 188, 231, 0.12);
}

.thread-user strong,
.thread-user span {
  display: block;
}

.thread-user strong {
  max-width: 260px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: 0.2s ease;
}

.thread-user span {
  max-width: 380px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-content {
  color: #14333f;
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-image-wrap {
  width: min(100%, 440px);
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 188, 231, 0.18);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(0, 188, 231, 0.1), transparent 42%),
    rgba(255, 255, 255, 0.62);
  box-shadow: 0 18px 48px rgba(0, 70, 90, 0.1);
}

.thread-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  object-position: center;
  border-radius: 22px;
  transition: 0.25s ease;
}

.thread-image:hover {
  transform: scale(1.015);
}

.profile-thread-image-wrap {
  width: min(100%, 380px);
}

.profile-thread-image {
  max-height: 280px;
}

/* Instagram-style horizontal social actions */

.thread-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}

.action-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.social-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}

.social-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  outline: 0;
  padding: 8px 4px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  transition: 0.2s ease;
}

.social-action-btn svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.social-action-btn span {
  min-width: 10px;
  color: inherit;
  font-size: 14px;
  font-weight: 900;
}

.social-action-btn:hover {
  color: var(--cyan-dark);
  transform: translateY(-2px);
}

.social-action-btn.liked {
  color: var(--danger);
}

.social-action-btn.liked:hover {
  color: var(--danger);
}

.social-action-btn:disabled {
  cursor: default;
  opacity: 1;
  transform: none;
}

/* Old mini actions still used for follow/delete/remove image */

.mini-action {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  transition: 0.2s ease;
}

.mini-action:hover {
  transform: translateY(-2px);
}

.like-action.liked {
  color: var(--danger);
}

.reply-action {
  color: var(--muted);
}

.delete-action {
  color: var(--danger);
}

.feed-follow-btn {
  width: auto;
  min-width: 92px;
  flex: 0 0 auto;
  padding: 9px 14px;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  border-color: rgba(0, 188, 231, 0.2);
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 12px 24px rgba(0, 188, 231, 0.18);
}

.feed-follow-btn.following {
  color: var(--cyan-dark);
  border: 1px solid rgba(0, 188, 231, 0.24);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
}

.feed-follow-btn.following:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 12px 24px rgba(0, 188, 231, 0.18);
}

.empty-state {
  padding: 36px 22px;
  border: 1px dashed rgba(0, 120, 160, 0.34);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  line-height: 1.6;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 18px;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 31, 42, 0.36);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.thread-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 34px 100px rgba(0, 45, 65, 0.32);
  transform: translateY(12px) scale(0.98);
  transition: 0.22s ease;
}

.thread-modal::-webkit-scrollbar {
  width: 6px;
}

.thread-modal::-webkit-scrollbar-track {
  background: rgba(0, 188, 231, 0.08);
  border-radius: 999px;
}

.thread-modal::-webkit-scrollbar-thumb {
  background: rgba(2, 135, 168, 0.28);
  border-radius: 999px;
}

.modal-backdrop.active .thread-modal {
  transform: translateY(0) scale(1);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.modal-head h2 {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.modal-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

.modal-textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.65;
  font-size: 16px;
  background: rgba(237, 250, 255, 0.62);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.modal-footer .btn {
  min-width: 118px;
}

/* Image upload */

.image-upload-box {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.image-upload-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px dashed rgba(0, 188, 231, 0.4);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(0, 188, 231, 0.1), transparent 42%),
    rgba(237, 250, 255, 0.68);
  color: var(--text);
  cursor: pointer;
  transition: 0.2s ease;
}

.image-upload-label:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 188, 231, 0.68);
  background:
    radial-gradient(circle at top left, rgba(0, 188, 231, 0.16), transparent 42%),
    rgba(255, 255, 255, 0.88);
}

.image-upload-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 14px 28px rgba(0, 188, 231, 0.24);
}

.image-upload-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.image-upload-label strong,
.image-upload-label small {
  display: block;
}

.image-upload-label strong {
  font-size: 14px;
  font-weight: 900;
}

.image-upload-label small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.image-upload-input {
  display: none;
}

.image-preview-wrap {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  animation: popIn 0.22s ease both;
}

.image-preview-wrap img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 18px;
  background: rgba(0, 188, 231, 0.1);
}

.image-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.image-preview-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Comments */

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding: 4px 4px 12px;
  margin-bottom: 14px;
  scroll-behavior: smooth;
}

.comments-list::-webkit-scrollbar {
  width: 8px;
}

.comments-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(0, 188, 231, 0.08);
}

.comments-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(2, 135, 168, 0.28);
}

.comment-original-thread {
  padding: 16px;
  border: 1px solid rgba(0, 188, 231, 0.18);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(0, 188, 231, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.82);
}

.comment-original-thread .thread-user {
  margin-bottom: 12px;
}

.comment-original-thread p {
  color: #14333f;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  animation: popIn 0.22s ease both;
}

.comment-card .thread-user {
  margin-bottom: 10px;
}

.comment-card p {
  color: #14333f;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-card .comment-delete-btn {
  margin-top: 12px;
}

.comment-composer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.comment-textarea {
  min-height: 104px;
  max-height: 180px;
  font-size: 15px;
  background: rgba(237, 250, 255, 0.72);
}

#commentsModalBackdrop .thread-modal {
  width: min(640px, 100%);
}

#commentsModalTitle {
  letter-spacing: -0.05em;
}

#commentCharCount {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

/* Delete modal */

.delete-post-modal {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid rgba(236, 75, 75, 0.22);
  border-radius: 32px;
  background:
    radial-gradient(circle at top left, rgba(236, 75, 75, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 34px 100px rgba(90, 0, 0, 0.24);
  transform: translateY(12px) scale(0.98);
  transition: 0.22s ease;
}

.modal-backdrop.active .delete-post-modal {
  transform: translateY(0) scale(1);
}

.delete-modal-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 20px;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b6b, var(--danger));
  box-shadow: 0 16px 34px rgba(236, 75, 75, 0.28);
}

.delete-modal-content h2 {
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.delete-modal-content p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.65;
}

.delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.danger-btn {
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, var(--danger));
  box-shadow: 0 14px 30px rgba(236, 75, 75, 0.24);
}

.danger-btn:hover {
  transform: translateY(-2px);
}

.profile-thread-actions {
  justify-content: flex-end;
}

.profile-delete-btn {
  min-width: 96px;
}

/* Bottom nav */

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 200;
  display: grid;
  grid-template-columns: 1fr 74px 1fr;
  align-items: center;
  gap: 12px;
  width: min(430px, calc(100% - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  box-shadow: 0 24px 70px rgba(0, 70, 90, 0.22);
  transform: translateX(-50%);
}

.bottom-nav-btn,
.bottom-nav-main {
  border: 0;
  outline: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: 0.2s ease;
}

.bottom-nav-btn {
  gap: 4px;
  height: 52px;
  border-radius: 999px;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
}

.bottom-nav-btn svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.bottom-nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 12px 26px rgba(0, 188, 231, 0.24);
}

.bottom-nav-main {
  width: 66px;
  height: 66px;
  justify-self: center;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 18px 34px rgba(0, 188, 231, 0.34);
}

.bottom-nav-main svg {
  width: 31px;
  height: 31px;
  fill: currentColor;
}

.bottom-nav-btn:hover,
.bottom-nav-main:hover {
  transform: translateY(-3px);
}

/* Profile page */

.profile-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 24px;
}

.profile-editor-card {
  padding: 24px;
  border-radius: 34px;
  background: var(--card-strong);
}

.profile-editor-head {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 22px;
}

.profile-editor-head h2 {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.profile-editor-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.profile-editor-form {
  display: grid;
  gap: 12px;
}

.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Avatar upload */

.profile-avatar-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding-bottom: 18px;
}

.profile-avatar-control img {
  width: 96px;
  height: 96px;
  border-radius: 30px;
  object-fit: cover;
  background: rgba(0, 188, 231, 0.12);
  box-shadow: 0 16px 34px rgba(0, 188, 231, 0.18);
}

.avatar-upload-btn {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(0, 188, 231, 0.32);
  transform: translateX(-50%);
  transition: 0.2s ease;
}

.avatar-upload-btn svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.avatar-upload-btn span {
  display: none;
}

.avatar-upload-btn:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 18px 36px rgba(0, 188, 231, 0.42);
}

.avatar-upload-input {
  display: none;
}

/* Animation */

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Desktop */

@media (min-width: 901px) {
  body {
    padding-bottom: 112px;
  }

  .bottom-nav {
    display: grid;
    width: min(460px, calc(100% - 40px));
    bottom: 22px;
  }
}

/* Tablet */

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    top: 10px;
    border-radius: 26px;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .left-panel {
    order: 2;
  }

  .feed-panel {
    order: 1;
  }

  .desktop-profile-btn {
    display: none;
  }
}

/* Phone */

@media (max-width: 560px) {
  .brand-logo {
    width: 50px;
    height: 50px;
    border-radius: 18px;
    font-size: 25px;
  }

  .brand h1 {
    font-size: 21px;
  }

  .brand p,
  .compact-brand p {
    display: none;
  }

  .app-topbar {
    top: 10px;
    padding: 12px;
  }

  .topbar-left {
    gap: 14px;
  }

  .hamburger-btn {
    width: 58px;
    height: 58px;
    border-radius: 22px;
    gap: 4px;
  }

  .hamburger-btn span {
    width: 26px;
    height: 3px;
  }

  .compact-brand {
    gap: 12px;
  }

  .compact-brand .brand-logo {
    width: 50px;
    height: 50px;
  }

  .app-sidebar {
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 30px;
  }

  .sidebar-account-row {
    padding: 9px;
    border-radius: 24px;
  }

  .sidebar-account-avatar {
    width: 52px;
    height: 52px;
    border-radius: 17px;
  }

  .sidebar-logout-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
  }

  .sidebar-account-meta strong {
    font-size: 14px;
  }

  .sidebar-account-meta span {
    font-size: 11px;
  }

  .modal-backdrop {
    align-items: flex-start;
    padding: 18px 12px;
    overflow-y: auto;
  }

  .thread-modal {
    width: 100%;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    border-radius: 28px;
  }

  .modal-textarea {
    min-height: 120px;
  }

  .modal-footer,
  .image-preview-meta,
  .delete-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-footer {
    position: sticky;
    bottom: -1px;
    z-index: 5;
    padding-top: 14px;
    padding-bottom: 2px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .delete-modal-actions {
    flex-direction: column-reverse;
  }

  .modal-footer .btn,
  .image-preview-meta .mini-action,
  .delete-modal-actions .btn,
  #modalUploadBtn {
    width: 100%;
  }

  .feed-top,
  .public-profile-head {
    align-items: stretch;
    flex-direction: column;
  }

  .feed-top .btn,
  .filter-pills,
  .pill {
    width: 100%;
  }

  .pill {
    text-align: center;
  }

  .public-profile-main,
  .profile-editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-avatar-control {
    width: auto;
    align-items: center;
    flex-direction: row;
  }

  .profile-avatar-control img {
    width: 104px;
    height: 104px;
    border-radius: 32px;
  }

  .avatar-upload-btn {
    width: 48px;
    height: 48px;
  }

  .public-profile-follow,
  .follow-btn {
    width: 100%;
  }

  .follow-btn {
    justify-content: center;
  }

  .thread-top {
    align-items: center;
    flex-direction: row;
    gap: 10px;
  }

  .thread-user {
    flex: 1 1 auto;
    min-width: 0;
  }

  .thread-user img {
    width: 42px;
    height: 42px;
  }

  .thread-user strong {
    max-width: 150px;
  }

  .thread-user span {
    max-width: 160px;
  }

  .thread-image-wrap,
  .profile-thread-image-wrap {
    width: 100%;
    border-radius: 20px;
  }

  .thread-image {
    max-height: 260px;
    border-radius: 20px;
  }

  .profile-thread-image {
    max-height: 240px;
  }

  .thread-actions {
    align-items: center;
    flex-direction: row;
  }

  .action-left,
  .social-actions {
    width: auto;
  }

  .social-actions {
    gap: 16px;
  }

  .thread-actions .social-action-btn {
    width: auto !important;
    text-align: left;
  }

  .social-action-btn svg {
    width: 24px;
    height: 24px;
  }

  .social-action-btn span {
    font-size: 14px;
  }

  .thread-actions .mini-action:not(.feed-follow-btn):not(.delete-action) {
    width: auto;
    text-align: left;
  }

  .feed-follow-btn {
    width: auto !important;
    min-width: 86px;
    flex: 0 0 auto;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 999px;
  }

  .profile-thread-actions {
    justify-content: stretch;
  }

  .profile-delete-btn {
    width: 100%;
  }

  .image-upload-label {
    align-items: flex-start;
  }

  .image-preview-wrap img {
    max-height: 170px;
  }

  .comments-list {
    max-height: 46vh;
  }

  .comment-original-thread,
  .comment-card {
    border-radius: 20px;
    padding: 14px;
  }

  .comment-textarea {
    min-height: 96px;
  }
}