/* ═══════════════════════════════════════════════════════════
   X-VARE DESIGN SYSTEM v2
   Палитра: тёмный фон + кислотно-зелёный акцент
   Шрифты: системный стек (без Google Fonts — CSP / офлайн)
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0B0E14;
  --bg-elevated: #11151F;
  --bg-card: #151A26;
  --border: #232938;
  --border-light: #2E3548;
  --text: #F2F4F8;
  --text-dim: #9099AC;
  --text-faint: #5A6478;
  --accent: #7CFF6B;
  --accent-dim: #5AD24C;
  --accent-glow: rgba(124, 255, 107, 0.15);
  --blue: #6B8BFF;
  --blue-dim: rgba(107, 139, 255, 0.15);
  --red: #FF6B7C;
  --red-dim: rgba(255, 107, 124, 0.15);
  --radius: 14px;
  --radius-sm: 8px;
  --font-display: "Segoe UI", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  overflow-x: clip;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem; /* 15px @ 16px root — scales with browser/OS zoom */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  min-height: 100vh;
  min-height: 100dvh;
}
body.menu-open { overflow: hidden; touch-action: none; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-glow); color: var(--accent); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 .5em;
  letter-spacing: -0.02em;
}
p { margin: 0 0 1em; color: var(--text-dim); }
.mono { font-family: var(--font-mono); }

/* ─── Layout ──────────────────────────────────────────── */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(14px, 3vw, 24px); }

/* ─── Navbar ──────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px clamp(14px, 3vw, 24px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--text);
  min-width: 0;
}
.logo-img { height: 28px; width: auto; display: block; }
.nav-links { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 14px; font-weight: 500; transition: all .15s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--bg-elevated); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--border-light); flex-shrink: 0;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 22px; cursor: pointer; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .menu-toggle { display: block; padding: 6px 8px; line-height: 1; }
  .navbar-inner { padding: 12px 14px; gap: 10px; }
  .nav-right { gap: 8px; }
  .nav-right .btn-sm { padding: 6px 10px; font-size: 12px; }
  .logo-img { height: 28px; }
}

.sidebar {
  position: fixed; top: 0; right: -280px; width: 260px; height: 100vh;
  background: var(--bg-elevated); border-left: 1px solid var(--border);
  z-index: 200; padding: 80px 20px 20px; transition: right .25s ease;
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar.active { right: 0; }
.sidebar a { padding: 12px 14px; border-radius: var(--radius-sm); color: var(--text-dim); }
.sidebar a:hover { background: var(--bg-card); color: var(--text); }
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 150; opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.overlay.active { opacity: 1; pointer-events: all; }

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
}
.btn-primary { background: var(--accent); color: #07140A; }
.btn-primary:hover { background: var(--accent-dim); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border-light); color: var(--text); }
.btn-ghost:hover { background: var(--bg-elevated); border-color: var(--accent-dim); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ─── Cards ───────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }

/* ─── Forms ───────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-dim); margin-bottom: 7px; }
.field-label-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 7px;
}
.field-label-row label { margin-bottom: 0; }
.field-link { font-size: 12px; color: var(--accent); white-space: nowrap; }
.field-link:hover { text-decoration: underline; }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; background: var(--bg-elevated);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-body); font-size: 14px; transition: border-color .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent-dim); }
.field textarea { resize: vertical; min-height: 90px; }
.code-input { text-align: center; font-size: 28px; letter-spacing: 14px; font-family: var(--font-mono); }

/* Password reveal */
.password-wrap { position: relative; }
.password-wrap input {
  width: 100%; padding: 12px 46px 12px 14px; background: var(--bg-elevated);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-body); font-size: 14px; transition: border-color .15s ease;
}
.password-wrap input:focus { outline: none; border-color: var(--accent-dim); }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-faint); cursor: pointer;
  display: grid; place-items: center; padding: 0;
  transition: color .15s, background .15s;
}
.password-toggle:hover { color: var(--text); background: rgba(255,255,255,.04); }
.password-toggle[aria-pressed="true"] { color: var(--accent); }
.password-toggle svg { width: 18px; height: 18px; display: block; }

/* ─── Alerts ──────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px; }
.alert-error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,107,124,.3); }
.alert-success { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(124,255,107,.3); }

/* ─── Auth pages ──────────────────────────────────────── */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(124,255,107,.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(107,139,255,.06), transparent 40%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px; }
.auth-card h1 { font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.35rem); text-align: center; }
.auth-subtitle { text-align: center; color: var(--text-faint); font-size: 13px; margin-bottom: 28px; }
.auth-links { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-faint); }
.auth-links a { color: var(--accent); }
.auth-links span { margin: 0 8px; color: var(--border-light); }

/* ─── Hero ────────────────────────────────────────────── */
.hero {
  padding: clamp(48px, 8vh, 80px) 0 clamp(40px, 6vh, 64px);
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -140px; left: 50%; transform: translateX(-50%);
  width: min(640px, 90vw); height: 400px;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 100px;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--accent); font-family: var(--font-mono); font-size: 0.75rem; margin-bottom: 20px;
}
.hero-eyebrow .pulse {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(124,255,107,.5); }
  70% { box-shadow: 0 0 0 10px rgba(124,255,107,0); }
  100% { box-shadow: 0 0 0 0 rgba(124,255,107,0); }
}
.hero h1 {
  /* Was up to 58px — too large at 125–150% OS scale */
  font-size: clamp(1.75rem, 1.35rem + 2vw, 2.75rem);
  line-height: 1.12;
  max-width: 36rem;
  margin: 0 auto 16px;
}
.hero h1 .accent { color: var(--accent); }
.hero p.lead {
  max-width: 32rem; margin: 0 auto 28px;
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
}
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.scramble { font-family: var(--font-mono); }

