/* ============================================================
   SocialTrend — design system
   Light + dark themes, responsive app shell, component library
   ============================================================ */
:root {
  --brand: #4361ee;
  --brand-dark: #3a0ca3;
  --brand-soft: rgba(67, 97, 238, .12);
  --accent: #4cc9f0;
  --pink: #f72585;
  --success: #14ae5c;
  --warning: #f5a524;
  --danger: #ef4444;

  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eceef1;
  --text: #14161a;
  --text-2: #5b6472;
  --text-3: #8b93a1;
  --border: #e3e6ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --topbar-h: 60px;
  --sidebar-w: 264px;
  --rail-w: 300px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
}

html[data-theme='dark'] {
  --bg: #0f1115;
  --surface: #181b21;
  --surface-2: #1f232b;
  --surface-3: #272c36;
  --text: #eef1f6;
  --text-2: #a3adbb;
  --text-3: #737d8c;
  --border: #2a2f39;
  --brand-soft: rgba(76, 201, 240, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .34);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------------------------------------------------- utilities */
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 600; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.gap-sm { gap: 6px; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--surface-3); border-top-color: var(--brand);
  animation: spin .7s linear infinite; margin: 20px auto;
}
.spinner.lg { width: 34px; height: 34px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .25s ease both; }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-3); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: filter .15s, background .15s, transform .06s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); filter: none; }
.btn-accent { background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--text);
  display: inline-grid; place-items: center; cursor: pointer; position: relative;
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.active { background: var(--brand-soft); color: var(--brand); }

/* ---------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: border-color .15s, background .15s;
}
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.textarea { resize: vertical; min-height: 90px; }
.input-group { position: relative; }
.input-group .input { padding-left: 40px; }
.input-group > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.hint { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--danger); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 44px; height: 25px; border-radius: 999px; background: var(--surface-3);
  position: relative; transition: background .18s; flex: none;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(19px); }

/* ---------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }
.card-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-size: 16px; font-weight: 700; }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.empty { text-align: center; padding: 34px 18px; color: var(--text-2); }
.empty i { font-size: 30px; color: var(--text-3); margin-bottom: 10px; display: block; }

/* ---------------------------------------------------------- avatars */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--surface-3); display: inline-grid; place-items: center;
  font-weight: 700; color: #fff; overflow: hidden; font-size: 15px;
}
.avatar.xs { width: 28px; height: 28px; font-size: 11px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.xl { width: 92px; height: 92px; font-size: 32px; }
.avatar.xxl { width: 150px; height: 150px; font-size: 48px; border: 4px solid var(--surface); }
.avatar-wrap { position: relative; flex: none; }
.presence {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-3); border: 2.5px solid var(--surface);
}
.presence.on { background: var(--success); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.icon-btn .badge { position: absolute; top: -2px; right: -2px; border: 2px solid var(--surface); height: 19px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.verified { color: var(--brand); font-size: 13px; }

/* ---------------------------------------------------------- app shell */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 50;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 17px;
}
.brand span { background: linear-gradient(135deg, var(--brand), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search-wrap { position: relative; max-width: 340px; flex: 1; }
.search-wrap .input { padding-left: 38px; border-radius: 999px; }
.search-wrap > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 360px; overflow-y: auto;
}
.search-results a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text); }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.topbar-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.topbar-nav .nav-link {
  width: 46px; height: 42px; border-radius: var(--radius-sm); display: grid; place-items: center;
  color: var(--text-2); font-size: 18px; position: relative;
}
.topbar-nav .nav-link:hover { background: var(--surface-2); text-decoration: none; }
.topbar-nav .nav-link.active { color: var(--brand); background: var(--brand-soft); }
.topbar-nav .nav-link .badge { position: absolute; top: 2px; right: 4px; }

.layout {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  gap: 20px; max-width: 1360px; margin: 0 auto; padding: calc(var(--topbar-h) + 18px) 16px 40px;
  align-items: start;
}
.layout.two-col { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.layout.one-col { grid-template-columns: minmax(0, 1fr); max-width: 820px; }
.layout.full { grid-template-columns: minmax(0, 1fr); max-width: 1360px; }
.sidebar, .rail { position: sticky; top: calc(var(--topbar-h) + 18px); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--text); font-weight: 600; font-size: 14.5px;
}
.sidebar-nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar-nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar-nav a i { width: 22px; text-align: center; font-size: 16px; }
.sidebar-nav a .badge { margin-left: auto; }
.me-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin-bottom: 12px; }

