:root {
  color-scheme: dark;
  --app-bg: #101114;
  --app-surface: #181a1f;
  --app-surface-2: #202329;
  --app-line: #2f333b;
  --app-text: #f7f4ef;
  --app-muted: #9ea4ae;
  --app-orange: #ff6a3d;
  --app-pink: #ff5c8a;
  --app-blue: #58a6ff;
  --app-green: #50d2a0;
  --app-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--app-bg);
  color: var(--app-text);
}

body {
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

body.app-sheet-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--app-orange);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.social-app {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--app-bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: max(10px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid var(--app-line);
  background: color-mix(in srgb, var(--app-bg) 92%, transparent);
  backdrop-filter: blur(18px);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--app-text);
  cursor: pointer;
  text-align: left;
}

.app-brand img {
  width: 35px;
  height: 35px;
  border: 1px solid #c9a967;
  border-radius: 10px;
  object-fit: cover;
}

.app-brand span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.app-brand strong {
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-brand small,
.app-kicker {
  color: var(--app-muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header-actions {
  display: flex;
  gap: 6px;
}

.app-icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.app-icon-button:hover {
  border-color: var(--app-line);
  background: var(--app-surface);
  color: var(--app-text);
}

.app-main {
  min-height: calc(100dvh - 66px);
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: block;
  animation: app-view-in 180ms ease both;
}

@keyframes app-view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 18px 16px;
}

.app-view-heading > div {
  min-width: 0;
}

.app-kicker {
  margin: 0 0 5px;
  color: var(--app-orange);
  font-weight: 800;
}

.app-view-heading h1,
.app-sheet-heading h2 {
  margin: 0;
  font-size: clamp(1.45rem, 6vw, 2rem);
  letter-spacing: -0.02em;
}

.app-search {
  display: flex;
  gap: 8px;
  padding: 0 18px 13px;
}

.app-search label {
  flex: 1;
}

.app-search input,
.app-auth-sheet input,
.app-compose-sheet textarea,
.app-auth-sheet textarea {
  width: 100%;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--app-surface);
  color: var(--app-text);
}

.app-search input,
.app-auth-sheet input {
  min-height: 44px;
  padding: 0 13px;
}

.app-guest-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 12px 10px;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--app-orange) 35%, var(--app-line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--app-orange) 8%, var(--app-surface));
}

.app-guest-avatar {
  display: inline-grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #2a2d34;
  font-size: 1.15rem;
}

.app-guest-banner div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.app-guest-banner strong,
.app-guest-banner small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-guest-banner small {
  color: var(--app-muted);
  font-size: 0.72rem;
}

.app-button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--app-orange);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  transition: filter 160ms ease, transform 160ms ease;
}

.app-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.app-button-small {
  min-height: 32px;
  margin-left: auto;
  padding: 0 12px;
  font-size: 0.7rem;
}

.app-text-button {
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: var(--app-orange);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.app-text-button:hover {
  color: var(--app-text);
}

.app-feed {
  border-top: 1px solid var(--app-line);
}

.app-post {
  position: relative;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--app-line);
  transition: background 160ms ease;
}

.app-post:hover {
  background: color-mix(in srgb, var(--app-surface) 42%, transparent);
}

.app-post::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--post-accent, var(--app-orange));
  content: "";
  opacity: 0.8;
}

.app-post-head,
.app-comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-avatar-button,
.app-profile-button {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.app-avatar {
  display: block;
  width: 44px;
  height: 44px;
  border: 2px solid color-mix(in srgb, var(--post-accent, var(--app-orange)) 70%, var(--app-line));
  border-radius: 50%;
  object-fit: cover;
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.app-avatar-button:hover .app-avatar,
.app-avatar-button:focus-visible .app-avatar {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--post-accent, var(--app-orange)) 18%, transparent);
  transform: scale(1.04);
}

