:root {
  --ink: #12202b;
  --ink-soft: #3d5160;
  --paper: #f3f7f9;
  --surface: rgba(255, 255, 255, 0.78);
  --line: rgba(18, 32, 43, 0.1);
  --accent: #0f7a6c;
  --accent-deep: #0a5a50;
  --accent-glow: rgba(15, 122, 108, 0.28);
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(18, 32, 43, 0.08);
  --radius: 18px;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Sora", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 12% -10%, #d7ece8 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #dce7f2 0%, transparent 50%),
    linear-gradient(180deg, #eef4f6 0%, var(--paper) 40%, #e8eef2 100%);
  line-height: 1.5;
}

.bg-glow {
  position: fixed;
  inset: auto -10% -20% auto;
  width: 48vw;
  height: 48vw;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(-8%, -6%, 0) scale(1.08);
  }
}

.landing,
.app {
  position: relative;
  z-index: 1;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 6vw, 5rem);
  max-width: 760px;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.logo-mark {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #1aa891, #0f7a6c 55%, #0a5a50);
  box-shadow: 0 0 0 6px rgba(15, 122, 108, 0.12);
}

.logo-mark-sm {
  width: 0.75rem;
  height: 0.75rem;
  box-shadow: 0 0 0 4px rgba(15, 122, 108, 0.12);
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 10vw, 5.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.95;
}

.brand-sm {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.landing-tagline {
  margin: 0 0 2rem;
  max-width: 28ch;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
}

.landing-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn:not(:disabled):active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:not(:disabled):hover {
  background: var(--accent-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding-inline: 0.85rem;
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(18, 32, 43, 0.05);
}

.btn-icon {
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 0.45rem;
  vertical-align: -0.15rem;
}

.error-text {
  margin: 0.9rem 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.app {
  min-height: 100vh;
  animation: rise 0.45s ease both;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 2rem);
  backdrop-filter: blur(14px);
  background: rgba(243, 247, 249, 0.78);
  border-bottom: 1px solid var(--line);
}

.topbar-brand,
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-name {
  font-size: 0.92rem;
  color: var(--ink-soft);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #d7e2e8;
}

.avatar-lg {
  width: 48px;
  height: 48px;
}

.layout {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 4vw, 1.5rem) 3rem;
}

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.1rem 0.9rem;
  margin-bottom: 1.5rem;
}

.composer-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.85rem;
}

.composer-body textarea {
  width: 100%;
  border: 0;
  outline: 0;
  resize: vertical;
  min-height: 88px;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
}

.composer-body textarea::placeholder {
  color: #7c909d;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: rgba(15, 122, 108, 0.1);
}

.icon-btn svg {
  width: 1.35rem;
  height: 1.35rem;
}

.char-count {
  font-size: 0.82rem;
  color: #7c909d;
}

.char-count.is-near-limit {
  color: #b26a00;
  font-weight: 600;
}

.image-previews {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.image-previews.count-1 {
  grid-template-columns: 1fr;
}

.image-previews.count-2,
.image-previews.count-4 {
  grid-template-columns: 1fr 1fr;
}

.image-previews.count-3 {
  grid-template-columns: 1fr 1fr;
}

.image-previews.count-3 .preview-item:first-child {
  grid-column: 1 / -1;
}

.preview-item {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  aspect-ratio: 16 / 11;
  background: #d7e2e8;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-remove {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.7rem;
  height: 1.7rem;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 32, 43, 0.72);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.feed-heading {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
}

.feed-status {
  color: var(--ink-soft);
  padding: 1rem 0.2rem;
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.post {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.8rem;
  padding: 1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: rise 0.35s ease both;
}

.post-meta {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.25rem;
}

.post-author {
  font-size: 0.95rem;
}

.post-meta time {
  font-size: 0.8rem;
  color: #7c909d;
}

.post-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-text a {
  color: var(--accent-deep);
}

.post-images {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.post-images.count-1 {
  grid-template-columns: 1fr;
}

.post-images.count-2,
.post-images.count-4 {
  grid-template-columns: 1fr 1fr;
}

.post-images.count-3 {
  grid-template-columns: 1fr 1fr;
}

.post-images.count-3 .post-image:first-child {
  grid-column: 1 / -1;
}

.post-image {
  display: block;
  overflow: hidden;
  border-radius: 14px;
  aspect-ratio: 16 / 11;
  background: #d7e2e8;
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.post-image:hover img {
  transform: scale(1.03);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(18, 32, 43, 0.25);
  animation: rise 0.25s ease both;
}

@media (max-width: 640px) {
  .user-name {
    display: none;
  }

  .composer-row {
    grid-template-columns: 40px 1fr;
  }

  .avatar-lg {
    width: 40px;
    height: 40px;
  }
}