/* ─── Section ─────────────────────────────────────────── */
.section { padding: clamp(40px, 6vw, 64px) 0; }
.section-head { margin-bottom: clamp(24px, 4vw, 36px); text-align: center; }
.section-head h2 { font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem); }
.section-head p { max-width: 32rem; margin: 0 auto; }

/* ─── Grid ────────────────────────────────────────────── */
.grid { display: grid; gap: clamp(14px, 2vw, 20px); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) and (min-width: 641px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ─── Feature card ────────────────────────────────────── */
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: border-color .2s ease, transform .2s ease;
}
.feature-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--accent-glow); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 14px;
}
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { font-size: 13.5px; margin: 0; }

/* ─── News slider ─────────────────────────────────────── */
.news-slider { position: relative; margin: 40px 0; }
.news-track-wrap { overflow: hidden; border-radius: var(--radius); }
.news-track { display: flex; transition: transform .4s ease; }
.news-slide {
  min-width: 100%; position: relative; height: 320px;
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end;
}
.news-slide::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent 60%);
}
.news-slide-content { position: relative; padding: 28px; z-index: 1; }
.news-slide-content h3 { font-size: 22px; margin-bottom: 6px; }
.news-slide-content p { color: #D8DCE6; font-size: 14px; margin: 0; }
.slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(11,14,20,.7); border: 1px solid var(--border-light); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; backdrop-filter: blur(6px);
}
.slider-arrow.left { left: 12px; }
.slider-arrow.right { right: 12px; }
.slider-arrow:hover { border-color: var(--accent); color: var(--accent); }

/* ─── News list ───────────────────────────────────────── */
.news-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-date { color: var(--text-faint); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; }
.news-item h4 { font-size: 15px; margin-bottom: 4px; }
.news-item p { font-size: 13.5px; margin: 0; }

/* ─── Footer ──────────────────────────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 60px; color: var(--text-faint); font-size: 13px; text-align: center; }

/* ─── Product cards (market) ──────────────────────────── */
.product-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.product-card h3 { font-size: 16px; margin: 0; }
.product-price { font-family: var(--font-mono); font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem); color: var(--accent); font-weight: 600; }
.product-badge { display: inline-block; padding: 3px 10px; border-radius: 100px; background: var(--blue-dim); color: var(--blue); font-size: 11px; font-weight: 600; width: fit-content; }

/* ─── Profile ─────────────────────────────────────────── */
.profile-header { display: flex; gap: 24px; align-items: center; padding: 32px 0; flex-wrap: wrap; }
.profile-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border-light); }
.profile-stats { display: flex; gap: 24px; margin-top: 10px; }
.profile-stat { font-size: 13px; color: var(--text-dim); }
.profile-stat b { color: var(--text); font-family: var(--font-mono); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab { padding: 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--text-faint); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── VPN ─────────────────────────────────────────────── */
.vpn-stat-bar { height: 8px; background: var(--bg-elevated); border-radius: 100px; overflow: hidden; margin: 10px 0; }
.vpn-stat-fill { height: 100%; background: var(--accent); border-radius: 100px; }
.server-pill { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--bg-elevated); border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 13.5px; }

