:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #8e8e8e;
  --line: #dbdbdb;
  --blue: #0095f6;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { min-height: 100vh; }
a, button, input { font: inherit; color: inherit; }
a { text-decoration: none; }
button { border: 0; background: transparent; cursor: pointer; padding: 0; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.is-hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.brand { font: 500 34px/1 "Segoe Script", "Brush Script MT", cursive; letter-spacing: -0.3px; }
.desktop-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 245px; padding: 36px 12px 20px;
  border-right: 1px solid #dbdbdb; background: #fff; display: flex; flex-direction: column;
}
.brand-desktop { margin: 4px 0 38px 12px; }
.side-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  width: 100%; height: 49px; padding: 11px 12px; border-radius: 8px; display: flex; align-items: center; gap: 16px;
  position: relative; font-size: 16px;
}
.nav-item:hover { background: #f3f3f3; }
.nav-item.active { font-weight: 700; }
.nav-item svg { width: 25px; height: 25px; flex: 0 0 25px; }
.nav-item.active svg:first-child,
.mobile-bottom-nav a.active svg { fill: currentColor; }
.nav-item .badge {
  margin-left: auto; background: #ff3040; color: #fff; border-radius: 999px; min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.nav-item.more { margin-top: auto; }
.mini-avatar {
  width: 25px; height: 25px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.profile-avatar { background: linear-gradient(135deg, #2b2928, #a27f6b); border: 1.5px solid #111; }

.mobile-header { display: none; }
.main-layout {
  margin-left: 245px; min-height: 100vh; display: grid; grid-template-columns: minmax(470px, 630px) 320px;
  gap: 52px; justify-content: center; padding: 26px 28px 80px;
}
.feed-column { width: 100%; max-width: 630px; }
.stories {
  height: 111px; display: flex; align-items: flex-start; gap: 14px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; padding: 6px 4px 0;
}
.stories::-webkit-scrollbar { display: none; }
.story { width: 76px; flex: 0 0 76px; position: relative; text-align: center; font-size: 12px; color: #262626; }
.story-ring {
  width: 66px; height: 66px; margin: 0 auto 5px; padding: 2.5px; border-radius: 50%;
  background: conic-gradient(from 230deg, #ffd600, #ff3040, #d300c5, #7638fa, #ffd600);
}
.story-avatar {
  width: 61px; height: 61px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 17px;
}
.story-a { background: linear-gradient(135deg,#d7b3a2,#513e37); }
.story-b { background: linear-gradient(150deg,#9ec7e8,#405f85); }
.story-c { background: linear-gradient(150deg,#f1e8dc,#8a6a45); }
.story-d { background: linear-gradient(150deg,#c6b2a6,#3b2930); }
.story-e { background: linear-gradient(150deg,#d9bb8a,#614830); }
.story-f { background: linear-gradient(150deg,#8c9f8d,#2f4134); }
.story span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-story .story-ring { background: #efefef; }
.my-story b {
  position: absolute; top: 45px; right: 7px; width: 19px; height: 19px; display: grid; place-items: center;
  border-radius: 50%; background: var(--blue); color: white; border: 2px solid white; font: 700 14px/1 Arial;
}

.post-card { width: 100%; max-width: 500px; margin: 0 auto 28px; border-bottom: 1px solid var(--line); }
.post-header { height: 52px; display: flex; align-items: center; justify-content: space-between; }
.post-user { display: flex; align-items: center; gap: 10px; }
.avatar-ring-small {
  width: 34px; height: 34px; padding: 2px; border-radius: 50%;
  background: conic-gradient(from 230deg,#ffd600,#ff3040,#d300c5,#7638fa,#ffd600);
}
.post-avatar {
  width: 30px; height: 30px; border: 2px solid #fff; border-radius: 50%; background: linear-gradient(135deg,#d7b3a2,#513e37);
  color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800;
}
.post-user-text { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.post-user-text strong { font-size: 14px; }
.post-user-text span { font-size: 12px; color: #505050; }
.more-button { font-size: 16px; letter-spacing: 1px; padding: 12px 5px; }
.post-media-wrap { width: 100%; aspect-ratio: 4 / 3; position: relative; overflow: hidden; background: #eee; }
.post-media { width: 100%; height: 100%; object-fit: cover; object-position: 52% 50%; display: block; }
.heart-burst {
  position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.96); font-size: 100px;
  opacity: 0; transform: scale(.35); text-shadow: 0 3px 20px rgba(0,0,0,.18); pointer-events: none;
}
.heart-burst.show { animation: heartPop .75s ease; }
@keyframes heartPop { 0%{opacity:0;transform:scale(.3)} 25%{opacity:1;transform:scale(1.08)} 65%{opacity:1;transform:scale(.95)} 100%{opacity:0;transform:scale(1.2)} }
.post-body { padding: 9px 0 18px; }
.post-actions { display: flex; align-items: center; justify-content: space-between; height: 34px; margin-bottom: 5px; }
.post-actions-left { display: flex; gap: 14px; align-items: center; }
.action-button { width: 25px; height: 25px; display: grid; place-items: center; }
.action-button svg { width: 25px; height: 25px; stroke-width: 2; }
.action-button:hover { color: #777; }
#likeButton .heart-filled { display: none; fill: #ff3040; stroke: #ff3040; }
#likeButton.liked .heart-outline { display: none; }
#likeButton.liked .heart-filled { display: block; }
#saveButton.saved svg { fill: #111; }
.likes { font-size: 14px; margin: 7px 0; }
.caption { font-size: 14px; line-height: 1.45; }
.caption strong, .comment strong { margin-right: 5px; }
.view-comments { margin-top: 7px; color: var(--muted); font-size: 14px; }
.comment { margin-top: 7px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; font-size: 14px; line-height: 1.35; }
.comment > button { color: #888; font-size: 18px; line-height: 1; }
.timestamp { margin-top: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.comment-form { display: flex; align-items: center; gap: 9px; min-height: 42px; margin-top: 8px; }
.comment-form .emoji { font-size: 20px; }
.comment-form input { border: 0; outline: 0; flex: 1; min-width: 0; font-size: 14px; background: transparent; }
.comment-form input::placeholder { color: #9c9c9c; }
.comment-form button { color: var(--blue); font-size: 13px; font-weight: 700; opacity: .45; }
.comment-form.ready button { opacity: 1; }

.desktop-rightbar { padding-top: 28px; width: 320px; }
.right-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 11px; align-items: center; margin-bottom: 14px; }
.suggest-row { grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
.right-profile {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  color: #fff; font-weight: 800; background: linear-gradient(135deg,#c5ad9f,#5b4540);
}
.right-profile.large { width: 46px; height: 46px; }
.right-profile.p1 { background: linear-gradient(135deg,#a9c9e7,#415c79); }
.right-profile.p2 { background: linear-gradient(135deg,#e0bea1,#70513c); }
.suggest-card { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 11px; align-items: center; text-align: left; min-width: 0; }
.suggest-copy { min-width: 0; display: flex; flex-direction: column; }
.suggest-card:hover .suggest-copy strong { text-decoration: underline; }
.right-row strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right-row span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.right-row button, .suggest-title button { color: var(--blue); font-size: 12px; font-weight: 700; }
.profile-view-button { white-space: nowrap; padding: 6px 0 6px 8px; }
.profile-view-button:hover { color: #1877d2; text-decoration: underline; }
.suggest-title { display: flex; justify-content: space-between; margin: 22px 0 15px; font-size: 13px; color: var(--muted); }
.suggest-title button { color: #111; }
.footer-copy { color: #c7c7c7; font-size: 11px; line-height: 1.45; margin-top: 26px; max-width: 285px; }
.mobile-bottom-nav { display: none; }

.dm-view {
  margin-left: 245px; min-height: 100vh; display: grid; grid-template-columns: 380px minmax(420px, 1fr);
  background: #fff;
}
.dm-threads-panel { border-right: 1px solid #dbdbdb; min-height: 100vh; padding-top: 18px; }
.dm-panel-header { padding: 20px 24px 18px; border-bottom: 1px solid #efefef; }
.dm-panel-header strong { display: block; font-size: 22px; }
.dm-panel-header span { color: var(--muted); font-size: 13px; display: block; margin-top: 5px; }
.dm-thread-list { padding: 10px 8px; }
.dm-thread {
  width: 100%; padding: 12px 16px; border-radius: 12px; display: grid; grid-template-columns: 58px minmax(0,1fr);
  gap: 14px; align-items: center; text-align: left;
}
.dm-thread:hover, .dm-thread.active { background: #f7f7f7; }
.dm-avatar {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px;
}
.dm-avatar-carj { background: linear-gradient(135deg,#dcb89e,#8d6243); }
.dm-avatar-corp { background: linear-gradient(135deg,#a2c6e5,#4d6e8f); }
.dm-thread-copy { min-width: 0; display: flex; flex-direction: column; }
.dm-thread-copy strong { font-size: 15px; }
.dm-thread-copy span { color: #6a6a6a; font-size: 14px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-chat-panel { min-height: 100vh; position: relative; background: #fff; }
.dm-chat-empty {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #7b7b7b; gap: 10px; text-align: center; padding: 20px;
}
.dm-chat-empty-icon {
  width: 78px; height: 78px; border-radius: 50%; border: 2px solid #2b2b2b; display: grid; place-items: center;
  color: #2b2b2b; font-size: 30px;
}
.dm-chat-empty strong { color: #111; font-size: 22px; }
.dm-chat-thread { min-height: 100vh; }
.dm-chat-topbar {
  height: 73px; padding: 0 24px; border-bottom: 1px solid #efefef; display: flex; align-items: center; gap: 16px;
}
.dm-chat-user { display: flex; align-items: center; gap: 12px; }
.dm-chat-user .dm-avatar { width: 38px; height: 38px; font-size: 14px; }
.dm-back-button { display: none; width: 34px; height: 34px; font-size: 24px; color: #111; }
.dm-chat-messages {
  max-width: 540px; padding: 28px 24px 50px; display: flex; flex-direction: column; gap: 12px;
}
.dm-bubble {
  width: fit-content; max-width: min(80%, 360px); padding: 11px 14px; border-radius: 18px; font-size: 15px; line-height: 1.4;
}
.dm-bubble.received { background: #efefef; color: #111; border-top-left-radius: 8px; }
.dm-bubble.positive { background: #eaf5ff; }

.profile-modal { position: fixed; inset: 0; z-index: 120; display: none; }
.profile-modal.open { display: block; }
.profile-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.56); backdrop-filter: blur(2px); }
.profile-modal-panel {
  position: relative; width: min(520px, calc(100vw - 36px)); max-height: calc(100vh - 48px); overflow: auto;
  margin: 24px auto; background: #fff; border: 1px solid #e8e8e8; border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.24); padding: 34px 30px 30px;
}
.profile-modal-close {
  position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border-radius: 50%; font-size: 26px; color: #333;
}
.profile-modal-close:hover { background: #f4f4f4; }
.profile-popup-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 26px; }
.profile-photo-placeholder {
  width: 150px; aspect-ratio: 1 / 1; border-radius: 50%; border: 1px solid #dedede; background: linear-gradient(135deg,#f5f5f5,#e8e8e8);
  display: grid; place-items: center; color: #a0a0a0; font-size: 18px; font-weight: 700; letter-spacing: .05em; box-shadow: inset 0 0 0 5px #fff;
}
.profile-username { margin: 14px 0 0; font-size: 21px; font-weight: 600; }
.profile-info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.profile-info-list div { min-height: 73px; border: 1px solid #e7e7e7; border-radius: 13px; padding: 13px 14px; background: #fafafa; }
.profile-info-list dt { color: #8a8a8a; font-size: 12px; margin-bottom: 8px; }
.profile-info-list dd { margin: 0; min-height: 20px; font-size: 15px; color: #262626; }
body.modal-open { overflow: hidden; }

@media (max-width: 1160px) {
  .desktop-sidebar { width: 74px; align-items: center; }
  .brand-desktop { font-size: 0; width: 30px; height: 30px; margin: 1px 0 38px; position: relative; }
  .brand-desktop::before { content: "◎"; font: 700 32px/1 Arial; }
  .nav-item { width: 50px; height: 50px; padding: 12px; justify-content: center; }
  .nav-item span:not(.badge):not(.mini-avatar) { display: none; }
  .nav-item .badge { position: absolute; right: 4px; top: 5px; }
  .main-layout, .dm-view { margin-left: 74px; }
}

@media (max-width: 965px) {
  .main-layout { grid-template-columns: minmax(470px, 630px); gap: 0; }
  .desktop-rightbar { display: none; }
  .dm-view { grid-template-columns: 330px minmax(320px, 1fr); }
}

@media (max-width: 767px) {
  body { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
  .desktop-sidebar { display: none; }
  .mobile-header {
    display: flex; position: sticky; top: 0; height: 55px; padding: 0 14px; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #efefef; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); z-index: 40;
  }
  .brand { font-size: 30px; }
  .mobile-header-actions { display: flex; gap: 15px; align-items: center; }
  .icon-button { width: 25px; height: 25px; position: relative; }
  .icon-button svg { width: 25px; height: 25px; stroke-width: 2; }
  .dot {
    position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #ff3040; right: -1px; top: 0; border: 1px solid #fff;
  }
  .mini-count {
    position: absolute; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #ff3040; color: #fff;
    font-size: 10px; font-weight: 700; display: grid; place-items: center; right: -6px; top: -5px;
  }
  .main-layout { display: block; margin-left: 0; padding: 0; min-height: auto; }
  .feed-column { max-width: none; }
  .stories { height: 104px; border-bottom: 1px solid #efefef; gap: 5px; padding: 10px 4px 0; }
  .story { width: 74px; flex-basis: 74px; }
  .story-ring { width: 63px; height: 63px; }
  .story-avatar { width: 58px; height: 58px; }
  .my-story b { top: 43px; right: 6px; }
  .post-card { max-width: none; width: 100%; margin-bottom: 0; border-bottom: 0; }
  .post-header { height: 53px; padding: 0 12px; }
  .post-media-wrap { aspect-ratio: 1 / 1; }
  .post-media { object-position: 52% 50%; }
  .post-body { padding: 9px 12px 19px; }
  .comment-form { display: none; }
  .mobile-bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; height: calc(50px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255,255,255,.98); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-around; z-index: 50;
  }
  .mobile-bottom-nav a { width: 48px; height: 48px; display: grid; place-items: center; }
  .mobile-bottom-nav svg { width: 25px; height: 25px; stroke-width: 2; }

  .dm-view { margin-left: 0; display: block; min-height: auto; }
  .dm-threads-panel { min-height: auto; padding-top: 0; border-right: 0; }
  .dm-panel-header { padding: 18px 16px 14px; }
  .dm-thread-list { padding: 8px; }
  .dm-chat-panel, .dm-chat-thread { min-height: calc(100vh - 106px); }
  .dm-chat-empty { min-height: calc(100vh - 106px); padding: 30px 20px; }
  .dm-chat-topbar { height: 60px; padding: 0 12px; }
  .dm-back-button { display: inline-grid; place-items: center; }
  #dmView.chat-open .dm-threads-panel { display: none; }
  #dmView:not(.chat-open) .dm-chat-panel { display: none; }
  .dm-chat-messages { padding: 20px 14px 90px; gap: 10px; }

  .profile-modal-panel {
    width: min(100vw - 20px, 520px); max-height: calc(100vh - 20px); margin: 10px auto; border-radius: 18px; padding: 28px 16px 22px;
  }
  .profile-photo-placeholder { width: 118px; }
  .profile-username { font-size: 19px; }
  .profile-popup-head { padding-bottom: 22px; }
  .profile-info-list { grid-template-columns: 1fr; gap: 9px; }
  .profile-info-list div { min-height: 65px; }
}

@media (max-width: 360px) {
  .stories { gap: 0; }
  .story { width: 68px; flex-basis: 68px; }
  .story-ring { width: 60px; height: 60px; }
  .story-avatar { width: 55px; height: 55px; }
  .brand { font-size: 28px; }
}
