/* max-comments — мини-приложение комментариев. Светлое, сдержанное: это чат, а не лендинг.
   Фирменное: градиент #6DB5F9 → #BB5EED только на главных действиях; крупные радиусы; Inter (если есть в системе). */
:root {
  --brand-a: #6DB5F9;
  --brand-b: #BB5EED;
  --brand: linear-gradient(135deg, var(--brand-a) 0%, var(--brand-b) 100%);
  --ink: #16181d;
  --ink-2: #4a4f5c;
  --ink-3: #8a8f9c;
  --line: #eceef3;
  --bg: #f6f7fb;
  --card: #ffffff;
  --mine: #f4efff;
  --accent: #7a6cf0;
  --danger: #e5484d;
  --ok: #2fa36b;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(22, 24, 29, .04), 0 4px 16px rgba(22, 24, 29, .05);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* иначе display:flex/block у классов перебивает атрибут hidden */
html, body { margin: 0; height: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.center { text-align: center; }

.app { display: flex; flex-direction: column; height: 100dvh; max-width: 720px; margin: 0 auto; position: relative; }

/* шапка */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 12px 10px 16px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 3;
}
.topbar::after { /* тонкая фирменная полоска */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); opacity: .55;
}
.topbar__titles { flex: 1; min-width: 0; }
.topbar__title { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.topbar__count { color: var(--ink-3); font-weight: 500; }
.topbar__sub { margin: 1px 0 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__sub:empty { display: none; }

.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:active { background: var(--line); }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.offline { background: #fff6e5; color: #8a5a00; font-size: 13px; text-align: center; padding: 6px 12px; }

.scroller { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.screen { padding: 12px 12px 16px; }
.screen--center { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; }

/* скелетон */
.skeleton { background: linear-gradient(90deg, #eef0f5 0%, #f7f8fb 50%, #eef0f5 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: var(--r-md); margin: 0 0 12px; }
.skeleton--post { height: 110px; border-radius: var(--r-lg); }
.skeleton--row { height: 64px; }
.skeleton--row.short { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* служебные экраны */
.msg-icon { width: 72px; height: 72px; border-radius: 24px; background: var(--brand); display: grid; place-items: center; font-size: 34px; margin-bottom: 18px; box-shadow: 0 8px 24px rgba(187, 94, 237, .25); }
.msg-title { margin: 0 0 8px; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.msg-text { margin: 0 0 22px; color: var(--ink-2); max-width: 320px; }
.msg-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }

/* кнопки */
.btn { border: 0; border-radius: var(--r-md); padding: 13px 18px; font-weight: 600; font-size: 15px; }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(122, 108, 240, .25); }
.btn--primary:active { filter: brightness(.95); transform: translateY(1px); }
.btn--secondary { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--danger { background: #fff; color: var(--danger); box-shadow: inset 0 0 0 1.5px #f6d4d5; }
.btn--sm { padding: 9px 14px; font-size: 14px; border-radius: 12px; }
.btn--block { display: block; width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { border: 0; background: none; padding: 6px 0 0; color: var(--accent); font-weight: 600; font-size: 14px; }

/* баннер «включите уведомления» */
.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border-radius: var(--r-lg); padding: 14px 10px 14px 14px; margin-bottom: 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.banner::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.banner__icon { font-size: 22px; line-height: 1; padding-top: 2px; }
.banner__body { flex: 1; min-width: 0; }
.banner__title { margin: 0 0 2px; font-weight: 650; }
.banner__text { margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }

/* пост */
.post { background: var(--card); border-radius: var(--r-lg); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.post__label { margin: 0 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; display: inline-block; }
.post__text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.post__text.clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* лента */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.c { display: flex; gap: 10px; padding: 10px 10px 8px; border-radius: var(--r-md); background: var(--card); transition: background-color .6s ease; }
.c--mine { background: var(--mine); }
.c--flash { background: #fff4d6; }
.c__avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: 13px; }
.c__main { flex: 1; min-width: 0; }
.c__head { display: flex; align-items: baseline; gap: 8px; }
.c__name { font-weight: 620; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c__time { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.c__quote { display: block; width: 100%; text-align: left; border: 0; margin: 4px 0 2px; padding: 4px 8px; border-radius: 8px; background: rgba(122, 108, 240, .08); border-left: 3px solid var(--accent); font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c__quote b { color: var(--accent); font-weight: 600; }
.c__text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.c__actions { display: flex; align-items: center; gap: 2px; margin: 4px 0 0 -8px; }
.act { border: 0; background: none; padding: 6px 8px; border-radius: 10px; font-size: 13px; font-weight: 550; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; min-height: 32px; }
.act:active { background: var(--line); }
.act--liked { color: #e0457b; }
.act svg { width: 16px; height: 16px; }
.act--more { margin-left: auto; }

.empty { text-align: center; padding: 40px 16px 24px; }
.empty__art { width: 64px; height: 64px; border-radius: 22px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, rgba(109, 181, 249, .18), rgba(187, 94, 237, .18)); }
.empty__title { margin: 0 0 4px; font-weight: 650; font-size: 16px; }
.empty__text { margin: 0 auto; color: var(--ink-2); max-width: 300px; font-size: 14px; }

.new-pill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(84px + var(--safe-b)); z-index: 4; border: 0; border-radius: 999px; padding: 8px 14px; background: var(--brand); color: #fff; font-weight: 600; font-size: 13px; box-shadow: 0 6px 18px rgba(122, 108, 240, .3); }

/* поле ввода */
.composer { background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-b)); z-index: 3; }
.composer__row { display: flex; align-items: flex-end; gap: 8px; }
.composer__input { flex: 1; resize: none; border: 1.5px solid var(--line); border-radius: 20px; padding: 10px 14px; font: 16px/1.35 var(--font); color: var(--ink); background: #fff; max-height: 140px; outline: none; }
.composer__input:focus { border-color: #c9c2fb; }
.send-btn { flex: 0 0 42px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; }
.send-btn[disabled] { background: #e3e5ec; }
.send-btn svg { width: 20px; height: 20px; }
.char-left { margin: 4px 6px 0; font-size: 12px; color: var(--ink-3); text-align: right; }
.char-left.over { color: var(--danger); }
.blocked-note { margin: 2px 4px 8px; font-size: 13px; color: var(--danger); }
.reply-chip { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 6px 6px 10px; border-radius: 12px; background: rgba(122, 108, 240, .08); border-left: 3px solid var(--accent); }
.reply-chip__body { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-chip__who { color: var(--accent); font-weight: 600; margin-right: 6px; }
.reply-chip__text { color: var(--ink-2); }

.toast { position: absolute; left: 12px; right: 12px; bottom: calc(80px + var(--safe-b)); z-index: 6; background: #1e2028; color: #fff; padding: 11px 14px; border-radius: 14px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }

/* нижний лист */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15, 17, 22, .35); z-index: 8; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 720px; margin: 0 auto; z-index: 9; background: #fff; border-radius: 22px 22px 0 0; padding: 8px 16px calc(16px + var(--safe-b)); max-height: 80dvh; overflow-y: auto; box-shadow: 0 -8px 30px rgba(0, 0, 0, .12); }
.sheet__grip { width: 40px; height: 4px; border-radius: 4px; background: #dfe1e8; margin: 0 auto 10px; }
.sheet__title { margin: 0 0 10px; font-size: 16px; font-weight: 650; }
.sheet__body { display: flex; flex-direction: column; gap: 8px; }
.sheet__body p { margin: 0; color: var(--ink-2); font-size: 14px; }
.sheet__body a { color: var(--accent); }
.row-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row-item__name { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
