:root {
  --blue: #0B4A75;
  --blue-dark: #08334F;
  --blue-hover: #0E5384;
  --gold: #E3B04B;
  --bg: #EEF3F7;
  --card: #FFFFFF;
  --line: #D3DEE8;
  --soft: #DCE8F1;
  --soft-2: #E4EDF4;
  --text: #16232F;
  --muted: #4A5C6B;
  --danger: #A32020;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { line-height: 1.25; }
.sr { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--muted); font-size: 14px; }
svg { width: 24px; height: 24px; flex: 0 0 auto; }
.inline-ico { width: 14px; height: 14px; vertical-align: -2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--blue); text-decoration: none !important; }
.brand .logo { width: 40px; height: 40px; border-radius: 20px; background: var(--blue); color: var(--gold); display: flex; align-items: center; justify-content: center; }
.brand .logo svg { width: 24px; height: 24px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: .01em; }
.search { flex: 1 1 240px; max-width: 420px; }
.search input { width: 100%; height: 44px; border-radius: 22px; border: 1px solid transparent; background: var(--bg); padding: 0 18px; font-size: 15px; color: var(--text); }
.search input:focus { border-color: var(--blue); background: #fff; }
.spacer { flex: 1 1 0; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 22px; border: 0; border-radius: 22px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none !important; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost { background: var(--soft-2); color: var(--blue); }
.btn-ghost:hover { background: var(--soft); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }
.linklike { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 14px; color: var(--blue); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 600; color: #3A4D5C; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=url], input[type=search], select, textarea {
  width: 100%; border: 1px solid #B9CAD8; border-radius: 8px; padding: 10px 12px; font: inherit; font-size: 15px; color: var(--text); background: #fff; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=url], select { height: 44px; padding-top: 0; padding-bottom: 0; }
input:disabled { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.4; color: #3A4D5C; margin: 4px 0 14px; }
.check input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; }
.form-msg { margin: 10px 0 0; font-size: 14px; min-height: 1em; color: var(--muted); }
.form-msg.is-ok { color: #1E6B3A; font-weight: 600; }
.form-msg.is-error { color: var(--danger); font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.join-form .btn, .side-card .btn { width: 100%; }
.side-card .row .btn { width: auto; flex: 1 1 auto; }

/* layout */
.shell { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 24px; padding: 24px; max-width: 1440px; margin: 0 auto; }
.nav { flex: 1 1 240px; max-width: 280px; min-width: 220px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 76px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 48px; border-radius: 10px; font-weight: 500; color: var(--text); text-decoration: none !important; }
.nav-item:hover { background: var(--soft); }
.nav-item.is-active { background: var(--soft); color: var(--blue); font-weight: 600; }
.nav-item.is-soon { color: var(--muted); cursor: default; }
.nav-item.is-soon:hover { background: transparent; }
.nav-item span { flex: 1 1 auto; }
.pill { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--soft-2); padding: 3px 8px; border-radius: 10px; }
.feed { flex: 999 1 560px; min-width: 0; max-width: 680px; display: flex; flex-direction: column; gap: 16px; }
.shell-narrow .feed { max-width: 760px; }
.side { flex: 1 1 280px; max-width: 320px; min-width: 260px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.side-card { padding: 20px; }
.side-card h2 { margin: 0 0 8px; font-size: 18px; color: var(--blue); }
.side-card p { margin: 0 0 12px; font-size: 15px; color: #3A4D5C; }
.follow { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; margin-top: 8px; border-radius: 10px; background: var(--bg); font-weight: 600; font-size: 15px; color: var(--text); text-decoration: none !important; }
.follow:hover { background: var(--soft); }
.follow span { flex: 1 1 auto; }
.follow small { font-weight: 500; color: var(--muted); font-size: 13px; }
.phases { display: flex; flex-direction: column; }
.phase-link { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--text); font-size: 15px; text-decoration: none !important; }
.phase-link:hover { color: var(--blue); }
.phase-link.is-active { font-weight: 700; color: var(--blue); }
.phase-link .dot { width: 10px; height: 10px; border-radius: 5px; background: #7FA3BF; }
.phase-link.is-active .dot { background: var(--blue); }

/* hero & headings */
.hero { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%); color: #fff; border-radius: 12px; padding: 28px; }
.hero .eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.hero h1 { margin: 10px 0; font-size: 30px; }
.hero p { margin: 0; color: #D5E3EE; }
.page-head h1 { margin: 0; font-size: 26px; color: var(--blue); }
.page-head p { margin: 2px 0 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.prose { padding: 28px; }
.prose h1 { margin-top: 0; color: var(--blue); }
.prose p { margin: 0 0 14px; }

/* posts */
.post-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 8px; }
.avatar { width: 44px; height: 44px; border-radius: 22px; background: var(--blue); color: var(--gold); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.avatar svg { width: 26px; height: 26px; }
.avatar.sm { width: 36px; height: 36px; font-weight: 700; font-size: 15px; color: #fff; }
.post-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.tag { font-size: 13px; font-weight: 600; background: var(--soft-2); color: var(--blue); padding: 4px 10px; border-radius: 12px; }
.post-title { margin: 4px 16px 0; font-size: 22px; }
.post-title a { color: var(--text); }
.post-body { padding: 8px 16px 12px; }
.post-body p { margin: 0 0 12px; overflow-wrap: anywhere; }
.post-body p:last-child { margin-bottom: 0; }
.more { font-weight: 600; }
.media img { display: block; width: 100%; height: auto; max-height: 640px; object-fit: cover; }
.video { position: relative; margin: 0 16px 12px; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--blue-dark); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media + .video { margin-top: 12px; }
.lockbox { display: flex; gap: 12px; align-items: center; margin: 0 16px 16px; padding: 14px; background: var(--bg); border-radius: 10px; font-size: 15px; }
.lockbox svg { width: 22px; height: 22px; color: var(--blue); }
.counts { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 14px; color: var(--muted); }
.counts a { color: var(--muted); }
.actions { display: flex; gap: 4px; margin: 0 16px; padding: 4px 0 4px; border-top: 1px solid var(--line); }
.actions + * { margin-top: 0; }
.post > .actions { margin-bottom: 12px; }
.act { flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: none !important; }
.act svg { width: 20px; height: 20px; }
.act:hover { background: var(--soft-2); }
.act.is-on { color: var(--blue); }
.act.is-on svg { fill: var(--blue); }
.pager { display: flex; justify-content: space-between; }

/* comments */
.comments { padding: 20px 16px; }
.comments h2 { margin: 0 0 12px; font-size: 18px; color: var(--blue); }
.comment-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.bubble { background: var(--bg); border-radius: 14px; padding: 8px 14px; min-width: 0; }
.bubble p { margin: 2px 0 0; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form .btn { align-self: flex-end; }
.comment-login { margin: 0; }

/* auth + admin */
.auth-card { padding: 28px; max-width: 520px; margin: 0 auto; width: 100%; }
.auth-card h1 { margin-top: 0; color: var(--blue); }
.auth-card hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.admin { padding: 24px; }
.admin h1 { margin-top: 0; color: var(--blue); }
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.admin-nav a:not(.btn) { padding: 10px 14px; border-radius: 10px; font-weight: 600; background: var(--soft-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; }
.stat strong { font-size: 24px; color: var(--blue); }
.stat span { font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

.footer { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 24px; color: var(--muted); font-size: 14px; }

@media (max-width: 900px) {
  .topbar { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .brand-name { font-size: 18px; }
  .search { order: 5; flex: 1 1 100%; max-width: none; }
  .spacer { display: none; }
  .shell { padding: 12px; gap: 16px; }
  .nav { position: static; flex: 1 1 100%; max-width: none; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-item { flex: 0 0 auto; height: 44px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 0 16px; }
  .nav-item.is-active { background: var(--blue); color: #fff; border-color: var(--blue); }
  .nav-item svg { display: none; }
  .nav-item .pill { display: none; }
  .feed, .side { flex: 1 1 100%; max-width: none; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 24px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* v2: avatars, composer, gallery, profiles */
[hidden] { display: none !important; }
.avatar { overflow: hidden; font-weight: 700; }
.avatar.has-img { background: var(--soft); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 36px; height: 36px; }
.avatar.xs { width: 26px; height: 26px; font-size: 12px; color: #fff; }
.avatar.xs svg { width: 16px; height: 16px; }
.avatar.xl { width: 96px; height: 96px; border-radius: 48px; font-size: 38px; color: #fff; }
.avatar-link { display: block; flex: 0 0 auto; text-decoration: none !important; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--blue-dark); background: var(--gold); padding: 2px 7px; border-radius: 8px; vertical-align: middle; }
.author { font-weight: 700; color: var(--text); }
.muted-link { color: var(--muted); }
.as-link { text-decoration: none; }
.fine { font-size: 13px; color: var(--muted); }
.me-btn { display: inline-flex; align-items: center; gap: 8px; }
.del-post { margin-left: auto; color: var(--danger); }

.composer { padding: 14px 16px; }
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-trigger { flex: 1 1 auto; text-align: left; min-height: 44px; padding: 0 16px; border: 0; border-radius: 22px; background: var(--bg); font: inherit; font-size: 16px; color: var(--muted); cursor: pointer; display: flex; align-items: center; }
.composer-trigger:hover { background: var(--soft-2); }
.composer-open { margin-top: 12px; }
.composer-open textarea { width: 100%; font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; min-height: 96px; }
.composer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.composer-bar .spacer { flex: 1 1 auto; }
.photo-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.photo-btn svg { width: 20px; height: 20px; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preview { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--soft); }
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }

.gallery { display: grid; gap: 3px; margin: 4px 0 12px; }
.gallery a { display: block; overflow: hidden; background: var(--soft); }
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery.g1 img { height: auto; max-height: 640px; }
.gallery.g2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.gallery.g3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.gallery.g3 a:first-child { grid-row: 1 / 3; }
.gallery.g4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; }

.profile-head { display: flex; align-items: center; gap: 18px; padding: 20px; }
.profile-info h1 { margin: 0 0 4px; font-size: 24px; }
.profile-info p { margin: 0 0 10px; }
.avatar-edit { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.thumb img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; display: block; }
.inline-form { display: inline; margin-right: 10px; }

/* v3: share popup, header share, link cards */
.share-top { height: 36px; padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; }
.share-top svg { width: 18px; height: 18px; }
.linkcard { display: block; margin: 4px 16px 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--text); text-decoration: none !important; background: var(--bg); }
.linkcard:hover { border-color: var(--blue); }
.linkcard img { display: block; width: 100%; max-height: 300px; object-fit: cover; }
.lc-text { display: block; padding: 10px 14px 12px; }
.lc-text > * { display: block; }
.lc-host { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.lc-desc { font-size: 14px; color: var(--muted); margin-top: 2px; }

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(8, 25, 38, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { width: 100%; max-width: 440px; background: var(--card); border-radius: 14px; padding: 18px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-x { width: 36px; height: 36px; border: 0; border-radius: 18px; background: var(--soft-2); font-size: 22px; line-height: 1; cursor: pointer; color: var(--text); }
.share-preview { display: flex; gap: 12px; align-items: center; padding: 10px; background: var(--bg); border-radius: 10px; margin-bottom: 14px; }
.share-preview img { width: 88px; height: 58px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.share-preview div { display: flex; flex-direction: column; min-width: 0; }
.share-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.share-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; text-decoration: none !important; }
.share-opt:hover { background: var(--soft-2); }
.sdot { width: 38px; height: 38px; border-radius: 19px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 17px; }
.s-wa { background: #25D366; } .s-fb { background: #1877F2; } .s-x { background: #000; } .s-tg { background: #2AABEE; } .s-em { background: var(--blue); } .s-more { background: var(--muted); }
.share-copy { display: flex; gap: 8px; }
.share-copy input { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14px; background: var(--bg); }
@media (max-width: 700px) { .share-top span { display: none; } .share-top { padding: 0 10px; } }
.modal-open { overflow: hidden; }
.share-copy .btn { white-space: nowrap; }

/* v4: profiles */
.rank { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--blue); background: var(--soft); padding: 2px 7px; border-radius: 8px; vertical-align: middle; }
.auth-card.wide { max-width: 640px; }
.auth-card h3 { margin: 22px 0 4px; font-size: 17px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.field legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
fieldset.field .check { margin: 0 0 8px; }
.field textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; }
.at { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.at span { padding: 0 4px 0 12px; color: var(--muted); font-size: 16px; }
.at input { border: 0 !important; box-shadow: none !important; flex: 1 1 auto; min-width: 0; padding-left: 0 !important; background: transparent; }
.auth-card input[type=file] { font: inherit; font-size: 14px; max-width: 100%; margin-bottom: 8px; }
.auth-card input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: 8px 14px; border: 0; border-radius: 18px; background: var(--soft-2); color: var(--blue); cursor: pointer; }
.profile-head { align-items: flex-start; }
.profile-info { min-width: 0; }
.bio { margin: 0 0 10px; font-size: 16px; overflow-wrap: anywhere; }
.facts { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.facts span { display: inline-block; min-width: 92px; color: var(--muted); }
.socs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.soc { font-size: 14px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 16px; color: var(--text); text-decoration: none !important; background: var(--bg); overflow-wrap: anywhere; }
.soc:hover { border-color: var(--blue); }
.soc strong { color: var(--blue); margin-right: 4px; }
@media (max-width: 560px) { .profile-head { flex-direction: column; align-items: center; text-align: center; } .facts span { display: block; min-width: 0; } }

/* v5: member card, welcome */
.avatar.lg { width: 56px; height: 56px; border-radius: 28px; font-size: 22px; color: #fff; }
.me-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.me-id { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.me-id .author { font-size: 17px; overflow-wrap: anywhere; }
.me-bio { margin: 0 0 8px; font-size: 15px; overflow-wrap: anywhere; }
.welcome { background: var(--soft-2); border-radius: 12px; padding: 16px 18px; margin-bottom: 20px; }
.welcome h1 { margin: 0 0 6px !important; font-size: 22px; }
.welcome p { margin: 0; }
