:root {
  color-scheme: dark;
  --background: #000;
  --surface: #101010;
  --surface-soft: #161616;
  --border: #262626;
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --blue: #0095f6;
  --blue-hover: #1877f2;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

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

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(12px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, 935px);
  height: 100%;
  margin: 0 auto;
}

.wordmark {
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -1.8px;
  line-height: 1;
}

.topbar__actions,
.profile__title-row,
.profile__stats,
.profile__thread,
.tabs,
.post__overlay,
.modal__actions,
.auth-modal__switch,
.story-modal__head,
.story-modal__meta,
.post-modal__author,
.post-modal__action-row {
  display: flex;
  align-items: center;
}

.topbar__actions {
  gap: 8px;
}

.button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

.button--primary {
  background: var(--blue);
  color: #fff;
}

.button--primary:hover {
  background: var(--blue-hover);
}

.button--ghost {
  background: transparent;
  color: var(--blue);
}

.button--ghost:hover {
  color: #e0f1ff;
}

.mobile-login {
  display: none;
}

.page {
  width: min(100% - 40px, 935px);
  margin: 0 auto;
  padding-top: 30px;
}

.profile {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 190px;
}

.profile__avatar-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.avatar-ring {
  width: 168px;
  height: 168px;
  margin-top: 4px;
  border: 0;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #f9ce34, #ee2a7b 52%, #6228d7);
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  border: 4px solid #000;
  border-radius: 50%;
  object-fit: cover;
}

.profile__details {
  min-width: 0;
  padding-top: 8px;
}

.profile__title-row {
  min-height: 40px;
  gap: 8px;
}

.profile__username {
  margin: 0;
  overflow: hidden;
  font-size: 20px;
  font-weight: 400;
  line-height: 25px;
  text-overflow: ellipsis;
}

