:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #171412;
  --muted: #667085;
  --line: #e5e7eb;
  --accent: #355872;
  --accent-mid: #7aaace;
  --accent-light: #9cd5ff;
  --accent-dark: #253f52;
  --rose: #355872;
  --gold: #7aaace;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body.app-loading .shell {
  visibility: hidden;
}

body.app-loading::before {
  content: "";
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 9999;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(86px, 250px) minmax(360px, 680px) minmax(280px, 380px);
  gap: 0;
  width: min(1360px, 100%);
  margin: 0 auto;
  min-height: 100vh;
}

.rail,
.context {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
}

.rail {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 900;
  font-size: 24px;
  box-shadow: var(--shadow);
}

.brand-spacer {
  visibility: hidden;
  pointer-events: none;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  text-align: left;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(122, 170, 206, 0.18);
  color: var(--ink);
  transform: translateX(2px);
}

body:not(.logged-in) .settings-link {
  display: none;
}

.icon {
  width: 24px;
  text-align: center;
  font-size: 23px;
  line-height: 1;
}

.compose-jump,
.account-logout,
.post-actions button {
  border: 0;
  min-height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 0 22px;
  box-shadow: 0 14px 32px rgba(53, 88, 114, 0.22);
  transition: transform 160ms ease, background 160ms ease;
}

.compose-jump:hover,
.account-logout:hover,
.post-actions button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.account-logout {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
  box-shadow: none;
  margin-left: auto;
}

.account-logout.logged-in {
  background: var(--ink);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}

.mini-profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mini-profile strong,
.mini-profile span {
  display: block;
}

.mini-profile span,
.eyebrow,
.hint,
.meta,
.post-stat,
.panel-head span {
  color: var(--muted);
}