.app-post-meta,
.app-comment-meta {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.app-post-meta button,
.app-comment-meta button {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--app-text);
  cursor: pointer;
  font-weight: 850;
  text-align: left;
}

.app-post-meta button:hover,
.app-comment-meta button:hover {
  color: var(--post-accent, var(--app-orange));
}

.app-post-meta span,
.app-comment-meta small,
.app-post-bio {
  overflow: hidden;
  color: var(--app-muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-post-delete {
  margin-left: auto;
}

.app-post-body {
  margin: 15px 0 12px 54px;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.app-mention {
  padding: 0 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--app-blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.app-mention:hover {
  background: color-mix(in srgb, var(--app-blue) 15%, transparent);
}

.app-post-media {
  margin: 0 0 13px 54px;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  background: #090a0c;
}

.app-post-media img,
.app-post-media video,
.app-post-media audio {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.app-post-audio {
  padding: 12px;
}

.app-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: 54px;
}

.app-action {
  min-width: 47px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
  font-size: 0.86rem;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.app-action:hover,
.app-action.is-active {
  border-color: color-mix(in srgb, var(--action-color, var(--app-orange)) 50%, transparent);
  background: color-mix(in srgb, var(--action-color, var(--app-orange)) 12%, transparent);
  color: var(--action-color, var(--app-orange));
  transform: translateY(-1px);
}

.app-action span {
  color: var(--app-muted);
  font-size: 0.72rem;
}

.app-action img {
  width: 23px;
  height: 23px;
  border-radius: 6px;
  object-fit: cover;
  vertical-align: middle;
}

.app-action-like { --action-color: var(--app-pink); }
.app-action-repost { --action-color: var(--app-blue); }
.app-action-keur { --action-color: #ff70b0; }
.app-action-ouin { --action-color: #ffc857; }
.app-action-comment { --action-color: #9b8cff; }
.app-action-bookmark { --action-color: var(--app-green); }

.app-comments {
  margin: 12px 0 0 54px;
  color: var(--app-muted);
}

.app-comments summary {
  width: fit-content;
  cursor: pointer;
  font-size: 0.76rem;
}

.app-comment-list {
  display: grid;
  gap: 13px;
  margin: 15px 0;
}

.app-comment {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
}

.app-comment .app-avatar {
  width: 30px;
  height: 30px;
}

.app-comment-body {
  margin: 4px 0 0;
  color: var(--app-text);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.app-comment-form {
  display: flex;
  gap: 7px;
}

.app-comment-form input {
  min-width: 0;
  flex: 1;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: var(--app-surface);
  color: var(--app-text);
}

.app-comment-form button {
  width: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--app-orange);
  color: #fff;
  cursor: pointer;
}

.app-repost-label {
  margin: 0 0 8px 54px;
  color: var(--app-blue);
  font-size: 0.75rem;
  font-weight: 800;
}

.app-poll {
  display: grid;
  gap: 8px;
  margin: 0 0 13px 54px;
}

.app-poll strong {
  font-size: 0.9rem;
}

.app-poll-option {
  position: relative;
  overflow: hidden;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: var(--app-surface);
  color: var(--app-text);
  cursor: pointer;
  text-align: left;
}

.app-poll-option i {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  background: color-mix(in srgb, var(--app-orange) 24%, transparent);
}

.app-poll-option span {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.app-poll-option small {
  color: var(--app-muted);
}

.app-empty,
.app-loading {
  display: grid;
  gap: 6px;
  padding: 45px 24px;
  color: var(--app-muted);
  text-align: center;
}

.app-empty strong {
  color: var(--app-text);
}

.app-notification-list {
  border-top: 1px solid var(--app-line);
}

.app-notification {
  display: grid;
  grid-template-columns: 28px 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--app-line);
  background: transparent;
  color: var(--app-text);
  cursor: pointer;
  text-align: left;
}

.app-notification:hover,
.app-notification.is-unread {
  background: color-mix(in srgb, var(--app-orange) 9%, transparent);
}

.app-notification-mark {
  display: inline-grid;
  width: 8px;
  height: 8px;
  place-items: center;
  border-radius: 50%;
  background: var(--app-orange);
  color: transparent;
}

.app-notification img {
  width: 38px;
  height: 38px;
  border: 2px solid var(--app-line);
  border-radius: 50%;
  object-fit: cover;
}

.app-notification span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.app-notification strong,
.app-notification small,
.app-notification time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-notification strong { font-size: 0.84rem; }
.app-notification small,
.app-notification time { color: var(--app-muted); font-size: 0.72rem; }

.app-profile {
  margin: 0 12px;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 18px;
  background: var(--app-surface);
}

.app-profile-cover {
  height: 90px;
  background: #4b3028;
}

.app-profile-main {
  padding: 0 18px 20px;
}

.app-profile-avatar {
  width: 76px;
  height: 76px;
  margin-top: -38px;
  border: 4px solid var(--app-surface);
  border-radius: 50%;
  object-fit: cover;
}

.app-profile h2 {
  margin: 10px 0 2px;
  font-size: 1.35rem;
}

.app-profile-handle,
.app-profile-bio,
.app-profile-member {
  color: var(--app-muted);
  font-size: 0.8rem;
}

.app-profile-bio {
  line-height: 1.5;
}

.app-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.app-profile-stats div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  text-align: center;
}

.app-profile-stats strong { font-size: 1rem; }
.app-profile-stats span { color: var(--app-muted); font-size: 0.64rem; }

.app-profile-edit {
  display: grid;
  gap: 13px;
  margin: 12px;
  padding: 18px;
  border: 1px solid var(--app-line);
  border-radius: 16px;
  background: var(--app-surface);
}

.app-profile-edit[hidden] {
  display: none;
}

.app-profile-edit label {
  display: grid;
  gap: 6px;
  color: var(--app-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.app-profile-edit input,
.app-profile-edit textarea {
  width: 100%;
  border: 1px solid var(--app-line);
  border-radius: 11px;
  padding: 10px 12px;
  background: var(--app-bg);
  color: var(--app-text);
}

.app-profile-edit textarea { resize: vertical; line-height: 1.45; }
.app-profile-avatar-input { justify-self: start; }

.app-profile-edit-preview {
  min-height: 1px;
}

.app-profile-edit-preview img {
  width: 64px;
  height: 64px;
  border: 2px solid var(--app-orange);
  border-radius: 50%;
  object-fit: cover;
}

.app-bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  min-height: 70px;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--app-line);
  background: color-mix(in srgb, var(--app-bg) 93%, transparent);
  backdrop-filter: blur(18px);
}

.app-bottom-nav > button:not(.app-compose-button) {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
}

.app-bottom-nav > button:not(.app-compose-button).is-active,
.app-bottom-nav > button:not(.app-compose-button):hover {
  color: var(--app-orange);
}

.app-bottom-nav small { font-size: 0.66rem; font-weight: 750; }
.app-bottom-nav span { font-size: 1.25rem; line-height: 1; }

.app-bottom-nav b {
  position: absolute;
  top: 0;
  right: calc(50% - 21px);
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--app-pink);
  color: #fff;
  font-size: 0.6rem;
}

.app-compose-button {
  display: inline-grid;
  width: 48px;
  height: 48px;
  justify-self: center;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--app-orange);
  box-shadow: 0 8px 20px rgba(255, 106, 61, 0.25);
  color: #fff;
  cursor: pointer;
  font-size: 1.6rem;
  transition: transform 160ms ease, filter 160ms ease;
}

.app-nav-bell {
  filter: saturate(1.15);
  font-size: 1.2rem !important;
}

.app-compose-button:hover { filter: brightness(1.08); transform: translateY(-2px) rotate(3deg); }

.app-sheet-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(5px);
}

.app-sheet {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 41;
  width: min(100%, 720px);
  max-height: min(88dvh, 720px);
  margin: 0 auto;
  overflow-y: auto;
  padding: 10px 18px max(20px, env(safe-area-inset-bottom));
  border: 1px solid var(--app-line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  animation: app-sheet-in 190ms ease both;
}

@keyframes app-sheet-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.app-sheet-handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 14px;
  border-radius: 999px;
  background: #555b66;
}

.app-sheet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.app-sheet-heading .app-kicker { margin-bottom: 3px; }

.app-confirm-copy {
  margin: 0 0 18px;
  color: var(--app-muted);
  line-height: 1.5;
}

.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.app-danger-button {
  border-color: #e85c6a;
  background: #e85c6a;
}

.app-compose-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--app-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.app-compose-author img {
  width: 32px;
  height: 32px;
  border: 2px solid var(--app-orange);
  border-radius: 50%;
  object-fit: cover;
}

.app-compose-sheet textarea,
.app-sheet textarea {
  min-height: 145px;
  padding: 13px;
  resize: vertical;
  line-height: 1.5;
}

.app-compose-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
}

.app-compose-footer > span { margin-left: auto; color: var(--app-muted); font-size: 0.7rem; }

.app-media-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  color: var(--app-blue);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.app-media-button:hover { background: color-mix(in srgb, var(--app-blue) 10%, transparent); }
.app-media-button input { display: none; }

.app-upload-preview {
  margin-top: 12px;
  overflow: hidden;
  border-radius: 12px;
  background: #090a0c;
}

.app-upload-preview img,
.app-upload-preview video { display: block; width: 100%; max-height: 250px; object-fit: contain; }

.app-form-status { min-height: 1.25em; margin: 10px 0 0; color: var(--app-muted); font-size: 0.75rem; }

.app-auth-sheet form { display: grid; gap: 13px; }
.app-auth-sheet label { display: grid; gap: 6px; color: var(--app-muted); font-size: 0.75rem; font-weight: 800; }
.app-auth-note { margin: 0; color: var(--app-muted); font-size: 0.74rem; line-height: 1.45; }
.app-auth-switch { justify-self: center; }

.app-mention-menu {
  display: grid;
  gap: 3px;
  max-height: 180px;
  margin-top: 5px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--app-surface-2);
}

.app-mention-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--app-text);
  cursor: pointer;
  text-align: left;
}

