/* HolyPoem 2.0 — стилі. Кольори як на старому сайті: кораловий → фіолетовий → синій */
:root {
  --coral: #d86a65;
  --plum: #935c95;
  --navy: #1e5a84;
  --grad: linear-gradient(90deg, var(--coral), var(--plum) 55%, var(--navy));
  --accent: #935c95;
  --accent-ink: #7a4580;
  --accent-soft: rgba(147, 92, 149, .1);
  --bg: #f6f1f7;
  --surface: #ffffff;
  --surface-2: #faf7fb;
  --ink: #241d29;
  --ink-2: #5d5463;
  --ink-3: #8c8292;
  --line: #ebe3ee;
  --warn-bg: #fff4e0;
  --warn-ink: #8a5a00;
  --danger: #c2413b;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 30, 70, .05), 0 4px 18px rgba(60, 30, 70, .06);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --poem-size: 19px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #c99bcb; --accent-ink: #dcb7de; --accent-soft: rgba(201, 155, 203, .14);
    --bg: #141118; --surface: #1e1a23; --surface-2: #26212c;
    --ink: #eee8f1; --ink-2: #bdb3c3; --ink-3: #8f8696; --line: #332c3a;
    --warn-bg: #3a2c12; --warn-ink: #f4c46b; --danger: #ef7a73;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #c99bcb; --accent-ink: #dcb7de; --accent-soft: rgba(201, 155, 203, .14);
  --bg: #141118; --surface: #1e1a23; --surface-2: #26212c;
  --ink: #eee8f1; --ink-2: #bdb3c3; --ink-3: #8f8696; --line: #332c3a;
  --warn-bg: #3a2c12; --warn-ink: #f4c46b; --danger: #ef7a73;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); overflow-x: hidden; }
a { color: var(--accent-ink); text-decoration: none; }
a { transition: color .15s, opacity .15s; }
a:hover { text-decoration: none; }
a:not([class]):hover { color: var(--accent); }
.crumbs a:hover, .has-cover a:hover { color: inherit; opacity: .75; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.sr-only, .hp-trap { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.ico { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s, transform .1s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 34px; padding: 5px 13px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #1b1320; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #1b1320; } }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.btn-light { background: rgba(255, 255, 255, .95); color: var(--plum); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: inherit; cursor: pointer; position: relative; flex: none; }
.icon-btn:hover { background: rgba(127, 127, 127, .14); text-decoration: none; }
.icon-btn .ico { width: 21px; height: 21px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink-3); cursor: pointer; font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
.link-btn:hover { color: var(--accent-ink); }
.link-btn.danger:hover { color: var(--danger); }

/* ---------- Шапка ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--grad); color: #fff; box-shadow: 0 2px 14px rgba(70, 30, 80, .18); }
.topbar-in { display: flex; align-items: center; gap: 14px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: inherit; font-weight: 700; letter-spacing: .06em; font-size: 18px; text-decoration: none !important; flex: none; }
.brand-logo { width: 32px; height: 32px; }
.topbar .brand { color: #fff; }
.mainnav { display: flex; gap: 2px; }
.mainnav a { color: rgba(255, 255, 255, .9); padding: 8px 12px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.mainnav a:hover, .mainnav a[aria-current] { background: rgba(255, 255, 255, .16); color: #fff; text-decoration: none; }
.search { position: relative; flex: 1; max-width: 360px; margin-left: auto; min-width: 180px; }
.search input { width: 100%; height: 40px; border-radius: 999px; border: 0; padding: 0 14px 0 38px; background: rgba(255, 255, 255, .95); color: #241d29; }
.search input::placeholder { color: #8c8292; }
.search-ico { position: absolute; left: 13px; top: 11px; color: #8c8292; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.top-actions .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.top-actions .btn-ghost:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.menu-btn, .search-toggle { display: none; }
.bell .dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #fff; color: var(--plum); font-size: 11px; font-weight: 700; line-height: 17px; }
.avatar-btn { border: 2px solid rgba(255, 255, 255, .55); border-radius: 50%; padding: 0; background: none; cursor: pointer; display: flex; margin-left: 4px; }
.avatar-btn { position: relative; }
.ava-badge { display: none; position: absolute; top: -4px; right: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: #e5484d; color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; text-align: center; box-shadow: 0 0 0 2px var(--plum); }
.menu-count { margin-left: auto; background: #e5484d; color: #fff; }
.avatar-btn .avatar { width: 32px !important; height: 32px !important; font-size: 13px !important; }

/* підказки пошуку */
.suggest { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; z-index: 60; }
.suggest h4 { margin: 0; padding: 8px 14px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.suggest a { display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--ink); }
.suggest a:hover, .suggest a.active { background: var(--accent-soft); text-decoration: none; }
.suggest a small { color: var(--ink-3); display: block; }
.suggest img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.suggest .all { justify-content: center; color: var(--accent-ink); font-weight: 600; border-top: 1px solid var(--line); }

/* меню користувача */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: 48px; min-width: 230px; background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; background: none; border: 0; color: var(--ink); cursor: pointer; text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--accent-soft); text-decoration: none; }
.dropdown-menu a.dd-head { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; margin-bottom: 4px; }
.dd-head > span { min-width: 0; }
.dd-head strong, .dd-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-head small { color: var(--ink-3); }

/* бокове меню (телефон) */
.drawer { position: fixed; inset: 0; z-index: 90; background: rgba(20, 10, 25, .45); }
.drawer-panel { position: absolute; left: 0; top: 0; bottom: 0; width: min(300px, 85vw); background: var(--surface); padding: 12px; overflow-y: auto; box-shadow: var(--shadow); animation: slideIn .2s ease; }
@keyframes slideIn { from { transform: translateX(-100%); } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.drawer-head .brand { color: var(--plum); }
.drawer-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 10px; color: var(--ink); font-weight: 500; }
.drawer-nav a:hover, .drawer-nav a[aria-current] { background: var(--accent-soft); text-decoration: none; }

/* ---------- Розкладка ---------- */
.main { padding-top: 22px; padding-bottom: 40px; min-height: 60vh; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.content { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; scrollbar-width: thin; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title { font-size: 19px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card-head .card-title { margin: 0; }
.count { display: inline-block; min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; text-align: center; }
.more { font-weight: 600; font-size: 14px; display: inline-block; margin-top: 10px; }
.card-head .more { margin: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 600; vertical-align: middle; }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }

/* ---------- Головна ---------- */
.hero { text-align: center; padding: 26px 0 30px; }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 5vw, 42px); margin-bottom: 8px; }
.hero p { color: var(--ink-2); margin: 0 auto 18px; max-width: 560px; }
.hero-search { display: flex; align-items: center; gap: 8px; max-width: 620px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 5px 5px 16px; box-shadow: var(--shadow); }
.hero-search > .ico { color: var(--ink-3); }
.hero-search input { flex: 1; min-width: 0; border: 0; background: transparent; height: 40px; outline: none; }
.hero-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }

/* ---------- Чіпи, сегменти, фільтри ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip img { border-radius: 2px; }
.chip .ico { width: 14px; height: 14px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-item { padding: 6px 13px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.seg-item:hover { color: var(--accent-ink); text-decoration: none; }
.seg-item.on { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(60, 30, 70, .12); font-weight: 600; }
.seg-sm .seg-item { padding: 4px 10px; font-size: 13px; }
.filters { display: flex; flex-direction: column; gap: 12px; }
.filters .chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters .chips::-webkit-scrollbar { display: none; }
.filters .chips .chip { flex: none; }
.filters-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.select select, .field select { appearance: none; height: 40px; padding: 0 36px 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238c8292' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; cursor: pointer; max-width: 100%; }
.field select { border-radius: var(--radius-sm); width: 100%; }

/* ---------- Картки віршів ---------- */
.plist { display: flex; flex-direction: column; gap: 10px; }
[data-popular] { transition: opacity .15s; }
.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
.pcard { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; transition: border-color .15s, box-shadow .15s; position: relative; }
.pcard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow); }
.pcard.is-hidden { opacity: .65; }
.pcard-body { flex: 1; min-width: 0; }
.pcard-title { font-size: 17px; font-weight: 600; margin: 0 0 1px; font-family: var(--serif); }
.pcard-title a { color: var(--ink); }
.pcard-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.pcard-title a:hover { text-decoration: none; color: var(--accent-ink); }
.pcard-author { position: relative; z-index: 1; font-size: 14px; color: var(--accent-ink); }
.pcard-ex { margin: 6px 0 0; color: var(--ink-2); font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.5; }
.pcard-ava { position: relative; z-index: 1; }
.pcard-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.views { display: inline-flex; gap: 4px; align-items: center; }
.views .ico { width: 15px; height: 15px; }
.pcard-compact { border: 0; padding: 9px 4px; border-radius: 10px; background: transparent; gap: 12px; align-items: center; }
.pcard-compact:hover { box-shadow: none; background: var(--accent-soft); }
.pcard-compact .pcard-title { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-compact .pcard-author { font-size: 13px; }
.plist-side { gap: 0; }

/* аватари */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; background: var(--surface-2); }
.avatar-text { align-items: center; justify-content: center; color: #fff; font-weight: 700; background: hsl(var(--h, 290) 38% 52%); }
.authors-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.author-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 92px; flex: none; text-align: center; color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.3; }
.author-chip .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent-soft); transition: box-shadow .15s; }
.author-chip:hover { text-decoration: none; color: var(--accent-ink); }
.author-chip:hover .avatar { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }

/* бокова колонка тем */
.theme-list { list-style: none; margin: 0 -8px; padding: 0; }
.theme-list a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px; border-radius: 9px; color: var(--ink); font-size: 14.5px; }
.theme-list a:hover, .theme-list a[aria-current] { background: var(--accent-soft); text-decoration: none; color: var(--accent-ink); }

/* ---------- Заголовки сторінок ---------- */
.page-head { margin-bottom: 4px; }
.page-head.has-cover { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 260px; overflow: hidden; background: linear-gradient(0deg, rgba(25, 10, 30, .72), rgba(25, 10, 30, .12)), var(--cover) center / cover; color: #fff; border-radius: var(--radius); padding: 20px 22px; }
.page-head.has-cover h1 { overflow: hidden; text-overflow: ellipsis; }
.page-head.has-cover .muted { margin: 0; }
.intro-below { margin: -4px 0 0; }
.cover-edit { position: absolute; top: 12px; right: 12px; background: rgba(255, 255, 255, .9); color: var(--plum); }
.theme-preview { display: flex; align-items: flex-end; min-height: 160px; padding: 16px; border-radius: var(--radius); color: #fff; font-size: 20px;
  background: linear-gradient(0deg, rgba(25, 10, 30, .7), rgba(25, 10, 30, .1)), var(--cover); }
.page-head.has-cover .muted, .page-head.has-cover .crumbs a { color: rgba(255, 255, 255, .85); }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.flag { border-radius: 3px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.intro { color: var(--ink-2); margin-top: 6px; max-width: 760px; }
.has-cover .intro { color: rgba(255, 255, 255, .92); }
[data-clamp] { position: relative; max-height: 7.6em; overflow: hidden; }
[data-clamp].clamped { -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent); }
[data-clamp].open { max-height: none; -webkit-mask-image: none; mask-image: none; }
.read-more { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 0; border: 0; background: none; color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.read-more:hover { color: var(--accent); }
.has-cover .read-more { color: #fff; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.crumbs a + a::before { content: "›"; margin-right: 6px; color: var(--ink-3); }
.inline-search { position: relative; max-width: 380px; margin-top: 10px; }
.inline-search .ico { position: absolute; left: 13px; top: 11px; color: var(--ink-3); }
.inline-search input { width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px 0 38px; }

/* ---------- Вірш ---------- */
.poem-card { padding: 28px clamp(18px, 4vw, 44px); }
.poem-head { margin-bottom: 14px; }
.poem-title { font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 4.4vw, 36px); margin-bottom: 14px; }
.poem-author { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.poem-author small { display: block; color: var(--ink-3); font-size: 12px; }
.poem-author strong { color: var(--accent-ink); }
.poem-author:hover { text-decoration: none; }
.poem-tools { display: flex; gap: 4px; margin: 0 0 18px; padding: 6px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tool { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.tool:hover { background: var(--accent-soft); color: var(--accent-ink); }
/* Telegram — окремо праворуч, щоб не натиснути випадково */
.poem-tools { align-items: center; }
.tg-send { margin-left: auto; background: #229ed9; color: #fff; padding: 5px 14px; }
.tg-send:hover { background: #1b8bc2; }
.tg-send.sent { background: transparent; color: #229ed9; border-color: #229ed9; }
.tg-send.just-sent { animation: tgPop .5s ease; }
@keyframes tgPop { 50% { transform: scale(1.08); } }
.poem-image { margin: 0 0 22px; }
.poem-image img { border-radius: var(--radius-sm); display: block; width: 100%; aspect-ratio: 7 / 3; object-fit: cover; object-position: center; background: var(--surface-2); }
.poem-text { font-family: var(--serif); font-size: var(--poem-size); line-height: 1.75; white-space: normal; overflow-wrap: break-word; margin: 0 0 24px; }
.poem-extra { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0 0 18px; font-size: 14px; }
.poem-extra dt { color: var(--ink-3); display: inline; }
.poem-extra dt::after { content: ": "; }
.poem-extra dd { display: inline; margin: 0; }
.poem-tags, .translations { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.poem-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 16px; border-top: 1px solid var(--line); }
.votes { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.vote { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; height: 40px; border: 0; background: var(--surface); color: var(--ink-2); cursor: pointer; font-weight: 600; }
.vote + .vote { border-left: 1px solid var(--line); }
.vote:hover { color: var(--accent-ink); }
.vote.on { background: var(--accent-soft); color: var(--accent-ink); }
.share { position: relative; margin-left: auto; }
.share-menu { position: absolute; right: 0; bottom: 48px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; min-width: 210px; z-index: 20; }
.share-menu a, .share-menu button { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.share-menu a:hover, .share-menu button:hover { background: var(--accent-soft); text-decoration: none; }
.poem-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 16px; color: var(--ink-3); font-size: 13px; }
.poem-meta span { display: inline-flex; gap: 5px; align-items: center; }
.poem-meta .ico { width: 15px; height: 15px; }
.poem-meta .link-btn { font-size: 13px; }
.poem-meta .link-btn .ico { width: 15px; height: 15px; }

/* ---------- Коментарі ---------- */
.comment-form { display: flex; gap: 12px; margin-bottom: 18px; }
.comment-form > div { flex: 1; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
textarea, .field input, .field select { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 10px 12px; }
textarea { resize: vertical; min-height: 44px; }
textarea:focus, .field input:focus, .field select:focus, .hero-search:focus-within, .inline-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.comment-list.flat { gap: 0; padding: 6px 20px; }
.comment-list.flat > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-list.flat > li:last-child { border: 0; }
.comment { display: flex; gap: 12px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 14px; }
.comment-name { font-weight: 700; color: var(--ink); }
.comment-head time { color: var(--ink-3); font-size: 12.5px; }
.comment-text { margin-top: 3px; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 14px; margin-top: 4px; }
.answers { list-style: none; margin: 10px 0 0; padding: 0 0 0 4px; display: flex; flex-direction: column; gap: 12px; border-left: 2px solid var(--line); padding-left: 12px; }
.answers:empty { display: none; }
.reply-form { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.comment-mini time { color: var(--ink-3); font-size: 12.5px; margin-left: 8px; }
.comment-poem { font-weight: 600; }
.login-hint { background: var(--surface-2); padding: 12px 16px; border-radius: var(--radius-sm); }

/* ---------- Сітки ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 16px; }
.theme-tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 130px; padding: 14px; border-radius: var(--radius); color: #fff; overflow: hidden;
  background: linear-gradient(0deg, rgba(25, 10, 30, .8), rgba(25, 10, 30, .1)), var(--img, var(--grad)) center / cover; box-shadow: var(--shadow); transition: transform .15s; }
.theme-tile:hover { transform: translateY(-2px); text-decoration: none; }
.theme-name { font-weight: 700; font-size: 17px; line-height: 1.25; }
.theme-count { font-size: 13px; opacity: .85; }
.lang-grid, .author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 16px; }
.lang-tile, .author-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; color: var(--ink); transition: border-color .15s; }
.lang-tile img { border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.lang-tile:hover, .author-tile:hover { border-color: var(--accent); text-decoration: none; }
.author-tile strong { line-height: 1.3; }
.author-tile .muted { font-size: 13px; }
.letters { display: flex; flex-wrap: wrap; gap: 4px; }
.letter { min-width: 34px; height: 34px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.letter:hover { background: var(--accent-soft); text-decoration: none; }
.letter.on { background: var(--accent); color: #fff; }

/* автор / профіль */
.author-head, .profile-head { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.author-head h1, .profile-head h1 { margin-bottom: 4px; }
.author-info p, .profile-info p { margin: 0 0 8px; }
.author-bio { grid-column: 1 / -1; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 14px; }
.socials { display: flex; gap: 4px; margin-bottom: 8px; }
.socials .icon-btn { background: var(--surface-2); }
.profile-head { grid-template-columns: auto 1fr auto; }
.head-cover { display: none; }
.profile-stats { display: flex; gap: 22px; margin: 0; text-align: center; }
.profile-stats dt { font-size: 12px; color: var(--ink-3); order: 2; }
.profile-stats div { display: flex; flex-direction: column; }
.profile-stats dd { margin: 0; font-size: 22px; font-weight: 700; }
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin: 18px 0 14px; overflow-x: auto; overflow-y: hidden; overscroll-behavior: contain; touch-action: pan-x; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px 12px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; flex: none; }
.tabs a[aria-current] { color: var(--accent-ink); border-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--accent-ink); }

/* ---------- Форми ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend, .field summary { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.field summary { cursor: pointer; }
details.field[open] { gap: 12px; }
.field input { height: 44px; }
.field .error-text { color: var(--danger); font-size: 13px; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.radios { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions .btn-danger { margin-left: auto; }
.poem-input { font-family: var(--serif); font-size: 17px; line-height: 1.6; min-height: 240px; }
textarea[data-autosize] { overflow-y: hidden; resize: none; }
.theme-checks, .lang-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check > span { display: inline-flex; align-items: center; gap: 8px; }
.lang-pick { padding: 8px 14px; font-size: 15px; }
.lang-pick img { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.avatar-logo { background: #fff; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.author-pick { position: relative; }
.author-selected { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.author-search { display: flex; flex-direction: column; gap: 6px; }
.author-results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.author-results li button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.author-results li button:hover, .author-results li button.active { background: var(--accent-soft); }
.img-current { display: flex; gap: 14px; align-items: center; }
.img-current img { border-radius: 8px; }
.avatar-edit { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.settings-grid > :first-child { grid-column: 1 / -1; }

.auth-wrap { display: flex; justify-content: center; padding: 20px 0; }
.auth-card { width: 100%; max-width: 420px; text-align: center; padding: 30px 26px; }
.auth-card.wide { max-width: 620px; }
.auth-card .form { text-align: left; margin-top: 14px; }
.auth-logo { width: 54px; height: 54px; color: var(--plum); }
.auth-links { margin: 16px 0 0; font-size: 14px; }

/* ---------- Інше ---------- */
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 24px 0 6px; }
.pg-item { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.pg-item:hover { border-color: var(--accent); text-decoration: none; }
.pg-item.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pg-item.disabled, .pg-item.gap { opacity: .45; pointer-events: none; }
.empty { text-align: center; padding: 34px 16px; color: var(--ink-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .ico { width: 34px; height: 34px; }
.empty.big { border: 0; background: none; padding: 40px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty.big .hero-search { width: 100%; }
.notif-list { list-style: none; margin: 0; padding: 6px 20px; }
.notif { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.notif:last-child { border: 0; }
.notif > .ico { color: var(--accent); margin-top: 3px; }
.notif p { margin: 2px 0; }
.notif.unread strong::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); margin-left: 8px; vertical-align: middle; }
.prose { max-width: 760px; margin: 0 auto; padding: 30px clamp(18px, 4vw, 40px); }
.prose li { margin-bottom: 8px; }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; text-align: center; }
.stats-row div { display: flex; flex-direction: column-reverse; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 6px; }
.stats-row dd { margin: 0; font-size: 24px; font-weight: 700; color: var(--accent-ink); }
.stats-row dt { font-size: 13px; color: var(--ink-3); }
.copyable { cursor: pointer; border-bottom: 1px dashed var(--accent); }
.moder-list { list-style: none; margin: 0; padding: 0; }
.moder-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.moder-item:last-child { border: 0; }
.moder-info { flex: 1; min-width: 0; }
.moder-info a.t { font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moder-info small { color: var(--ink-3); }
.moder-actions { display: flex; gap: 6px; flex: none; }
.moder-actions .btn { padding: 5px 12px; }
.notif div { min-width: 0; overflow-wrap: anywhere; }
.log { background: var(--surface-2); padding: 12px; border-radius: 8px; white-space: pre-wrap; font-size: 13px; max-height: 300px; overflow: auto; }
.ad { min-height: 100px; }

.profile-stats .iq dd { color: var(--accent-ink); }
.iq-chip { color: var(--accent-ink); font-weight: 700; font-size: 12px; margin-top: -2px; }
.medal { position: absolute; right: -2px; bottom: 0; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 12px; font-weight: 800; color: #fff; box-shadow: 0 0 0 2px var(--surface); }
.medal.m1 { background: #e0a526; } .medal.m2 { background: #9aa3ad; } .medal.m3 { background: #c0773c; }
.notif-menu { width: min(420px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notif-menu-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dropdown-menu .notif-menu-head a { display: inline; width: auto; padding: 0; color: var(--accent-ink); font-weight: 600; }
.notif-menu .notif-menu-list { max-height: min(460px, 70vh); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.notif-menu-list .nf { padding: 10px 14px 10px 12px; gap: 10px; }
.notif-menu-list .nf-ico { width: 32px; height: 32px; }
.notif-menu-list .nf-ico .ico { width: 16px; height: 16px; }
.notif-menu-list .nf-text { font-size: 14px; }
.notif-menu-list .nf-time { font-size: 11.5px; }
.dropdown-menu .nf a { display: inline; width: auto; padding: 0; }
.dropdown-menu .nf a:hover { background: none; }
.nf-loading { padding: 18px; text-align: center; }
@media (max-width: 720px) {
  .notif-dd { position: static; }
  .notif-menu { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; }
}
/* Сповіщення — як на HolyChords: кольорова смужка й іконка за видом */
.notif-feed { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.nf { display: flex; align-items: center; gap: 14px; padding: 14px 18px 14px 16px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--nf, var(--line)); }
.nf:last-child { border-bottom: 0; }
.nf.unread { background: var(--accent-soft); }
.nf-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--nf, var(--ink-3));
  background: color-mix(in srgb, var(--nf, var(--ink-3)) 14%, transparent); }
.nf-body { flex: 1; min-width: 0; }
.nf-text { line-height: 1.4; }
.nf-text a { font-weight: 600; }
.nf-extra { color: var(--ink-2); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.nf-open { font-size: 13px; }
.nf-time { flex: none; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.nf-poem { --nf: #2fbf71; } .nf-edit { --nf: #26a69a; } .nf-comment, .nf-reply { --nf: #3b82f6; } .nf-daily { --nf: #e0a526; } .nf-info { --nf: var(--accent); }
@media (max-width: 720px) {
  .nf { flex-wrap: wrap; padding: 12px 14px 12px 12px; gap: 10px; }
  .nf-body { flex-basis: calc(100% - 110px); }
}
.caps-result { margin-top: 14px; }
.caps-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; margin: 8px 0 14px; }
.caps-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.caps-row:last-child { border: 0; }
.caps-old { color: var(--ink-3); overflow-wrap: anywhere; }
.caps-new { font-weight: 600; overflow-wrap: anywhere; }
.caps-arrow { color: var(--accent); }
.linked-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.linked-user > div { flex: 1; min-width: 0; }
.linked-user small { display: block; overflow: hidden; text-overflow: ellipsis; }
.link-box { margin-top: 18px; }
.link-box .card-title { margin: 0; }
.link-box > p { margin: -6px 0 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack .notif-list { padding: 0; }
.stack .card-title + .notif-list:empty { display: none; }
.claim-msg { margin-top: 6px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.author-info .badge-warn { display: inline-block; margin-top: 6px; }
/* Повідомлення — як у Telegram */
.sec-messages .footer { display: none; }
.sec-messages .main { padding-top: 16px; padding-bottom: 16px; }
.messenger { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 62px - 32px); min-height: 460px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.messenger-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.messenger-search { position: relative; padding: 12px; border-bottom: 1px solid var(--line); }
.messenger-search .ico { position: absolute; left: 24px; top: 23px; color: var(--ink-3); }
.messenger-search input { width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 14px 0 38px; }
.messenger-search input:focus { outline: none; border-color: var(--accent); }
.chat-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.chat-list-empty { padding: 20px; text-align: center; }
.chat-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; color: var(--ink); }
.chat-row:hover { background: var(--accent-soft); color: var(--ink); }
.chat-row.active { background: var(--accent); color: #fff; }
.chat-row.active .chat-row-last, .chat-row.active time { color: rgba(255, 255, 255, .85); }
.chat-row.active .count { background: #fff; color: var(--plum); }
.chat-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-row-top { display: flex; justify-content: space-between; gap: 10px; }
.chat-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.chat-row-top time { color: var(--ink-3); font-size: 12px; flex: none; }
.chat-row-last { color: var(--ink-3); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.unread .chat-row-last { color: var(--ink); font-weight: 600; }
.ava-wrap { position: relative; display: inline-flex; flex: none; }
.online-dot { position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: #2fbf71; border: 2px solid var(--surface); }
.messenger-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: radial-gradient(120% 80% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface-2); }
.chat-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-back { display: none; margin-left: -8px; }
.chat-head-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.chat-head-info a { color: var(--ink); }
.chat-head-info small.online { color: #2fbf71; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 5px; overscroll-behavior: contain; }
.chat-empty { text-align: center; margin: auto; }
.day-sep { align-self: center; margin: 10px 0 6px; position: sticky; top: 6px; z-index: 2; }
.day-sep span { display: inline-block; min-width: 108px; text-align: center; padding: 4px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 72%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-author { color: var(--accent-ink); font-size: 12px; font-weight: 600; margin: 0 0 2px 12px; }
.msg-bubble { background: var(--surface); border: 1px solid var(--line); padding: 8px 12px 6px; border-radius: 18px 18px 18px 6px; overflow-wrap: anywhere; line-height: 1.45; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.msg-bubble a { text-decoration: underline; text-underline-offset: 2px; }
.msg.mine .msg-bubble { background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 18px 18px 6px 18px; }
.msg.mine .msg-bubble a { color: inherit; }
:root[data-theme="dark"] .msg.mine .msg-bubble, :root[data-theme="dark"] .chat-row.active { color: #1b1320; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.mine .msg-bubble, :root:not([data-theme="light"]) .chat-row.active { color: #1b1320; } }
.msg-bubble time { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; opacity: .6; margin-top: 2px; }
.msg.mine .msg-bubble time { opacity: .8; }
/* галочки: ✓ надіслано, ✓✓ прочитано */
.ticks { position: relative; display: inline-block; width: 16px; height: 10px; }
.ticks::before, .ticks::after { content: ""; position: absolute; top: 0; width: 5px; height: 9px; border: solid currentColor; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.ticks::before { left: 3px; }
.ticks::after { left: 8px; display: none; }
.msg.read .ticks::after { display: block; }
.msg.read .ticks { color: #7fe3a0; }
:root[data-theme="dark"] .msg.read .ticks { color: #1f7a44; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .msg.read .ticks { color: #1f7a44; } }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 180px; border-radius: 22px; padding: 11px 16px; background: var(--surface-2); }
.chat-form textarea[data-autosize] { overflow-y: auto; }
.chat-send { width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
.chat-form { position: relative; }
.emoji-btn { color: var(--ink-3); flex: none; align-self: flex-end; height: 44px; }
.emoji-btn:hover { color: var(--accent); }
.emoji-box { position: absolute; left: 10px; bottom: calc(100% + 8px); width: min(360px, calc(100% - 20px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); z-index: 30; overflow: hidden; animation: popIn .15s ease; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--line); padding: 4px; gap: 2px; }
.emoji-tabs button { flex: 1; border: 0; background: none; font-size: 20px; padding: 6px 0; border-radius: 10px; cursor: pointer; opacity: .55; }
.emoji-tabs button.on, .emoji-tabs button:hover { opacity: 1; background: var(--accent-soft); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); grid-auto-rows: 42px; align-content: start; gap: 2px; padding: 8px; height: calc(4 * 42px + 3 * 2px + 16px); overflow-y: auto; overscroll-behavior: contain; }
.emoji-grid button { border: 0; background: none; font-size: 26px; line-height: 1; padding: 6px 0; border-radius: 10px; cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; transition: transform .1s; }
.emoji-grid button:hover { background: var(--accent-soft); transform: scale(1.15); }
.chat-placeholder { margin: auto; text-align: center; color: var(--ink-3); }
.chat-placeholder .ico { width: 64px; height: 64px; opacity: .5; }
.chat-placeholder p { margin: 10px 0 0; }
@media (max-width: 820px) {
  .sec-messages .main { padding: 0; }
  .sec-messages .main.wrap { padding: 0; }
  .messenger { grid-template-columns: minmax(0, 1fr); border-radius: 0; border: 0; height: calc(100vh - 56px); height: calc(100dvh - 56px); min-height: 0; }
  .messenger.has-chat .messenger-list, .messenger:not(.has-chat) .messenger-chat { display: none; }
  .messenger-list { border-right: 0; }
  .chat-back { display: inline-flex; }
  .chat-messages { padding: 12px; }
  .msg { max-width: 86%; }
}
.modal-back { position: fixed; inset: 0; z-index: 120; background: rgba(20, 10, 25, .5); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s ease; }
.modal { width: 100%; max-width: 420px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); animation: popIn .18s ease; }
.modal-title { font-size: 18px; margin: 0 0 6px; }
.modal-text { margin: 0 0 16px; color: var(--ink-2); line-height: 1.5; }
.modal-input { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-tg { background: #229ed9; color: #fff; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a2230; color: #fff; padding: 11px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); z-index: 100; max-width: calc(100vw - 32px); font-weight: 500; }
.toast.error { background: var(--danger); }

/* ---------- Підвал ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); padding: 28px 0 18px; margin-top: 20px; }
.footer-in { display: grid; grid-template-columns: 1.3fr 1fr auto; gap: 24px; align-items: start; }
.footer .brand { color: var(--plum); }
.footer-brand p { color: var(--ink-3); font-size: 14px; max-width: 360px; margin: 8px 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-top: 6px; }
.footer-links a { color: var(--ink-2); font-size: 14px; }
.footer-tools { display: flex; gap: 10px; align-items: center; }
.lang-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-switch a { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.lang-switch a[aria-current] { background: var(--accent); color: #fff; }
.lang-switch a:hover { text-decoration: none; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.footer-copy { color: var(--ink-3); font-size: 13px; margin-top: 18px; }

/* ---------- Адаптив ---------- */
/* iPhone збільшує сторінку при фокусі на полі зі шрифтом < 16px */
@media (max-width: 960px), (pointer: coarse) {
  input, select, textarea, .search input, .hero-search input, .inline-search input { font-size: 16px; }
}
@media (max-width: 1100px) {
  .mainnav a { padding: 8px 9px; }
  .add-btn span { display: none; }
  .add-btn { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; margin: 0 4px; }
  .add-btn .ico { width: 20px; height: 20px; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; overflow: visible; }
  .side-themes { display: none; }
  .mainnav { display: none; }
  .menu-btn { display: inline-flex; margin-left: -8px; }
  .footer-in { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar-in { gap: 6px; height: 56px; }
  .brand span { font-size: 16px; }
  .brand-logo { width: 28px; height: 28px; }
  .search { display: none; position: absolute; left: 8px; right: 8px; top: 8px; max-width: none; margin: 0; z-index: 2; }
  .topbar.search-open .search { display: block; }
  .topbar.search-open .search input { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
  .topbar.search-open .menu-btn, .topbar.search-open .brand, .topbar.search-open .top-actions { visibility: hidden; }
  .search-toggle { display: inline-flex; }
  /* телефон: «Додати» і «Повідомлення» — у меню; порядок: дзвіночок, пошук, аватар (з лічильником повідомлень) */
  .top-actions .add-btn, .top-actions .msg-btn { display: none; }
  .top-actions .notif-dd { order: 1; }
  .top-actions .search-toggle { order: 2; }
  .top-actions .dropdown { order: 3; }
  .ava-badge { display: block; }
  .top-actions .btn-ghost { padding: 4px 11px; }
  .pgrid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; border-radius: 12px; }
  .pcard { padding: 12px; gap: 12px; }
  .pcard-meta { position: absolute; right: 12px; top: 12px; }
  .pcard-body { padding-right: 44px; }
  .pcard-compact .pcard-body { padding-right: 52px; }
  .pcard-compact .pcard-meta { top: 50%; transform: translateY(-50%); right: 4px; }
  .grid2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-head { grid-template-columns: auto 1fr; }
  .profile-stats { grid-column: 1 / -1; justify-content: space-around; }
  .author-head, .profile-head { gap: 14px; }
  .author-head .avatar, .profile-head > .avatar { width: 80px !important; height: 80px !important; }
  /* телефон: велике фото зверху, інформація під ним */
  .has-photo { display: block; padding-top: 0; overflow: hidden; }
  .has-photo > .avatar { display: none !important; }
  .has-photo .head-cover { display: block; width: calc(100% + 32px); max-width: none; margin: 0 -16px 16px; aspect-ratio: 1 / 1; max-height: 70vh; object-fit: cover; object-position: center 25%; background: var(--surface-2); }
  .has-photo .profile-stats { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
  .has-photo .author-bio { margin-top: 14px; }
  .hide-sm { display: none; }
  .moder-item { flex-wrap: wrap; }
  .moder-info { flex-basis: calc(100% - 52px); }
  .moder-info a.t { white-space: normal; }
  .moder-actions { width: 100%; justify-content: flex-end; }
  .poem-card { padding: 20px 16px; }
  .poem-actions .btn span { display: none; }
  .poem-actions .btn { width: 42px; padding: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 12px 0 18px; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .theme-tile { min-height: 104px; }
  .page-head.has-cover { height: 190px; padding: 16px; }
  .cover-edit { top: 10px; right: 10px; }
  .lang-grid, .author-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .filters-row .seg { justify-content: center; }
  .card-head .seg { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .card-head .seg::-webkit-scrollbar { display: none; }
  .select select { width: 100%; }
}
@media (max-width: 440px) {
  /* шапка на вузьких телефонах: голубка без напису, щільніші іконки */
  .topbar-in { gap: 2px; }
  .top-actions { gap: 0; }
  .top-actions .icon-btn { width: 38px; }
  .add-btn { margin: 0 2px; }
}
@media (max-width: 380px) {
  .top-actions .btn-ghost { padding: 4px 9px; font-size: 13px; }
}
@media (max-width: 350px) {
  .topbar .brand span { display: none; }
}

/* ---------- Друк ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 16mm 18mm; }
  /* друк завжди світлий, незалежно від теми сайту */
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #222; --ink-3: #555;
    --line: #ccc; --accent: #000; --accent-ink: #000; color-scheme: light;
  }
  html, body { background: #fff !important; color: #000 !important; }
  .topbar, .footer, .sidebar, .poem-tools, .poem-actions, .comments, .ad, .crumbs, .skip, .drawer, .toast, .modal-back,
  .poem-tags, .poem-meta, .translations, .poem-image, .alert, ins.adsbygoogle, iframe { display: none !important; }
  .main { padding: 0 !important; min-height: 0; }
  .wrap { max-width: none; padding: 0; }
  .layout { display: block; }
  .content { gap: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .main, .content, .poem-card { width: auto !important; max-width: 100% !important; }
  .card, .poem-card { background: #fff !important; box-shadow: none !important; border: 0 !important; padding: 0 4mm !important; border-radius: 0; }
  .poem-head { margin-bottom: 7mm; padding-bottom: 5mm; border-bottom: 0.5pt solid #bbb; }
  .poem-title { font-size: 22pt; line-height: 1.2; margin-bottom: 4mm; color: #000; }
  .poem-author { color: #000; gap: 3mm; }
  .poem-author .avatar { width: 12mm !important; height: 12mm !important; font-size: 5mm !important; }
  .poem-author small { color: #777; font-size: 8pt; }
  .poem-author strong { color: #222; font-weight: 600; font-size: 12pt; }
  .poem-text { font-size: 13pt; line-height: 1.65; color: #000; margin-bottom: 6mm; orphans: 3; widows: 3; overflow-wrap: anywhere; }
  .poem-extra { font-size: 10pt; color: #333; margin-bottom: 4mm; }
  .print-only { display: block; font-size: 9pt; color: #777; border-top: 1px solid #ccc; padding-top: 2mm; margin-top: 6mm; }
  a { color: #000 !important; text-decoration: none !important; }
}