/* ---------------------------------------------------------- composer */
.composer { padding: 14px 16px; }
.composer textarea {
  width: 100%; border: 0; background: transparent; resize: none; min-height: 52px;
  font-size: 16.5px; outline: none; color: var(--text);
}
.composer textarea::placeholder { color: var(--text-3); }
.composer-actions { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; flex-wrap: wrap; }
.composer-action {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
  font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.composer-action:hover { background: var(--surface-2); }
.composer-action i { font-size: 15px; }
.media-preview { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.media-preview .thumb { position: relative; width: 92px; height: 92px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-3); }
.media-preview .thumb img, .media-preview .thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-preview .thumb button {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 11px;
}

/* ---------------------------------------------------------- posts */
.post { margin-bottom: 16px; }
.post-head { display: flex; align-items: flex-start; gap: 11px; padding: 14px 16px 0; }
.post-meta { min-width: 0; flex: 1; }
.post-author { font-weight: 700; color: var(--text); }
.post-author:hover { text-decoration: underline; }
.post-sub { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.post-body { padding: 10px 16px 0; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.post-body.big { font-size: 20px; font-weight: 500; }
.post-media { margin-top: 12px; display: grid; gap: 3px; background: var(--surface-3); }
.post-media.n1 { grid-template-columns: 1fr; }
.post-media.n2 { grid-template-columns: 1fr 1fr; }
.post-media.n3 { grid-template-columns: 1fr 1fr; }
.post-media.n3 > *:first-child { grid-column: span 2; }
.post-media.n4 { grid-template-columns: 1fr 1fr; }
.post-media img, .post-media video { width: 100%; max-height: 520px; object-fit: cover; cursor: zoom-in; }
.post-stats { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; font-size: 13px; color: var(--text-2); }
.reaction-pills { display: inline-flex; align-items: center; }
.reaction-pills span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--surface-2); border: 1.5px solid var(--surface); margin-left: -5px; }
.post-actions { display: flex; border-top: 1px solid var(--border); padding: 5px 8px; }
.post-action {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; background: transparent; padding: 9px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.post-action:hover { background: var(--surface-2); }
.post-action.liked { color: var(--brand); }
.post-action.saved { color: var(--warning); }
.shared-post { margin: 12px 16px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.shared-post .post-head { padding: 12px 12px 0; }
.shared-post .post-body { padding: 8px 12px 12px; }
.hashtag { color: var(--brand); font-weight: 600; }
.mention { color: var(--brand); font-weight: 600; }

/* comments */
.comments { padding: 6px 16px 14px; border-top: 1px solid var(--border); }
.comment { display: flex; gap: 9px; padding: 8px 0; }
.comment-bubble { background: var(--surface-2); border-radius: 16px; padding: 8px 13px; display: inline-block; max-width: 100%; }
.comment-bubble .name { font-weight: 700; font-size: 13.5px; }
.comment-bubble .text { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.comment-tools { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); padding: 3px 12px; }
.comment-tools button { border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; font-size: 12px; }
.comment-tools button:hover { text-decoration: underline; }
.comment-form { display: flex; gap: 9px; align-items: center; padding-top: 8px; }
.comment-form input {
  flex: 1; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 999px; padding: 9px 14px; outline: none;
}
.comment-form input:focus { border-color: var(--brand); }
.replies { margin-left: 43px; }

/* reaction picker */
.reaction-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0; display: flex; gap: 4px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-lg); z-index: 20;
}
.reaction-picker button { border: 0; background: none; font-size: 22px; cursor: pointer; transition: transform .12s; line-height: 1; padding: 2px; }
.reaction-picker button:hover { transform: scale(1.32) translateY(-3px); }

/* ---------------------------------------------------------- stories */
.stories { display: flex; gap: 10px; overflow-x: auto; padding: 14px; scrollbar-width: none; }
.stories::-webkit-scrollbar { display: none; }
.story-card {
  flex: none; width: 108px; height: 178px; border-radius: var(--radius); overflow: hidden;
  position: relative; cursor: pointer; background: linear-gradient(160deg, var(--brand), var(--brand-dark)); color: #fff;
  border: 0; padding: 0; text-align: left;
}
.story-card img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.story-card .overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.72), transparent 55%); }
.story-card .who { position: absolute; bottom: 8px; left: 8px; right: 8px; font-size: 12px; font-weight: 700; z-index: 2; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.story-card .ring { position: absolute; top: 8px; left: 8px; z-index: 2; border-radius: 50%; padding: 2px; background: var(--accent); }
.story-card .ring.seen { background: rgba(255,255,255,.5); }
.story-card.add { background: var(--surface); border: 1px solid var(--border); color: var(--text); display: grid; place-items: center; }
.story-card.add .plus { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 16px; margin: 0 auto 8px; }
.story-viewer { position: fixed; inset: 0; background: #000; z-index: 200; display: grid; place-items: center; }
.story-viewer .stage { width: min(440px, 100vw); height: min(100vh, 820px); position: relative; display: grid; place-items: center; padding: 24px; }
.story-viewer .story-content { width: 100%; height: 100%; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 600; text-align: center; padding: 28px; overflow: hidden; }
.story-viewer .bars { position: absolute; top: 10px; left: 24px; right: 24px; display: flex; gap: 4px; z-index: 3; }
.story-viewer .bars i { flex: 1; height: 3px; background: rgba(255,255,255,.32); border-radius: 3px; overflow: hidden; }
.story-viewer .bars i.done { background: #fff; }
.story-viewer .bars i.active::after { content: ''; display: block; height: 100%; background: #fff; animation: storyFill 5s linear forwards; }
@keyframes storyFill { from { width: 0; } to { width: 100%; } }
.story-viewer .head { position: absolute; top: 24px; left: 24px; right: 24px; display: flex; align-items: center; gap: 10px; color: #fff; z-index: 3; }
.story-viewer .nav { position: absolute; top: 0; bottom: 0; width: 32%; background: none; border: 0; cursor: pointer; z-index: 2; }
.story-viewer .nav.prev { left: 0; } .story-viewer .nav.next { right: 0; }

/* ---------------------------------------------------------- profile */
.profile-header { overflow: hidden; }
.cover { height: 280px; background: linear-gradient(135deg, var(--brand), var(--accent)); position: relative; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .cover-btn { position: absolute; right: 14px; bottom: 14px; }
.profile-bar { padding: 0 22px 16px; display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.profile-bar .avatar-wrap { margin-top: -56px; }
.profile-identity { flex: 1; min-width: 200px; padding-bottom: 4px; }
.profile-identity h1 { font-size: 26px; display: flex; align-items: center; gap: 8px; }
.profile-stats { display: flex; gap: 20px; padding: 0 22px 12px; color: var(--text-2); font-size: 14px; flex-wrap: wrap; }
.profile-stats b { color: var(--text); }
.tabs { display: flex; gap: 4px; border-top: 1px solid var(--border); padding: 6px 14px; overflow-x: auto; }
.tab {
  padding: 10px 16px; border: 0; background: none; font-weight: 700; color: var(--text-2);
  cursor: pointer; border-radius: var(--radius-sm); white-space: nowrap; font-size: 14.5px;
}
.tab:hover { background: var(--surface-2); }
.tab.active { color: var(--brand); background: var(--brand-soft); }
.info-list { display: flex; flex-direction: column; gap: 11px; }
.info-list div { display: flex; gap: 11px; align-items: flex-start; font-size: 14px; }
.info-list i { width: 18px; color: var(--text-3); margin-top: 3px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.photo-grid a { aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }

/* people cards */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.person { text-align: center; padding: 18px 14px; }
.person .avatar { margin: 0 auto 10px; }
.person .name { font-weight: 700; }
.user-row { display: flex; align-items: center; gap: 11px; padding: 9px 0; }

/* ---------------------------------------------------------- messenger */
.messenger { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 28px); overflow: hidden; }
.messenger-page { padding-bottom: 14px !important; }
.thread-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.thread-list .head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.thread-scroll { overflow-y: auto; flex: 1; }
.thread {
  display: flex; gap: 11px; align-items: center; padding: 11px 14px; cursor: pointer;
  border-left: 3px solid transparent;
}
.thread:hover { background: var(--surface-2); }
.thread.active { background: var(--brand-soft); border-left-color: var(--brand); }
.thread .preview { font-size: 13px; color: var(--text-2); }
.thread.unread .preview, .thread.unread .tname { font-weight: 700; color: var(--text); }
.tname { font-weight: 600; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { padding: 11px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 11px; }
.chat-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 18px; display: flex; flex-direction: column; align-items: stretch;
  gap: 2px; background: var(--surface-2);
}
.msg-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; flex: 0 0 auto; }
.msg-row.mine { flex-direction: row-reverse; }
.bubble {
  max-width: min(70%, 520px); width: fit-content; min-width: 0;
  padding: 8px 13px; border-radius: 18px; position: relative;
  background: var(--surface); border: 1px solid var(--border);
}
/* Only the message text preserves newlines — keeping pre-wrap on .bubble would
   render the markup's own indentation as blank lines. */
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.bubble .attach img, .bubble .attach video { border-radius: 12px; margin-top: 6px; max-height: 280px; width: auto; }
.bubble .attach-audio { margin-top: 6px; max-width: 250px; display: block; }
.bubble .attach-file { display: block; margin-top: 6px; color: inherit; text-decoration: underline; }
.msg-row.mine .bubble { background: var(--brand); border-color: var(--brand); color: #fff; }
.bubble .time { font-size: 10.5px; opacity: .7; margin-top: 2px; text-align: right; white-space: nowrap; }
.bubble .reply-quote { font-size: 12.5px; opacity: .8; border-left: 3px solid currentColor; padding-left: 8px; margin-bottom: 5px; }
.bubble .msg-reactions { position: absolute; bottom: -11px; right: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px; font-size: 11px; white-space: nowrap; }
.msg-system { align-self: center; font-size: 12px; color: var(--text-2); background: var(--surface-3); padding: 4px 12px; border-radius: 999px; margin: 8px 0; }
.msg-tools { display: flex; gap: 4px; align-self: center; opacity: 0; transition: opacity .15s; }
.msg-row:hover .msg-tools { opacity: 1; }
.msg-tools button { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 12px; padding: 3px; }
.chat-compose { padding: 11px 14px; border-top: 1px solid var(--border); display: flex; gap: 9px; align-items: flex-end; }
.chat-compose textarea {
  flex: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 20px;
  padding: 10px 15px; resize: none; max-height: 120px; min-height: 42px; outline: none;
}
.chat-compose textarea:focus { border-color: var(--brand); }
.typing { font-size: 12.5px; color: var(--brand); padding: 0 18px 6px; font-style: italic; height: 19px; }
.chat-empty { display: grid; place-items: center; height: 100%; text-align: center; color: var(--text-2); }
.reply-preview { padding: 8px 14px; background: var(--surface-2); border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }

/* ---------------------------------------------------------- notifications */
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--brand-soft); }
.notif .kind {
  position: absolute; right: -3px; bottom: -3px; width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; color: #fff; border: 2px solid var(--surface);
}
.kind.like { background: var(--brand); } .kind.comment { background: var(--success); }
.kind.friend_request, .kind.friend_accept, .kind.follow { background: var(--accent); }
.kind.message { background: var(--pink); } .kind.mention { background: var(--warning); }
.kind.share, .kind.group_post { background: var(--brand-dark); }
.kind.event_invite, .kind.event_rsvp, .kind.event_update, .kind.group_invite, .kind.reply { background: var(--text-2); }

/* ---------------------------------------------------------- toast / modal */
.toasts { position: fixed; top: 74px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 9px; max-width: 340px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 15px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  box-shadow: var(--shadow-lg); animation: fadeUp .2s ease both; font-size: 14px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent); }
.toast i { margin-top: 2px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 16, .62); z-index: 250; display: grid; place-items: center; padding: 18px; animation: fadeUp .16s ease both; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: min(540px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal.wide { width: min(820px, 100%); }
.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 260; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 94vh; object-fit: contain; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow-y: auto;
}
.dropdown-menu button, .dropdown-menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px;
  border: 0; background: none; border-radius: var(--radius-sm); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
}
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu i { width: 18px; text-align: center; }

/* ---------------------------------------------------------- auth pages */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-hero {
  background: linear-gradient(140deg, var(--brand-dark), var(--brand) 55%, var(--accent));
  color: #fff; padding: 54px; display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.auth-hero h1 { font-size: 42px; line-height: 1.12; }
.auth-hero p { font-size: 17px; opacity: .92; max-width: 460px; }
.auth-features { display: grid; gap: 14px; margin-top: 10px; }
.auth-features div { display: flex; gap: 13px; align-items: center; font-weight: 500; }
.auth-features i { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(430px, 100%); }
.auth-card h2 { font-size: 26px; margin-bottom: 6px; }
.strength { height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.strength > i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }

/* ---------------------------------------------------------- events / groups */
.tile { overflow: hidden; display: flex; flex-direction: column; }
.tile .banner { height: 132px; background: linear-gradient(135deg, var(--brand), var(--accent)); position: relative; }
.tile .banner img { width: 100%; height: 100%; object-fit: cover; }
.tile .banner .date {
  position: absolute; top: 10px; left: 10px; background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 5px 9px; text-align: center; font-weight: 800; line-height: 1.1; box-shadow: var(--shadow);
}
.tile .banner .date small { display: block; font-size: 10px; color: var(--danger); text-transform: uppercase; }
.tile .body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .rail { display: none; }
}
@media (max-width: 900px) {
  .layout, .layout.two-col { grid-template-columns: minmax(0, 1fr); padding-bottom: 78px; }
  .sidebar { display: none; }
  .topbar-nav .nav-link span { display: none; }
  .messenger { grid-template-columns: 1fr; height: calc(100vh - var(--topbar-h) - 86px); }
  .messenger.show-chat .thread-list { display: none; }
  .messenger:not(.show-chat) .chat { display: none; }
  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--surface);
    border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 7px 4px;
  }
  .mobile-nav a { display: grid; place-items: center; gap: 2px; color: var(--text-2); font-size: 18px; padding: 5px 12px; border-radius: 10px; position: relative; }
  .mobile-nav a small { font-size: 10px; font-weight: 600; }
  .mobile-nav a.active { color: var(--brand); }
  .auth-page { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .cover { height: 190px; }
  .profile-bar { padding: 0 16px 14px; }
  .avatar.xxl { width: 108px; height: 108px; font-size: 36px; }
  .search-wrap { max-width: none; }
}
@media (min-width: 901px) { .mobile-nav { display: none; } }
@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .people-grid { grid-template-columns: 1fr 1fr; }
  .brand span { display: none; }
  .profile-identity h1 { font-size: 21px; }
}

/* ---------------------------------------------------------- marketplace */
.market-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 18px; align-items: start; }
.filter-rail { position: sticky; top: calc(var(--topbar-h) + 18px); max-height: calc(100vh - var(--topbar-h) - 36px); overflow-y: auto; }
.mobile-filter-btn { display: none; }