.verified {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.profile__stats {
  gap: 40px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
  font-size: 16px;
}

.profile__stats strong {
  font-weight: 600;
}

.profile__bio,
.profile__bio-mobile {
  line-height: 20px;
}

.profile__bio p,
.profile__bio-mobile p {
  margin: 0;
}

.profile__name {
  font-weight: 600;
}

.profile__thread {
  width: max-content;
  max-width: 100%;
  gap: 5px;
  margin: 5px 0;
  border-radius: 13px;
  padding: 3px 8px;
  background: #1a1a1a;
  color: #dadada;
  font-size: 12px;
}

.profile__link {
  display: inline-block;
  margin-top: 5px;
  color: #e0f1ff;
  font-weight: 600;
}

.profile__bio-mobile {
  display: none;
}

.highlights {
  display: flex;
  gap: 22px;
  margin: 34px 0 45px;
  padding: 0 13px 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.highlights::-webkit-scrollbar {
  display: none;
}

.highlight {
  width: 87px;
  flex: 0 0 87px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.highlight__ring,
.highlight > span {
  display: block;
  width: 87px;
  height: 87px;
  border: 1px solid #363636;
  border-radius: 50%;
  padding: 3px;
}

.highlight__ring img,
.highlight > span img {
  width: 100%;
  height: 100%;
  border: 2px solid #000;
  border-radius: 50%;
  object-fit: cover;
}

.highlight__label,
.highlight > b {
  display: block;
  margin-top: 11px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  border-top: 1px solid var(--border);
}

.tabs {
  justify-content: center;
  gap: 58px;
  height: 53px;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.tab.is-active {
  color: #f5f5f5;
}

.tab.is-active::before {
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 1px;
  background: #fff;
  content: "";
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.post {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: #171717;
  cursor: pointer;
}

.post > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 220ms ease, opacity 180ms ease;
}

.post:hover > img,
.post:focus-visible > img {
  opacity: 0.7;
  transform: scale(1.015);
}

.post__type,
.carousel-icon,
.reel-icon {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
  font-size: 18px;
}

.post__overlay,
.post-overlay {
  position: absolute;
  inset: 0;
  justify-content: center;
  gap: 24px;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  font-size: 16px;
  font-weight: 700;
  transition: opacity 160ms ease;
}

.post:hover .post__overlay,
.post:focus-visible .post__overlay,
.post:hover .post-overlay,
.post:focus-visible .post-overlay {
  opacity: 1;
}

.post__metric {
  display: flex;
  align-items: center;
  gap: 7px;
}

.empty-tab {
  display: none;
  min-height: 300px;
  place-items: center;
  padding: 60px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-tab.is-visible {
  display: grid;
}

.empty-tab strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 24px;
}

.more {
  display: grid;
  place-items: center;
  min-height: 110px;
}

.footer {
  width: min(100% - 32px, 935px);
  margin: 70px auto 50px;
  color: #737373;
  font-size: 12px;
  text-align: center;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  margin-bottom: 20px;
}

.footer button {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.footer > div {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.modal-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
}

.modal-layer.is-open {
  display: grid;
}

.modal-close {
  position: absolute;
  z-index: 4;
  top: 20px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
}

.auth-modal,
.post-modal,
.story-modal {
  display: none;
}

.modal-layer[data-active="auth"] .auth-modal,
.modal-layer[data-active="post"] .post-modal,
.modal-layer[data-active="story"] .story-modal {
  display: block;
}

.auth-modal {
  width: min(100%, 400px);
  border: 1px solid #303030;
  border-radius: 12px;
  padding: 34px 38px 28px;
  background: #121212;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.auth-modal .wordmark {
  margin: 0 0 24px;
  cursor: default;
  font-size: 34px;
}

.auth-modal h2 {
  margin: 0 0 8px;
  font-size: 19px;
}

.auth-modal p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 19px;
}

.auth-modal .button {
  width: 100%;
  min-height: 40px;
}

.modal-avatar {
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f9ce34, #ee2a7b 52%, #6228d7);
}

.modal-avatar img {
  width: 100%;
  height: 100%;
  border: 3px solid #121212;
  border-radius: 50%;
  object-fit: cover;
}

.auth-modal .modal-primary,
.auth-modal .modal-secondary {
  display: block;
  width: 100%;
  min-height: 40px;
  margin-top: 9px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.auth-modal .modal-primary {
  background: var(--blue);
  color: #fff;
}

.auth-modal .modal-secondary {
  background: transparent;
  color: var(--blue);
}

.auth-modal small {
  display: block;
  margin-top: 20px;
  color: #737373;
  line-height: 16px;
}

.auth-modal__switch {
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  color: var(--muted);
}

.auth-modal__switch button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--blue);
  cursor: pointer;
  font-weight: 600;
}

.post-modal {
  position: relative;
  width: min(100%, 1050px);
  height: min(82vh, 680px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #000;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.7);
}

.modal-layer[data-active="post"] .post-modal {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
}

.post-modal-media {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  background: #080808;
}

.post-modal-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.post-modal-copy {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.post-modal-copy > header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  border-bottom: 1px solid var(--border);
  padding: 12px 15px;
}

.post-modal-copy > header img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.post-modal-copy > header button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.post-modal-copy .caption {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px;
  line-height: 20px;
}

.post-modal-copy .caption p {
  margin: 0;
}

.post-modal-copy .caption small {
  display: block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 10px;
}

.post-modal-copy .post-actions {
  display: flex;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding: 11px 15px 7px;
}

.post-modal-copy .post-actions button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 25px;
}

.post-modal-copy .post-actions button:last-child {
  margin-left: auto;
}

.post-modal-copy .post-actions button.is-active {
  color: #ff3040;
}

.post-modal-copy > [data-modal-likes] {
  padding: 0 16px 4px;
}

.post-modal-copy .login-note {
  padding: 0 16px 15px;
  color: var(--muted);
  font-size: 12px;
}

.post-modal__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  height: 100%;
}

.post-modal__visual {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  background: #080808;
}

.post-modal__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.post-modal__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #000;
}

.post-modal__author {
  gap: 11px;
  min-height: 61px;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  font-weight: 600;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  object-fit: cover;
}

.post-modal__caption {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 16px;
  line-height: 20px;
}

.post-modal__caption strong {
  margin-right: 5px;
}

.post-modal__actions {
  border-top: 1px solid var(--border);
  padding: 10px 16px 14px;
}

.post-modal__action-row {
  gap: 16px;
}

.post-modal__action-row button {
  border: 0;
  padding: 2px;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
}

.post-modal__action-row .save-action {
  margin-left: auto;
}

.post-modal__action-row button.is-active {
  color: #ff3040;
}

.post-modal__likes {
  margin-top: 9px;
  font-weight: 600;
}

.post-modal__date {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.story-modal {
  position: relative;
  width: min(100%, 420px);
  height: min(88vh, 750px);
  overflow: hidden;
  border-radius: 8px;
  background: #171717;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.75);
}

.story-progress {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  left: 10px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.story-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: translateX(-100%);
}

.story-modal.is-playing .story-progress span {
  animation: story-progress 6s linear forwards;
}

.story-modal > header {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  background: linear-gradient(rgba(0, 0, 0, 0.65), transparent);
}

.story-modal > header img {
  width: 34px;
  height: 34px;
  border: 1px solid #fff;
  border-radius: 50%;
  object-fit: cover;
}

.story-modal > [data-story-image] {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.82);
}

.story-modal > [data-story-title] {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 42px;
  left: 24px;
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.66);
  font-size: 17px;
  text-align: center;
}