/* ─── XHE page specific ───────────────────────────────── */
.xhe-module { display: flex; gap: 18px; padding: 22px 0; border-bottom: 1px solid var(--border); }
.xhe-module:last-child { border-bottom: none; }
.xhe-module-code { font-family: var(--font-mono); color: var(--accent); font-size: 13px; flex-shrink: 0; width: 70px; }
.xhe-table { width: 100%; border-collapse: collapse; margin: 24px 0; }
.xhe-table th, .xhe-table td { padding: 12px 16px; text-align: left; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.xhe-table th { color: var(--text-faint); font-weight: 500; font-family: var(--font-mono); font-size: 12px; }
.xhe-table .no { color: var(--accent); font-weight: 600; }

.theme-toggle { display: none; }

/* ─── Chat modal ──────────────────────────────────────── */
.chat-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 400; align-items: center; justify-content: center;
}
.chat-modal-content {
  width: 100%; max-width: 420px; height: 600px; max-height: 85vh;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.chat-header img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.chat-header .chat-close { margin-left: auto; background: none; border: none; color: var(--text-faint); font-size: 18px; cursor: pointer; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px 44px; display: flex; flex-direction: column; gap: 8px; }
.chat-bubble {
  max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.4;
  word-wrap: break-word;
}
.chat-bubble.mine { align-self: flex-end; background: var(--accent); color: #07140A; border-bottom-right-radius: 4px; }
.chat-bubble.theirs { align-self: flex-start; background: var(--bg-elevated); border-bottom-left-radius: 4px; }
.chat-bubble img { max-width: 100%; border-radius: 8px; margin-bottom: 4px; }
.chat-input-area { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-input-area input[type=text] {
  flex: 1; padding: 10px 14px; background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 100px; color: var(--text); font-size: 13.5px;
}
.chat-input-area input[type=text]:focus { outline: none; border-color: var(--accent-dim); }


@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ─── Remove accent hover animation outside XHE ─────── */
.hero h1 .accent { color: var(--accent); }

/* ─── Animations ─────────────────────────────────────── */
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.animate-modal { animation: modalIn .22s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.animate-fadein { animation: fadein .28s ease both; }

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* mobile rules consolidated at end of file */

/* ─── Market group ────────────────────────────────────── */
.market-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--bg-card);
  margin-bottom: 24px;
}
.market-group-header {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: var(--text); margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.market-group .product-card { background: var(--bg-elevated); }

/* ─── Modal overlay ──────────────────────────────────── */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  width: 100vw !important;
  height: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  z-index: 950;
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.65);
  box-sizing: border-box;
  overflow: hidden;
  overscroll-behavior: contain;
  margin: 0 !important;
  inset: auto; /* overridden by top/left/right/bottom above */
}
.modal-overlay.is-open {
  display: flex !important;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  width: min(440px, 100%);
  max-height: min(90vh, 90dvh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  overscroll-behavior: contain;
  margin: auto;
}
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
html.modal-open,
body.modal-open {
  overflow: hidden !important;
}
body.modal-open .support-fab,
body.modal-open .support-panel {
  visibility: hidden !important;
  pointer-events: none !important;
}
.xhe-table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 24px 0; border-radius: var(--radius); border: 1px solid var(--border);
}
.xhe-table-wrap .xhe-table { margin: 0; border: none; min-width: 480px; }

/* ─── Context menu ────────────────────────────────────── */
.ctx-item { display:flex; align-items:center; gap:8px; padding:8px 12px; border-radius:var(--radius-sm); font-size:13px; cursor:pointer; color:var(--text-dim); transition:all .12s; }
.ctx-item:hover { background:var(--bg-elevated); color:var(--text); }
.ctx-item-danger:hover { background:var(--red-dim); color:var(--red); }

/* ─── Chat close button ─────────────────────────────── */
.chat-close-btn { background:none; border:none; color:var(--text-faint); font-size:18px; cursor:pointer; line-height:1; padding:4px; border-radius:6px; transition:color .15s; }
.chat-close-btn:hover { color:var(--text); }

/* ─── Online dot ─────────────────────────────────────── */
.online-dot { position:absolute; bottom:3px; right:3px; width:11px; height:11px; border-radius:50%; background:var(--text-faint); border:2px solid var(--bg-card); transition:background .3s; }
.online-dot.online { background:var(--accent); }
.online-dot-lg { position:absolute; bottom:4px; right:4px; width:14px; height:14px; border-radius:50%; background:var(--text-faint); border:2px solid var(--bg-card); }
.online-dot-lg.online { background:var(--accent); }

/* ─── Pinned bubble ─────────────────────────────────── */
.chat-bubble.pinned { border: 1px solid var(--accent-dim); box-shadow: inset 0 0 0 1px var(--accent-glow); }
.chat-bubble .bubble-time { font-size:10px; opacity:.6; margin-top:4px; text-align:right; display:flex; gap:4px; justify-content:flex-end; align-items:center; }
.chat-bubble .reply-preview {
  font-size:12px; border-left:3px solid var(--accent); padding:6px 8px; margin-bottom:6px;
  background: rgba(0,0,0,.12); border-radius: 0 8px 8px 0; cursor:pointer;
}
.reply-preview-label { font-size:10px; color:var(--accent); font-weight:600; margin-bottom:2px; }
.reply-preview-text { opacity:.85; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:220px; }

/* ─── Feed / social ─────────────────────────────────── */
.feed-wrap { max-width: 680px; }
.feed-head { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:24px; flex-wrap:wrap; }
.feed-title { margin:0; font-family:var(--font-display); font-size:clamp(1.35rem, 1.2rem + 0.8vw, 1.75rem); letter-spacing:-.02em; }
.feed-sub { margin:6px 0 0; color:var(--text-faint); font-size:13px; }
.card-soft {
  background: var(--bg-card); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px 20px; margin-bottom:14px;
}
.feed-composer-title { font-weight:600; margin-bottom:10px; }
.feed-composer textarea, .new-post-form textarea {
  width:100%; min-height:88px; resize:vertical; padding:12px 14px;
  background:var(--bg-elevated); border:1px solid var(--border-light); border-radius:var(--radius-sm);
  color:var(--text); font:inherit; line-height:1.55; white-space:pre-wrap;
}
.feed-composer textarea:focus, .new-post-form textarea:focus { outline:none; border-color:var(--accent-dim); box-shadow:0 0 0 3px var(--accent-glow); }
.feed-composer-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:12px; flex-wrap:wrap; }
.feed-attach { display:inline-flex; align-items:center; gap:8px; }
.feed-attach-name { font-size:12px; color:var(--text-faint); max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.feed-list { display:flex; flex-direction:column; gap:4px; }
.feed-post { position: relative; }
.feed-post-head {
  margin-bottom:12px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.feed-author { display:flex; gap:12px; align-items:center; min-width:0; flex:1; }
.wall-post-top {
  display:flex;
  justify-content:flex-end;
  margin: -4px -4px 6px 0;
  min-height: 28px;
}
.post-more { position: relative; flex-shrink: 0; }
.post-more-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  color: var(--text-faint); font-size: 20px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.post-more-btn:hover, .post-more-btn[aria-expanded="true"] {
  background: var(--bg-elevated); border-color: var(--border); color: var(--text);
}
.post-more-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40;
  min-width: 160px; padding: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.post-more-menu[hidden] { display: none !important; }
.post-more-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--text);
  padding: 10px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px;
}
.post-more-item:hover { background: var(--bg-elevated); color: var(--accent); }
.feed-post.is-share-focus {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-glow);
  transition: box-shadow .25s ease;
}
.share-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  z-index: 2000; opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 100px;
  background: rgba(20,24,32,.92); border: 1px solid var(--border);
  color: var(--text); font-size: 13px;
  transition: opacity .2s ease, transform .2s ease;
}
.share-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.profile-share-fab {
  display: none;
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--accent);
  font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.profile-share-fab:hover { border-color: var(--accent-dim); }
