/* Абсурдия — сообщество: поиск в шапке, Telegram и Discord, друзья, истории, профиль, расширенный поиск */

/* ---------- поиск в шапке ---------- */
.tsearch { position: relative; flex: 0 1 280px; min-width: 170px; margin-left: auto; }
.tsearch + .top-right { margin-left: 0; }
.tsearch-ic { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--dusk); pointer-events: none; }
.tsearch input[type="search"] { padding: 8px 12px 8px 36px; font-size: 15.5px; border-radius: 99px; background: var(--ink-1); }
.tsearch.open input[type="search"] { border-color: var(--gold-deep); }
.sdrop {
  position: absolute; top: calc(100% + 8px); right: 0; width: max(100%, 340px); z-index: 30; display: flex; flex-direction: column; gap: 4px;
  background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 8px;
}
.sres-list { display: flex; flex-direction: column; gap: 2px; }
.sres { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; color: var(--moon); text-decoration: none; min-width: 0; }
.sres:hover, .sres:focus-visible { background: var(--ink-3); }
.sres > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.sres b { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sres small { color: var(--dusk); font-size: 13px; }
.sthumb { flex: none; position: relative; width: 52px; height: 34px; border-radius: 7px; overflow: hidden; background: #000; }
.sthumb img, .sthumb svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sempty { margin: 0; padding: 8px; color: var(--mist); font-size: 15px; }
.shint { margin: 0; padding: 8px 8px 4px; font-size: 14px; color: var(--dusk); border-top: 1px solid var(--line); }
.sres-list + .shint, .sempty + .shint { margin-top: 4px; }
.shint b { color: var(--gold); }
.sadv { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 10px; font-weight: 700; font-size: 15px; text-decoration: none; }
.sadv:hover { background: var(--ink-3); }
.sadv svg { width: 16px; height: 16px; }

/* ---------- кружок с буквой вместо аватарки ---------- */
.uav { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(160deg, #3a2e63, #221a3c); border: 1px solid var(--gold-deep); font: 800 14px var(--f-display); color: var(--gold-2); }
.uav.big { width: 44px; height: 44px; font-size: 18px; }
.uav.huge { width: 96px; height: 96px; font-size: 40px; border-width: 2px; box-shadow: 0 0 0 6px rgba(244, 198, 91, .08); }

/* ---------- сообщество: шапка с Telegram и Discord ---------- */
.comm-hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: center; overflow: hidden;
  padding: clamp(24px, 4vw, 44px); border-radius: 22px; border: 1px solid var(--line);
  background: radial-gradient(600px 300px at 90% 10%, rgba(255, 122, 184, .16), transparent 70%), radial-gradient(500px 280px at 0% 100%, rgba(244, 198, 91, .12), transparent 70%), var(--ink-1);
}
.comm-copy { display: flex; flex-direction: column; gap: 12px; }
.comm-copy .h1 { font-size: clamp(30px, 4.4vw, 50px); }
.comm-sub { font: italic 500 18px var(--f-story); color: var(--rose); letter-spacing: .02em; }
.comm-links { display: flex; flex-direction: column; gap: 14px; }
.comm-link {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: 16px; text-decoration: none; color: #fff;
  border: 1px solid rgba(255, 255, 255, .18); transition: transform .15s, box-shadow .15s, filter .15s;
}
.comm-link:hover { transform: translateY(-2px); filter: brightness(1.08); }
.comm-link svg { width: 38px; height: 38px; flex: none; }
.comm-link span { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.comm-link b { font: 800 20px var(--f-display); }
.comm-link small { font-size: 14.5px; opacity: .85; }
.comm-link i { font-style: normal; font-size: 22px; opacity: .8; }
.comm-link.tg { background: linear-gradient(135deg, #2aabee, #1d8fd0); box-shadow: 0 10px 28px rgba(42, 171, 238, .25); }
.comm-link.ds { background: linear-gradient(135deg, #6b74f8, #5865f2); box-shadow: 0 10px 28px rgba(88, 101, 242, .28); }

/* ---------- сообщество: комнаты и друзья ---------- */
.comm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.comm-grid .saves { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.friends-panel { position: sticky; top: 90px; gap: 14px; }
.friends-panel > .btn { align-self: flex-start; }
.fgroup { display: flex; flex-direction: column; gap: 6px; }
.fgroup .lbl { margin-top: 4px; }
.frow { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--ink-0); border: 1px solid var(--line); min-width: 0; }
.frow > a { flex: 1; min-width: 0; color: var(--moon); text-decoration: none; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow > a:hover { color: var(--gold-2); }
.frow-acts { display: flex; gap: 4px; flex: none; }
.fnow-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fnow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--ink-1); border: 1px solid var(--line); min-width: 0; }
.fnow-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fnow-t a { color: var(--moon); text-decoration: none; }
.fnow-t a:hover b { color: var(--gold-2); }
.fnow-t small { color: var(--mist); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.save .thumb .badge { z-index: 1; font: 700 11.5px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: rgba(15, 11, 26, .8); border: 1px solid var(--line-2); color: var(--mist); backdrop-filter: blur(4px); white-space: nowrap; }

/* ---------- истории ---------- */
.story-card h3 a { color: inherit; text-decoration: none; }
.story-card h3 a:hover { color: var(--gold-2); }
.story-card .cover { display: block; }
.story-card .cover img, .story-card .cover svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-card .card-foot a { color: var(--mist); }
.story-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 32px; align-items: center; }
.story-hero .cover { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 10; border: 1px solid var(--line); box-shadow: var(--shadow); background: #000; }
.story-hero .cover img, .story-hero .cover svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-hero .cover img.who { left: auto; right: 4%; top: auto; bottom: 0; width: auto; height: 78%; object-fit: contain; }
.story-meta { display: flex; flex-direction: column; gap: 12px; }
.story-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.story-read { padding: clamp(20px, 4vw, 48px); }
.story-read .page { gap: 20px; }
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.pick { display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-0); color: var(--moon); cursor: pointer; }
.pick:hover { border-color: var(--gold-deep); background: rgba(244, 198, 91, .06); }
.pick .thumb { flex: none; position: relative; width: 84px; height: 56px; border-radius: 8px; overflow: hidden; background: #000; }
.pick .thumb img, .pick .thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pick > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.pick small { color: var(--dusk); font-size: 13.5px; }

/* ---------- окна: правила, видимость комнаты ---------- */
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--mist); font-size: 15.5px; }
.rules b { color: var(--moon); }
.vis-opts { display: flex; flex-direction: column; gap: 8px; }
.vis-opts .tier-opt b { justify-content: flex-start; }
.modal:has(.rules), .modal:has(.vis-opts), .modal:has(.pick-list) { width: min(560px, 100%); }
.pill.ok { color: var(--leaf); border-color: rgba(157, 219, 138, .5); }

/* ---------- профиль ---------- */
.profile { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 26px; border-radius: 20px; border: 1px solid var(--line); background: var(--ink-1); }
.profile-t { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.profile-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- расширенный поиск ---------- */
.adv { gap: 16px; }
.adv .seg svg { width: 17px; height: 17px; flex: none; }
.adv-row { display: flex; gap: 10px; }
.adv-row input { font-size: 18px; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; align-items: start; }
.adv-checks { display: flex; gap: 14px; flex-wrap: wrap; padding-top: 6px; }
.adv-checks .check-row { font-size: 15.5px; }
.ugrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ucard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--ink-1); color: var(--moon); text-decoration: none; }
.ucard:hover { border-color: var(--gold-deep); }
.ucard > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.ucard small { color: var(--dusk); font-size: 13.5px; }

@media (max-width: 1100px) {
  .comm-grid { grid-template-columns: 1fr; }
  .friends-panel { position: static; }
}
/* Средние экраны: поиск сжимается в кнопку-лупу и раскрывается поверх шапки при нажатии */
@media (max-width: 1180px) and (min-width: 721px) {
  .tsearch { flex: 0 0 40px; min-width: 40px; height: 40px; }
  .tsearch input[type="search"] { position: absolute; right: 0; top: 0; width: 40px; height: 40px; padding: 0 0 0 38px; cursor: pointer; transition: width .18s; }
  .tsearch input[type="search"]::placeholder { color: transparent; }
  .tsearch-ic { left: 11px; z-index: 1; }
  .tsearch:focus-within input[type="search"], .tsearch.open input[type="search"] { width: min(340px, 60vw); padding-right: 12px; cursor: text; z-index: 31; }
  .tsearch:focus-within input[type="search"]::placeholder { color: #6f6496; }
  .sdrop { top: 48px; width: min(340px, 60vw); }
  .top { gap: 14px; }
  .nav a { padding: 8px 10px; }
  .nav svg { display: none; }
}
@media (max-width: 920px) and (min-width: 721px) {
  .wordmark { display: none; }
}
@media (max-width: 980px) {
  .comm-hero, .story-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .comm-hero { padding: 22px 18px; gap: 22px; }
  .comm-copy .h1 { font-size: 6.2vw; overflow-wrap: break-word; }
  .comm-link { padding: 14px 16px; }
  .profile { padding: 18px; }
}
@media (max-width: 720px) {
  .tsearch { order: 4; flex: 1 1 100%; margin-left: 0; }
  .tsearch + .top-right { margin-left: auto; }
  .sdrop { width: 100%; }
  .comm-grid .saves, .fnow-list { grid-template-columns: 1fr; }
  .adv-row { flex-direction: column; }
}
