:root {
  --bg: #f6f7f3;
  --panel: #ffffff;
  --panel-2: #f0f2ed;
  --panel-3: #e7eae3;
  --line: #dfe3da;
  --line-soft: rgba(24,28,20,.09);
  --text: #171a16;
  --muted: #6d746b;
  --muted-2: #9aa096;
  --accent: #b9ef3a;
  --accent-ink: #172000;
  --danger: #ff525d;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 49% -20%, rgba(185,239,58,.18), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 680px) 330px;
  justify-content: center;
  gap: 22px;
  padding: 0 24px;
}

.desktop-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 0 18px;
  display: flex;
  flex-direction: column;
}
.brand {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  padding: 0 12px 27px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 900;
  font-size: 21px;
  letter-spacing: -2px;
  box-shadow: 0 7px 30px rgba(200,255,87,.16);
  transform: rotate(-4deg);
}
.brand-mark.small { width: 31px; height: 31px; border-radius: 10px; font-size: 17px; }
.brand-name { font-size: 24px; font-weight: 800; letter-spacing: -1.1px; }
.side-nav { display: grid; gap: 7px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 49px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  padding: 0 13px;
  font-weight: 650;
  text-align: left;
  transition: .2s ease;
}
.nav-item:hover { background: rgba(24,28,20,.045); color: var(--text); }
.nav-item.active { color: var(--text); background: var(--panel-2); border-color: var(--line-soft); }
.nav-icon { width: 28px; font-size: 26px; line-height: 1; font-weight: 400; text-align: center; }
.mini-clan { font-size: 20px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: auto; box-shadow: 0 0 0 4px rgba(200,255,87,.09); }
.create-side {
  margin: 20px 5px 0;
  border: 0;
  min-height: 48px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 11px 30px rgba(200,255,87,.12);
  transition: transform .18s ease, filter .18s ease;
}
.create-side:hover { transform: translateY(-2px); filter: brightness(1.05); }
.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 17px;
  padding: 10px;
  color: var(--text);
}
.side-user:hover { background: rgba(24,28,20,.045); }
.side-user div:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.side-user strong { font-size: 13px; }
.side-user span { color: var(--muted); font-size: 12px; }
.more-btn { margin-left: auto; border: 0; background: none; color: var(--muted); }

.main-column {
  min-height: 100vh;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  background: rgba(255,255,255,.72);
}
.screen { display: none; min-height: 100vh; animation: screenIn .24s ease; }
.screen.active { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.mobile-header { display: none; }
.sticky-card {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246,247,243,.88);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
.feed-header, .page-top {
  min-height: 91px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 23px 13px;
}
.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
.feed-header h1, .page-top h1 { margin: 0; font-size: 27px; letter-spacing: -1.15px; }
.avatar-button { width: 42px; height: 42px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 14px; font-size: 20px; }
.feed-tabs {
  position: sticky;
  top: 91px;
  z-index: 19;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(246,247,243,.92);
  backdrop-filter: blur(18px);
}
.feed-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  height: 48px;
  font-weight: 700;
}
.feed-tab.active { color: var(--text); }
.feed-tab.active::after {
  content: "";
  position: absolute;
  left: 30%; right: 30%; bottom: -1px;
  height: 3px;
  border-radius: 10px 10px 0 0;
  background: var(--accent);
}
.quick-compose {
  width: calc(100% - 32px);
  margin: 16px;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: 20px;
  padding: 10px 12px;
  color: var(--muted);
  text-align: left;
}
.quick-compose:hover { background: var(--panel-2); }
.quick-plus { margin-left: auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-3); color: var(--text); font-size: 21px; }
.clan-avatar {
  flex: 0 0 auto;
  width: 41px;
  height: 41px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(24,28,20,.09);
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #e9ede5);
  font-size: 20px;
  box-shadow: inset 0 1px rgba(255,255,255,.9);
}
.clan-avatar.small-avatar { width: 39px; height: 39px; }
.clan-avatar.large { width: 55px; height: 55px; border-radius: 18px; font-size: 26px; }
.stories-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 15px;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line-soft);
}
.stories-strip::-webkit-scrollbar { display: none; }
.story {
  min-width: 73px;
  border: 0;
  background: transparent;
  display: grid;
  justify-items: center;
  gap: 5px;
}
.story span { width: 47px; height: 47px; display: grid; place-items: center; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line); font-size: 21px; }
.story small { color: var(--muted); font-size: 10px; }
.story.active-story span { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,255,87,.08); }