.profile-share-desktop { display: inline-flex; }
.feed-avatar { width:42px; height:42px; border-radius:50%; object-fit:cover; border:2px solid var(--border-light); }
.feed-author-name { font-weight:600; font-size:14px; }
.feed-meta { font-size:11px; color:var(--text-faint); margin-top:2px; }
.feed-post-body, .wall-post-body {
  white-space: pre-wrap; word-break: break-word; line-height:1.65; margin-bottom:12px; color:var(--text);
}
.feed-post-media {
  position: relative;
  margin: 0 -4px 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.feed-post-media img {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  opacity: 1;
  transition: opacity .2s ease;
  cursor: zoom-in;
}
.feed-post-media.is-loading {
  aspect-ratio: 4 / 3;
  max-height: 480px;
}
.feed-post-media.is-loading img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  cursor: default;
}
.feed-post-media.is-loading::after,
.bubble-media.is-loading::after,
.support-msg-media:has(img.is-loading)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
  z-index: 1;
  pointer-events: none;
}
.bubble-media {
  position: relative;
  display: block;
  margin: 2px 0 6px;
  border-radius: 12px;
  overflow: hidden;
  max-width: min(270px, 100%);
  background: rgba(0, 0, 0, .1);
}
.bubble-media.is-loading {
  min-width: 140px;
  min-height: 120px;
  aspect-ratio: 4 / 3;
}
.bubble-media.is-loading .bubble-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}
.bubble-media .bubble-img {
  display: block;
  max-width: 100%;
  max-height: 40vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-in;
  margin: 0;
  opacity: 1;
  transition: opacity .2s ease;
}
.feed-post-actions { display:flex; gap:8px; padding-top:4px; border-top:1px solid transparent; }
.react-btn {
  display:inline-flex; align-items:center; gap:7px; padding:8px 12px; border-radius:999px;
  background:var(--bg-elevated); border:1px solid var(--border-light); color:var(--text-dim);
  font-size:12.5px; font-weight:500; cursor:pointer; transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.react-btn .ico { width:16px; height:16px; flex-shrink:0; }
.react-btn:hover { border-color:var(--accent-dim); color:var(--text); transform: translateY(-1px); }
.react-btn.is-like { background:rgba(124,255,107,.12); border-color:var(--accent-dim); color:var(--accent); }
.react-btn.is-dislike { background:var(--red-dim); border-color:rgba(255,107,124,.35); color:var(--red); }
.feed-comments { margin-top:14px; padding-top:14px; border-top:1px solid var(--border); }
.feed-comment { display:flex; gap:10px; margin-bottom:12px; }
.feed-comment.is-reply { margin-left:28px; margin-top:8px; padding-left:10px; border-left:2px solid var(--border); }
.feed-comment-av { width:32px; height:32px; border-radius:50%; object-fit:cover; flex-shrink:0; }
.feed-comment-main { flex:1; min-width:0; }
.feed-comment-name { font-weight:600; font-size:13px; color:var(--accent); }
.feed-comment-body { font-size:13.5px; line-height:1.5; white-space:pre-wrap; word-break:break-word; margin:4px 0; }
.feed-comment-actions { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:4px; }
.feed-comment-actions .react-btn { padding:4px 8px; font-size:12px; }
.feed-comment-replies-toggle {
  background:none; border:0; color:var(--accent); font-size:12px; cursor:pointer; padding:4px 6px; font-weight:600;
}
.feed-comment-replies-toggle:hover { text-decoration: underline; }
.feed-comment-reply-btn {
  background:none; border:0; color:var(--text-faint); font-size:12px; cursor:pointer; padding:4px 6px;
}
.feed-comment-reply-btn:hover { color:var(--accent); }
.feed-comment { cursor: pointer; }
.feed-comment .feed-comment-name,
.feed-comment .react-btn,
.feed-comment .feed-comment-replies-toggle { cursor: pointer; }
.feed-comment-reply-form { display:flex; gap:8px; margin-top:8px; }
.feed-comment-reply-form[hidden] { display:none !important; }
.feed-comment-reply-form input {
  flex:1; min-width:0; padding:8px 10px; border-radius:10px;
  border:1px solid var(--border-light); background:var(--bg-elevated); color:var(--text); font:inherit; font-size:13px;
}
.feed-comment-replies { margin-top:4px; }
.feed-comment-replies[hidden] { display:none !important; }
.feed-comment-form { display:flex; gap:8px; margin-top:8px; }
.feed-comment-form input {
  flex:1; padding:10px 12px; border-radius:999px; border:1px solid var(--border-light);
  background:var(--bg-elevated); color:var(--text); font:inherit;
}
.feed-comments-empty { font-size:13px; color:var(--text-faint); padding:8px 0; }
.feed-msg { font-size:13px; margin-top:10px; }
.feed-msg.err { color:var(--red); }
.empty-feed { text-align:center; padding:40px 20px; }
.empty-feed h3 { margin:0 0 8px; }
.wall-post { margin-bottom:12px; }
.wall-post-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.wall-post-date { font-size:12px; color:var(--text-faint); }

/* ─── Chat UX v2 ─────────────────────────────────────── */
.chat-overlay { backdrop-filter: blur(6px); }
.chat-shell {
  width: 100%;
  max-width: 440px;
  height: min(720px, 92vh);
  background: linear-gradient(180deg, #171c28 0%, var(--bg-card) 40%);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
}
.chat-bubble.decrypt-fail .bubble-text { opacity: .75; font-style: italic; font-size: 12.5px; }
.chat-bubble.pending { opacity: .72; }

/* Settings modal — как chat-shell на десктопе */
.settings-modal-box {
  width: min(480px, 100%);
  max-width: 480px;
  height: min(720px, 92vh);
  max-height: min(720px, 92vh);
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #171c28 0%, var(--bg-card) 36%);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.settings-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
  flex-shrink: 0;
}
.settings-modal-head h3 { margin: 0; }
.settings-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 18px 18px;
}
.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}
.chat-header { display:flex; align-items:center; padding:14px 16px; border-bottom:1px solid var(--border); gap:12px; flex-shrink:0; }
.chat-header-av { width:40px; height:40px; border-radius:50%; object-fit:cover; }
.chat-header-name { font-weight:600; font-size:14px; }
.chat-header-status { font-size:11px; color:var(--text-faint); margin-top:2px; }
.chat-header-right { margin-left:auto; display:flex; align-items:center; gap:8px; }
.chat-hme-badge {
  font-family:var(--font-mono); font-size:10px; color:var(--accent);
  background:var(--accent-glow); padding:3px 8px; border-radius:999px; white-space:nowrap;
}
.chat-pinned {
  display:flex; gap:10px; align-items:center; padding:10px 14px;
  background:rgba(124,255,107,.06); border-bottom:1px solid var(--accent-dim); cursor:pointer;
}
.chat-pinned-label { font-size:10px; color:var(--accent); font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
.chat-pinned-text { font-size:12px; color:var(--text-dim); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:300px; }
.chat-reply-bar {
  display:flex; align-items:stretch; gap:0; background:var(--bg-elevated); border-bottom:1px solid var(--border);
}
.chat-reply-accent { width:3px; background:var(--accent); flex-shrink:0; }
.chat-reply-body { flex:1; padding:8px 12px; min-width:0; }
.chat-reply-label { font-size:11px; color:var(--accent); font-weight:600; }
.chat-reply-text { font-size:12px; color:var(--text-dim); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-reply-close { background:none; border:none; color:var(--text-faint); padding:0 12px; cursor:pointer; font-size:16px; }
.chat-messages { flex:1; min-height:0; overflow-y:auto; padding:16px 44px; gap:10px; display:flex; flex-direction:column; background: radial-gradient(1200px 400px at 50% -10%, rgba(124,255,107,.04), transparent); }
.chat-bubble {
  max-width:78%; padding:10px 12px 8px; border-radius:16px; font-size:14px; line-height:1.45;
  word-wrap:break-word; position:relative; box-shadow:0 2px 10px rgba(0,0,0,.12);
}
.chat-bubble.mine { background:linear-gradient(160deg, #8dff7d, var(--accent)); color:#07140A; border-bottom-right-radius:5px; }
.chat-bubble.theirs { background:var(--bg-elevated); border:1px solid var(--border); border-bottom-left-radius:5px; }
.chat-bubble.mine .reply-preview { background:rgba(0,0,0,.1); border-left-color:#0a1a08; }
.chat-bubble.mine .reply-preview-label { color:#0a1a08; }
.bubble-text { white-space:pre-wrap; word-break:break-word; }
.bubble-img { max-width:100%; border-radius:10px; }
.bubble-reactions { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.bubble-react-pill {
  font-size:12px; padding:2px 7px; border-radius:999px;
  background:rgba(0,0,0,.14); border:1px solid rgba(255,255,255,.08);
}
.chat-bubble.theirs .bubble-react-pill { background:var(--bg-card); }
.bubble-in { animation: bubbleIn .22s ease both; }
.bubble-flash { outline:2px solid var(--accent); outline-offset:2px; transition:outline .2s; }
.chat-input-area { padding:12px; gap:10px; align-items:flex-end; background:rgba(11,14,20,.65); backdrop-filter:blur(8px); }
.chat-textarea {
  flex:1; resize:none; min-height:42px; max-height:120px; padding:10px 14px;
  background:var(--bg-elevated); border:1px solid var(--border-light); border-radius:16px;
  color:var(--text); font:inherit; line-height:1.4;
}
.chat-textarea:focus { outline:none; border-color:var(--accent-dim); }
.chat-send-btn {
  width:42px; height:42px; border:none; border-radius:50%; cursor:pointer;
  background:var(--accent); color:#07140A; display:grid; place-items:center;
  transition: transform .12s, filter .12s;
}
.chat-send-btn:hover { transform:scale(1.05); filter:brightness(1.05); }
.chat-ctx {
  position: fixed;
  z-index: 1200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  min-width: 200px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.chat-ctx.is-open { display: block !important; }
.chat-react-picker {
  position: fixed;
  z-index: 1210;
  display: none;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
}
.chat-react-picker.is-open { display: flex !important; }
.chat-react-picker button {
  width: 36px; height: 36px; border: none; border-radius: 50%; background: var(--bg-elevated);
  cursor: pointer; font-size: 18px; transition: transform .12s;
}
.chat-react-picker button:hover { transform: scale(1.15); background: var(--accent-glow); }
.chat-bubble-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: var(--text-dim);
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  z-index: 2;
  flex-shrink: 0;
}
/* Свои — слева от пузыря; чужие — справа, чтобы не перекрывать текст */
.chat-bubble.mine .chat-bubble-actions {
  right: auto;
  left: -34px;
}
.chat-bubble.theirs .chat-bubble-actions {
  left: auto;
  right: -34px;
}
.chat-bubble:hover .chat-bubble-actions,
.chat-bubble.show-actions .chat-bubble-actions,
.chat-bubble:focus-within .chat-bubble-actions {
  opacity: 1;
}
.chat-bubble-actions:hover {
  background: rgba(255, 255, 255, .14);
  color: var(--text);
}
.chat-delete-modal { max-width: 340px; width: 92%; }
.chat-delete-modal h3 { margin: 0 0 8px; }
.chat-delete-hint { color: var(--text-dim); font-size: 13px; margin: 0 0 16px; }

/* ─── Motion / polish ────────────────────────────────── */
.page-enter { animation: pageEnter .38s cubic-bezier(.22,.61,.36,1) both; }
@keyframes pageEnter {
  /* opacity only — transform/filter create a containing block and break position:fixed modals */
  from { opacity: 0; }
  to { opacity: 1; }
}
.animate-rise { animation: riseIn .4s cubic-bezier(.22,.61,.36,1) both; }
@keyframes riseIn {
  from { opacity:0; transform: translateY(16px); }
  to { opacity:1; transform:none; }
}
.skeleton-line {
  height:12px; border-radius:6px; margin-bottom:8px;
  background: linear-gradient(90deg, var(--bg-elevated), var(--border), var(--bg-elevated));
  background-size:200% 100%; animation: shimmer 1.2s infinite linear;
}
.skeleton-line.short { width:55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

#page-loader {
  position:fixed; inset:0; z-index:9999; display:grid; place-items:center;
  background:rgba(11,14,20,.55); backdrop-filter:blur(4px);
  opacity:0; pointer-events:none; transition:opacity .2s;
}
#page-loader.show { opacity:1; pointer-events:auto; }
.loader-ring {
  width:42px; height:42px; border-radius:50%;
  border:3px solid var(--border-light); border-top-color:var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Photo lightbox (feed / posts) ───────────────────────── */
.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(72, 78, 90, 0.72);
  backdrop-filter: blur(2px);
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.photo-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}
.photo-lightbox[hidden] { display: none !important; }
.photo-lightbox-img {
  max-width: min(96vw, 1200px);
  max-height: min(92vh, 92dvh);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  cursor: default;
  animation: modalIn .2s ease;
  background: rgba(0, 0, 0, .15);
}
.photo-lightbox-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top, 0px));
  left: max(14px, env(safe-area-inset-left, 0px));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(20, 24, 32, .55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.photo-lightbox-close:hover { background: rgba(20, 24, 32, .75); }
.photo-lightbox-menu-wrap {
  position: absolute;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 2;
}
.photo-lightbox-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(20, 24, 32, .55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.photo-lightbox-menu-btn:hover,
.photo-lightbox-menu-btn[aria-expanded="true"] {
  background: rgba(20, 24, 32, .75);
}
.photo-lightbox-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  display: none;
}
.photo-lightbox-menu.is-open { display: block; }
.photo-lightbox-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.photo-lightbox-menu button:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}
.photo-lightbox-toast {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 24, 32, .88);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 3;
}
.photo-lightbox-toast.is-show { opacity: 1; }

body.nav-leaving main, body.nav-leaving .section, body.nav-leaving .page-enter {
  opacity:.35; transition: opacity .18s ease;
}

/* Support FAB + panel */
.support-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 850;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-card, var(--bg-elevated));
  color: var(--accent);
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .25s ease, opacity .25s ease, bottom .25s ease;
}
.support-fab:hover { transform: scale(1.05); }
.support-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(.9);
}
.support-panel {
  position: fixed;
  right: 28px;
  bottom: 96px;
  z-index: 860;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100dvh - 120px));
  max-height: min(560px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--bg-card, var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 56px rgba(0,0,0,.42);
  overflow: hidden;
}
.support-panel[hidden] { display: none !important; }
.support-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(124,255,107,.06), transparent);
}
.support-panel-head b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}
.support-panel-sub {
  font-size: 12px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}