.timeline {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(22px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 86px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 800;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 0.95;
  letter-spacing: 0;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(260px, 42%);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
}

.search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.composer {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

body:not(.logged-in) .composer,
body:not(.logged-in) .compose-jump,
body:not(.logged-in) .mini-profile {
  display: none;
}

body.settings-view .composer,
body.settings-view .tabs,
body.settings-view .feed {
  display: none;
}

.avatar {
  inline-size: 48px;
  block-size: 48px;
  min-inline-size: 48px;
  min-block-size: 48px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #251f1a;
  color: white;
  font-weight: 900;
  font-size: 14px;
}

.avatar-user {
  background:
    radial-gradient(circle at 32% 28%, var(--accent-light) 0 17%, transparent 18%),
    linear-gradient(135deg, var(--accent), #172a38 72%);
}

.avatar img {
  inline-size: 100%;
  block-size: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 86px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.42;
}

textarea::placeholder,
input::placeholder {
  color: #948b82;
}

.media-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.media-field input {
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  outline: 0;
  padding: 0 14px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 38px;
  min-height: 36px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.upload-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.clear-upload {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.composer-preview {
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.composer-preview img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.composer-tools,
.post-actions,
.tool-row,
.tabs,
.post-top,
.post-actions-row {
  display: flex;
  align-items: center;
}

.composer-tools {
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.tool-row {
  gap: 8px;
  flex-wrap: wrap;
}

.chip,
.tab,
.post-action {
  border: 0;
  background: transparent;
  color: var(--muted);
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.chip {
  inline-size: 34px;
  block-size: 34px;
  min-inline-size: 34px;
  min-block-size: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 17px;
  line-height: 1;
}

.chip.active,
.chip:hover {
  color: var(--accent-dark);
  background: rgba(15, 118, 110, 0.1);
}

.post-actions {
  gap: 14px;
}

#char-count.warning {
  color: var(--rose);
  font-weight: 800;
}

.tabs {
  position: sticky;
  top: 86px;
  z-index: 3;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.tab {
  flex: 1;
  min-height: 52px;
  font-weight: 800;
  position: relative;
}

.tab.active {
  color: var(--ink);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 54px;
  height: 4px;
  border-radius: 999px 999px 0 0;
  background: var(--accent);
  transform: translateX(-50%);
}

.feed {
  min-height: 320px;
}

.post {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  animation: rise 360ms ease both;
}

.post:hover {
  background: #f8fafc;
}

.post-top {
  justify-content: space-between;
  gap: 10px;
}

.author {
  min-width: 0;
  display: flex;
  gap: 7px;
  align-items: baseline;
  flex-wrap: wrap;
}

.author strong {
  font-size: 15px;
}

.meta {
  font-size: 14px;
}

.tone {
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-body {
  margin: 8px 0 12px;
  font-size: 17px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.post-media {
  margin: 10px 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.post-media img,
.post-media video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.post-actions-row {
  width: 100%;
  justify-content: space-between;
}

.post-action[data-action="delete"] {
  margin-left: auto;
}

.post-action {
  min-height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.post-action:hover {
  background: rgba(15, 118, 110, 0.09);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.post-action.liked {
  color: var(--rose);
}

.empty {
  padding: 48px 22px;
  color: var(--muted);
  text-align: center;
}

.settings-page {
  display: none;
  padding: 22px;
}

body.settings-view .settings-page {
  display: block;
}

.settings-form {
  display: grid;
  gap: 18px;
}

.settings-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.settings-group h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

.settings-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.settings-field input,
.settings-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  outline: 0;
  padding: 0 12px;
}

.settings-field input {
  height: 44px;
}

.settings-field textarea {
  min-height: 96px;
  padding-top: 10px;
  font-size: 15px;
}

.settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: var(--ink);
  font-weight: 700;
}

.settings-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.avatar-upload {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
}

.avatar-upload .avatar {
  inline-size: 58px;
  block-size: 58px;
  min-inline-size: 58px;
  min-block-size: 58px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
}

.settings-actions button,
#login-form > button {
  border: 0;
  min-height: 44px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  padding: 0 22px;
}

[hidden] {
  display: none !important;
}

.context {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.feature {
  overflow: hidden;
  padding: 0 16px 16px;
}

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

.profile-card .eyebrow {
  margin-top: 4px;
}

.feature h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.04;
}

.feature p:last-child {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0;
}

.profile-card-image,
.profile-image-preview {
  min-height: 150px;
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(53, 88, 114, 0.95), rgba(122, 170, 206, 0.88)),
    #f8fafc;
}

.profile-card-image {
  margin-inline: -16px;
  border-bottom: 1px solid var(--line);
}

.profile-image-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
}

.profile-card-image img,
.profile-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}

.profile-card-image.empty {
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
}

.profile-card-image.empty::before {
  content: "";
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head h2 {
  font-size: 18px;
  margin: 0;
}

.trends {
  display: grid;
  gap: 12px;
}

.trend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.trend:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.trend strong {
  overflow-wrap: anywhere;
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 420ms ease;
}

dialog {
  width: min(520px, calc(100% - 28px));
  border: 0;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 0;
}

dialog::backdrop {
  background: rgba(23, 20, 18, 0.35);
  backdrop-filter: blur(4px);
}

#login-form {
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dialog-head h2 {
  margin: 0;
}

.dialog-head button {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
}

.login-field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-field input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  outline: 0;
  padding: 0 12px;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

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

@media (max-width: 1060px) {
  .shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .context {
    display: none;
  }

  .rail {
    padding: 16px;
    align-items: center;
  }

  .nav-item {
    width: 50px;
    justify-content: center;
    padding: 0;
  }

  .nav-item span:last-child,
  .mini-profile div,
  .compose-jump {
    display: none;
  }
}

@media (max-width: 640px) {
  .shell {
    display: block;
  }

  .rail {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 8;
    height: 64px;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    flex-direction: row;
    justify-content: space-around;
    padding: 8px 12px;
  }

  .brand,
  .mini-profile {
    display: none;
  }

  .nav {
    display: contents;
  }

  .nav-item {
    min-height: 46px;
  }

  .timeline {
    border-right: 0;
    padding-bottom: 76px;
  }

  .topbar {
    min-height: 78px;
    padding: 14px 16px;
    align-items: center;
  }

  .search {
    inline-size: 42px;
    block-size: 42px;
    min-height: 0;
    flex: 0 0 42px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
    overflow: hidden;
  }

  .search span {
    font-size: 18px;
  }

  .search:focus-within {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 16px;
    block-size: 44px;
    width: auto;
    padding: 0 14px;
    border-color: var(--line);
    background: #f8fafc;
    z-index: 2;
  }

  .search input {
    inline-size: 0;
    min-inline-size: 0;
    opacity: 0;
  }

  .search:focus-within input {
    inline-size: 100%;
    opacity: 1;
  }

  .composer,
  .post {
    grid-template-columns: 40px 1fr;
    gap: 10px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .avatar {
    inline-size: 40px;
    block-size: 40px;
    min-inline-size: 40px;
    min-block-size: 40px;
  }

  textarea {
    font-size: 18px;
  }

  .composer-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .media-field {
    grid-template-columns: 1fr;
  }

  .post-actions {
    justify-content: space-between;
  }

  .tabs {
    top: 78px;
  }
}