.posts { display: grid; }
.post-card {
  padding: 18px 19px 14px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .18s ease;
}
.post-card:hover { background: rgba(24,28,20,.018); }
.post-head { display: flex; gap: 11px; align-items: flex-start; }
.post-meta { flex: 1; min-width: 0; }
.post-name-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.post-name { font-weight: 800; font-size: 14px; }
.post-handle, .post-time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.post-handle { overflow: hidden; text-overflow: ellipsis; }
.verified { width: 15px; height: 15px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 9px; font-weight: 900; }
.ceo-label {
  display: inline-flex; align-items: center; min-height: 19px; padding: 2px 7px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 8px; line-height: 1; font-weight: 950; letter-spacing: .055em;
  white-space: nowrap;
}
.post-menu { border: 0; background: transparent; color: var(--muted); padding: 4px 2px; letter-spacing: 1px; }
.post-content { margin-left: 52px; margin-top: -12px; }
.post-text {
  margin: 0 0 12px;
  line-height: 1.45;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
}
.post-text .tag { color: var(--accent); }
.post-image {
  width: 100%;
  max-height: 540px;
  object-fit: cover;
  display: block;
  border-radius: 21px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
}
.post-image-art { min-height: 330px; display: grid; place-items: end start; padding: 25px; overflow: hidden; position: relative; }
.post-image-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.17), transparent 20%), radial-gradient(circle at 80% 75%, rgba(200,255,87,.28), transparent 24%); }
.post-image-art span { position: relative; max-width: 80%; font-size: clamp(35px, 8vw, 72px); line-height: .88; font-weight: 900; letter-spacing: -5px; text-transform: uppercase; }
.art-1 { background: linear-gradient(145deg, #242020, #4f1c2d 45%, #15151a); }
.art-2 { background: linear-gradient(145deg, #0e2031, #12345a 45%, #17171a); }
.art-3 { background: linear-gradient(145deg, #222015, #514a14 48%, #151515); }
.post-actions { display: flex; align-items: center; gap: clamp(15px, 6vw, 37px); margin-top: 13px; }
.action-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px;
  font-size: 12px;
}
.action-button .action-icon { font-size: 19px; line-height: 1; transition: transform .16s ease; }
.action-button:hover { color: var(--text); }
.action-button:hover .action-icon { transform: scale(1.08); }
.action-button.liked { color: #ff5b6f; }
.action-button.saved { color: var(--accent); }
.post-separator { color: var(--muted-2); }

.right-rail { padding: 24px 0; display: grid; align-content: start; gap: 14px; }
.rail-card { border: 1px solid var(--line-soft); border-radius: 22px; background: rgba(255,255,255,.88); overflow: hidden; box-shadow: 0 12px 35px rgba(35,45,27,.05); }
.identity-card { padding: 17px; }
.rail-profile-top { display: flex; align-items: center; gap: 12px; }
.rail-profile-top div:last-child { display: grid; gap: 3px; }
.rail-profile-top strong { font-size: 15px; }
.rail-profile-top span { font-size: 12px; color: var(--muted); }
.identity-card p { color: var(--muted); font-size: 12px; margin: 15px 0 10px; }
.rank-line { display: flex; justify-content: space-between; border-radius: 13px; background: var(--panel-2); padding: 11px 12px; font-size: 12px; }
.rank-line b { color: var(--accent); }
.rail-title { display: flex; align-items: center; justify-content: space-between; padding: 16px 17px 7px; }
.rail-title h3 { margin: 0; font-size: 15px; }
.rail-title button { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.rail-trend { width: 100%; border: 0; background: transparent; padding: 11px 17px 13px; display: grid; gap: 4px; text-align: left; }
.rail-trend:hover { background: rgba(24,28,20,.03); }
.rail-trend small, .rail-trend span { color: var(--muted); font-size: 10px; }
.rail-trend strong { font-size: 13px; }
.recommend-user { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 15px; }
.recommend-user > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: var(--panel-2); }
.recommend-user div { display: grid; gap: 2px; min-width: 0; }
.recommend-user strong { font-size: 12px; }
.recommend-user small { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
.follow-btn { border: 0; border-radius: 11px; background: var(--text); color: #fff; font-size: 10px; font-weight: 800; padding: 8px 10px; }
.follow-btn.following { background: var(--panel-3); color: var(--muted); }
.rail-footer { color: var(--muted-2); font-size: 10px; padding: 4px 5px; }

.search-box { margin: 4px 18px 18px; height: 52px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.search-box:focus-within { border-color: rgba(200,255,87,.6); box-shadow: 0 0 0 3px rgba(200,255,87,.07); }
.search-box span { color: var(--muted); font-size: 24px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box kbd { color: var(--muted-2); border: 1px solid var(--line); border-radius: 7px; padding: 3px 6px; font-size: 10px; }
.section-title { display: flex; justify-content: space-between; align-items: end; padding: 12px 19px 8px; }
.section-title h2 { margin: 0; font-size: 17px; }
.section-title span { color: var(--muted-2); font-size: 10px; }
.trend-list, .people-list { border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.trend-item { width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; display: grid; grid-template-columns: 43px 1fr auto; align-items: center; gap: 12px; padding: 14px 18px; text-align: left; }
.trend-item:last-child { border-bottom: 0; }
.trend-item:hover { background: rgba(24,28,20,.025); }
.trend-emoji { width: 43px; height: 43px; border-radius: 14px; display: grid; place-items: center; background: var(--panel-2); font-size: 20px; }
.trend-copy { display: grid; gap: 3px; }
.trend-copy strong { font-size: 13px; }
.trend-copy span { color: var(--muted); font-size: 10px; }
.trend-rank { color: var(--accent); font-size: 11px; font-weight: 800; }
.person-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.person-row:last-child { border-bottom: 0; }
.person-copy { min-width: 0; display: grid; gap: 2px; }
.person-copy strong { font-size: 13px; }
.person-copy span { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.event-hero { position: relative; min-height: 360px; margin: 5px 17px 16px; border-radius: 27px; overflow: hidden; padding: 27px; background: linear-gradient(140deg, #302152, #16162a 46%, #15230f); border: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; justify-content: flex-end; }
.event-hero::after { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 45%; right: -50px; top: -45px; background: var(--accent); filter: blur(1px); opacity: .9; transform: rotate(28deg); box-shadow: -100px 85px 0 rgba(126,93,255,.8); }
.event-noise { position: absolute; inset: 0; opacity: .16; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); }
.event-hero p, .event-hero h2, .event-hero span, .event-hero button { position: relative; z-index: 2; }
.event-hero p { color: var(--accent); font-weight: 800; font-size: 11px; letter-spacing: .15em; }
.event-hero h2 { margin: 0 0 13px; max-width: 430px; font-size: clamp(38px, 7vw, 63px); line-height: .91; letter-spacing: -4px; text-transform: uppercase; }
.event-hero span { color: rgba(255,255,255,.68); max-width: 450px; line-height: 1.5; font-size: 12px; }
.event-hero button { width: fit-content; margin-top: 19px; border: 0; background: var(--text); color: #111; border-radius: 13px; padding: 11px 16px; font-weight: 800; font-size: 11px; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 0 17px 17px; }
.score-grid article { border: 1px solid var(--line-soft); border-radius: 18px; background: var(--panel); padding: 15px 12px; display: grid; gap: 4px; }
.score-grid article span { font-size: 21px; }
.score-grid strong { font-size: 14px; }
.score-grid small { color: var(--muted); font-size: 10px; }
.pixel-board { margin: 0 17px 30px; display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; padding: 10px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-soft); }
.pixel { aspect-ratio: 1; border: 0; border-radius: 5px; background: var(--panel-3); font-size: clamp(8px, 1.3vw, 13px); padding: 0; }
.pixel:hover { outline: 1px solid var(--accent); }

.text-button { border: 0; background: transparent; color: var(--accent); font-size: 11px; font-weight: 700; }
.notice-tabs { display: flex; gap: 7px; padding: 0 17px 16px; border-bottom: 1px solid var(--line-soft); }
.notice-tabs button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 8px 13px; font-size: 11px; }
.notice-tabs button.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 800; }
.notice-row { position: relative; display: grid; grid-template-columns: 45px minmax(0,1fr) auto; gap: 12px; align-items: start; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.notice-row.unread::before { content: ""; position: absolute; left: 6px; top: 29px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.notice-icon { width: 45px; height: 45px; border-radius: 15px; background: var(--panel-2); display: grid; place-items: center; font-size: 20px; }
.notice-copy { font-size: 12px; line-height: 1.5; }
.notice-copy strong { font-weight: 800; }
.notice-copy p { margin: 4px 0 0; color: var(--muted); }
.notice-time { color: var(--muted-2); font-size: 10px; white-space: nowrap; }

.profile-banner { position: relative; height: 206px; overflow: hidden; background: linear-gradient(140deg, #eef6d9, #e8e3fb); border-bottom: 1px solid var(--line-soft); }
.banner-art { position: absolute; inset: -20px; display: grid; align-content: center; transform: rotate(-8deg); }
.banner-art span { font-size: 75px; line-height: .78; font-weight: 900; letter-spacing: -7px; color: transparent; -webkit-text-stroke: 1px rgba(200,255,87,.4); }
.banner-art span:nth-child(2) { color: var(--accent); -webkit-text-stroke: 0; transform: translateX(55px); }
.profile-settings { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 13px; border: 1px solid rgba(24,28,20,.12); background: rgba(255,255,255,.72); backdrop-filter: blur(10px); }
.profile-main { position: relative; padding: 57px 19px 18px; }
.profile-avatar { position: absolute; top: -49px; left: 19px; width: 94px; height: 94px; display: grid; place-items: center; border-radius: 29px; background: linear-gradient(145deg, #ffffff, #e8ece4); border: 5px solid var(--bg); box-shadow: 0 12px 30px rgba(35,45,27,.12); font-size: 45px; }
.edit-profile { position: absolute; right: 19px; top: 14px; border: 1px solid var(--line); background: transparent; border-radius: 13px; padding: 9px 14px; font-size: 11px; font-weight: 700; }
.edit-profile:hover { background: var(--panel-2); }
.profile-main h1 { margin: 0 0 2px; font-size: 23px; }
.profile-handle { color: var(--muted); font-size: 11px; }
.profile-bio { margin: 15px 0; line-height: 1.55; font-size: 13px; }
.profile-stats { display: flex; gap: 22px; }
.profile-stats button { border: 0; background: transparent; display: flex; gap: 5px; padding: 0; align-items: baseline; }
.profile-stats strong { font-size: 12px; }
.profile-stats span { color: var(--muted); font-size: 10px; }
.profile-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
.profile-tabs button { position: relative; border: 0; background: transparent; color: var(--muted); height: 48px; font-size: 11px; font-weight: 700; }
.profile-tabs button.active { color: var(--text); }
.profile-tabs button.active::after { content: ""; position: absolute; left: 35%; right: 35%; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }

.mobile-nav { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding: 8vh 18px 20px; background: rgba(0,0,0,.68); backdrop-filter: blur(9px); }
.modal-backdrop.open { display: flex; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.composer-modal { width: min(600px, 100%); border: 1px solid var(--line); border-radius: 25px; background: #ffffff; overflow: hidden; box-shadow: 0 30px 90px rgba(30,38,24,.22); animation: modalIn .22s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { height: 62px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--line-soft); }
.modal-head strong { font-size: 14px; }
.modal-close, .publish-btn { border: 0; background: transparent; font-size: 11px; }
.modal-close { justify-self: start; color: var(--muted); }
.publish-btn { justify-self: end; background: var(--accent); color: var(--accent-ink); border-radius: 11px; padding: 8px 12px; font-weight: 800; }
.publish-btn:disabled { opacity: .32; cursor: not-allowed; }
.composer-body { display: flex; align-items: flex-start; gap: 11px; padding: 18px; }
.composer-input-wrap { flex: 1; min-width: 0; }
.composer-input-wrap textarea { width: 100%; min-height: 145px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 1.5; }
.composer-input-wrap textarea::placeholder { color: var(--muted-2); }
.composer-tools { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.tool-button { width: 34px; height: 34px; border: 0; border-radius: 11px; background: var(--panel-2); color: var(--accent); display: grid; place-items: center; font-weight: 800; }
.char-count { margin-left: auto; color: var(--muted-2); font-size: 10px; }
.image-preview { position: relative; min-height: 180px; border-radius: 18px; margin: 2px 0 14px; background-size: cover; background-position: center; border: 1px solid var(--line); }
.hidden { display: none; }
.small-modal { max-width: 480px; }
.edit-fields { display: grid; gap: 15px; padding: 20px; }
.edit-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.edit-fields input, .edit-fields textarea { width: 100%; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 14px; padding: 12px 13px; outline: 0; text-transform: none; letter-spacing: 0; font-size: 13px; }
.edit-fields textarea { min-height: 100px; resize: vertical; }
.edit-fields input:focus, .edit-fields textarea:focus { border-color: rgba(200,255,87,.55); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 28px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; background: var(--text); color: #fff; border-radius: 13px; padding: 10px 15px; font-size: 11px; font-weight: 800; transition: .22s ease; box-shadow: 0 15px 50px rgba(30,38,24,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 84px minmax(0, 680px) 300px; gap: 16px; }
  .brand-name, .nav-item > span:not(.nav-icon):not(.dot), .side-user > div:nth-child(2), .side-user .more-btn { display: none; }
  .desktop-sidebar { align-items: center; }
  .brand { padding-left: 0; padding-right: 0; }
  .side-nav { width: 56px; }
  .nav-item { justify-content: center; padding: 0; }
  .create-side { width: 52px; height: 52px; min-height: 52px; border-radius: 17px; font-size: 0; }
  .create-side::before { content: "+"; font-size: 25px; }
  .side-user { padding: 7px; }
}

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 78px minmax(0, 680px); }
  .right-rail { display: none; }
}

@media (max-width: 700px) {
  body { background: var(--bg); }
  .app-shell { display: block; padding: 0; }
  .desktop-sidebar { display: none; }
  .main-column { border: 0; width: 100%; min-height: 100vh; padding-bottom: 78px; }
  .mobile-header { position: sticky; top: 0; z-index: 30; height: 57px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line-soft); background: rgba(246,247,243,.92); backdrop-filter: blur(18px); }
  .logo-button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 0; }
  .logo-button b { font-size: 18px; letter-spacing: -.8px; }
  .header-action { border: 0; width: 34px; height: 34px; border-radius: 12px; background: var(--panel-2); font-size: 21px; }
  .feed-header, .page-top { min-height: 76px; top: 57px; padding: 15px 16px 10px; }
  .feed-header h1, .page-top h1 { font-size: 23px; }
  .feed-tabs { top: 133px; }
  .quick-compose { width: calc(100% - 24px); margin: 12px; }
  .post-card { padding: 16px 14px 13px; }
  .post-content { margin-left: 49px; }
  .post-image-art { min-height: 310px; }
  .post-actions { justify-content: space-between; gap: 0; }
  .mobile-nav { position: fixed; z-index: 50; left: 9px; right: 9px; bottom: calc(8px + env(safe-area-inset-bottom)); height: 64px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; border: 1px solid rgba(24,28,20,.1); border-radius: 21px; background: rgba(255,255,255,.94); backdrop-filter: blur(20px) saturate(170%); box-shadow: 0 14px 45px rgba(30,38,24,.14); padding: 5px 4px; }
  .mobile-nav-item { position: relative; height: 54px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; }
  .mobile-nav-item > span { font-size: 24px; line-height: 1; }
  .mobile-nav-item small { font-size: 8px; }
  .mobile-nav-item.active { color: var(--text); }
  .mobile-nav-item.active::after { content: ""; position: absolute; bottom: 1px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
  .mobile-nav-item i { position: absolute; top: 7px; right: 24%; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  .center-create span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 15px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 28px rgba(200,255,87,.18); font-size: 27px; }
  .center-create::after { display: none !important; }
  .nav-clan { font-size: 18px !important; width: 31px; height: 31px; border-radius: 10px; background: var(--panel-3); display: grid; place-items: center; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .composer-modal { width: 100%; border-radius: 24px 24px 0 0; border-bottom: 0; max-height: 91vh; padding-bottom: env(safe-area-inset-bottom); }
  .profile-banner { height: 170px; }
  .banner-art span { font-size: 61px; }
  .event-hero { min-height: 340px; margin-left: 12px; margin-right: 12px; padding: 22px; }
  .score-grid { padding-left: 12px; padding-right: 12px; }
  .pixel-board { margin-left: 12px; margin-right: 12px; }
  .search-box { margin-left: 12px; margin-right: 12px; }
}

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

/* Empty production-ready states */
.empty-state {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 38px 24px;
  text-align: center;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.empty-state-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  border: 1px solid var(--line);
  margin-bottom: 4px;
}

.empty-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  max-width: 360px;
  font-size: 14px;
  line-height: 1.55;
}

.empty-state-action {
  margin-top: 10px;
  padding: 11px 16px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: #111;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.empty-rail-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}


/* Language switcher and light theme polish */
.language-control {
  display: grid;
  gap: 7px;
  margin: 14px 5px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.language-select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  outline: 0;
  font-weight: 750;
  cursor: pointer;
}
.language-select:focus {
  border-color: rgba(137,190,19,.65);
  box-shadow: 0 0 0 3px rgba(185,239,58,.18);
}
.mobile-header-actions { display: flex; align-items: center; gap: 8px; }
.mobile-language { display: none; width: 58px; height: 34px; padding: 0 7px; border-radius: 11px; font-size: 11px; }
.main-column { box-shadow: 0 0 55px rgba(35,45,27,.035); }
.quick-compose, .search-box, .edit-fields input, .edit-fields textarea { box-shadow: 0 8px 25px rgba(35,45,27,.035); }
.modal-backdrop { background: rgba(30,38,24,.35); }
.banner-art span { -webkit-text-stroke-color: rgba(104,145,20,.38); }
.empty-state-action { color: var(--accent-ink); }

@media (max-width: 1100px) {
  .desktop-language span { display: none; }
  .desktop-language { margin-left: 0; margin-right: 0; width: 56px; }
  .desktop-language .language-select { width: 56px; padding: 0 7px; font-size: 10px; }
}

@media (max-width: 700px) {
  .mobile-language { display: block; }
}

/* Light / dark theme selector */
.preference-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 5px 0;
}
.preference-control {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.theme-select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  color: var(--text);
  padding: 0 10px;
  outline: 0;
  font-weight: 750;
  cursor: pointer;
}
.theme-select:focus {
  border-color: rgba(137,190,19,.65);
  box-shadow: 0 0 0 3px rgba(185,239,58,.18);
}
.mobile-theme { display: none; width: 54px; height: 34px; padding: 0 8px; border-radius: 11px; font-size: 14px; }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1110;
  --panel: #171a18;
  --panel-2: #202420;
  --panel-3: #292e29;
  --line: #303630;
  --line-soft: rgba(255,255,255,.085);
  --text: #f4f7f2;
  --muted: #a1aaa0;
  --muted-2: #717a70;
  --accent: #b9ef3a;
  --accent-ink: #172000;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 49% -20%, rgba(185,239,58,.11), transparent 31%),
    var(--bg);
}
html[data-theme="dark"] .main-column { background: rgba(20,23,21,.82); box-shadow: 0 0 55px rgba(0,0,0,.18); }
html[data-theme="dark"] .sticky-card,
html[data-theme="dark"] .feed-tabs { background: rgba(15,17,16,.9); }
html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .side-user:hover { background: rgba(255,255,255,.055); }
html[data-theme="dark"] .post-card:hover,
html[data-theme="dark"] .trend-item:hover,
html[data-theme="dark"] .rail-trend:hover { background: rgba(255,255,255,.025); }
html[data-theme="dark"] .clan-avatar,
html[data-theme="dark"] .profile-avatar { background: linear-gradient(145deg, #252a25, #171a18); box-shadow: inset 0 1px rgba(255,255,255,.045); }
html[data-theme="dark"] .rail-card { background: rgba(23,26,24,.9); box-shadow: 0 12px 35px rgba(0,0,0,.16); }
html[data-theme="dark"] .profile-banner { background: linear-gradient(140deg, #1d2819, #242032); }
html[data-theme="dark"] .profile-settings { border-color: rgba(255,255,255,.12); background: rgba(23,26,24,.72); color: var(--text); }
html[data-theme="dark"] .composer-modal { background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.48); }
html[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,.62); }
html[data-theme="dark"] .toast { background: #f4f7f2; color: #111; box-shadow: 0 15px 50px rgba(0,0,0,.35); }
html[data-theme="dark"] .follow-btn { background: var(--text); color: #111; }
html[data-theme="dark"] .mobile-header { background: rgba(15,17,16,.92); }
html[data-theme="dark"] .mobile-nav { border-color: rgba(255,255,255,.1); background: rgba(23,26,24,.95); box-shadow: 0 14px 45px rgba(0,0,0,.35); }
html[data-theme="dark"] select { color-scheme: dark; }

@media (max-width: 1100px) {
  .desktop-preferences { grid-template-columns: 56px; width: 56px; margin-left: 0; margin-right: 0; }
  .desktop-preferences .preference-control span { display: none; }
  .desktop-preferences .language-select,
  .desktop-preferences .theme-select { width: 56px; padding: 0 7px; font-size: 10px; }
}

@media (max-width: 700px) {
  .mobile-theme { display: block; }
}

/* Real account and authentication */
[hidden] { display: none !important; }
body.auth-open { min-height: 100vh; overflow-x: hidden; }
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% -10%, rgba(185,239,58,.20), transparent 34%),
    var(--bg);
}
.auth-card {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 30px 90px rgba(32, 40, 25, .12);
  padding: 28px;
  backdrop-filter: blur(18px);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
}
.auth-brand > span:last-child { display: grid; line-height: 1.08; }
.auth-brand b { font-size: 27px; letter-spacing: -.05em; }
.auth-brand small { margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.auth-preferences {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.auth-preferences select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  outline: 0;
  font-weight: 750;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 5px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--panel-2);
}
.auth-tab {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.auth-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 5px 16px rgba(0,0,0,.06);
}
.auth-form { display: grid; gap: 13px; }
.auth-field { display: grid; gap: 7px; }
.auth-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.auth-field input,
.username-input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  outline: none;
}
.auth-field > input { padding: 0 15px; }
.username-input { display: flex; align-items: center; padding: 0 15px; gap: 5px; }
.username-input > span { color: var(--muted); font-weight: 800; }
.username-input input {
  min-height: 46px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.auth-field input:focus,
.username-input:focus-within {
  border-color: rgba(137,190,19,.72);
  box-shadow: 0 0 0 4px rgba(185,239,58,.16);
}
.auth-error {
  min-height: 19px;
  margin: -2px 2px 0;
  color: #d94b62;
  font-size: 12px;
  font-weight: 700;
}
.auth-submit {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease;
}
.auth-submit:hover { transform: translateY(-1px); }
.auth-submit:disabled { opacity: .55; cursor: wait; transform: none; }
.auth-session-note,
.auth-legal {
  margin: 15px 5px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}
.auth-legal { margin-top: 7px; color: var(--muted-2); }
.profile-action-row { display: flex; justify-content: flex-end; gap: 8px; }
.logout-profile {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  padding: 9px 15px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.logout-profile:hover { color: #d94b62; border-color: rgba(217,75,98,.35); }
.repost-action.reposted { color: #5eaa28; }
.delete-post { font-size: 22px; line-height: 1; color: var(--muted-2); }
.delete-post:hover { color: #d94b62; }
html[data-theme="dark"] .auth-card { box-shadow: 0 30px 90px rgba(0,0,0,.42); }
html[data-theme="dark"] .auth-tab.active { box-shadow: 0 6px 18px rgba(0,0,0,.22); }

@media (max-width: 520px) {
  .auth-gate { padding: 14px; place-items: start center; }
  .auth-card { margin-top: 5vh; padding: 21px; border-radius: 24px; }
  .auth-brand b { font-size: 24px; }
}

/* Verification and CEO controls */
.profile-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.profile-name-line h1 { margin: 0; }
.profile-verified { width: 18px; height: 18px; font-size: 11px; flex: 0 0 auto; }
.profile-role {
  display: inline-flex; align-items: center; min-height: 24px; padding: 4px 9px;
  border-radius: 999px; background: var(--panel-3); color: var(--accent-ink);
  font-size: 10px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
}
.profile-role[hidden], .profile-verified[hidden] { display: none !important; }
.person-copy strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.person-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.verify-btn {
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--line));
  border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 900; padding: 8px 10px; cursor: pointer;
}
.verify-btn.active { background: transparent; color: var(--text); border-color: var(--line); }
.verify-btn:disabled { opacity: .55; cursor: wait; }
@media (max-width: 620px) {
  .person-row { grid-template-columns: 44px minmax(0, 1fr); }
  .person-actions { grid-column: 2; justify-content: flex-start; }
}

/* Profile media and simplified profile posts */
.clan-avatar,
.avatar-button,
.nav-clan,
.profile-avatar,
.notice-icon {
  overflow: hidden;
}
.clan-avatar img,
.avatar-button img,
.nav-clan img,
.profile-avatar img,
.notice-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.avatar-button { padding: 0; }
.profile-banner { cursor: pointer; }
.profile-banner-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.profile-banner.has-image .banner-art { display: none; }
.profile-banner .profile-settings { z-index: 2; }
.profile-avatar { cursor: pointer; }
.profile-posts-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 19px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}
.profile-posts-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 850;
}
.edit-media-grid {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 12px;
}
.media-picker {
  display: grid !important;
  gap: 8px;
  align-content: start;
  cursor: pointer;
}
.media-picker > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.media-picker > b {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 10px;
  text-align: center;
  font-size: 10px;
}
.media-picker:hover > b { border-color: rgba(117, 168, 23, .52); }
.media-preview {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 100%;
  background: linear-gradient(145deg, var(--panel-2), var(--panel-3));
  border: 1px dashed var(--line);
  color: var(--muted);
}
.media-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.avatar-preview {
  width: 94px;
  height: 94px;
  border-radius: 28px;
  font-size: 35px;
}
.banner-preview {
  min-height: 94px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .08em;
}
html[data-theme="dark"] .profile-posts-heading { background: var(--panel); }

@media (max-width: 540px) {
  .edit-media-grid { grid-template-columns: 1fr; }
  .media-picker:first-child { grid-template-columns: 94px 1fr; align-items: center; }
  .media-picker:first-child > span { grid-column: 1 / -1; }
  .media-picker:first-child > b { align-self: center; }
}

/* Marki production MVP additions */
.nav-badge { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-left: auto; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.text-button, .rail-footer button { border: 0; background: transparent; color: var(--muted); padding: 0; }
.text-button:hover, .rail-footer button:hover { color: var(--text); text-decoration: underline; }
.auth-legal button { border: 0; background: transparent; color: inherit; padding: 0; text-decoration: underline; }
.feed-tabs { overflow-x: auto; scrollbar-width: none; }
.feed-tabs::-webkit-scrollbar { display: none; }
.load-more { display: block; width: calc(100% - 32px); margin: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); font-weight: 800; }
.load-more:hover { background: var(--panel-2); }
.post-menu-wrap { position: relative; margin-left: auto; }
.post-menu-wrap .post-menu { margin-left: 0; }
.post-dropdown { display: none; position: absolute; right: 0; top: 34px; z-index: 50; min-width: 190px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 18px 55px rgba(0,0,0,.18); }
.post-menu-wrap.open .post-dropdown { display: grid; }
.post-dropdown button { border: 0; border-radius: 10px; background: transparent; padding: 10px 12px; text-align: left; }
.post-dropdown button:hover { background: var(--panel-2); }
.danger-text { color: var(--danger) !important; }
.edited-label { color: var(--muted-2); font-size: 11px; }
.user-link { border: 0; background: transparent; padding: 0; color: inherit; text-align: left; }
.post-name.user-link:hover, .person-copy:hover strong, .chat-head .user-link:hover strong { text-decoration: underline; }
.icon-button { min-width: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 8px; }
.primary-button { border: 0 !important; background: var(--accent) !important; color: var(--accent-ink) !important; font-weight: 800 !important; }
.danger-button { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)) !important; color: var(--danger) !important; }

.messages-layout { min-height: calc(100vh - 78px); display: grid; grid-template-columns: 260px minmax(0,1fr); }
.conversation-list { border-right: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 82%, transparent); overflow-y: auto; }
.conversation-list .empty-state { padding: 48px 18px; }
.conversation-row { width: 100%; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; padding: 13px; text-align: left; }
.conversation-row:hover, .conversation-row.active { background: var(--panel-2); }
.conversation-row > span { min-width: 0; display: grid; gap: 3px; }
.conversation-row strong, .conversation-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row small { color: var(--muted); }
.conversation-row i { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-style: normal; font-size: 11px; font-weight: 900; }
.conversation-avatar { width: 42px; height: 42px; border-radius: 14px; }
.chat-panel { display: grid; grid-template-rows: auto minmax(0,1fr) auto; min-height: 640px; background: var(--panel); }
.empty-chat { min-height: 560px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 24px; text-align: center; color: var(--muted); }
.empty-chat > span { font-size: 42px; }
.empty-chat h2, .empty-chat p { margin: 0; }
.chat-head { border-bottom: 1px solid var(--line); padding: 12px 16px; }
.chat-head .user-link { display: flex; align-items: center; gap: 10px; }
.chat-head .user-link > span:last-child { display: grid; }
.chat-head small { color: var(--muted); }
.chat-messages { min-height: 0; max-height: calc(100vh - 225px); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 9px; }
.message-bubble { align-self: flex-start; max-width: min(78%, 520px); border: 1px solid var(--line); border-radius: 17px 17px 17px 5px; background: var(--panel-2); padding: 10px 12px 7px; }
.message-bubble.mine { align-self: flex-end; border-color: transparent; border-radius: 17px 17px 5px 17px; background: var(--accent); color: var(--accent-ink); }
.message-bubble p { margin: 0; overflow-wrap: anywhere; }
.message-bubble small { display: block; margin-top: 4px; opacity: .65; font-size: 9px; text-align: right; }
.chat-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; border-top: 1px solid var(--line); padding: 12px; }
.chat-form input { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); color: var(--text); padding: 12px; outline: none; }
.chat-form button { border-radius: 13px; padding: 0 16px; }

.settings-stack { padding: 16px; display: grid; gap: 14px; }
.settings-card { border: 1px solid var(--line); border-radius: 20px; background: var(--panel); padding: 18px; display: grid; gap: 13px; }
.settings-card h2 { margin: 0; font-size: 16px; }
.settings-card label:not(.switch-row) { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.settings-card input[type="email"], .settings-card input[type="password"] { border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); color: var(--text); padding: 11px 12px; outline: none; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.switch-row > span { display: grid; gap: 4px; }
.switch-row small, .muted { color: var(--muted); }
.switch-row input { width: 44px; height: 24px; accent-color: var(--accent); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-actions button, .settings-card > button, .section-title-row button, .session-row button { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); padding: 9px 12px; font-weight: 750; }
.warning-card { border-color: color-mix(in srgb, #f6b73c 55%, var(--line)); background: color-mix(in srgb, #f6b73c 10%, var(--panel)); }
.warning-card p { margin: 0; color: var(--muted); }
.section-title-row { display: flex; justify-content: space-between; align-items: center; }
.session-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line-soft); padding: 12px 0; }
.session-row:first-child { border-top: 0; }
.session-row > div { min-width: 0; display: grid; gap: 3px; }
.session-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-row span { color: var(--muted); font-size: 11px; }

.detail-modal { width: min(680px, calc(100vw - 24px)); max-height: min(92vh, 920px); overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 28px 90px rgba(0,0,0,.28); }
.detail-modal .post-card { border: 0; border-radius: 0; box-shadow: none; }
.comments-section { border-top: 1px solid var(--line); padding: 15px 18px 20px; }
.comments-section h3 { margin: 0 0 12px; }
.comment-row { display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.comment-row.reply-comment { margin-left: 36px; }
.comment-avatar { width: 36px; height: 36px; border-radius: 12px; }
.comment-copy { min-width: 0; }
.comment-copy > div:first-child { font-size: 12px; }
.comment-copy > div:first-child > span { color: var(--muted); }
.comment-copy p { margin: 5px 0; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 12px; }
.comment-actions button { border: 0; background: transparent; color: var(--muted); padding: 0; font-size: 10px; font-weight: 700; }
.comment-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 14px; }
.comment-form input { border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); color: var(--text); padding: 11px; }
.comment-form button { border-radius: 12px; padding: 0 15px; }

.public-profile-banner { height: 180px; background: linear-gradient(135deg, var(--accent), #5be0a5 55%, #7b7cff); background-size: cover; background-position: center; }
.public-profile-main { position: relative; padding: 0 20px 18px; }
.public-avatar { position: relative; margin-top: -48px; width: 96px !important; height: 96px !important; border-radius: 30px !important; border: 5px solid var(--panel); font-size: 34px; }
.public-profile-actions { margin-top: -40px; min-height: 44px; display: flex; justify-content: flex-end; gap: 7px; }
.public-profile-actions button { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); padding: 9px 12px; font-weight: 750; }
.public-profile-main h1 { margin: 18px 0 0; }
.public-profile-main > p { margin: 5px 0; color: var(--muted); }
.modal-list { padding: 8px; max-height: 65vh; overflow-y: auto; }
.legal-copy { padding: 22px; line-height: 1.7; white-space: pre-wrap; }
.prompt-form { padding: 20px; display: grid; gap: 13px; }
.prompt-form p { margin: 0; color: var(--muted); }
.prompt-form input, .prompt-form textarea { border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); color: var(--text); padding: 11px; min-height: 44px; outline: none; }
.prompt-form textarea { min-height: 130px; resize: vertical; }
.prompt-actions { display: flex; justify-content: flex-end; gap: 8px; }
.prompt-actions button { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 9px 13px; }

.admin-stats { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; padding: 16px; }
.admin-stats > div { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 14px; display: grid; gap: 4px; }
.admin-stats strong { font-size: 22px; }
.admin-stats span { color: var(--muted); font-size: 10px; }
.admin-tabs { display: flex; gap: 8px; padding: 0 16px 12px; }
.admin-tab { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 9px 13px; }
.admin-tab.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#adminContent { padding: 0 16px 30px; display: grid; gap: 9px; }
.admin-row { display: flex; justify-content: space-between; gap: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 13px; }
.admin-row > div:first-child { min-width: 0; display: grid; gap: 4px; }
.admin-row span { color: var(--muted); font-size: 11px; }
.admin-row p { margin: 4px 0 0; overflow-wrap: anywhere; }
.admin-row > div:last-child { display: flex; align-items: center; gap: 6px; }
.admin-row button { border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); padding: 8px 10px; }
.admin-user { display: flex !important; align-items: center; gap: 10px; }
.admin-user .user-link { display: grid; }
.status-pill { border-radius: 999px; background: var(--panel-2); padding: 6px 9px; }

html[data-theme="dark"] .main-column { background: rgba(15,17,16,.84); }
html[data-theme="dark"] .post-dropdown, html[data-theme="dark"] .detail-modal { box-shadow: 0 28px 90px rgba(0,0,0,.55); }

@media (max-width: 1100px) {
  .messages-layout { grid-template-columns: 220px minmax(0,1fr); }
  .admin-stats { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 780px) {
  .messages-layout { display: block; }
  .conversation-list { max-height: 250px; border-right: 0; border-bottom: 1px solid var(--line); }
  .chat-panel { min-height: 520px; }
  .chat-messages { max-height: 430px; }
  .admin-stats { grid-template-columns: repeat(2,1fr); }
  .admin-row { display: grid; }
  .admin-row > div:last-child { flex-wrap: wrap; }
}
@media (max-width: 540px) {
  .settings-stack { padding: 10px; }
  .settings-card { border-radius: 17px; padding: 14px; }
  .detail-modal { width: 100vw; max-height: 100vh; min-height: 100vh; border-radius: 0; border: 0; }
  .public-profile-banner { height: 150px; }
  .comment-row.reply-comment { margin-left: 20px; }
  .admin-stats { grid-template-columns: 1fr 1fr; padding: 10px; }
  #adminContent { padding: 0 10px 90px; }
  .conversation-list { max-height: 220px; }
}

.translation-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.translation-note:hover { color: var(--accent); }
.comment-translation { margin-top: -2px; margin-bottom: 6px; }

/* Avatar sizing hotfix — keep profile pictures inside their cards */
.profile-main {
  isolation: isolate;
}

.profile-avatar,
.public-avatar {
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  overflow: hidden !important;
  max-width: 96px !important;
  max-height: 96px !important;
  aspect-ratio: 1 / 1 !important;
  z-index: 5;
}

.profile-avatar {
  width: 94px !important;
  height: 94px !important;
  min-width: 94px !important;
  min-height: 94px !important;
}

.profile-avatar > img,
.public-avatar > img,
[data-current-avatar] > img,
.clan-avatar > img,
.avatar-button > img,
.nav-clan > img,
.notice-icon > img,
.comment-avatar > img,
.conversation-avatar > img {
  position: static !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

@media (max-width: 620px) {
  .profile-avatar {
    width: 86px !important;
    height: 86px !important;
    min-width: 86px !important;
    min-height: 86px !important;
    max-width: 86px !important;
    max-height: 86px !important;
    border-radius: 27px !important;
  }
}

/* Mobile interface polish — compact headers, readable posts and profile layout */
@media (max-width: 700px) {
  html, body { width: 100%; overflow-x: hidden; }
  .main-column { overflow-x: hidden; padding-bottom: 82px; }

  .mobile-header {
    height: 54px;
    padding: 0 12px;
    gap: 8px;
  }
  .logo-button { min-width: 0; gap: 8px; }
  .logo-button b { font-size: 17px; }
  .mobile-header-actions { gap: 6px; flex: 0 0 auto; }
  .mobile-language { width: 56px; height: 36px; }
  .mobile-theme { width: 48px; height: 36px; }
  .header-action { width: 36px; height: 36px; border-radius: 12px; }

  .feed-header,
  .page-top {
    min-height: 60px;
    top: 54px;
    padding: 9px 15px 8px;
  }
  .feed-header .eyebrow,
  .page-top .eyebrow { display: none; }
  .feed-header h1,
  .page-top h1 { font-size: 23px; line-height: 1.1; }
  .avatar-button { width: 42px; height: 42px; border-radius: 14px; }

  .feed-tabs {
    top: 114px;
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    white-space: nowrap;
    scroll-snap-type: x proximity;
  }
  .feed-tab {
    flex: 1 0 25%;
    min-width: 92px;
    height: 46px;
    padding: 0 10px;
    scroll-snap-align: start;
    font-size: 13px;
  }
  .feed-tab.active::after { left: 28%; right: 28%; }

  .post-card {
    width: 100%;
    padding: 14px 13px 12px;
    overflow: hidden;
  }
  .post-head { gap: 10px; width: 100%; min-width: 0; }
  .post-head > .clan-avatar {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    flex: 0 0 46px;
  }
  .post-meta { min-width: 0; overflow: hidden; }
  .post-name-row {
    display: grid;
    grid-template-columns: minmax(0, auto) auto auto minmax(0, 1fr) auto;
    grid-template-areas:
      "name verified ceo spacer spacer"
      "handle handle handle spacer time";
    align-items: center;
    column-gap: 6px;
    row-gap: 2px;
    width: 100%;
  }
  .post-name {
    grid-area: name;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }
  .post-name-row .verified { grid-area: verified; }
  .post-name-row .ceo-label {
    grid-area: ceo;
    min-height: 18px;
    padding: 3px 7px;
    font-size: 7px;
    white-space: nowrap;
  }
  .post-handle {
    grid-area: handle;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .post-time { grid-area: time; justify-self: end; }
  .post-name-row > span:not(.verified):not(.ceo-label):not(.post-handle):not(.post-time):not(.edited-label) { display: none; }
  .edited-label { grid-column: 4 / 6; grid-row: 2; justify-self: end; }
  .post-menu-wrap { flex: 0 0 auto; }
  .post-menu { padding: 2px 0 8px 6px; }

  .post-content {
    width: calc(100% - 56px);
    max-width: calc(100% - 56px);
    margin: 8px 0 0 56px;
    min-width: 0;
  }
  .post-text {
    width: 100%;
    margin: 0 0 10px;
    font-size: 15.5px;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .post-image { border-radius: 17px; max-height: 460px; }
  .post-actions {
    width: 100%;
    margin-top: 11px;
    justify-content: space-between;
    gap: 4px;
  }
  .action-button { min-width: 42px; justify-content: flex-start; gap: 5px; }
  .action-button .action-icon { font-size: 20px; }

  .profile-banner { height: 158px; }
  .profile-settings { right: 13px; top: 13px; }
  .profile-main {
    padding: 56px 17px 17px;
    overflow: visible;
  }
  .profile-avatar {
    left: 17px !important;
    top: -45px !important;
    width: 86px !important;
    height: 86px !important;
    min-width: 86px !important;
    min-height: 86px !important;
    border-radius: 27px !important;
  }
  .profile-action-row {
    position: absolute;
    top: 12px;
    right: 14px;
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
  }
  .edit-profile,
  .logout-profile {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 11px;
    white-space: nowrap;
  }
  .profile-name-line { gap: 7px; }
  .profile-name-line h1 { font-size: 22px; line-height: 1.15; }
  .profile-role { min-height: 22px; padding: 4px 8px; font-size: 9px; }
  .profile-handle { margin: 4px 0 0; font-size: 12px; }
  .profile-bio { margin: 15px 0 14px; font-size: 14px; }
  .profile-stats {
    gap: 15px;
    flex-wrap: wrap;
  }
  .profile-stats button { gap: 4px; }
  .profile-stats strong { font-size: 13px; }
  .profile-stats span { font-size: 10px; }
  .profile-posts-heading { min-height: 48px; padding: 0 16px; }

  .mobile-nav {
    left: 8px;
    right: 8px;
    height: 66px;
    bottom: calc(7px + env(safe-area-inset-bottom));
    border-radius: 22px;
  }
  .mobile-nav-item { height: 56px; }
  .mobile-nav-item small { font-size: 9px; }
  .center-create span { width: 46px; height: 46px; }
}

@media (max-width: 390px) {
  .mobile-header { padding: 0 9px; }
  .mobile-header-actions { gap: 4px; }
  .mobile-language { width: 52px; padding: 0 5px; }
  .mobile-theme { width: 44px; padding: 0 5px; }
  .post-name { max-width: 118px; }
  .post-handle { max-width: 135px; }
  .post-card { padding-left: 11px; padding-right: 11px; }
  .post-content { width: calc(100% - 54px); max-width: calc(100% - 54px); margin-left: 54px; }
  .profile-action-row { right: 10px; gap: 5px; }
  .edit-profile, .logout-profile { padding-left: 10px; padding-right: 10px; }
}

/* Marki mobile v2 — single-column, touch-friendly layout */
@media (max-width: 700px) {
  :root { --mobile-gutter: 14px; }

  body { min-width: 0; }
  .app-shell, .main-column, .page { width: 100%; max-width: 100%; min-width: 0; }

  /* Keep the app header compact and prevent controls from squeezing the logo. */
  .mobile-header { position: sticky; top: 0; z-index: 120; }
  .logo-button { flex: 1 1 auto; overflow: hidden; }
  .logo-button b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-header-actions { max-width: 68%; }

  /* Four feed tabs remain reachable without crushing their labels. */
  .feed-tabs { padding-inline: 6px; overscroll-behavior-x: contain; }
  .feed-tab { flex: 0 0 auto; min-width: max-content; padding-inline: 18px; }

  /* Post card: avatar, identity and menu occupy one clean row. */
  .post-card {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    column-gap: 10px;
    padding: 14px var(--mobile-gutter) 13px;
  }
  .post-head {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 38px;
    gap: 10px;
    align-items: start;
  }
  .post-head > .clan-avatar {
    grid-column: 1;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 15px;
  }
  .post-meta { grid-column: 2; width: 100%; overflow: visible; }
  .post-menu-wrap { grid-column: 3; justify-self: end; align-self: start; }
  .post-menu { width: 38px; min-height: 44px; display: grid; place-items: center; padding: 0; }

  /* Do not use the desktop identity grid on a narrow screen. */
  .post-name-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 6px;
    width: 100%;
    min-width: 0;
  }
  .post-name {
    order: 1;
    max-width: min(48vw, 190px);
    min-width: 0;
    font-size: 15px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .post-name-row .verified { order: 2; flex: 0 0 auto; }
  .post-name-row .ceo-label {
    order: 3;
    flex: 0 0 auto;
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .post-handle {
    order: 10;
    flex: 1 1 auto;
    max-width: calc(100% - 58px);
    font-size: 11px;
    line-height: 1.25;
  }
  .post-time { order: 11; margin-left: auto; font-size: 11px; }
  .edited-label { order: 12; font-size: 10px; }
  .post-name-row > span:not(.verified):not(.ceo-label):not(.post-handle):not(.post-time):not(.edited-label) { display: none; }

  /* Body gets all available width and never overlaps the identity row. */
  .post-content {
    grid-column: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 8px 0 0;
  }
  .post-text {
    max-width: 100%;
    font-size: 16px;
    line-height: 1.46;
    overflow-wrap: anywhere;
    word-break: normal;
  }
  .post-image { width: 100%; height: auto; max-height: 72vh; }
  .post-actions {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding-left: 58px;
    gap: 4px;
  }
  .action-button {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
    justify-content: center;
    border-radius: 12px;
  }

  /* Profile controls stay in one row and never overlap the name. */
  .profile-main { padding-top: 62px; }
  .profile-action-row {
    position: static;
    width: 100%;
    margin: 0 0 17px;
    padding-left: 102px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .profile-action-row .edit-profile,
  .profile-action-row .logout-profile,
  .edit-profile,
  .logout-profile {
    position: static !important;
    min-height: 44px;
    padding: 9px 13px;
  }
  .profile-name-line { width: 100%; min-width: 0; }
  .profile-name-line h1 { min-width: 0; overflow-wrap: anywhere; }
  .profile-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .profile-stats button { min-width: 0; flex-wrap: wrap; }

  /* Comments: readable actions and form on small screens. */
  .comments-section { padding: 16px var(--mobile-gutter) 22px; }
  .comment-row { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; }
  .comment-actions { flex-wrap: wrap; gap: 6px 12px; }
  .comment-actions button { min-height: 36px; padding: 6px 0; font-size: 11px; }
  .comment-form { grid-template-columns: 1fr; }
  .comment-form input { min-height: 48px; font-size: 16px; }
  .comment-form button { min-height: 48px; width: 100%; }

  /* Bottom navigation does not cover the final post/comment. */
  .main-column { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .mobile-nav { z-index: 150; }
  .mobile-nav-item { min-width: 48px; min-height: 56px; }
}

@media (max-width: 380px) {
  .mobile-header-actions .header-action:first-child { display: none; }
  .mobile-language { width: 50px; }
  .feed-tab { padding-inline: 14px; }
  .post-card { grid-template-columns: 44px minmax(0, 1fr); column-gap: 9px; }
  .post-head { grid-template-columns: 44px minmax(0, 1fr) 34px; gap: 9px; }
  .post-head > .clan-avatar { width: 44px; height: 44px; min-width: 44px; }
  .post-actions { padding-left: 53px; }
  .post-name { max-width: 42vw; }
  .profile-action-row { padding-left: 94px; }
}

/* Marki mobile usability final pass */
@media (max-width: 720px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

  .feed-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow: visible !important;
    padding-inline: 12px !important;
  }
  .feed-tab { min-width: 0 !important; width: 100%; }

  .post-card {
    display: grid !important;
    grid-template-columns: 54px minmax(0, 1fr) !important;
    column-gap: 12px !important;
    padding: 16px 14px !important;
    overflow: hidden !important;
  }
  .post-head {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 54px minmax(0,1fr) 42px !important;
    gap: 12px !important;
    align-items: start !important;
    min-width: 0 !important;
  }
  .post-head > .clan-avatar, .post-head > .user-avatar, .post-head > .avatar { grid-column: 1 !important; }
  .post-meta { grid-column: 2 !important; min-width: 0 !important; }
  .post-name-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 3px 6px !important;
    min-width: 0 !important;
    line-height: 1.25 !important;
  }
  .post-name { max-width: 100% !important; white-space: normal !important; overflow-wrap: anywhere !important; font-size: 16px !important; }
  .post-handle, .post-time, .edited-label { font-size: 13px !important; color: var(--muted) !important; }
  .post-menu-wrap { grid-column: 3 !important; justify-self: end !important; position: relative !important; }
  .post-menu { width: 42px !important; height: 42px !important; }
  .post-content, .post-actions { grid-column: 2 / -1 !important; min-width: 0 !important; }
  .post-content { margin-top: 8px !important; }
  .post-text { font-size: 17px !important; line-height: 1.48 !important; overflow-wrap: anywhere !important; }
  .post-actions { margin-top: 12px !important; display: grid !important; grid-template-columns: repeat(4, 1fr) !important; }
  .action-button { min-width: 44px !important; min-height: 44px !important; }

  .modal-backdrop { z-index: 1000 !important; padding: 0 !important; align-items: stretch !important; }
  .modal-backdrop .composer-modal,
  .modal-backdrop .detail-modal,
  #listModal .small-modal {
    width: 100% !important;
    max-width: none !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    overflow: auto !important;
  }
  .modal-head {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
    min-height: 58px !important;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px !important;
    background: color-mix(in srgb, var(--panel) 94%, transparent) !important;
    backdrop-filter: blur(18px) !important;
  }
  .modal-close, .mobile-back-button {
    width: 46px !important;
    height: 46px !important;
    display: inline-grid !important;
    place-items: center !important;
    border-radius: 50% !important;
    font-size: 26px !important;
    color: var(--text) !important;
    background: transparent !important;
  }
  body.modal-open .mobile-nav { display: none !important; }

  #listModalContent { padding: 8px 14px calc(24px + env(safe-area-inset-bottom)) !important; }
  .person-row { min-height: 72px !important; padding: 10px 4px !important; grid-template-columns: 48px minmax(0,1fr) auto !important; }
  .person-copy { min-width: 0 !important; }
  .person-copy strong, .person-copy span { overflow-wrap: anywhere !important; }
  .person-actions .follow-btn { min-height: 42px !important; padding: 0 14px !important; }

  .messages-layout { min-height: calc(100dvh - 150px) !important; }
  .messages-layout.chat-open .conversation-list { display: none !important; }
  .messages-layout:not(.chat-open) .chat-panel { display: none !important; }
  .messages-layout.chat-open .chat-panel { display: grid !important; position: fixed !important; inset: 0 !important; z-index: 1000 !important; min-height: 100dvh !important; height: 100dvh !important; }
  .chat-head { display: grid !important; grid-template-columns: 48px minmax(0,1fr) !important; align-items: center !important; gap: 6px !important; padding: calc(8px + env(safe-area-inset-top)) 10px 8px !important; }
  .chat-head .user-link { min-width: 0 !important; }
  .chat-messages { max-height: none !important; padding-bottom: 18px !important; }
  .chat-form { padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important; }

  .comments-section { padding: 20px 16px calc(30px + env(safe-area-inset-bottom)) !important; }
  .comment-row { grid-template-columns: 42px minmax(0,1fr) !important; gap: 10px !important; }
  .comment-copy { min-width: 0 !important; }
  .comment-copy p { overflow-wrap: anywhere !important; }
  .comment-actions { display: flex !important; flex-wrap: wrap !important; gap: 4px 12px !important; }
  .comment-actions button { min-height: 38px !important; }
  .comment-form { position: sticky !important; bottom: 0 !important; z-index: 4 !important; background: var(--panel) !important; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)) !important; }

  .mobile-nav { z-index: 300 !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important; }
  .screen { padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }
}
