:root {
  /* палитра как у кланового дешборда */
  --bg: #14151b; --side: #0e0f14; --bg2: #22232c; --panel: #1b1c24; --panel2: #22232c; --panel3: #2c2e39;
  --line: #2a2c36; --line2: #373945;
  --text: #dcddde; --muted: #8b8d98; --dim: #6b6d79;
  --gold: #9184d9; --gold-hover: #7d6ecb; --gold2: #b3a9ec; --gold-bg: rgba(145, 132, 217, .16);
  --red: #e5484d; --green: #23a55a; --blue: #5865f2; --orange: #e0a040;
  --r: 14px; --r-sm: 8px;
  font-family: 'gg sans', 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
body { min-height: 100vh; background: var(--bg); }
[hidden] { display: none !important; }
a { color: var(--gold2); text-decoration: none; }
code { background: var(--panel3); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; font-family: Consolas, monospace; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: #fff; }
h3 { font-size: 16px; color: #fff; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.brand { font-weight: 800; }
.err { color: var(--red); min-height: 20px; margin: 8px 0 0; font-size: 13px; }

/* ---------- кнопки и поля ---------- */
.btn { --c: var(--panel3); appearance: none; border: 1px solid var(--line2); background: var(--c); color: var(--text); font: inherit; font-weight: 600;
  padding: 9px 16px; border-radius: var(--r-sm); cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn:hover { border-color: var(--dim); background: #2b2b35; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.gold { background: var(--gold); border-color: transparent; color: #fff; }
.btn.gold:hover { background: var(--gold-hover); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8a8d; border-color: #5a2a2d; background: #2a1517; }
.btn.danger:hover { background: #3a1b1e; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn.wide { width: 100%; justify-content: center; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: var(--panel3); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field > span .counter { margin-left: auto; }
.field > span em { font-style: normal; color: var(--dim); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 11px; width: 100%; outline: none; transition: border-color .15s; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input[type=color] { padding: 2px; height: 38px; width: 46px; cursor: pointer; }
input[type=checkbox] { width: auto; }
select { cursor: pointer; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

/* переключатель */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 38px; height: 22px; background: var(--panel3); border: 1px solid var(--line2); border-radius: 20px; position: relative; transition: .2s; flex: none; }
.switch i::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); top: 2px; left: 2px; transition: .2s; }
.switch input:checked + i { background: var(--gold); border-color: var(--gold); }
.switch input:checked + i::after { left: 18px; background: #fff; }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--gold-bg); }

/* ---------- вход ---------- */
.hero { text-align: center; padding: 80px 20px 8px; max-width: 480px; margin: 0 auto; }
.hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: #fff; margin: 0 0 4px; display: inline-flex; align-items: center; gap: 12px; }
.hero > p { color: var(--muted); max-width: 440px; margin: 8px auto 24px; line-height: 1.5; }
.hero .btn { padding: 11px 18px; font-size: 14px; border-radius: 8px; }
.hero .hint { margin-top: 14px; line-height: 1.6; }
.dlogo { width: 34px; height: 26px; color: #fff; flex: none; }
.dlogo.sm { width: 20px; height: 15px; }
.hero h1 .dlogo { color: var(--gold2); }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { display: flex; gap: 10px; align-items: center; padding: 8px 10px 18px; font-size: 18px; font-weight: 800; color: #fff; }
.logo-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--gold); display: grid; place-items: center; flex: none; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 10px 6px; font-weight: 700; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { display: flex; gap: 11px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 600; transition: .15s; }
#nav a i { font-style: normal; width: 20px; text-align: center; opacity: .85; }
#nav a:hover { background: var(--panel); color: var(--text); }
#nav a.on { background: var(--gold-bg); color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.usercard { display: flex; gap: 10px; align-items: center; padding: 8px 8px 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.usercard .avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--panel2); }
.uc-name { flex: 1; min-width: 0; }
.uc-name b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.uc-name small { display: block; color: var(--muted); font-size: 11.5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 4px; }
.dot.off { background: var(--red); }
.made { text-align: center; color: var(--dim); font-size: 11px; letter-spacing: .05em; }

main { min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: rgba(20,21,27,.85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; }
.guild { display: flex; align-items: center; gap: 10px; min-width: 0; }
.guild img, .guild .gph { width: 34px; height: 34px; border-radius: 10px; flex: none; }
.gph { background: var(--panel3); display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.guild select { width: auto; max-width: 260px; font-weight: 700; background: transparent; border-color: transparent; padding-left: 4px; }
.guild b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; gap: 8px; align-items: center; }
.page { padding: 24px 32px 110px; max-width: 1320px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; min-width: 0; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols > div { min-width: 0; }

/* ---------- обзор ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; position: relative; overflow: hidden; }
.stat b { font-size: 28px; display: block; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat i { position: absolute; right: 14px; top: 12px; font-style: normal; font-size: 20px; opacity: .35; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.log li:last-child { border-bottom: 0; }
.log li time { color: var(--dim); font-size: 12px; white-space: nowrap; }
.log li small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-word; }
.empty { color: var(--dim); text-align: center; padding: 24px 8px; font-size: 13.5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv span { color: var(--muted); }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 12px; margin-top: 4px; }
.linkbox a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* ---------- чипы (роли/каналы) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); min-height: 40px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel3); border: 1px solid var(--line2); border-radius: 20px; padding: 2px 4px 2px 10px; font-size: 12.5px; font-weight: 600; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.chip button:hover { color: var(--red); }
.chips select { width: auto; flex: 1; min-width: 140px; border: 0; background: transparent; padding: 4px; color: var(--muted); box-shadow: none; }

/* ---------- автомод ---------- */
.rule { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rule:last-child { border-bottom: 0; padding-bottom: 0; }
.rule:first-child { padding-top: 0; }
.rule h3 { display: flex; gap: 8px; align-items: center; }
.rule p { margin: 3px 0 10px; color: var(--muted); font-size: 13px; }
.rule .opts { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.rule .opts .field { margin: 0; min-width: 150px; flex: 1; }
.rule .opts .field.narrow { max-width: 130px; min-width: 100px; }
.rule.off .opts { opacity: .45; pointer-events: none; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--panel3); color: var(--muted); }
.tag.on { background: rgba(63,185,80,.15); color: #6fdc80; }
.tag.gold { background: var(--gold-bg); color: var(--gold2); }

/* ---------- таблицы ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* ---------- типы тикетов ---------- */
.tt { border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); margin-bottom: 12px; }
.tt > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.tt > summary::-webkit-details-marker { display: none; }
.tt > summary .pv { margin-left: auto; }
.tt[open] > summary { border-bottom: 1px solid var(--line); }
.tt .body { padding: 14px; }
.q { display: grid; grid-template-columns: 1fr 1fr auto auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.q label { font-size: 12px; color: var(--muted); display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.dbtn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 4px; font: 500 14px 'Noto Sans', sans-serif; color: #fff; }
.dbtn.Primary { background: #5865f2; } .dbtn.Secondary { background: #4e5058; } .dbtn.Success { background: #248046; } .dbtn.Danger { background: #da373c; }
.dbtn.Link { background: #4e5058; }

/* ---------- редактор сообщений ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.preview-col { position: sticky; top: 80px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--panel3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04); }
.tools { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: var(--panel2); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tools + textarea { border-radius: 0 0 var(--r-sm) var(--r-sm); }
.tools button { background: none; border: 0; color: var(--muted); font: 600 13px 'Noto Sans', sans-serif; min-width: 30px; height: 28px; padding: 0 7px; border-radius: 6px; cursor: pointer; }
.tools button:hover { background: var(--panel3); color: var(--text); }
.tools .sep { width: 1px; background: var(--line2); margin: 4px 3px; }
.colors { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw.on { border-color: #fff; }
.img-field { display: flex; gap: 6px; }
.img-field input[type=text] { flex: 1; }
.drop { border: 1.5px dashed var(--line2); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; font-size: 13px; }
.drop:hover, .drop.over { border-color: var(--gold); color: var(--gold2); background: var(--gold-bg); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; width: 86px; height: 86px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line2); background: var(--bg2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.75); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.thumb small { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.7); font-size: 10px; padding: 2px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fieldrow { display: grid; grid-template-columns: 1fr 1.6fr auto auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.fieldrow textarea { min-height: 40px; height: 40px; }
.fieldrow label { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; height: 40px; white-space: nowrap; }
.counter { font-weight: 500; color: var(--dim); font-size: 11.5px; }
.counter.over { color: var(--red); }
details.sec { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 6px; }
details.sec > summary { cursor: pointer; list-style: none; padding: 10px 0; font-weight: 700; display: flex; align-items: center; gap: 8px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: '›'; display: inline-block; transition: .15s; color: var(--muted); width: 12px; }
details.sec[open] > summary::before { transform: rotate(90deg); }
details.sec > summary small { color: var(--dim); font-weight: 500; }

/* шпаргалка */
.cheat { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cheat button { text-align: left; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--text); cursor: pointer; font: inherit; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.cheat button:hover { border-color: var(--gold); }
.cheat button code { background: none; padding: 0; color: var(--gold2); }
.cheat button span { color: var(--muted); font-size: 12px; }
.tips { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.tips li { margin-bottom: 6px; }
.tips b { color: var(--text); }

/* ---------- превью Discord ---------- */
.dc { background: #313338; border-radius: var(--r); padding: 16px 16px 18px 16px; font-family: 'gg sans', 'Noto Sans', 'Segoe UI', sans-serif; color: #dbdee1; font-size: 15px; line-height: 1.375; }
.dc-bar { display: flex; justify-content: space-between; align-items: center; color: #949ba4; font-size: 12px; margin: -4px 0 12px; font-family: inherit; }
.dc-msg { display: grid; grid-template-columns: 40px 1fr; gap: 0 16px; }
.dc-ava { width: 40px; height: 40px; border-radius: 50%; background: var(--panel3); }
.dc-name { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.dc-name b { color: #f2f3f5; font-weight: 500; }
.dc-badge { background: #5865f2; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; line-height: 15px; }
.dc-name time { color: #949ba4; font-size: 12px; }
.dc-body { min-width: 0; word-wrap: break-word; }
.dc-text { white-space: pre-wrap; }
.dc-embed { display: grid; grid-template-columns: minmax(0, 1fr) auto; max-width: 516px; background: #2b2d31; border-left: 4px solid var(--gold); border-radius: 4px; padding: 8px 16px 16px 12px; margin-top: 4px; gap: 0 16px; }
.dc-embed > * { grid-column: 1; }
.dc-embed .e-thumb { grid-column: 2; grid-row: 1 / 6; width: 80px; height: 80px; object-fit: cover; border-radius: 4px; margin-top: 8px; }
.e-author { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.e-author img { width: 24px; height: 24px; border-radius: 50%; }
.e-title { margin-top: 8px; font-weight: 600; color: #f2f3f5; font-size: 16px; }
.e-title a { color: #00a8fc; }
.e-desc { margin-top: 8px; font-size: 14px; white-space: pre-wrap; }
.e-fields { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; margin-top: 8px; }
.e-field { grid-column: span 12; font-size: 14px; min-width: 0; }
.e-field.inline { grid-column: span 4; }
.e-field b { display: block; color: #f2f3f5; font-weight: 600; margin-bottom: 2px; }
.e-field div { white-space: pre-wrap; }
.e-image { margin-top: 16px; max-width: 100%; max-height: 300px; border-radius: 4px; display: block; }
.e-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #b5bac1; }
.e-foot img { width: 20px; height: 20px; border-radius: 50%; }
.dc-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-width: 516px; }
.dc-atts img { max-width: 100%; max-height: 260px; border-radius: 8px; }
.dc-atts.many img { width: calc(50% - 3px); height: 160px; object-fit: cover; }
.dc-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btns .dbtn.Link::after { content: '↗'; font-size: 12px; opacity: .8; }
/* разметка Discord */
.dc strong { font-weight: 700; } .dc u { text-decoration: underline; } .dc s { text-decoration: line-through; }
.dc .md-code { background: #2b2d31; border: 1px solid #1e1f22; padding: 0 3px; border-radius: 4px; font: 13px Consolas, monospace; }
.dc pre { background: #2b2d31; border: 1px solid #1e1f22; padding: 8px; border-radius: 4px; font: 13px Consolas, monospace; white-space: pre-wrap; margin: 4px 0; }
.dc-embed pre { background: #1e1f22; }
.dc blockquote { margin: 0; padding-left: 12px; border-left: 4px solid #4e5058; }
.dc .h1 { font-size: 24px; font-weight: 700; color: #f2f3f5; display: block; margin: 8px 0 4px; line-height: 1.2; }
.dc .h2 { font-size: 20px; font-weight: 700; color: #f2f3f5; display: block; margin: 8px 0 4px; line-height: 1.2; }
.dc .h3 { font-size: 16px; font-weight: 700; color: #f2f3f5; display: block; margin: 8px 0 4px; }
.dc .sub { font-size: 12px; color: #949ba4; display: block; }
.dc .li { display: block; padding-left: 18px; position: relative; }
.dc .li::before { content: '•'; position: absolute; left: 5px; }
.dc .li-num { display: block; padding-left: 4px; }
.dc .spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.dc .spoiler.show, .dc .spoiler:hover { color: inherit; background: #404249; }
.dc .mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc .ts { background: rgba(255,255,255,.06); border-radius: 3px; padding: 0 2px; }
.dc .emoji { width: 22px; height: 22px; vertical-align: -5px; object-fit: contain; }
.dc a { color: #00a8fc; }

/* ---------- всплывашки ---------- */
.pop { position: fixed; z-index: 100; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.6); padding: 10px; width: 290px; max-height: 360px; overflow: auto; }
.pop input { margin-bottom: 8px; }
.pop .opt { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pop .opt:hover { background: var(--panel3); }
.pop .opt small { color: var(--dim); margin-left: auto; font-size: 11px; }
.pop .emo { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.pop .emo button { background: none; border: 0; font-size: 20px; padding: 4px; border-radius: 6px; cursor: pointer; }
.pop .emo button:hover { background: var(--panel3); }
.pop .emo img { width: 24px; height: 24px; object-fit: contain; }
.pop h4 { margin: 4px 2px 8px; font-size: 12px; color: var(--muted); }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--green); padding: 11px 16px; border-radius: 9px; box-shadow: 0 12px 30px rgba(0,0,0,.5); max-width: 380px; animation: tin .2s ease-out; font-size: 13.5px; }
.toast.bad { border-left-color: var(--red); }
.toast a { font-weight: 700; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.savebar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90; display: flex; gap: 20px; align-items: center; justify-content: space-between;
  background: var(--panel2); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 12px 10px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.6); width: min(560px, calc(100% - 32px)); animation: tin .2s; font-weight: 600; }
.tip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--panel3); color: var(--muted); font-size: 10.5px; font-weight: 700; cursor: help; position: relative; flex: none; }
.tip:hover::after { content: attr(data-tip); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 260px; background: #000; color: var(--text); padding: 7px 10px; border-radius: 7px; font-size: 12px; font-weight: 500; line-height: 1.4; z-index: 50; white-space: normal; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* ---------- адаптив ---------- */
@media (max-width: 1200px) {
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .preview-col { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 40; padding: 6px; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); }
  .logo, .side-foot { display: none; }
  #nav { flex-direction: row; width: 100%; justify-content: space-around; }
  #nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; text-align: center; }
  #nav a.on { box-shadow: none; }
  .nav-label { display: none; }
  .top { padding: 10px 16px; }
  .page { padding: 18px 16px 150px; }
  .cols, .grid2, .grid3 { grid-template-columns: 1fr; }
  .savebar { bottom: 76px; }
  .toasts { bottom: 140px; left: 16px; right: 16px; }
  .q { grid-template-columns: 1fr 1fr; }
  .fieldrow { grid-template-columns: 1fr auto; }
  .fieldrow textarea { grid-column: 1 / -1; }
  .cheat { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 22px; }
  .row { flex-direction: column; gap: 0; }
  .row > * { width: 100%; }
  .e-field.inline { grid-column: span 12; }
}