.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.listing-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s;
}
.listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.listing-card a { color: inherit; text-decoration: none; }
.listing-thumb {
  aspect-ratio: 4 / 3; background: var(--surface-3); position: relative; overflow: hidden;
  display: grid; place-items: center; color: var(--text-3); font-size: 30px;
}
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.listing-badge {
  background: rgba(12, 14, 18, .78); color: #fff; border-radius: 999px;
  padding: 3px 9px; font-size: 11px; font-weight: 700; backdrop-filter: blur(4px);
}
.listing-badge.sold { background: var(--danger); }
.listing-badge.reserved { background: var(--warning); color: #1a1205; }
.listing-badge.free { background: var(--success); }
.listing-fav {
  position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: rgba(12, 14, 18, .72); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.listing-fav.on { background: var(--pink); }
.listing-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.listing-price { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.listing-price small { font-size: 11px; font-weight: 600; color: var(--text-2); margin-left: 4px; }
.listing-title { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-meta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 5px; margin-top: auto; }
.listing-meta i { font-size: 10px; }

.filter-row { display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 5px 0; font-size: 14px; }
.filter-row:hover { color: var(--brand); }
.filter-row input { accent-color: var(--brand); width: 15px; height: 15px; }
.filter-row .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.filter-row i.cat-icon { width: 18px; text-align: center; color: var(--text-3); }
.filter-row.active { color: var(--brand); font-weight: 600; }
.filter-row.active i.cat-icon { color: var(--brand); }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.filter-chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; line-height: 1; }

/* listing detail */
.gallery { display: grid; gap: 8px; }
.gallery-main { aspect-ratio: 16 / 11; background: var(--surface-3); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; color: var(--text-3); font-size: 46px; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #0b0d11; cursor: zoom-in; }
.gallery-strip { display: flex; gap: 8px; overflow-x: auto; }
.gallery-strip button { width: 72px; height: 56px; border-radius: 9px; overflow: hidden; border: 2px solid transparent; background: var(--surface-3); cursor: pointer; padding: 0; flex: none; }
.gallery-strip button.active { border-color: var(--brand); }
.gallery-strip img { width: 100%; height: 100%; object-fit: cover; }
.listing-detail { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.spec { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.spec .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700; }
.spec .val { font-size: 14px; font-weight: 600; margin-top: 2px; }
.map-pin {
  height: 130px; border-radius: var(--radius-sm); position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(67,97,238,.28) 0 14%, transparent 42%),
    repeating-linear-gradient(0deg, var(--border) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, var(--border) 0 1px, transparent 1px 26px),
    var(--surface-2);
  display: grid; place-items: center;
}
.map-pin i { font-size: 26px; color: var(--brand); filter: drop-shadow(0 3px 5px rgba(0,0,0,.28)); }
.map-pin .radius-ring { position: absolute; width: 96px; height: 96px; border-radius: 50%; border: 2px dashed var(--brand); opacity: .55; }

@media (max-width: 1100px) { .listing-detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .market-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-rail { position: static; max-height: none; display: none; }
  .filter-rail.open { display: block; }
  .mobile-filter-btn { display: inline-flex; }
  .listing-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
.kind.listing_favorite, .kind.listing_message, .kind.listing_offer,
.kind.listing_sold, .kind.listing_nearby { background: var(--pink); }

/* ---------------------------------------------------------- calls */
.call-incoming {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  background: rgba(8, 10, 14, .72); backdrop-filter: blur(6px); animation: fadeUp .18s ease both;
}
.call-incoming-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px 34px; text-align: center; box-shadow: var(--shadow-lg); min-width: 290px;
}
.call-incoming-card .avatar { margin: 0 auto; animation: callPulse 1.6s ease-in-out infinite; }
@keyframes callPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(67, 97, 238, .45); }
  50% { box-shadow: 0 0 0 16px rgba(67, 97, 238, 0); }
}

.call-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 19px;
  background: var(--surface-3); color: var(--text); transition: filter .15s, background .15s;
}
.call-btn:hover { filter: brightness(1.12); }
.call-btn.off { background: var(--surface); color: var(--danger); outline: 1px solid var(--danger); }
.call-btn.answer { background: var(--success); color: #fff; }
.call-btn.answer-audio { background: var(--brand); color: #fff; }
.call-btn.decline { background: var(--danger); color: #fff; }

.call-overlay {
  position: fixed; inset: 0; z-index: 390; background: #0b0d11; color: #fff;
  display: flex; flex-direction: column; animation: fadeUp .18s ease both;
}
.call-overlay.minimised {
  inset: auto 18px 18px auto; width: 300px; height: 210px;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg);
}
.call-overlay.minimised .call-controls { padding: 6px; gap: 8px; }
.call-overlay.minimised .call-btn { width: 38px; height: 38px; font-size: 14px; }
.call-overlay.minimised .call-self { width: 76px; height: 56px; }
.call-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: rgba(255, 255, 255, .06);
}
.call-head .call-timer { margin-left: auto; font-variant-numeric: tabular-nums; opacity: .85; }
.call-head .icon-btn { background: rgba(255, 255, 255, .12); color: #fff; }
.call-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(20, 174, 92, .25); }

.call-stage { flex: 1; display: grid; gap: 6px; padding: 6px; place-items: center; min-height: 0; }
.call-stage.tiles-1 { grid-template-columns: 1fr; }
.call-stage.tiles-2 { grid-template-columns: repeat(2, 1fr); }
.call-stage.tiles-3, .call-stage.tiles-4 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.call-tile {
  position: relative; width: 100%; height: 100%; min-height: 0;
  background: #14171d; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center;
}
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile-avatar { display: grid; place-items: center; }
.call-tile-name {
  position: absolute; left: 10px; bottom: 10px; font-size: 13px; font-weight: 600;
  background: rgba(0, 0, 0, .55); padding: 3px 10px; border-radius: 999px;
}
.call-waiting { text-align: center; display: grid; place-items: center; gap: 4px; }
.call-waiting .avatar { animation: callPulse 1.8s ease-in-out infinite; }

.call-self {
  position: absolute; right: 18px; top: 74px; width: 190px; height: 130px;
  object-fit: cover; border-radius: var(--radius); border: 2px solid rgba(255, 255, 255, .22);
  background: #14171d; transform: scaleX(-1); z-index: 2;
}
.call-controls {
  display: flex; justify-content: center; gap: 16px; padding: 18px;
  background: rgba(255, 255, 255, .06);
}
.call-controls .call-btn { background: rgba(255, 255, 255, .14); color: #fff; }
.call-controls .call-btn.decline { background: var(--danger); }
.call-controls .call-btn.off { background: #fff; color: #14171d; outline: none; }

@media (max-width: 700px) {
  .call-self { width: 116px; height: 84px; right: 12px; top: 66px; }
  .call-controls { gap: 12px; padding: 14px; }
  .call-btn { width: 50px; height: 50px; }
  .call-overlay.minimised { inset: auto 10px 74px auto; width: 210px; height: 150px; }
}
.msg-system.call-log { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* upload progress */
.upload-progress { margin: 8px 0 4px; }
.upload-progress > i {
  display: block; height: 5px; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .2s ease;
}
.upload-progress > span { display: block; font-size: 12px; color: var(--text-2); margin-top: 5px; }
.upload-progress::before {
  content: ''; display: block; height: 5px; border-radius: 3px;
  background: var(--surface-3); margin-bottom: -5px;
}

/* ---------------------------------------------------------- auth hero */
.auth-hero { gap: 26px; overflow-y: auto; }
.hero-copy h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.02em; }
.hero-copy p { font-size: 16.5px; opacity: .93; max-width: 480px; margin-top: 12px; }

.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; }
.hero-card {
  background: rgba(255, 255, 255, .11); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px; padding: 14px 15px; backdrop-filter: blur(3px);
}
.hero-card i { font-size: 17px; opacity: .95; }
.hero-card h3 { font-size: 14.5px; margin: 7px 0 4px; font-weight: 700; }
.hero-card p { font-size: 13px; line-height: 1.5; opacity: .88; }

.hero-points { display: grid; gap: 11px; max-width: 520px; }
.hero-points > div { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; opacity: .95; }
.hero-points i { width: 20px; text-align: center; margin-top: 2px; opacity: .9; }

.hero-steps { list-style: none; display: grid; gap: 14px; max-width: 520px; }
.hero-steps li { display: flex; gap: 13px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.hero-steps span {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); font-weight: 800; font-size: 13px;
}

/* condensed pitch shown only where the hero panel is hidden */
.mobile-pitch { display: none; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.pitch-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2);
}
.pitch-chip i { font-size: 11px; color: var(--brand); }

@media (max-width: 1100px) { .hero-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .mobile-pitch { display: block; } }
@media (max-height: 760px) {
  .auth-hero { padding-top: 34px; padding-bottom: 34px; }
  .hero-card p { display: none; }
  .hero-card h3 { margin-bottom: 0; }
}

/* ---------------------------------------------------------- live streaming */
.live-card .listing-thumb { background: linear-gradient(140deg, #1c2030, #0f1115); font-size: 34px; }
.live-badge {
  position: absolute; top: 8px; left: 8px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 3px 8px; border-radius: 5px;
}
.live-badge.floating { top: 14px; left: 14px; z-index: 3; }
.viewer-badge, .quality-badge {
  position: absolute; bottom: 8px; background: rgba(10, 12, 16, .78); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px;
}
.viewer-badge { left: 8px; }
.quality-badge { right: 8px; }

.watch-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.player-shell { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; }
.player-shell video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.player-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #0d0f14; color: #fff; }

.chat-panel { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 40px); position: sticky; top: calc(var(--topbar-h) + 18px); }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.chat-line { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.chat-user { font-weight: 700; color: var(--brand); margin-right: 5px; }
.chat-user:hover { text-decoration: underline; }
.chat-user.owner { color: var(--danger); }
.chat-user.owner::after { content: ' ●'; font-size: 9px; vertical-align: middle; }
.chat-send { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--border); }
.chat-send input { flex: 1; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 9px 14px; outline: none; }
.chat-send input:focus { border-color: var(--brand); }

.code-block {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 12.5px; overflow-x: auto; margin-top: 8px; line-height: 1.6;
}
details summary::-webkit-details-marker { color: var(--text-3); }

@media (max-width: 1000px) {
  .watch-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-panel { height: 460px; position: static; }
}