.story-modal__progress {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  left: 10px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.story-modal__progress::after {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  content: "";
  transform: translateX(-100%);
}

.story-modal.is-playing .story-modal__progress::after {
  animation: story-progress 6s linear forwards;
}

@keyframes story-progress {
  to { transform: translateX(0); }
}

.story-modal__head {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 0;
  left: 0;
  justify-content: space-between;
  padding: 13px 16px;
  background: linear-gradient(rgba(0, 0, 0, 0.65), transparent);
}

.story-modal__meta {
  gap: 9px;
  font-weight: 600;
}

.story-modal__meta img {
  width: 34px;
  height: 34px;
  border: 1px solid #fff;
  border-radius: 50%;
  object-fit: cover;
}

.story-modal__time {
  margin-left: 4px;
  color: #d0d0d0;
  font-weight: 400;
}

.story-modal__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.82);
}

.story-modal__title {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: 42px;
  left: 24px;
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.66);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 150;
  bottom: 24px;
  left: 50%;
  max-width: calc(100% - 32px);
  border-radius: 8px;
  padding: 11px 16px;
  background: #fff;
  color: #151515;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.remote-image-error {
  background: linear-gradient(135deg, #222, #0e0e0e);
  color: transparent;
}

@media (max-width: 767px) {
  .topbar__inner,
  .page {
    width: 100%;
  }

  .topbar__inner {
    padding: 0 16px;
  }

  .page {
    padding-top: 16px;
  }

  .profile {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: auto;
    padding: 0 16px;
  }

  .profile__avatar-wrap {
    justify-content: flex-start;
  }

  .avatar-ring {
    width: 90px;
    height: 90px;
    margin-top: 3px;
    padding: 2px;
  }

  .avatar-ring img {
    border-width: 3px;
  }

  .profile__details {
    padding-top: 0;
  }

  .profile__title-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .profile__username {
    font-size: 19px;
  }

  .mobile-login {
    display: inline-block;
    min-height: 30px;
    padding: 5px 13px;
  }

  .profile__stats {
    position: relative;
    left: -112px;
    justify-content: space-around;
    width: calc(100% + 112px);
    gap: 8px;
    margin: 29px 0 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    font-size: 13px;
    text-align: center;
  }

  .profile__stats li {
    display: flex;
    min-width: 70px;
    flex-direction: column;
  }

  .profile__bio {
    display: none;
  }

  .profile__bio-mobile {
    display: block;
    margin: 12px 16px 0;
  }

  .highlights {
    gap: 14px;
    margin: 22px 0 23px;
    padding: 0 12px 11px;
  }

  .highlight,
  .highlight__ring,
  .highlight > span {
    width: 70px;
  }

  .highlight {
    flex-basis: 70px;
  }

  .highlight__ring {
    height: 70px;
  }

  .highlight__label {
    margin-top: 7px;
    font-size: 11px;
  }

  .tabs {
    justify-content: space-around;
    gap: 0;
  }

  .tab {
    justify-content: center;
    width: 33.333%;
  }

  .tab__label {
    display: none;
  }

  .grid {
    gap: 2px;
  }

  .post__type {
    top: 7px;
    right: 7px;
    font-size: 15px;
  }

  .post__overlay {
    gap: 10px;
    font-size: 12px;
  }

  .more {
    min-height: 90px;
  }

  .footer {
    margin-top: 45px;
  }

  .post-modal {
    width: min(100%, 550px);
    height: min(88vh, 760px);
  }

  .modal-layer[data-active="post"] .post-modal {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 62%) minmax(0, 38%);
  }

  .post-modal-copy {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .post-modal-copy > header {
    display: none;
  }

  .post-modal-copy .caption {
    padding: 10px 14px;
  }

  .post-modal__layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 62%) minmax(0, 38%);
  }

  .post-modal__copy {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .post-modal__author {
    display: none;
  }

  .post-modal__caption {
    padding: 12px 14px;
  }

  .post-modal__actions {
    padding: 8px 14px 10px;
  }
}

@media (max-width: 480px) {
  .wordmark {
    font-size: 22px;
  }

  .topbar__actions .button {
    padding-right: 11px;
    padding-left: 11px;
  }

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

  .avatar-ring {
    width: 77px;
    height: 77px;
  }

  .profile__stats {
    left: -94px;
    width: calc(100% + 94px);
    margin-top: 22px;
  }

  .modal-layer {
    padding: 0;
  }

  .modal-close {
    top: 7px;
    right: 7px;
    text-shadow: 0 1px 5px #000;
  }

  .auth-modal {
    width: calc(100% - 28px);
    padding: 30px 25px 25px;
  }

  .post-modal,
  .story-modal {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
