/* =====================================================================
   ТЕЗАУРУС · общая основа
   Палитра, кнопки, поля, модальные окна, меню, «круг» человека.
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root{
  --ink:    #0d1424;
  --ink-2:  #34405c;
  --muted:  #6b7690;
  --faint:  #a4adc0;
  --cyan:   #00c2ff;
  --violet: #7b5cff;
  --pink:   #ff2fd0;
  --red:    #ff3b5c;
  --red-ink:#d3123a;
  --glass:  rgba(255,255,255,.72);
  --line:   rgba(13,20,36,.10);
  --line-2: rgba(13,20,36,.06);
  --shadow-s: 0 4px 14px rgba(13,20,36,.08);
  --shadow-m: 0 10px 28px rgba(13,20,36,.13);
  --shadow-l: 0 24px 60px rgba(13,20,36,.22);
  --grad: linear-gradient(135deg, #00c2ff, #7b5cff);
  --grad-3: linear-gradient(90deg, #00c2ff, #7b5cff 55%, #ff2fd0);
}

html, body{
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body{
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #eef2f9;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

button, input, textarea, select{ font-family: inherit; }
button{ cursor: pointer; }
[hidden]{ display: none !important; }

::selection{ background: rgba(123,92,255,.3); }

/* ---------- экраны ---------- */
.screen{
  position: fixed;
  inset: 0;
  display: flex;
  overflow: hidden;
}
.screen.hidden{ display: none; }

/* ---------- фон «космоса» ---------- */
.cosmos{
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 18% 8%,  rgba(0,194,255,.16), transparent 62%),
    radial-gradient(820px 620px at 88% 92%, rgba(255,47,208,.12), transparent 62%),
    radial-gradient(700px 500px at 60% 40%, rgba(123,92,255,.10), transparent 65%),
    #f1f5fb;
}
.cosmos::after{
  content:'';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(13,20,36,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,20,36,.045) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 30%, transparent 78%);
}

.cosmos-orb{
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .5;
  animation: orbFloat 22s ease-in-out infinite;
}
.cosmos-orb.a{ width: 380px; height: 380px; left: -80px; top: -60px; background: rgba(0,194,255,.45); }
.cosmos-orb.b{ width: 420px; height: 420px; right: -120px; bottom: -120px; background: rgba(255,47,208,.35); animation-delay: -7s; }
.cosmos-orb.c{ width: 320px; height: 320px; right: 24%; top: 12%; background: rgba(123,92,255,.32); animation-delay: -13s; }

@keyframes orbFloat{
  0%,100%{ transform: translate3d(0,0,0) scale(1); }
  33%    { transform: translate3d(40px,-30px,0) scale(1.08); }
  66%    { transform: translate3d(-30px,26px,0) scale(.94); }
}

@keyframes breathe{ 0%,100%{ opacity:.45; } 50%{ opacity:.95; } }
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
@keyframes dropIn{ from{ opacity:0; transform: translateY(-4px); } to{ opacity:1; transform:none; } }
@keyframes riseIn{ from{ opacity:0; transform: translateY(14px); } to{ opacity:1; transform:none; } }

/* ---------- аватары ---------- */
.ava{
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--h,200) 85% 62%), hsl(var(--h,200) 82% 45%));
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: .02em;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,.6), 0 4px 12px hsl(var(--h,200) 80% 45% / .35);
  user-select: none;
}
.ava img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.ava-sm{ width: 34px; height: 34px; font-size: 12px; }
.ava-md{ width: 48px; height: 48px; font-size: 15px; }
.ava-lg{ width: 74px; height: 74px; font-size: 22px; }

/* ---------- огонёк присутствия у аватарки ----------
   зелёный и дышит — человек сейчас в сети; серый — не в сети */