.app-mention-option:hover { background: color-mix(in srgb, var(--app-orange) 12%, transparent); }
.app-mention-option img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.app-mention-option span { display: grid; gap: 1px; }
.app-mention-option small { color: var(--app-muted); font-size: 0.68rem; }

.app-toast {
  position: fixed;
  right: 14px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 60;
  width: min(100% - 28px, 390px);
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--app-orange) 55%, var(--app-line));
  border-radius: 14px;
  background: var(--app-surface-2);
  box-shadow: var(--app-shadow);
  color: var(--app-text);
  font-size: 0.8rem;
  text-align: center;
  animation: app-toast-in 180ms ease both;
}

@keyframes app-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 721px) {
  .social-app {
    border-right: 1px solid var(--app-line);
    border-left: 1px solid var(--app-line);
  }

  .app-header,
  .app-bottom-nav {
    padding-right: 28px;
    padding-left: 28px;
  }
}

@media (max-width: 480px) {
  .app-view-heading { padding-right: 14px; padding-left: 14px; }
  .app-post { padding-right: 14px; padding-left: 14px; }
  .app-post-body,
  .app-post-media,
  .app-post-actions,
  .app-comments,
  .app-poll,
  .app-repost-label { margin-left: 0; }
  .app-post-meta span { max-width: 210px; }
  .app-guest-banner { margin-right: 8px; margin-left: 8px; }
  .app-guest-banner .app-button-small { padding: 0 9px; }
}