.support-panel-sub .pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
.support-panel-close {
  width: 34px; height: 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
}
.support-panel-close:hover { color: var(--text); border-color: var(--accent-dim); }
.support-panel-msgs {
  flex: 1;
  overflow: auto;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(124,255,107,.04), transparent 40%),
    var(--bg);
}
.support-panel-empty {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.5;
  padding: 24px 12px;
  max-width: 240px;
}
.support-panel .support-msg,
.support-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}
.support-panel .support-msg.user,
.support-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #07140A;
  border: none;
  border-bottom-right-radius: 4px;
}
.support-panel .support-msg.user .support-msg-meta,
.support-msg.user .support-msg-meta { color: rgba(7,20,10,.55); }
.support-panel .support-msg.staff,
.support-msg.staff {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--text);
}
.support-msg-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; }
.support-panel-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: rgba(11,14,20,.72);
  backdrop-filter: blur(10px);
}
.support-composer {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.support-composer:focus-within {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.support-composer textarea {
  flex: 1;
  width: 100%;
  min-height: 24px;
  max-height: 120px;
  resize: none;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px 0 !important;
  margin: 0;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  outline: none;
}
.support-composer textarea::placeholder { color: var(--text-faint); }
.support-attach-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color .15s, border-color .15s, background .15s;
}
.support-attach-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.support-attach-btn svg { width: 18px; height: 18px; display: block; }
.support-attach-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.support-attach-preview[hidden] { display: none !important; }
.support-attach-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}
.support-attach-clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg);
  color: var(--text-dim);
  cursor: pointer;
  line-height: 1;
  font-size: 16px;
}
.support-msg-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.support-msg-media {
  position: relative;
  margin: 0;
  display: inline-block;
  max-width: min(260px, 100%);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, .12);
}
.support-msg-media:has(img.is-loading) {
  min-width: 140px;
  min-height: 120px;
  aspect-ratio: 4 / 3;
}
.support-msg-img {
  display: block;
  max-width: min(260px, 100%);
  max-height: 40vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  cursor: zoom-in;
  background: transparent;
  opacity: 1;
  transition: opacity .2s ease;
}
.support-msg-img.is-loading {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}
.support-msg-media.is-error {
  font-size: 12px;
  color: var(--text-faint);
  padding: 6px 0;
}
.support-panel .support-msg.user .support-msg-media.is-error {
  color: rgba(7, 20, 10, .55);
}
.support-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.support-lightbox[hidden] { display: none !important; }
.support-lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}
.support-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.support-send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #07140A;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .15s, background .15s, opacity .15s;
}
.support-send-btn:hover { background: var(--accent-dim); transform: scale(1.04); }
.support-send-btn:disabled { opacity: .45; cursor: default; transform: none; }
.support-send-btn svg { width: 18px; height: 18px; display: block; }
/* ═══════════════════════════════════════════════════════════
   MOBILE / TABLET RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .card, .card-soft { padding: 16px; border-radius: 12px; }
  .section { padding: 36px 0; }
  .section-head { margin-bottom: 20px; }
  .section-head h2 { font-size: 1.35rem; }
  .hero { padding: 40px 0 28px; }
  .hero h1 { font-size: clamp(1.5rem, 1.2rem + 2.5vw, 2rem); }
  .hero p.lead { font-size: 0.95rem; margin-bottom: 20px; }
  .hero-actions .btn { flex: 1 1 auto; min-width: 140px; }
  .auth-screen { padding: 24px 14px; align-items: flex-start; min-height: 100dvh; }
  .auth-card { padding: 24px 18px; border-radius: 14px; margin-top: 24px; }
  /* iOS: prevent auto-zoom on focus */
  .field input, .field textarea, .field select,
  input, textarea, select {
    font-size: 16px !important;
  }
  .code-input {
    font-size: 20px !important;
    letter-spacing: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .creator-stock-row { flex-wrap: wrap; }
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 8px 12px; font-size: 12.5px; }

  .tabs {
    overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }

  .news-slide { height: 200px; }
  .news-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .news-date { white-space: normal; }

  .profile-header-card {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
  }
  .profile-header-inner {
    flex-direction: column !important;
    align-items: center !important;
  }
  .profile-header-bg-overlay {
    background: linear-gradient(180deg,
      rgba(11,14,20,.55) 0%,
      rgba(11,14,20,.88) 55%,
      rgba(11,14,20,.95) 100%) !important;
  }
  .profile-header-actions {
    margin-left: 0 !important;
    align-self: stretch !important;
    flex-direction: row !important;
    justify-content: center;
    flex-wrap: wrap;
  }
  .profile-share-desktop { display: none !important; }
  .profile-share-fab { display: inline-flex !important; align-items: center; justify-content: center; }
  /* На чужом профиле на мобилке в шапке остаётся только скрытая desktop-кнопка — убираем пустой блок */
  .profile-header-actions:not(:has(button:not(.profile-share-desktop))) {
    display: none !important;
  }
  .profile-info { text-align: center; width: 100%; }
  .profile-stats { justify-content: center; flex-wrap: wrap; }
  .profile-bg-item { justify-content: center; }
  .friend-card, .purchase-card {
    flex-wrap: wrap; gap: 10px;
  }
  .friend-card { flex-direction: column; align-items: stretch; }
  .friend-card .friend-actions,
  .friend-card > div:last-child { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .friend-card .btn { flex: 1 1 auto; }

  .feed-title { font-size: 1.35rem; }
  .feed-head { align-items: flex-start; }
  .feed-meta { word-break: break-word; overflow-wrap: anywhere; }
  .feed-author { min-width: 0; }
  .feed-author > div { min-width: 0; }
  .feed-comment-form { flex-wrap: wrap; }
  .feed-comment-form input { flex: 1 1 100%; min-width: 0; }
  .feed-comment-form .btn { width: 100%; }
  .feed-composer-row { flex-direction: column; align-items: stretch; }
  .feed-composer-row .btn { width: 100%; }

  /* Mobile modals — overlay size comes from JS pinToScreen (viewport) */
  .modal-overlay.is-open {
    display: flex !important;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    padding: 0 !important;
    background: rgba(0, 0, 0, 0.62) !important;
    overflow: hidden !important;
  }
  .modal-overlay.is-open:has(.chat-shell),
  .modal-overlay.is-open:has(.chat-modal-content),
  .modal-overlay.is-open:has(.settings-modal-box) {
    justify-content: stretch;
    background: var(--bg) !important;
  }

  .modal-overlay.is-open > .modal-box:not(.chat-shell):not(.chat-modal-content):not(.settings-modal-box),
  .modal-overlay.is-open > .card,
  .modal-overlay.is-open > .promo-success-box,
  .modal-overlay.is-open > .chat-delete-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: min(88dvh, 100%) !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-shadow: 0 -8px 40px rgba(0,0,0,.35) !important;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    animation: none !important;
    transform: none !important;
  }

  .modal-overlay.is-open > .chat-shell,
  .modal-overlay.is-open > .chat-modal-content,
  .modal-overlay.is-open > .settings-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: none !important;
    transform: none !important;
    background: var(--bg-card) !important;
  }

  .settings-modal-head {
    padding: max(14px, env(safe-area-inset-top, 0px)) 16px 10px !important;
  }
  .settings-modal-body {
    padding: 0 16px max(16px, env(safe-area-inset-bottom, 0px)) !important;
  }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }

  .chat-hme-badge { display: none; }
  .chat-pinned-text { max-width: 55vw; }
  .reply-preview-text { max-width: 46vw; }
  .chat-header {
    flex-shrink: 0 !important;
    padding: max(12px, env(safe-area-inset-top, 0px)) 14px 12px !important;
  }
  .chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-left: 40px !important;
    padding-right: 40px !important;
  }
  .chat-input-area {
    flex-shrink: 0 !important;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom, 0px)) !important;
  }
  .chat-bubble-actions { opacity: 0.85; }
  .chat-ctx, .chat-react-picker {
    z-index: 1300 !important;
    max-width: calc(100vw - 24px);
  }

  .settings-tabs {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .settings-tab-btn { white-space: nowrap; flex-shrink: 0; }
  .settings-email-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .avatar-change-area { flex-direction: column; align-items: center; text-align: center; }
  body.modal-open { overflow: hidden !important; }
  html.modal-open { overflow: hidden !important; }

  .market-promo-bar,
  .market-group-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .market-promo-bar .btn,
  .enterprise-cta { width: 100%; }
  .product-card .btn { width: 100%; }

  .support-fab {
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    width: 52px; height: 52px;
  }
  .support-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(78dvh, 640px);
    max-height: min(78dvh, 640px);
    border-radius: 18px 18px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .support-panel-form {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .support-msg-img {
    max-width: 100%;
    max-height: 40vh;
  }
  .support-attach-btn {
    width: 40px;
    height: 40px;
  }

  .admin-subnav { width: 100%; }
  .admin-subnav .btn { flex: 1 1 calc(50% - 6px); justify-content: center; }
  .admin-page-head { flex-direction: column; align-items: stretch !important; }
  .admin-search-wrap { width: 100%; margin-left: 0 !important; }
  .admin-search-wrap input { width: 100% !important; max-width: none !important; }
  .admin-user-card { flex-direction: column; align-items: stretch !important; }
  .admin-user-actions { width: 100%; }
  .admin-user-actions .btn { flex: 1 1 calc(50% - 4px); min-width: 120px; justify-content: center; }

  #actionMsg, #resolveMsg {
    left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    width: auto !important;
  }

  .sidebar {
    width: min(300px, 86vw);
    right: calc(-1 * min(300px, 86vw));
    padding-top: max(72px, env(safe-area-inset-top, 0px) + 56px);
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  }
  .footer { padding: 28px 0; font-size: 12px; }
}

@media (max-width: 400px) {
  .nav-right > .btn-ghost.btn-sm { display: none; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
}

/* Windows 125–150% zoom: keep density readable without oversized hero */
@media (min-width: 641px) and (max-height: 800px) {
  .hero { padding: 40px 0 32px; }
  .section { padding: 40px 0; }
}