.ava-box{
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.ava-box .ava-dot{
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c3cad6;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(13,20,36,.22);
  pointer-events: none;
}
.ava-box .ava-dot.on{
  background: #22c55e;
  animation: onlinePulse 2.4s ease-out infinite;
}
@keyframes onlinePulse{
  0%  { box-shadow: 0 1px 3px rgba(13,20,36,.22), 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 1px 3px rgba(13,20,36,.22), 0 0 0 7px rgba(34,197,94,0); }
  100%{ box-shadow: 0 1px 3px rgba(13,20,36,.22), 0 0 0 0 rgba(34,197,94,0); }
}

/* ---------- кнопки ---------- */
.btn{
  border: 1px solid var(--line);
  background: rgba(255,255,255,.85);
  color: var(--ink-2);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: .04em;
  transition: .16s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn:hover{ border-color: var(--cyan); color: #0079a8; background: #fff; transform: translateY(-1px); }
.btn:active{ transform: translateY(0) scale(.985); }
.btn:disabled{ opacity: .45; cursor: not-allowed; transform: none; }

.btn.primary{
  border-color: transparent;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,140,255,.35);
}
.btn.primary:hover{ color: #fff; border-color: transparent; box-shadow: 0 10px 26px rgba(0,140,255,.5); }
.btn.danger:hover{ border-color: var(--red); color: var(--red-ink); background: rgba(255,59,92,.06); }
.btn.vk{
  border-color: transparent;
  background: linear-gradient(135deg, #0077ff, #4c8dff);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,119,255,.35);
}
.btn.vk:hover{ color: #fff; box-shadow: 0 10px 26px rgba(0,119,255,.5); }
.btn.tiny{ padding: 6px 10px; font-size: 11px; border-radius: 8px; }

/* ---------- поля ---------- */
.input{
  width: 100%;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid rgba(13,20,36,.14);
  background: rgba(255,255,255,.92);
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input::placeholder{ color: var(--faint); }
.input:focus{ border-color: var(--violet); box-shadow: 0 0 0 3px rgba(123,92,255,.16); }
.field-label{
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px 2px;
}

/* ---------- чипы и значки ---------- */
.chip{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(13,20,36,.06);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.cyan{ background: rgba(0,194,255,.14); color: #0079a8; }
.chip.violet{ background: rgba(123,92,255,.14); color: #5b3fd6; }
.chip.pink{ background: rgba(255,47,208,.14); color: #c00092; }
.chip.green{ background: rgba(0,190,120,.15); color: #067a51; }
.chip.lockchip{ background: rgba(255,59,92,.12); color: var(--red-ink); }

/* ---------- модальные окна ---------- */
.overlay{
  position: fixed;
  inset: 0;
  background: rgba(13,20,36,.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.overlay.show{ display: flex; animation: fadeIn .18s ease; }

.modal{
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-l), 0 0 0 1px rgba(13,20,36,.06), 0 0 0 6px rgba(0,194,255,.08);
  overflow: hidden;
  animation: riseIn .24s cubic-bezier(.2,.9,.3,1.05);
}
.modal.wide{ max-width: 760px; }

.modal-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-2);
  background: #fbfcff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.modal-close{
  width: 30px; height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--faint);
  font-size: 19px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  transition: .15s;
}
.modal-close:hover{ background: rgba(255,59,92,.12); color: var(--red-ink); }

.modal-body{ padding: 20px; overflow-y: auto; }
.modal-body.scroll{ scrollbar-width: thin; }
.modal-body.scroll::-webkit-scrollbar{ width: 6px; }
.modal-body.scroll::-webkit-scrollbar-thumb{ background: rgba(13,20,36,.14); border-radius: 3px; }

.modal-foot{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line-2);
  background: #f7f9fd;
  flex-wrap: wrap;
}
.modal-hint{ font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.modal-hint b{ color: var(--ink-2); }
.modal-btns{ display: flex; gap: 8px; }

.note{
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  background: rgba(0,194,255,.07);
  border: 1px solid rgba(0,194,255,.2);
  border-radius: 11px;
  padding: 11px 13px;
}
.note b{ color: var(--ink-2); }
.note.warn{ background: rgba(255,59,92,.07); border-color: rgba(255,59,92,.22); }

/* ---------- контекстное меню ---------- */
.ctx{
  position: fixed;
  left: 0; top: 0;
  min-width: 232px;
  padding: 6px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 46px rgba(13,20,36,.22), 0 0 0 4px rgba(123,92,255,.06);
  display: none;
  z-index: 1500;
}
.ctx.show{ display: block; animation: dropIn .13s ease; }

.ctx-item{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 11px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  text-align: left;
  transition: background .12s;
}
.ctx-item .ctx-icon{ width: 16px; flex: 0 0 16px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1; }
.ctx-item .ctx-sub{ margin-left: auto; font-size: 9.5px; color: var(--muted); letter-spacing: .04em; }
.ctx-item:hover{ background: rgba(123,92,255,.10); }
.ctx-item:hover .ctx-icon{ color: inherit; }
.ctx-item.danger:hover{ background: rgba(255,59,92,.12); color: var(--red-ink); }
.ctx-item:disabled{ opacity: .38; cursor: not-allowed; background: transparent; }
.ctx-sep{ height: 1px; margin: 4px 6px; background: var(--line-2); }
.ctx-head{
  padding: 7px 11px 5px;
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* =====================================================================
   НАСТРОЙКИ ВИДА
   ---------------------------------------------------------------------
   Что человек выбрал в окне «Настройки», то и применяется: размер текста,
   подписи в галактике, меньше движения. Выбор хранится в браузере.
   ===================================================================== */

/* Крупнее текст в панелях, ленте и окнах. Галактика при этом не меняется —
   поэтому карта кругов и её расчёт остаются нетронутыми. */
html[data-text="big"] .side,
html[data-text="big"] .sidebar,
html[data-text="big"] .flow-wrap,
html[data-text="big"] .modal,
html[data-text="big"] .side-search,
html[data-text="big"] .space-focus{ zoom: 1.12; }

html[data-text="huge"] .side,
html[data-text="huge"] .sidebar,
html[data-text="huge"] .flow-wrap,
html[data-text="huge"] .modal,
html[data-text="huge"] .side-search,
html[data-text="huge"] .space-focus{ zoom: 1.26; }

/* меньше движения: убираем анимации, но интерфейс остаётся живым */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after{
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

/* ---------- окно настроек ---------- */

.set-group{
  padding: 14px 0;
  border-bottom: 1px solid var(--line-2);
}
.set-group:first-child{ padding-top: 0; }
.set-group:last-child{ border-bottom: none; padding-bottom: 0; }

.set-title{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: .03em;
}
.set-hint{
  margin: 4px 0 9px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
}
.set-seg{ width: 100%; }
.set-seg button{ flex: 1 1 0; min-width: 0; font-size: 10.5px; }

.set-links{
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 10px 0 4px;
}
.set-links a{
  font-size: 12px;
  color: #4a35c9;
  text-decoration: none;
  border-bottom: 1px dashed rgba(123,92,255,.35);
  align-self: flex-start;
}
.set-links a:hover{ color: var(--violet); }

/* ---------- кнопка настроек на стартовом экране ---------- */

.landing-gear{
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink-2);
  font-size: 11.5px;
  box-shadow: var(--shadow-s);
  transition: .16s;
}
.landing-gear:hover{ border-color: var(--violet); color: var(--violet); background: #fff; transform: translateY(-1px); }
.landing-gear span:first-child{ font-size: 14px; line-height: 1; }

@media (max-width: 620px) {
  .landing-gear{ right: 12px; top: 12px; padding: 8px 11px; }
  .landing-gear .lg-text{ display: none; }
}

/* ---------- стартовый экран: как войти ---------- */

.start-choice{
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.start-opt{
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  transition: .16s;
}
.start-opt:hover{
  border-color: var(--violet);
  box-shadow: 0 8px 22px rgba(123,92,255,.14);
  transform: translateY(-1px);
}
.start-opt .so-ico{
  font-size: 20px;
  line-height: 1;
  width: 26px;
  text-align: center;
}
.start-opt .so-txt{ display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.start-opt .so-txt b{ font-size: 13px; color: var(--ink); font-weight: 600; }
.start-opt .so-txt span{ font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.start-opt.soft{ background: rgba(123,92,255,.05); border-style: dashed; }

.start-form{ display: block; }
.start-row{ display: flex; gap: 10px; }
.start-row > div{ flex: 1 1 0; min-width: 0; }

.start-note{
  margin-top: 12px;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}
.start-note a{ color: #4a35c9; }

/* полоска «вы смотрите как Аноним» в галактике */
.guest-bar{
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 40px);
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(123,92,255,.3);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-s);
  font-size: 11px;
  color: var(--ink-2);
}
.guest-bar b{ color: var(--violet); }
.guest-bar .btn{ padding: 6px 12px; font-size: 11px; border-radius: 999px; }

@media (max-width: 720px) {
  .guest-bar{
    left: 10px;
    right: 10px;
    transform: none;
    max-width: none;
    font-size: 10px;
    padding: 8px 11px;
  }
  .guest-bar span{ flex: 1; }
}

/* ---------- всплывающие сообщения ---------- */
.toasts{
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
  align-items: center;
}
.toast{
  padding: 10px 18px;
  border-radius: 30px;
  background: rgba(13,20,36,.9);
  color: #fff;
  font-size: 11.5px;
  letter-spacing: .04em;
  box-shadow: var(--shadow-m);
  animation: riseIn .2s ease;
  max-width: 90vw;
}
.toast.good{ background: linear-gradient(135deg, #00a86b, #00c2ff); }
.toast.bad{ background: linear-gradient(135deg, #d3123a, #ff6b3b); }
.toast.out{ animation: fadeIn .3s ease reverse forwards; }

/* ---------- прочее ---------- */
.empty-note{
  padding: 26px 16px;
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
}
.spin{
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(123,92,255,.25);
  border-top-color: var(--violet);
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

.loading{
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 60px 0;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .1em;
}

@media (max-width: 760px){
  .ava-lg{ width: 58px; height: 58px; font-size: 18px; }
}

/* =====================================================================
   ЧТЕНИЕ ЗАПИСИ
   ===================================================================== */
.reader-meta{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}
.reader-author{ font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.reader-text{
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.reader-text::selection{ background: rgba(123,92,255,.28); }

/* =====================================================================
   ВАРИАНТЫ СКАЧИВАНИЯ
   ===================================================================== */
.export-opt{
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 15px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.75);
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.export-opt:hover{
  border-color: var(--violet);
  background: #fff;
  transform: translateY(-1px);
}
.export-opt .eo-icon{
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 17px;
  background: linear-gradient(135deg, rgba(0,194,255,.16), rgba(123,92,255,.16));
}
.export-opt .eo-txt{ flex: 1; min-width: 0; }
.export-opt .eo-title{ font-size: 12.5px; font-weight: 700; }
.export-opt .eo-sub{ font-size: 10.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.export-opt .eo-go{ color: var(--muted); font-size: 15px; }
