@font-face { font-family: "Roboto"; src: url("/static/fonts/Roboto.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Momo Trust Display"; src: url("/static/fonts/MomoTrustDisplay-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
:root {
    --fg: #fff; --muted: #9a9a9a; --line: #2e2e2e; --bg: #000; --card: #0b0b0b; --card-2: #141414;
    --link: #6cb6ff; --bad: #ff6b6b; --ok: #5fd68a; --signal: #ffb703; --lock: #c792ff; --radius: 8px;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --sans: "Roboto", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --logo: "Momo Trust Display", "Montserrat", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--sans); }
::selection { background: #fff; color: #000; }
a { color: var(--link); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
[hidden] { display: none !important; }
.grow { flex: 1 1 160px; min-width: 0; }
.center { text-align: center; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px clamp(16px, 4vw, 44px); border-bottom: 1px solid var(--line); }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.mark__text { font: 400 26px/1 var(--logo); }
.logo-img { display: block; height: 44px; width: auto; }
.who { display: flex; align-items: center; gap: 12px; font-size: 15px; flex-wrap: wrap; justify-content: flex-end; }
.who__name { font-weight: 500; }
.avatar { width: 40px; height: 40px; border-radius: var(--radius); object-fit: cover; background: var(--card-2); flex: none; }
.badge { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 10px; background: #1e1e1e; color: #ccc; }
.badge--mod { background: #2b1d3d; color: var(--lock); }

.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 96px; }
.wrap--wide { max-width: 1180px; }
h1 { font-size: clamp(28px, 5.5vw, 44px); line-height: 1.12; font-weight: 700; letter-spacing: -.02em; margin: 24px 0 12px; }
h2 { font-size: 22px; font-weight: 500; margin: 0 0 10px; }
h3 { font-size: 17px; font-weight: 500; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin: 32px 0; }
.big-name { font-size: clamp(22px, 4vw, 30px); font-weight: 700; margin: 8px 0; }
.err { color: var(--bad); margin: 8px 0 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

input, select, textarea { font: inherit; color: inherit; background: #0b0b0b; border: 1.5px solid #3a3a3a; border-radius: var(--radius); padding: 9px 12px; min-height: 40px; max-width: 100%; }
textarea { width: 100%; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #666; }
input:focus, select:focus, textarea:focus { border-color: #fff; outline: none; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; accent-color: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 20px; border-radius: var(--radius); border: 2px solid #fff; background: #fff; color: #000;
       font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn:hover { background: #d9d9d9; border-color: #d9d9d9; }
.btn--ghost { background: transparent; color: #fff; }
.btn--ghost:hover { background: #fff; color: #000; border-color: #fff; }
.btn--danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn--danger:hover { background: var(--bad); border-color: var(--bad); color: #000; }
.btn--small { min-height: 34px; padding: 0 12px; font-size: 14px; border-width: 1.5px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn--big { min-height: 58px; font-size: 20px; padding: 0 32px; border-width: 4px; background: transparent; color: #fff; text-transform: uppercase; }

/* значки: файл из /static/media/icons/<имя>.svg красится в цвет текста; пока файла нет — буква */
.ico { display: inline-flex; align-items: center; justify-content: center; width: 1.25em; height: 1.25em; font-size: 15px; line-height: 1; flex: none; }
.ico--ok { -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; background: currentColor; }
.ico--ok .ico__fb { display: none; }
.iconbtn, .tbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: #ddd; cursor: pointer; font: inherit; font-size: 14px; }
.iconbtn:hover, .tbtn:hover { background: #222; border-color: #444; color: #fff; }
.iconbtn[disabled], .tbtn[disabled] { opacity: .3; cursor: default; pointer-events: none; }

/* главная */
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 20px 0 8px; }
.toolbar input[type=search] { max-width: 340px; }
.chips { display: flex; gap: 6px; }
.chip { border: 1.5px solid #3a3a3a; background: transparent; color: #ccc; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: #fff; color: #fff; }
.chip--on { background: #fff; color: #000; border-color: #fff; }
.cat { margin: 34px 0; }
.cat__title { display: flex; align-items: baseline; gap: 12px; font-size: 26px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; }
.cat__count { font-size: 15px; }
.words { display: flex; flex-wrap: wrap; gap: 10px; }
.word { display: inline-block; padding: 7px 16px; border-radius: 999px; border: 1.5px solid #3a3a3a; text-decoration: none; font-size: 17px; background: transparent; font-family: inherit; }
.word--taken { color: #fff; border-color: #fff; }
.word--taken:hover { background: #fff; color: #000; }
.word--free { color: #6a6a6a; border-style: dashed; cursor: default; }
a.word--free { cursor: pointer; }
a.word--free:hover { color: #fff; border-color: #fff; }
.word--add { color: var(--ok); border-color: var(--ok); border-style: dashed; cursor: pointer; }
.wordbox { display: inline-flex; align-items: center; gap: 2px; }

/* страница слова */
.wordhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.wordhead__title { margin: 4px 0 0; }
.modbar { gap: 12px; }
.seg { display: inline-flex; border: 1.5px solid #3a3a3a; border-radius: var(--radius); overflow: hidden; }
.seg__btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: #ccc; font: inherit; font-size: 14px; padding: 0 14px; min-height: 34px; cursor: pointer; }
.seg__btn + .seg__btn { border-left: 1.5px solid #3a3a3a; }
.seg__btn--on { background: #fff; color: #000; }
.seg--small .seg__btn { min-height: 28px; padding: 0 10px; font-size: 13px; }
.page__cols { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 32px; align-items: start; }
.infobox { border: 1px solid #3a3a3a; border-radius: 10px; background: var(--card); overflow: hidden; }
.infobox__title { background: #1b1b1b; text-align: center; font-weight: 700; font-size: 20px; padding: 12px 14px; overflow-wrap: anywhere; }
.infobox__img { margin: 0; padding: 12px; text-align: center; border-bottom: 1px solid var(--line); }
.infobox__img img { max-width: 100%; max-height: 420px; border-radius: 6px; display: block; margin: 0 auto; }
.infobox__img figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.infobox__rows { margin: 0; padding: 4px 14px 10px; }
.infobox__row { display: grid; grid-template-columns: minmax(80px, 38%) 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid #1c1c1c; font-size: 15px; }
.infobox__row:last-child { border-bottom: 0; }
.infobox__row dt { color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.infobox__row dd { margin: 0; overflow-wrap: anywhere; }
.toc { display: inline-block; min-width: 220px; border: 1px solid #3a3a3a; border-radius: 10px; background: var(--card); padding: 12px 20px 12px 16px; margin: 0 0 24px; }
.toc__title { font-weight: 700; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 22px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.psec { margin: 0 0 28px; }
.psec__title { font-size: 28px; font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 0 0 14px; scroll-margin-top: 16px; }
.pagebody__h3 { font-size: 20px; font-weight: 700; margin: 20px 0 8px; }
.pagebody > div, .psec > div { margin-bottom: 14px; }
.filebox { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 18px; }
.filelist, .flist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.filelist__item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.filelist__name { flex: 1 1 200px; font-weight: 500; overflow-wrap: anywhere; }
.media { margin: 0; }
.media img, .media video { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.media audio { width: 100%; max-width: 420px; }
.media--small { max-width: 240px; } .media--medium { max-width: 480px; } .media--full { max-width: 100%; }
.media figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* текст с тегами */
.rich { overflow-wrap: anywhere; }
.rich blockquote { margin: 8px 0; padding: 4px 14px; border-left: 3px solid #555; color: #ccc; }
.rich pre { background: var(--card-2); border-radius: var(--radius); padding: 10px 14px; overflow-x: auto; white-space: pre; }
.rich code { font-family: var(--mono); background: var(--card-2); border-radius: 4px; padding: 1px 5px; font-size: .92em; }
.rich pre code { padding: 0; background: none; }
.rich ul, .rich ol { margin: 6px 0; padding-left: 24px; }
.c-red { color: #ff6b6b; } .c-orange { color: #ff9f43; } .c-yellow { color: #ffd34d; } .c-green { color: #5fd68a; } .c-cyan { color: #4dd6e8; }
.c-blue { color: #6cb6ff; } .c-purple { color: #c792ff; } .c-pink { color: #ff8ad8; } .c-gray { color: #9a9a9a; }
.veil { display: inline; font-family: var(--mono); color: #bbb; letter-spacing: .02em; user-select: none; -webkit-user-select: none; pointer-events: none; word-break: break-all; }
.sec-open { border-bottom: 1px dotted #666; }
.sec-open--mark { background: rgba(199, 146, 255, .13); border-bottom: 1px dotted var(--lock); }
.locked { outline: 1px dashed var(--lock); outline-offset: 4px; border-radius: 4px; }
.lockbadge { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font: 500 12px/1 var(--sans); color: var(--lock); background: rgba(199, 146, 255, .12); border-radius: 10px; padding: 3px 8px; vertical-align: middle; }
.lockbadge .ico { width: 1em; height: 1em; font-size: 12px; }

/* редактор */
.ed__bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: rgba(0, 0, 0, .94); border-bottom: 1px solid var(--line); margin: -24px -16px 20px; padding: 10px 16px; backdrop-filter: blur(6px); }
.ed__word { font-size: 18px; margin-right: 6px; }
.ed__status { font-size: 14px; }
.ed__cols { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.ed__panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.ed__panel > label { display: block; margin: 12px 0 4px; font-size: 14px; }
.ed__files { margin-top: 24px; }
.ed__photo { display: grid; gap: 8px; }
.mprev { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; }
.erow { border: 1px solid #262626; border-radius: 10px; padding: 8px; margin: 8px 0; display: grid; gap: 6px; }
.erow--locked, .blk--locked { border-color: #4a3a63; }
.erow__head { display: flex; align-items: center; gap: 2px; }
.blocks { display: grid; gap: 12px; }
.blk { border: 1px solid #2e2e2e; border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: #080808; min-width: 0; }
.blk--section { background: #0d0d0d; border-color: #3a3a3a; }
.blk__head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.blk__type { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: #ddd; }
.blk__children { border-left: 2px solid #333; padding-left: 12px; margin-left: 4px; }
.permpick { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.permpick--on { color: var(--lock); }
.permsel { min-height: 32px; padding: 3px 8px; font-size: 13px; max-width: 200px; }
.permpick--on .permsel { border-color: #6b4f93; }
.filepick { min-height: 34px; padding: 4px 8px; font-size: 14px; max-width: 260px; }
.addmenu { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mediaedit { display: grid; gap: 8px; }
.rte { border: 1.5px solid #3a3a3a; border-radius: var(--radius); overflow: visible; position: relative; }
.rte:focus-within { border-color: #777; }
.rte__bar { position: relative; display: flex; align-items: center; gap: 1px; flex-wrap: wrap; padding: 3px 4px; border-bottom: 1px solid #2a2a2a; background: #101010; border-radius: 6px 6px 0 0; }
.rte__src { border: 0; border-radius: 0 0 6px 6px; display: block; font-family: var(--mono); font-size: 14px; min-height: 0; }
.rte__src:focus { outline: none; }
.rte__view { padding: 10px 12px; min-height: 60px; }
.pop { position: absolute; top: 100%; z-index: 30; margin-top: 4px; min-width: 220px; max-width: 260px; background: #151515; border: 1px solid #555; border-radius: 10px; padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; box-shadow: 0 8px 30px rgba(0, 0, 0, .7); }
.pop__hint { width: 100%; margin: 2px 4px 4px; font-size: 13px; color: var(--muted); }
.pop__item { width: 100%; text-align: left; background: transparent; border: 0; color: #fff; font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.pop__item:hover { background: #2a2a2a; }
.swatch { width: 34px; height: 34px; border-radius: 6px; border: 1px solid #444; background: #0b0b0b; font: 700 16px var(--sans); cursor: pointer; }
.swatch:hover { background: #222; }
.flist .frow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid #262626; border-radius: 10px; padding: 8px 10px; }
.frow__thumb { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--card-2); flex: none; }
.frow__thumb--ico { display: inline-flex; align-items: center; justify-content: center; }
.frow__info { flex: 1 1 200px; display: grid; min-width: 0; }
.frow__name { font-weight: 500; overflow-wrap: anywhere; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.dropzone { margin-top: 12px; border: 2px dashed #555; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.dropzone--over { border-color: #fff; background: #151515; color: #fff; }
.help ul { padding-left: 20px; display: grid; gap: 6px; }

/* окна, права, сообщения */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .72); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px 12px; overflow-y: auto; }
.modal__box { width: 100%; max-width: 480px; background: #101010; border: 1px solid #555; border-radius: 14px; padding: 18px; }
.modal__box--wide { max-width: 720px; }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal__head h2 { margin: 0; }
.modal__body { display: grid; gap: 10px; }
.perm { border: 1px solid #2e2e2e; border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.perm__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.perm__name { font: 700 16px var(--mono); color: var(--lock); }
.perm__users { display: flex; gap: 6px; flex-wrap: wrap; }
.usertag { display: inline-flex; align-items: center; gap: 2px; background: #1c1c1c; border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 14px; }
.usertag__x { border: 0; background: transparent; color: #aaa; cursor: pointer; border-radius: 50%; min-width: 24px; height: 24px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; }
.usertag__x:hover { background: #333; color: #fff; }
.pickwrap { display: grid; gap: 4px; }
.pick { display: grid; gap: 2px; }
.pick__item { text-align: left; background: #151515; border: 1px solid #2e2e2e; border-radius: 8px; color: #fff; font: inherit; font-size: 14px; padding: 6px 10px; cursor: pointer; }
.pick__item:hover { border-color: #fff; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 200; padding: 10px 18px; border-radius: 10px; background: #1b1b1b; border: 1px solid #555; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; }
.toast--on { opacity: 1; transform: translate(-50%, 0); }
.toast--err { border-color: var(--bad); color: var(--bad); }
.toast--ok { border-color: var(--ok); }

.error-page { min-height: 100vh; display: flex; flex-direction: column; }
.error-page .top { border-bottom: 0; }
.error { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px 20px 72px; text-align: center; }
.error__code { margin: 0; font: 400 clamp(110px, 26vw, 280px)/.9 var(--logo); letter-spacing: -.04em; }
.error__title { margin: 12px 0 0; font-size: clamp(26px, 5vw, 40px); font-weight: 700; }
.error__text { max-width: 520px; margin: 8px 0 0; font-size: 18px; color: #bdbdbd; }
.error__actions { margin-top: 24px; }

@media (max-width: 860px) {
    .page__cols, .ed__cols { grid-template-columns: 1fr; }
    .infobox { max-width: 460px; }
}
@media (max-width: 560px) {
    .logo-img { height: 34px; } .mark__text { font-size: 22px; }
    .ed__bar { position: static; margin: 0 0 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
