/* Kenstagram: Instagram-style look, light and dark. Plain CSS, no build step. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #efefef;
  --text: #0f1419;
  --muted: #737373;
  --border: #dbdbdb;
  --link: #00376b;
  --accent: #0095f6;
  --accent-hover: #1877f2;
  --like: #ff3040;
  --danger: #ed4956;
  --brand: linear-gradient(45deg, #f09433, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888);
  --radius: 8px;
  --nav-width: 245px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #000000;
    --surface-2: #262626;
    --text: #f5f5f5;
    --muted: #a8a8a8;
    --border: #363636;
    --link: #e0f1ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
input, textarea { font: inherit; color: inherit; }

.muted { color: var(--muted); }
.strong { font-weight: 600; }
.center { text-align: center; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.logotype {
  font-family: "Grand Hotel", cursive;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}
.logotype--large { font-size: 52px; text-align: center; margin: 12px 0 24px; }

/* Icons */
.icon { width: 24px; height: 24px; flex: none; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px; margin: 0; border: 0; background: none; cursor: pointer;
}
.icon-button:hover { opacity: 0.6; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 16px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--accent-hover); }
.button--secondary { background: var(--surface-2); color: var(--text); }
.button--secondary:hover { background: var(--border); }
.button--compact { padding: 5px 12px; font-size: 13px; }
.button--block { width: 100%; }
.link-button {
  border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: inherit;
}
.comment__meta .link-button { color: var(--muted); }
button.danger { color: var(--danger); }
form.button_to { display: inline; }

