:root {
  --bg: #f5eee4;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fffaf4;
  --text: #24180f;
  --muted: #6c5c4d;
  --accent: #bd4f2c;
  --accent-dark: #7f2f18;
  --line: rgba(52, 32, 18, 0.12);
  --shadow: 0 28px 60px rgba(76, 38, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 189, 128, 0.65), transparent 35%),
    linear-gradient(140deg, #f8e8cc, #f3f0ea 55%, #dfe9e1);
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(36, 24, 15, 0.09);
}

textarea,
input {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.8);
}

#app {
  width: 100%;
}

.auth-shell,
.setup-shell,
.error-screen {
  min-height: 100vh;
  display: grid;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-shell {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
}

.hero-panel,
.auth-card,
.setup-card,
.panel {
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 28px;
  box-shadow: var(--shadow);
  animation: fadeUp 520ms ease both;
}

.hero-panel,
.setup-card,
.auth-card,
.panel {
  padding: 1.5rem;
}

.hero-panel h1,
.setup-card h1 {
  font-size: clamp(2.5rem, 4vw, 4.4rem);
  line-height: 0.95;
  margin: 0.4rem 0 1rem;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-points span,
.stats-row span,
.eyebrow {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(189, 79, 44, 0.1);
}

.eyebrow {
  width: fit-content;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-tabs,
.panel-header,
.topbar,
.post-actions,
.inline-form,
.stats-row,
.topbar-actions,
.messages-layout,
.section-nav {
  display: flex;
  gap: 0.75rem;
}

.auth-tabs {
  margin-bottom: 1rem;
}

.tab-button.is-active,
.topbar-actions .is-active,
.primary-button {
  background: linear-gradient(135deg, var(--accent), #ec8b51);
  color: white;
  border-color: transparent;
}

.stack-form {
  display: grid;
  gap: 0.9rem;
}

.form-message {
  border-radius: 16px;
  padding: 0.8rem 0.95rem;
  font-size: 0.95rem;
}

.form-message.is-error {
  background: rgba(186, 64, 47, 0.12);
  color: #8e2615;
  border: 1px solid rgba(186, 64, 47, 0.16);
}

.form-message.is-success {
  background: rgba(47, 123, 87, 0.12);
  color: #1c6a47;
  border: 1px solid rgba(47, 123, 87, 0.16);
}

.stack-form label {
  display: grid;
  gap: 0.4rem;
}

.compact {
  gap: 0.65rem;
}

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

.is-hidden {
  display: none;
}

.app-shell {
  padding: 1.25rem;
}

.premium-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.main-shell {
  display: grid;
  gap: 1rem;
}

.topbar {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.topbar h1,
.panel h2,
.post-header h3 {
  margin: 0;
}

.section-nav {
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-nav button {
  background: rgba(255, 255, 255, 0.72);
}

.section-nav .is-active {
  background: linear-gradient(135deg, var(--accent), #ec8b51);
  color: white;
  border-color: transparent;
}

.panel {
  position: relative;
  overflow: hidden;
}

.profile-hero-panel {
  padding-top: 0;
}

.profile-cover {
  height: 140px;
  margin: -1.5rem -1.5rem 1rem;
  background:
    linear-gradient(135deg, rgba(12, 46, 38, 0.75), rgba(196, 76, 45, 0.55)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.3), transparent 35%);
  background-size: cover;
  background-position: center;
  border-radius: 28px 28px 26px 26px;
}

.panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.1), transparent 40%);
  pointer-events: none;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.premium-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.left-column,
.right-column,
.center-column,
.feed-column,
.notification-list,
.directory-list {
  display: grid;
  gap: 1rem;
}

.desktop-sidebar,
.desktop-rail {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.sidebar-panel,
.rail-panel {
  padding: 1.25rem;
}

.brand-row,
.composer-header,
.post-identity {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #c44c2d, #f0a057);
  color: white;
  font-size: 1.2rem;
  font-weight: 800;
}

.sidebar-links,
.shortcut-grid,
.trend-list,
.mini-stats,
.stories-grid {
  display: grid;
  gap: 0.75rem;
}

.sidebar-link {
  width: 100%;
  justify-content: flex-start;
}

.sidebar-profile {
  text-align: center;
  justify-items: center;
}

.mini-stats {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stats span,
.story-badge,
.post-tag,
.trend-rank {
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: rgba(189, 79, 44, 0.1);
  font-size: 0.84rem;
}

.stories-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.story-card {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 0.55rem;
  justify-items: start;
}

.story-card p {
  margin: 0;
  color: var(--muted);
}

.composer-actions,
.person-actions,
.post-stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.post-stats {
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.post-tag {
  margin-left: auto;
}

.trend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
}

.trend-item p,
.compact-card p,
.sidebar-profile p {
  margin: 0;
  color: var(--muted);
}

.mobile-bottom-nav {
  display: none;
}

.avatar.small {
  width: 38px;
  height: 38px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #112b21, #336b5f);
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

.avatar.large {
  width: 72px;
  height: 72px;
}

.avatar.small {
  width: 38px;
  height: 38px;
}

.avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-header,
.mini-card,
.conversation-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mini-card,
.conversation-button {
  width: 100%;
  padding: 0.8rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.mini-card:hover,
.conversation-button:hover,
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(36, 24, 15, 0.08);
}

.post-content,
.comment-item p {
  white-space: pre-wrap;
}

.post-media {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 24px;
  margin: 1rem 0;
  animation: fadeIn 320ms ease;
}

.comment-box {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  animation: commentReveal 220ms ease;
}

.comments-list,
.conversation-messages {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.comment-item,
.message-bubble {
  background: rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  padding: 0.7rem 0.9rem;
}

.message-bubble.mine {
  background: rgba(189, 79, 44, 0.12);
}

.post-actions button.is-liked {
  background: linear-gradient(135deg, #c4422f, #ef8552);
  color: white;
  border-color: transparent;
}

.post-card.card-pop {
  animation: cardPop 360ms ease;
}

.post-card.card-glow {
  animation: cardGlow 420ms ease;
}

.messages-layout {
  align-items: stretch;
}

.conversation-list,
.conversation-panel {
  flex: 1;
  display: grid;
  gap: 0.75rem;
}

.conversation-messages {
  max-height: 280px;
  overflow: auto;
}

.file-input {
  border: 1px dashed var(--line);
  border-radius: 20px;
  padding: 1rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.unread {
  border: 1px solid rgba(189, 79, 44, 0.38);
}

.panel-hidden-mobile {
  display: block;
}

.mobile-hidden {
  display: grid;
}

.toast-tray {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  display: grid;
  gap: 0.7rem;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(24, 19, 16, 0.92);
  color: white;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
  transform: translateY(16px);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cardPop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.018);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes cardGlow {
  0% {
    box-shadow: var(--shadow);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(236, 139, 81, 0.18), 0 28px 60px rgba(76, 38, 18, 0.12);
  }
  100% {
    box-shadow: var(--shadow);
  }
}

@keyframes commentReveal {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .premium-shell,
  .auth-shell,
  .dashboard-grid,
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .messages-layout,
  .topbar,
  .topbar-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .desktop-sidebar,
  .desktop-rail {
    display: none;
  }

  .section-nav {
    position: sticky;
    top: 0.5rem;
    z-index: 4;
    padding: 0.6rem;
    background: rgba(255, 250, 244, 0.86);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 22px;
  }

  .section-nav button {
    flex: 1 1 calc(50% - 0.75rem);
    min-width: 0;
  }

  .panel-hidden-mobile {
    display: none;
  }

  .mobile-hidden {
    display: none;
  }

  .right-column > .panel-hidden-mobile:first-child,
  .right-column > div:not(.panel-hidden-mobile) {
    display: block;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.55rem;
    border-radius: 24px;
    background: rgba(255, 250, 244, 0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.12);
  }

  .mobile-bottom-nav button {
    padding: 0.75rem 0.5rem;
  }

  .main-shell {
    padding-bottom: 5.5rem;
  }

  .stories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