/* Layout and navigation */
.main {
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.nav {
  position: fixed; z-index: 10; inset: auto 0 0 0;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(50px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.nav__logo, .nav__label { display: none; }
.nav__item {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 12px; border-radius: var(--radius); cursor: pointer; list-style: none;
}
.nav__item::-webkit-details-marker { display: none; }
.nav__item--current .icon { stroke-width: 2.6; }
.nav__item--current .nav__label { font-weight: 700; }
.nav__icon { position: relative; display: flex; }
.nav__dot {
  position: absolute; top: -1px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--like);
}
.nav__badge {
  position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--like); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.nav__item--wide { display: none; }
.nav__more { position: relative; display: none; }
.nav__more .menu { bottom: 54px; right: 0; }

.mobile-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: 54px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.mobile-header__icon { position: relative; display: flex; }
.mobile-header__icons { display: flex; gap: 20px; }

@media (min-width: 768px) {
  .main { padding: 0 0 0 72px; }
  .nav {
    inset: 0 auto 0 0; flex-direction: column; justify-content: flex-start; align-items: stretch;
    width: 72px; height: auto; padding: 24px 12px; gap: 6px;
    border-top: 0; border-right: 1px solid var(--border);
  }
  .nav__item:hover { background: var(--surface-2); }
  .nav__more { display: block; margin-top: auto; }
  .nav__item--wide { display: flex; }
  .nav__more .menu { bottom: 54px; left: 0; right: auto; }
  .mobile-header { display: none; }
}

@media (min-width: 1264px) {
  .main { padding-left: var(--nav-width); }
  .nav { width: var(--nav-width); }
  .nav__logo { display: block; padding: 12px 12px 28px; }
  .nav__label { display: inline; font-size: 16px; }
}

/* Menus (details/summary popovers) */
.menu {
  position: absolute; z-index: 20; min-width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 4px 24px rgb(0 0 0 / 0.15);
}
.menu > a, .menu button {
  display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px;
  background: none; text-align: left; cursor: pointer; font-size: 14px;
}
.menu > a:hover, .menu button:hover { background: var(--surface-2); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* Flash: slides in, waits, fades out once, then removes itself */
.flash {
  position: fixed; z-index: 30; left: 50%; bottom: 72px; translate: -50% 0;
  padding: 12px 20px; border-radius: var(--radius);
  background: #262626; color: #fff; box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
  animation: flash 4s ease forwards;
}
.flash--alert { background: var(--danger); }
@keyframes flash {
  0% { opacity: 0; transform: translateY(10px); }
  8%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* Avatars */
.avatar {
  --size: 32px;
  position: relative; display: inline-flex; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden;
}
.avatar__image { width: 100%; height: 100%; object-fit: cover; }
.avatar__initials {
  display: grid; place-items: center; width: 100%; height: 100%;
  background: hsl(var(--hue) 65% 55%); color: #fff;
  font-weight: 600; font-size: calc(var(--size) * 0.38);
}
.avatar--ring { padding: 4px; background: var(--brand); overflow: visible; }
.avatar--ring > * { border-radius: 50%; border: 3px solid var(--bg); overflow: hidden; }
.avatar--seen { padding: 2px; background: var(--border); }
.avatar--seen > * { border-width: 3px; }

/* Feed */
.feed-layout { display: flex; justify-content: center; gap: 64px; padding: 0 0 24px; }
.feed { width: 100%; max-width: 470px; }
@media (min-width: 768px) { .feed-layout { padding-top: 24px; } }
.feed__end { padding: 32px 0; text-align: center; color: var(--muted); }

.suggestions { display: none; width: 320px; padding-top: 12px; }
@media (min-width: 1160px) { .suggestions { display: block; } }
.suggestions__title { margin: 24px 0 8px; color: var(--muted); font-size: 14px; }
.suggestions__footer { margin-top: 32px; color: var(--muted); font-size: 12px; }

/* Posts */
.post { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 12px; }
.post__header { display: flex; align-items: center; gap: 6px; padding: 10px 12px; flex-wrap: wrap; }
@media (min-width: 768px) { .feed .post__header { padding-inline: 0; } }
.post__author { display: flex; align-items: center; gap: 10px; }
.post__location { flex-basis: 100%; margin: -6px 0 0 42px; font-size: 12px; }
.post__menu { position: relative; margin-left: auto; }
.post__menu summary { padding: 4px; }
.post__menu .menu { right: 0; top: 100%; }
.post__actions { display: flex; align-items: center; gap: 4px; padding: 4px 4px 0; }
.post__body { padding: 0 12px; display: grid; gap: 6px; }
@media (min-width: 768px) { .feed .post__body, .feed .post__actions { padding-inline: 0; } }
.post__caption { overflow-wrap: anywhere; }
.post__caption a, .comment__body a { font-weight: 600; }
.post__caption a.strong + span a, .comment__body p span a { color: var(--link); font-weight: 400; }
.post__comments-link { font-size: 14px; }
.post__date { padding: 0 12px 12px; font-size: 12px; text-transform: uppercase; }

.post--detail { max-width: 935px; margin: 0 auto; border: 0; }
.post__side { display: flex; flex-direction: column; }
.post__thread { display: grid; gap: 16px; padding: 12px; align-content: start; }
#comments { display: grid; gap: 16px; }
@media (min-width: 768px) {
  .post--detail {
    display: grid; grid-template-columns: minmax(0, 1fr) 400px;
    margin-top: 24px; border: 1px solid var(--border);
  }
  .post--detail .post__media { background: #000; display: grid; align-items: center; }
  .post--detail .post__header { border-bottom: 1px solid var(--border); padding: 14px 16px; }
  .post__side { max-height: min(90vh, 800px); }
  .post__thread { flex: 1; overflow-y: auto; padding: 16px; }
  .post--detail .post__actions { border-top: 1px solid var(--border); }
}

/* Carousel: native scroll snapping, no autoplay */
.carousel { position: relative; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; }
/* In the feed the photo sits in a rounded frame; on phones it keeps a thin gap from the screen edge */
.feed .carousel { margin-inline: 6px; border-radius: 4px; border: 1px solid var(--border); }
@media (min-width: 768px) { .feed .carousel { margin-inline: 0; } }
.carousel__track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: var(--aspect, 1); touch-action: pan-x pan-y;
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__photo { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: center; }
.carousel__arrow {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 28px; height: 28px; padding: 0 0 3px; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / 0.85); color: #262626; font-size: 22px; line-height: 1; cursor: pointer;
  display: none;
}
.carousel__arrow[hidden] { display: none !important; }
@media (hover: hover) { .carousel__arrow { display: block; } }
.carousel__arrow--prev { left: 10px; }
.carousel__arrow--next { right: 10px; }
.carousel__count {
  position: absolute; top: 12px; right: 12px; padding: 3px 9px; border-radius: 12px;
  background: rgb(26 26 26 / 0.75); color: #fff; font-size: 12px;
}
.carousel__dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; }
.carousel__dot { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / 0.5); }
.carousel__dot--current { background: #fff; }

/* The double-tap heart: pops once and disappears */
.burst {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0;
}
.burst .icon { width: 96px; height: 96px; fill: #fff; stroke: none; filter: drop-shadow(0 2px 12px rgb(0 0 0 / 0.3)); }
.burst--play { animation: burst 0.9s ease-out 1; }
@keyframes burst {
  0% { opacity: 0; transform: scale(0.2); }
  15% { opacity: 1; transform: scale(1.15); }
  30% { transform: scale(0.95); }
  45%, 70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1) translateY(-30px); }
}

/* Likes */
.like { display: inline-flex; align-items: center; }
.post__actions .like { gap: 4px; }
.post__actions .like__count { order: 2; }
.like__form { display: inline; }
.like__button--liked .icon { fill: var(--like); stroke: var(--like); animation: like-pop 0.35s ease 1; }
@keyframes like-pop { 50% { transform: scale(1.25); } }
.like--small { flex-direction: column; margin-left: auto; align-self: start; }
.like--small .icon { width: 13px; height: 13px; }
.like--small .icon-button { padding: 6px 4px 2px; }
.like--small .like__count { font-size: 11px; color: var(--muted); }
.post__actions .like { order: 0; }

/* Comments */
.comment { display: flex; gap: 12px; align-items: flex-start; }
.comment__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment__meta { font-size: 12px; display: inline-flex; gap: 4px; margin-top: 4px; }
.comment-form {
  display: flex; gap: 8px; align-items: center; padding: 12px; border-top: 1px solid var(--border);
}
.comment-form input[type="text"] { flex: 1; border: 0; background: none; outline: none; padding: 4px 0; }

/* Grids (profile, explore) */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.tile { position: relative; aspect-ratio: 1; background: var(--surface-2); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover img { filter: var(--photo-filter, ) brightness(0.8); }
.tile__multiple { position: absolute; top: 6px; right: 8px; color: #fff; font-size: 18px; text-shadow: 0 1px 3px rgb(0 0 0 / 0.5); }

/* Profile */
.profile { max-width: 935px; margin: 0 auto; }
.profile__header { display: grid; grid-template-columns: auto 1fr; gap: 20px 28px; align-items: center; padding: 16px; }
.profile__header > .avatar { --size: 86px !important; }
@media (min-width: 768px) {
  .profile { padding-top: 30px; }
  .profile__header { gap: 30px 80px; padding: 0 20px 44px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
  .profile__header > .avatar { --size: 150px !important; margin-left: 40px; }
}
.profile__top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.profile__username { font-size: 20px; font-weight: 400; margin-right: 8px; }
.profile__stats { display: flex; gap: 28px; padding: 0; margin: 16px 0; list-style: none; font-size: 15px; }
.profile__bio p { margin-top: 2px; white-space: pre-line; }
@media (max-width: 767px) {
  .profile__header { grid-template-columns: auto 1fr; }
  .profile__bio { grid-column: 1 / -1; }
  .profile__stats { gap: 16px; font-size: 14px; }
}

/* Empty states */
.empty { display: grid; justify-items: center; gap: 12px; padding: 60px 24px; text-align: center; }
.empty h2 { font-size: 24px; font-weight: 800; }
.empty__icon { width: 62px; height: 62px; padding: 12px; border: 2px solid currentColor; border-radius: 50%; stroke-width: 1.2; margin: 0 auto; }

/* Panels (forms, lists) */
.panel { max-width: 600px; margin: 0 auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
@media (min-width: 768px) { .panel { padding-top: 36px; } }
.panel__title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.back { font-size: 30px; line-height: 1; font-weight: 300; }
.section-title { margin: 16px 0 4px; font-size: 16px; font-weight: 600; }

.person-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.person-row__link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.person-row__actions { display: flex; gap: 8px; }

.notification { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.notification__text { flex: 1; overflow-wrap: anywhere; }
.notification__thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.notification--unread { background: color-mix(in srgb, var(--accent) 8%, transparent); margin-inline: -8px; padding-inline: 8px; border-radius: var(--radius); }

/* Forms */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); outline: none;
}
input:focus, textarea:focus { border-color: var(--muted); }
textarea { resize: vertical; }
.errors { padding: 10px 12px; border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.stacked-form { display: grid; gap: 8px; }
.stacked-form label { font-weight: 600; margin-top: 8px; }
.stacked-form .button { justify-self: start; margin-top: 12px; padding-inline: 32px; }
.avatar-field { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 16px; background: var(--surface-2); }
.avatar-field label { margin: 0; cursor: pointer; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }
.setting__title { font-size: 16px; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }

.post-form { display: grid; gap: 12px; }
.post-form > * { min-width: 0; }
.dropzone {
  display: grid; justify-items: center; gap: 12px; padding: 48px 16px;
  border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone__icon { width: 56px; height: 56px; stroke-width: 1.2; }
.dropzone__text { font-size: 18px; }
.dropzone--filled { padding: 16px; }
.dropzone--filled .dropzone__icon { display: none; }
.dropzone--filled .dropzone__text::after { content: " (tap to change)"; color: var(--muted); font-size: 14px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 4px; }
.previews:empty { display: none; }
.previews :is(img, video) { aspect-ratio: 1; width: 100%; object-fit: cover; border-radius: 4px; }

/* Photo filters: a post's container sets --photo-filter and its photos pick it up */
.photo-filter--vivid           { --photo-filter: saturate(1.6) contrast(1.1); }
.photo-filter--warm            { --photo-filter: sepia(0.3) saturate(1.3) brightness(1.03); }
.photo-filter--cool            { --photo-filter: hue-rotate(-12deg) saturate(0.85) brightness(1.05) contrast(1.05); }
.photo-filter--fade            { --photo-filter: contrast(0.8) brightness(1.12) saturate(0.7); }
.photo-filter--sepia           { --photo-filter: sepia(1); }
.photo-filter--ole_timey       { --photo-filter: sepia(0.9) contrast(1.25) brightness(0.9) saturate(0.8); }
.photo-filter--black_and_white { --photo-filter: grayscale(1); }
.photo-filter--noir            { --photo-filter: grayscale(1) contrast(1.5) brightness(0.9); }
:is(.carousel__photo, .tile img, .previews img, .filters__sample img) { filter: var(--photo-filter, none); }
/* Ole timey also darkens the corners, like an old print */
.photo-filter--ole_timey:is(.carousel, .tile)::before,
.photo-filter--ole_timey .filters__sample::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 min(25%, 120px) rgb(30 15 0 / 0.65);
}

.filters { display: flex; gap: 10px; min-width: 0; margin: 0; padding: 4px 4px 8px; border: 0; overflow-x: auto; scrollbar-width: thin; }
.filters__option { position: relative; flex: 0 0 76px; display: grid; gap: 6px; justify-items: center; cursor: pointer; font-size: 12px; text-align: center; color: var(--muted); }
.filters__sample { position: relative; width: 76px; height: 76px; border-radius: 6px; overflow: hidden; background: var(--surface-2); outline: 2px solid transparent; outline-offset: 2px; }
.filters__sample img { width: 100%; height: 100%; object-fit: cover; }
.filters__option:has(:checked) { color: var(--text); font-weight: 600; }
.filters__option:has(:checked) .filters__sample { outline-color: var(--accent); }
.filters__option:has(:focus-visible) .filters__sample { outline-color: var(--link); }

.invite { display: flex; gap: 8px; align-items: center; }
.invite input { flex: 1; font-size: 13px; }

/* Explore */
.explore { max-width: 935px; margin: 0 auto; padding: 12px; display: grid; gap: 8px; }
@media (min-width: 768px) { .explore { padding-top: 32px; } }
.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--muted); }
.search input { padding-left: 38px; }

/* Auth pages */
.auth { display: grid; place-content: center; gap: 12px; min-height: 100vh; padding: 16px; }
.auth__card {
  width: min(350px, 100vw - 32px); display: grid; gap: 14px; padding: 28px 32px;
}
@media (min-width: 450px) { .auth__card { border: 1px solid var(--border); } }
.auth__card h1:not(.logotype) { font-size: 16px; }
.auth__card a { color: var(--link); }
.auth__form { display: grid; gap: 8px; }
.auth__form input:not([type="submit"]) { padding: 9px 10px; font-size: 13px; background: var(--surface-2); }
.auth__form .button { margin-top: 8px; }
.auth__note { text-align: center; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .story__fill--current { animation-duration: 5s !important; }
}
.person-row .button { padding: 5px 12px; font-size: 13px; }
.account-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border); }

/* On phones the post header sits above the photo, like Instagram */
@media (max-width: 767px) {
  .post--detail { display: flex; flex-direction: column; }
  .post--detail .post__side { display: contents; }
  .post--detail .post__header { order: -1; }
  .post--detail .post__thread { order: 2; }
  .post--detail .post__date { order: 1; }
  .post--detail .comment-form { order: 3; }
}

/* Story tray */
.tray { display: flex; gap: 14px; padding: 12px; overflow-x: auto; scrollbar-width: none; margin-bottom: 8px; }
.tray::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .tray { padding-inline: 0; } }
.tray__item { display: grid; justify-items: center; gap: 4px; width: 70px; flex: none; }
.tray__item .avatar--ring, .tray__avatar { --size: 66px !important; }
.tray__avatar { position: relative; display: block; padding: 2px; }
.tray__add {
  position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; border: 2px solid var(--bg); font-weight: 700; line-height: 17px; text-align: center;
}
.tray__name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

/* Story viewer */
.fullscreen .main { padding: 0; }
.story { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #1a1a1a; color: #fff; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.story__frame { position: relative; width: min(100vw, calc(100dvh * 9 / 16)); height: 100dvh; background: #000; overflow: hidden; }
@media (min-width: 768px) { .story__frame { height: calc(100dvh - 32px); width: min(100vw, calc((100dvh - 32px) * 9 / 16)); border-radius: 8px; } }
.story__photo { width: 100%; height: 100%; object-fit: contain; }
.story__progress { position: absolute; z-index: 3; top: 8px; left: 8px; right: 8px; display: flex; gap: 3px; }
.story__bar { flex: 1; height: 2px; border-radius: 1px; background: rgb(255 255 255 / 0.35); overflow: hidden; }
.story__fill { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left; transform: scaleX(0); }
.story__fill--done { transform: none; }
.story__fill--current { animation: story-progress 5s linear 1 forwards; }
@keyframes story-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.story__header { position: absolute; z-index: 3; top: 18px; left: 12px; right: 8px; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 2px rgb(0 0 0 / 0.5); }
.story__time { opacity: 0.8; }
.story__sound { margin-left: auto; padding: 6px; display: flex; background: none; border: 0; color: inherit; cursor: pointer; }
.story__sound + .story__close { margin-left: 0; }
.story__sound--muted .story__sound-on, .story__sound:not(.story__sound--muted) .story__sound-off { display: none; }
.story__close { margin-left: auto; padding: 6px; display: flex; }
.story__caption {
  position: absolute; z-index: 1; left: 16px; right: 16px; bottom: 90px; text-align: center; font-size: 20px; font-weight: 600;
  text-shadow: 0 1px 6px rgb(0 0 0 / 0.6); overflow-wrap: anywhere;
}
.story__tap { position: absolute; z-index: 2; top: 60px; bottom: 70px; font-size: 0; }
.story__tap--prev { left: 0; width: 33%; }
.story__tap--next { right: 0; width: 67%; }
.story__footer { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.story__seen { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.story__delete { margin-left: auto; background: none; border: 0; color: #fff; cursor: pointer; font-weight: 600; }
.story__reply { flex: 1; display: flex; align-items: center; gap: 8px; }
.story__reply input[type="text"] { flex: 1; border-radius: 22px; border: 1px solid rgb(255 255 255 / 0.6); background: transparent; color: #fff; padding: 10px 16px; }
.story__reply input::placeholder { color: rgb(255 255 255 / 0.8); }
.story__reply .icon-button { color: #fff; }
.previews--story { grid-template-columns: minmax(0, 200px); }
.previews--story :is(img, video) { aspect-ratio: 9 / 16; background: #000; }

/* Saved and profile tabs */
.bookmark { margin-left: auto; }
.bookmark__button--saved .icon { fill: currentColor; }
.profile__tabs { display: flex; justify-content: center; gap: 60px; border-top: 1px solid var(--border); }
@media (min-width: 768px) { .profile__tabs { border-top: 0; margin-top: -5px; } }
.profile__tab { display: flex; align-items: center; gap: 6px; padding: 14px 0; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; border-top: 1px solid transparent; }
.profile__tab .icon { width: 14px; height: 14px; }
.profile__tab--current { color: var(--text); border-top-color: var(--text); }
.profile__saved-title { padding: 16px; }

/* Hashtags */
.tag-header { display: flex; align-items: center; gap: 24px; padding: 16px 8px 24px; }
.tag-header__icon, .tag-avatar {
  display: grid; place-items: center; flex: none; border-radius: 50%; border: 1px solid var(--border); font-weight: 300;
}
.tag-header__icon { width: 96px; height: 96px; font-size: 48px; }
.tag-avatar { width: 44px; height: 44px; font-size: 22px; }
.tag-header__name { font-size: 24px; font-weight: 400; margin-bottom: 4px; }

/* Messages */
.panel__action { margin-left: auto; }
.avatar-stack { display: flex; flex: none; }
.avatar-stack .avatar + .avatar { margin-left: -18px; border: 2px solid var(--bg); }
.conversation-row__text { display: grid; flex: 1; min-width: 0; }
.conversation-row__text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.recipient { cursor: pointer; }
.recipient__check { width: 22px; height: 22px; accent-color: var(--accent); }
.recipients { display: grid; gap: 4px; }
.recipients .button { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); margin-top: 12px; }
@media (min-width: 768px) { .recipients .button { bottom: 16px; } }

.chat { display: flex; flex-direction: column; max-width: 700px; margin: 0 auto; height: calc(100dvh - 56px - env(safe-area-inset-bottom)); }
@media (min-width: 768px) { .chat { height: 100dvh; border-inline: 1px solid var(--border); } }
.chat__header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.chat__scroller { flex: 1; display: flex; flex-direction: column-reverse; overflow-y: auto; }
.chat__messages { display: grid; gap: 6px; padding: 16px; }
.message { display: flex; align-items: flex-end; gap: 8px; max-width: 80%; }
.message--mine { justify-self: end; flex-direction: row-reverse; }
.message__bubble { padding: 8px 14px; border-radius: 20px; background: var(--surface-2); overflow-wrap: anywhere; }
.message--mine .message__bubble { background: #3797f0; color: #fff; }

.message__unsend { font-size: 12px; color: var(--muted); opacity: 0; }
.message:hover .message__unsend, .message__unsend:focus { opacity: 1; }
@media (hover: none) { .message__unsend { opacity: 1; } }
.chat__form { display: flex; gap: 8px; align-items: center; margin: 12px 16px; padding: 4px 16px; border: 1px solid var(--border); border-radius: 22px; }
.chat__form input[type="text"] { flex: 1; border: 0; background: none; padding: 8px 0; }
.message__bubble a { color: var(--link); }
.message--mine .message__bubble a { color: #fff; text-decoration: underline; }

/* Story likes */
.like--story .icon-button { color: #fff; padding: 6px; }
.like--story .icon { width: 28px; height: 28px; }
.story__likes { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
.story__likes .icon, .viewer__liked .icon { width: 16px; height: 16px; fill: var(--like); stroke: var(--like); }
