@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0a0b0f;
  --panel: rgba(255,255,255,0.04);
  --panel-2: rgba(255,255,255,0.065);
  --panel-solid: #14161d;
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.19);
  --text: #f3f4f7;
  --text-dim: #a3aabd;
  --gold: #f0b429;
  --gold-2: #ffd166;
  --gold-dim: #7a6329;
  --violet: #8b7bff;
  --danger: #ef5a52;
  --ok: #3ec079;
  --radius: 14px;
  --radius-sm: 9px;
  --glow-gold: 0 0 0 1px rgba(240,180,41,0.25), 0 8px 28px rgba(240,180,41,0.18);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 28px rgba(0,0,0,0.28);
  --shadow-card-hover: 0 1px 0 rgba(255,255,255,0.04) inset, 0 16px 38px rgba(0,0,0,0.36);
  --ease: cubic-bezier(.22,.9,.32,1.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 620px at 10% -14%, rgba(240,180,41,0.10), transparent 60%),
    radial-gradient(1000px 560px at 108% 4%, rgba(139,123,255,0.09), transparent 60%),
    radial-gradient(800px 560px at 50% 118%, rgba(240,180,41,0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  animation: pageFadeIn .35s var(--ease);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(240,180,41,0.3); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-2); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }

a { color: inherit; text-decoration: none; }

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px 32px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
  position: sticky;
  top: 0;
  background: rgba(7,8,11,0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.brand:hover { opacity: .85; transform: translateY(-1px); }
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--gold-2), var(--gold) 55%, #a97b1f);
  display: flex; align-items: center; justify-content: center;
  color: #14100a; font-weight: 800;
  box-shadow: var(--glow-gold);
}

.nav { display: flex; gap: 22px; font-weight: 600; color: var(--text-dim); font-size: 14.5px; }
.nav a { position: relative; padding: 4px 0; transition: color .2s var(--ease); }
.nav a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: -3px; height: 2px;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  border-radius: 2px; transition: right .25s var(--ease);
}
.nav a:hover { color: var(--text); }
.nav a:hover::after, .nav a.active::after { right: 0; }
.nav a.active { color: var(--text); }

.search-box {
  position: relative;
  width: 100%;
  max-width: 440px;
  justify-self: center;
}
.search-box input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.search-box input:focus { outline: none; border-color: var(--gold-dim); background: var(--panel-2); box-shadow: var(--glow-gold); }
.search-box input::placeholder { color: var(--text-dim); }
.search-box::before {
  content: '⌕';
  position: absolute;
  left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 17px;
  pointer-events: none;
  transition: color .2s var(--ease);
}
.search-box:focus-within::before { color: var(--gold); }
.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0; right: 0;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  z-index: 20;
  display: none;
  box-shadow: 0 20px 48px rgba(0,0,0,0.5);
  animation: dropdownIn .18s var(--ease);
}
.search-results a { display: block; padding: 11px 16px; font-weight: 600; transition: background .15s, padding-left .15s; }
.search-results a:hover { background: var(--panel-2); padding-left: 20px; }

/* Подсказки по нику в модалке "Выдать наказание" (см. #rNick в admin.js) */
.nick-suggest-wrap { position: relative; }
.nick-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  z-index: 50;
  display: none;
  box-shadow: 0 20px 48px rgba(0,0,0,0.5);
  animation: dropdownIn .15s var(--ease);
  max-height: 260px;
  overflow-y: auto;
}
.nick-suggest.open { display: block; }
.nick-suggest-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; transition: background .12s;
}
.nick-suggest-item:hover:not(.disabled) { background: var(--panel-2); }
.nick-suggest-item .avatar-head { width: 28px; height: 28px; flex: none; }
.nick-suggest-item .nsi-name { font-weight: 600; font-size: 14px; }
.nick-suggest-item .nsi-discord { font-size: 11px; color: var(--text-dim); }
.nick-suggest-item.disabled { cursor: not-allowed; opacity: .5; }
.nick-suggest-item .nsi-badge {
  margin-left: auto; font-size: 11px; color: var(--red, #ed4245);
  border: 1px solid currentColor; border-radius: 6px; padding: 2px 6px; white-space: nowrap;
}
.nick-suggest-empty { padding: 10px 14px; font-size: 13px; color: var(--text-dim); }

/* ---------- Редактор вебхука (модалка "Отправить сообщение") ---------- */
/* modal-lg: шире обычной модалки; modal-resizable: вдобавок можно вручную растянуть за
   уголок (родная браузерная ручка resize внизу справа) — сама модалка не под завязку по
   высоте (max-height у .modal общий), поэтому есть куда расти. */
.modal.modal-lg { max-width: 1300px; width: 96vw; }
.modal.modal-resizable { resize: both; overflow: auto; min-width: 720px; min-height: 480px; }
.wh-editor-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .wh-editor-layout { grid-template-columns: 1fr; } }
/* Превью справа остаётся на виду, пока заполняешь длинную форму embed'ов слева */
@media (min-width: 761px) { .wh-editor-layout > .wh-editor-col:last-child { position: sticky; top: 0; } }
.wh-editor-col textarea#whSendContent { min-height: 320px; resize: vertical; font-family: inherit; line-height: 1.5; }
.wh-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wh-toolbar button {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: 7px; padding: 5px 9px; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.wh-toolbar button:hover { background: var(--panel-2); border-color: var(--border-strong); }
.wh-charcount { text-align: right; font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.wh-charcount.over { color: var(--danger); font-weight: 700; }

/* Превью в стиле Discord — тёмная карточка сообщения от вебхука */
.discord-preview-label { font-size: 12px; color: var(--text-dim); font-weight: 700; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.discord-preview {
  background: #313338; border-radius: 10px; padding: 14px 16px;
  font-family: 'gg sans', Inter, system-ui, sans-serif;
  color: #dbdee1; min-height: 220px;
}
.discord-preview-head { display: flex; gap: 12px; align-items: flex-start; }
.discord-preview-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--gold), var(--violet));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #14161d; font-size: 15px;
}
.discord-preview-name-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.discord-preview-name { color: #f2f3f5; font-weight: 600; font-size: 15px; }
.discord-preview-bot-tag {
  background: #5865f2; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 3px; padding: 1px 4px; line-height: 1.4; vertical-align: middle;
}
.discord-preview-time { color: #949ba4; font-size: 11px; }
.discord-preview-body { margin-top: 2px; font-size: 15px; line-height: 1.375; white-space: pre-wrap; word-break: break-word; }
.discord-preview-body:empty::before { content: 'Тут появится предпросмотр сообщения...'; color: #6d7178; font-style: italic; }
.discord-preview-body h1 { font-size: 20px; margin: 8px 0 4px; color: #f2f3f5; }
.discord-preview-body h2 { font-size: 18px; margin: 6px 0 4px; color: #f2f3f5; }
.discord-preview-body h3 { font-size: 16px; margin: 4px 0 4px; color: #f2f3f5; }
.discord-preview-body code { background: rgba(0,0,0,0.35); border-radius: 4px; padding: 1px 4px; font-family: 'Consolas', monospace; font-size: 85%; }
.discord-preview-body pre { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 6px; padding: 8px 10px; overflow-x: auto; margin: 6px 0; }
.discord-preview-body pre code { background: none; padding: 0; }
.discord-preview-body blockquote { border-left: 4px solid #4e5058; margin: 4px 0; padding: 0 8px; color: #dbdee1; }
.discord-preview-body .wh-mention { background: rgba(88,101,242,0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.discord-preview-body .wh-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.discord-preview-body .wh-spoiler.revealed { color: inherit; background: #2b2d31; }
.discord-preview-body ul { margin: 4px 0; padding-left: 20px; }
.discord-preview-head > div:last-child { min-width: 0; flex: 1; }
.discord-preview.has-embeds .discord-preview-body:empty { display: none; }
.discord-preview-body a, .dc-embed a { color: #00a8fc; text-decoration: none; }
.discord-preview-body a:hover, .dc-embed a:hover { text-decoration: underline; }

/* ---------- Embed'ы вебхука: редактор ---------- */
.wh-embeds { margin: 4px 0 14px; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.wh-embeds-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.wh-embeds-title { font-size: 14px; font-weight: 700; color: var(--text); }
.wh-embeds-actions { display: flex; gap: 6px; }
.wh-embeds-actions .btn { padding: 5px 12px; font-size: 13px; }
.wh-ecount { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-left: 6px; }
.wh-embed-total { min-height: 0; margin-bottom: 8px; font-size: 12px; color: var(--text-dim); }
.wh-embed-total:empty { display: none; }
.wh-embed-total.over { color: var(--danger); font-weight: 700; }
.wh-embed-empty { padding: 6px 2px; font-size: 13px; }
.wh-embed-json { margin-bottom: 10px; }
.wh-embed-json textarea { width: 100%; box-sizing: border-box; min-height: 160px; font-family: 'Consolas', monospace; font-size: 12px; resize: vertical; }
.wh-embed-json-btns { display: flex; gap: 8px; margin: 8px 0 4px; }
.wh-embed-json-btns .btn { padding: 5px 12px; font-size: 13px; }

.wh-embed { margin-bottom: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.wh-embed > summary { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; list-style: none; user-select: none; }
.wh-embed > summary::-webkit-details-marker { display: none; }
.wh-embed > summary::before { content: '▸'; flex: none; font-size: 12px; color: var(--text-dim); transition: transform .12s; }
.wh-embed[open] > summary::before { transform: rotate(90deg); }
.wh-embed-swatch { flex: none; width: 6px; height: 22px; border-radius: 3px; }
.wh-embed-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-embed-ctl { display: flex; gap: 4px; flex: none; }
.wh-embed-body { padding: 4px 12px 12px; border-top: 1px solid var(--border); }
.wh-egroup { margin: 12px 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.wh-egrid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.wh-egrid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .wh-egrid-2 { grid-template-columns: 1fr; } }
.wh-egrid .field, .wh-efield .field { margin-bottom: 0; }
.wh-embed-body > .field { margin-bottom: 8px; }
.wh-embed-body textarea { min-height: 70px; }
.wh-ecolor { display: flex; align-items: center; gap: 8px; }
.wh-ecolor input[type="color"] { flex: none; width: 44px; height: 34px; padding: 2px; cursor: pointer; }
.wh-ecolor input[type="text"] { width: 110px; flex: none; font-family: 'Consolas', monospace; }
.wh-efield { margin-bottom: 8px; padding: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.wh-efield .field { margin-bottom: 6px; }
.wh-efield-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.wh-efield-n { flex: 1; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.wh-efield-inline { margin: 0; }
.wh-ebtn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 6px;
  padding: 3px 9px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.wh-ebtn:hover:not(:disabled) { background: var(--panel-2); border-color: var(--border-strong); }
.wh-ebtn:disabled { opacity: .4; cursor: not-allowed; }
.wh-ebtn-wide { width: 100%; padding: 6px 10px; font-size: 13px; }

/* ---------- Embed'ы вебхука: превью как в Discord ---------- */
.dc-embeds { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.dc-embed {
  max-width: 520px; box-sizing: border-box; background: #2b2d31; border-left: 4px solid #1e1f22;
  border-radius: 4px; padding: 8px 16px 16px 12px; color: #dbdee1; font-size: 14px; line-height: 1.375;
}
.dc-embed-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
.dc-embed-main { min-width: 0; display: flex; flex-direction: column; }
.dc-embed-author { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 600; color: #f2f3f5; }
.dc-embed-author a { color: #f2f3f5; }
.dc-embed-author-icon { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dc-embed-title { margin-top: 8px; font-size: 16px; font-weight: 700; color: #f2f3f5; overflow-wrap: anywhere; }
.dc-embed-title a { color: #00a8fc; }
.dc-embed-desc { margin-top: 8px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-embed-desc h1 { font-size: 20px; margin: 8px 0 4px; color: #f2f3f5; }
.dc-embed-desc h2 { font-size: 18px; margin: 6px 0 4px; color: #f2f3f5; }
.dc-embed-desc h3 { font-size: 16px; margin: 4px 0 4px; color: #f2f3f5; }
.dc-embed-desc code, .dc-embed-field-value code { background: rgba(0,0,0,.35); border-radius: 4px; padding: 1px 4px; font-family: 'Consolas', monospace; font-size: 85%; }
.dc-embed-desc pre { background: #1e1f22; border-radius: 4px; padding: 8px 10px; overflow-x: auto; margin: 6px 0; }
.dc-embed-desc pre code { background: none; padding: 0; }
.dc-embed-desc blockquote { border-left: 4px solid #4e5058; margin: 4px 0; padding: 0 8px; }
.dc-embed-desc ul { margin: 4px 0; padding-left: 20px; }
.dc-embed .wh-mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-embed .wh-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.dc-embed .wh-spoiler.revealed { color: inherit; background: #111214; }
.dc-embed-fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.dc-embed-field { grid-column: 1 / -1; min-width: 0; }
.dc-embed-field.inline { grid-column: span 4; }
.dc-embed-field-name { font-size: 14px; font-weight: 700; color: #f2f3f5; overflow-wrap: anywhere; }
.dc-embed-field-value { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dc-embed-image { margin-top: 16px; }
.dc-embed-image img { display: block; max-width: 100%; max-height: 300px; border-radius: 4px; }
.dc-embed-thumb img { display: block; width: 80px; height: 80px; margin-top: 8px; border-radius: 4px; object-fit: cover; }
.dc-embed-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 500; color: #b5bac1; }
.dc-embed-footer-icon { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }

.account { display: flex; align-items: center; gap: 10px; }
.btn {
  padding: 9px 17px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s var(--ease), transform .15s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); background: var(--panel-2); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #14100a; border-color: transparent;
  box-shadow: 0 6px 20px rgba(240,180,41,0.25);
}
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 26px rgba(240,180,41,0.35); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(239,90,82,0.4); }
.btn.danger:hover { background: rgba(239,90,82,0.08); border-color: var(--danger); }

.container { max-width: var(--page-width); margin: 0 auto; padding: 36px 32px 56px; }

h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 19px; font-weight: 800; margin: 0 0 16px; letter-spacing: -0.01em; }
.muted { color: var(--text-dim); }

.mode-tabs { display: flex; gap: 8px; margin: 24px 0; flex-wrap: wrap; }
.mode-tab {
  padding: 9px 17px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-weight: 700;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.mode-tab:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.mode-tab.active {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #14100a; border-color: transparent;
  box-shadow: 0 6px 18px rgba(240,180,41,0.28);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-card);
  transition: border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-card-hover); }

.podium { display: grid; grid-template-columns: 1fr 1.1fr 1fr; gap: 14px; margin-bottom: 20px; }
.podium .card { text-align: center; }
.podium .card:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.podium .rank { font-weight: 800; color: var(--gold); font-size: 14px; }
.podium .name { font-weight: 800; font-size: 18px; margin: 6px 0 2px; }
.podium .score { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }

.tier-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  margin: 2px 3px 2px 0;
  transition: border-color .2s;
}

.leader-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  transition: background .18s var(--ease), padding-left .18s var(--ease);
}
.leader-row:hover { background: var(--panel-2); padding-left: 12px; }
.leader-row .rank { width: 26px; color: var(--text-dim); font-weight: 700; }
.leader-row .name { font-weight: 700; flex: 0 0 180px; }
.leader-row .chips { flex: 1; }
.leader-row .score { color: var(--text-dim); font-weight: 600; font-size: 13px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.steps .card .num { color: var(--gold); font-weight: 800; margin-right: 6px; }
.steps .card:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.avatar-skin {
  width: 72px; height: 72px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.tiers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tier-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }

/* --- модалки: открытие и закрытие анимируются на чистом CSS, JS только переключает .open --- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4,5,8,0.72);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .22s var(--ease), visibility .22s var(--ease);
}
.modal-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }
.modal {
  background: linear-gradient(180deg, var(--panel-2), var(--panel-solid));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 26px;
  width: 100%; max-width: 420px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  transform: scale(.93) translateY(14px);
  opacity: 0;
  transition: transform .3s var(--ease), opacity .22s var(--ease);
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
}
.modal-backdrop.open .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal .modal-close { cursor: pointer; color: var(--text-dim); font-size: 18px; border: none; background: none; transition: color .15s, transform .15s; }
.modal .modal-close:hover { color: var(--text); transform: rotate(90deg); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field .hint { display: block; font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold-dim); box-shadow: var(--glow-gold); }
.field textarea { resize: vertical; min-height: 60px; max-height: 200px; width: 100%; }
.radio-row { display: flex; gap: 10px; }
.radio-row label { flex: 1; border: 1px solid var(--border); border-radius: 9px; padding: 10px; text-align: center; cursor: pointer; font-weight: 600; font-size: 13px; transition: border-color .18s, background .18s; }
.radio-row label:hover { border-color: var(--gold-dim); }
.radio-row input { display: none; }
.radio-row input:checked + span { color: var(--gold); }
.radio-row label:has(input:checked) { border-color: var(--gold-dim); background: rgba(240,180,41,0.08); }
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; animation: shakeX .3s var(--ease); }

.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-dim);
  border-radius: 9px; padding: 10px 6px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: border-color .18s, background .18s, color .18s, transform .18s;
}
.mode-btn .icon { font-size: 18px; }
.mode-btn:hover { border-color: var(--gold-dim); color: var(--text); transform: translateY(-1px); }
.mode-btn.selected { border-color: var(--gold); background: rgba(240,180,41,0.1); color: var(--gold); }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer; user-select: none; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row span { font-size: 13px; color: var(--text-dim); font-weight: 600; }

/* Тумблер (напр. "Интеграция включена" в настройках Discord очереди) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text-dim);
  transition: transform .2s var(--ease), background .2s var(--ease);
}
.switch input:checked + .track { background: rgba(62,192,121,0.18); border-color: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--ok); }
.switch .label { font-size: 14px; font-weight: 700; }

.fieldset-box { border: 1px solid var(--border); border-radius: 11px; padding: 12px; margin-bottom: 14px; }
.fieldset-box > .field:last-child { margin-bottom: 0; }
.fieldset-box legend, .fieldset-box .legend { font-size: 13px; color: var(--text-dim); font-weight: 700; margin-bottom: 10px; }

.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* --- admin --- */
.admin-layout { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.admin-sidebar {
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  background: rgba(255,255,255,0.015);
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
}
.admin-sidebar .group-label { color: var(--text-dim); font-size: 11px; font-weight: 800; text-transform: uppercase; margin: 18px 8px 6px; letter-spacing: .06em; }
.admin-sidebar a {
  display: block; padding: 9px 12px; border-radius: 8px; font-weight: 600; color: var(--text-dim);
  border-left: 2px solid transparent; transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), transform .15s var(--ease);
  margin-bottom: 2px;
}
.admin-sidebar a:hover { background: var(--panel); color: var(--text); transform: translateX(2px); }
.admin-sidebar a.active { background: var(--panel-2); color: var(--gold); border-left-color: var(--gold); }
.admin-main { padding: 30px 34px 56px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-dim); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
tr { transition: background .15s var(--ease); }
tr:hover td { background: var(--panel); }
tr td:first-child { border-radius: 8px 0 0 8px; }
tr td:last-child { border-radius: 0 8px 8px 0; }
.badge { padding: 3px 10px; border-radius: 7px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.badge.license { background: rgba(62,192,121,0.15); color: var(--ok); }
.badge.pirate { background: rgba(227,154,59,0.15); color: #e39a3b; }

/* --- загрузка --- */
.loading-state { display: flex; align-items: center; gap: 10px; color: var(--text-dim); padding: 6px 0; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--gold);
  animation: spin .7s linear infinite; flex: none;
}

@media (max-width: 720px) {
  .podium, .steps { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
}

@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pageFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pageFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shakeX { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.container, .admin-main { animation: fadeUp .32s var(--ease); }
body.page-leaving { animation: pageFadeOut .18s var(--ease) forwards; }

/* --- профиль игрока --- */
.profile-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  margin-bottom: 32px;
}
.profile-skin-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: border-color .2s var(--ease);
}
.profile-skin-card:hover { border-color: var(--border-strong); }
.profile-skin-card img { width: 100%; max-width: 160px; image-rendering: pixelated; margin: 0 auto; display: block; }
.profile-info { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.eyebrow { color: var(--text-dim); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.profile-info h1 { font-size: 34px; margin: 0; }
.profile-info .meta { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-weight: 600; font-size: 14px; }
.profile-actions { display: flex; gap: 10px; margin-top: 6px; }

.tier-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tier-card {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 800;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.tier-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: 0 14px 32px rgba(0,0,0,0.35); }
.tier-card .mode-name { font-size: 12px; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.tier-card .tier-name { font-size: 22px; }
.tier-card.t-HT1, .tier-card.t-LT1 { background: linear-gradient(160deg,#c23f3f,#5c1414); }
.tier-card.t-HT2, .tier-card.t-LT2 { background: linear-gradient(160deg,#c8811f,#5c3a0d); }
.tier-card.t-HT3, .tier-card.t-LT3 { background: linear-gradient(160deg,#33b06b,#0f4b2a); }
.tier-card.t-HT4, .tier-card.t-LT4 { background: linear-gradient(160deg,#3690cf,#123c58); }
.tier-card.t-HT5, .tier-card.t-LT5 { background: linear-gradient(160deg,#5f6672,#2a2e35); }
.tier-card.t-RHT1, .tier-card.t-RLT1, .tier-card.t-RHT2, .tier-card.t-RLT2 { background: linear-gradient(160deg,#4a4f5a,#1e2126); opacity: .85; } /* ретайред */

.history-list { margin-top: 10px; }
.history-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 6px; border-bottom: 1px solid var(--border); font-size: 14px;
  transition: background .15s var(--ease);
}
.history-row:hover { background: var(--panel); }
.history-row .when { color: var(--text-dim); font-size: 12px; }
.collapsible { max-height: 0; overflow: hidden; transition: max-height .3s var(--ease); }
.collapsible.open { max-height: 800px; }

/* --- общий тир-лист (колонки Tier 1..5) --- */

/* Полоска китов сверху — иконка + название, активный кит подсвечен, как на референсе.
   Не переносится на новую строку, а скроллится по горизонтали одной лентой (плавно,
   scroll-behavior: smooth, скроллбар скрыт) — как переключатель режимов. */
.kit-switcher {
  display: flex; gap: 12px; margin: 22px 0 18px; flex-wrap: nowrap; width: 100%;
}
.kit-tab {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 10px 18px;
  height: 52px;
  box-sizing: border-box;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-weight: 700;
  cursor: pointer;
  flex: 1;
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.kit-tab .kit-tab-icon {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-size: 15px; background: var(--panel-2); flex: none;
}
.kit-tab:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kit-tab.active {
  background: linear-gradient(135deg, rgba(79,159,224,0.22), rgba(139,123,255,0.16));
  border-color: rgba(79,159,224,0.55);
  box-shadow: 0 6px 20px rgba(79,159,224,0.20);
}
.kit-tab.active .kit-tab-icon { background: linear-gradient(160deg,#4f9fe0,#2f6fb0); color: #fff; }

/* Баннер выбранного кита — заголовок + CTA, аналог синей плашки "SWORD" на референсе */
.kit-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: linear-gradient(120deg, #2456b8, #4f8fe0 55%, #6f6fe8);
  box-shadow: 0 14px 36px rgba(45,100,200,0.28);
  color: #fff;
  flex-wrap: wrap;
}
.kit-banner-title { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.kit-banner-title .kit-banner-icon {
  width: 42px; height: 42px; border-radius: 11px; background: rgba(255,255,255,0.16);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.kit-banner-sub { font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.78); margin-top: 2px; }
.kit-banner-actions { display: flex; align-items: center; gap: 10px; }
.kit-banner-actions .btn {
  background: #fff; color: #1b3a75; border: none; font-weight: 800;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.kit-banner-actions .btn:hover { transform: translateY(-1px); }

.tierlist-columns {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0; align-items: stretch;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  height: 640px;
}
.tierlist-col {
  background: transparent;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.tierlist-col:last-child { border-right: none; }
.tierlist-col .col-head {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  padding: 12px 14px; font-weight: 800; text-align: center; font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase;
  position: relative; z-index: 1; flex: none;
}
.tierlist-col.b1 .col-head { background: linear-gradient(160deg,#e2665f,#8a1e1e); color: #fff; }
.tierlist-col.b2 .col-head { background: linear-gradient(160deg, var(--gold-2), var(--gold)); color: #14100a; }
.tierlist-col.b3 .col-head { background: linear-gradient(160deg,#4fc98a,#1f6b45); color: #fff; }
.tierlist-col.b4 .col-head { background: linear-gradient(160deg,#4f9fe0,#1c4d7a); color: #fff; }
.tierlist-col.b5 .col-head { background: linear-gradient(160deg,#7c8494,#333844); color: #fff; }

/* Каждая колонка скроллится независимо — как в референсе; тонкий скролл в цвет тира.
   scroll-behavior:smooth — плавная прокрутка колёсиком/клавишами; overscroll-behavior:contain —
   когда докручиваешь колонку до конца, скролл не "перетекает" на всю страницу под ней. */
.tierlist-col .col-body {
  padding: 6px 0; flex: 1; min-height: 0; overflow-y: auto;
  scrollbar-width: thin; scroll-behavior: smooth; overscroll-behavior: contain;
}
.tierlist-col.b1 .col-body { scrollbar-color: #c85850 transparent; }
.tierlist-col.b2 .col-body { scrollbar-color: var(--gold) transparent; }
.tierlist-col.b3 .col-body { scrollbar-color: #3f9d6c transparent; }
.tierlist-col.b4 .col-body { scrollbar-color: #4f9fe0 transparent; }
.tierlist-col.b5 .col-body { scrollbar-color: #7c8494 transparent; }
.tierlist-col .col-body::-webkit-scrollbar { width: 6px; }
.tierlist-col .col-body::-webkit-scrollbar-track { background: transparent; }
.tierlist-col.b1 .col-body::-webkit-scrollbar-thumb { background: #c85850; border-radius: 6px; }
.tierlist-col.b2 .col-body::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 6px; }
.tierlist-col.b3 .col-body::-webkit-scrollbar-thumb { background: #3f9d6c; border-radius: 6px; }
.tierlist-col.b4 .col-body::-webkit-scrollbar-thumb { background: #4f9fe0; border-radius: 6px; }
.tierlist-col.b5 .col-body::-webkit-scrollbar-thumb { background: #7c8494; border-radius: 6px; }

/* Строки появляются плавно по мере прокрутки (см. wireTierlistRowReveal в tierlist.html) —
   стартуют чуть ниже и прозрачными, "доезжают" на место при попадании в кадр колонки. */
.reveal-row { opacity: 0; transform: translateY(10px); transition: opacity .45s var(--ease), transform .45s var(--ease); }
.reveal-row.in { opacity: 1; transform: translateY(0); }

.tierlist-col .row {
  display: flex; justify-content: flex-start; align-items: center;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
  border-left: 2px solid transparent;
  transition: background .2s var(--ease), transform .2s var(--ease), padding-left .2s var(--ease), border-color .2s var(--ease);
}
.tierlist-col .row .rank { color: var(--text-dim); font-size: 11px; font-weight: 700; width: 18px; flex: none; text-align: right; margin-right: 8px; transition: color .2s var(--ease); }
.tierlist-col .row .name-with-avatar { flex: 1; min-width: 0; overflow: hidden; gap: 7px; }
.tierlist-col .row .name-with-avatar span.nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tierlist-col .row .avatar-head.sm { width: 18px; height: 18px; border-radius: 5px; transition: transform .2s var(--ease); }
/* Ховер строки игрока — как в референсе: подсветка фона чуть светлее подложки и плавный
   сдвиг всей строки вправо, без цветных акцентов слева (только нейтральный серый). */
.tierlist-col .row:hover { background: var(--panel-2); padding-left: 20px; transform: translateX(2px); border-left-color: var(--border-strong); }
.tierlist-col .row:hover .avatar-head { transform: scale(1.12); }
.tierlist-col .row:hover .rank { color: var(--text); }
.tierlist-col .empty { padding: 16px 14px; color: var(--text-dim); font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .tierlist-columns { grid-template-columns: repeat(2, 1fr); height: auto; }
  .tierlist-col { border-right: none; border-bottom: 1px solid var(--border); }
  .tierlist-col .col-body { max-height: 320px; }
  .kit-banner { flex-direction: column; align-items: flex-start; }
}

/* --- тест-сессия: чат тестер↔игрок --- */
.queue-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }
.session-panel { display: flex; flex-direction: column; min-height: 460px; }
.session-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-dim); text-align: center; padding: 40px 20px;
}
.session-empty-icon { font-size: 32px; opacity: .5; }
.session-empty.compact { flex: 0 0 auto; padding: 20px 20px 10px; }
.session-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.session-head .who { font-weight: 800; }
.session-head .sub { color: var(--text-dim); font-size: 12px; }
.chat-scroll {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 4px 2px; max-height: 440px; min-height: 200px;
}
.chat-bubble { max-width: 78%; padding: 9px 13px; border-radius: 12px; font-size: 14px; line-height: 1.4; word-break: break-word; }
.chat-bubble.system { align-self: center; background: transparent; color: var(--text-dim); font-size: 12px; text-align: center; max-width: 100%; }
.chat-bubble.them { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble.me { align-self: flex-end; background: linear-gradient(160deg, var(--gold-2), var(--gold)); color: #14100a; border-bottom-right-radius: 4px; font-weight: 600; }
.chat-bubble .meta { display: block; font-size: 11px; opacity: .65; margin-top: 3px; font-weight: 500; }
.chat-input-row { display: flex; gap: 8px; margin-top: 12px; }
.chat-input-row input {
  flex: 1; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); font-family: inherit;
}
.chat-input-row input:focus { outline: none; border-color: var(--gold-dim); box-shadow: var(--glow-gold); }
.session-close-box { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.session-close-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.session-close-row .field { margin-bottom: 10px; }
.session-close-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.session-close-actions .btn { width: 100%; }
.cooldown-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cooldown-row:last-child { border-bottom: none; }
@media (max-width: 900px) {
  .queue-layout { grid-template-columns: 1fr; }
}

/* ---------- Пиксельные аватарки (голова скина) ---------- */
.pixel-avatar { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.avatar-head {
  width: 56px; height: 56px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); background: var(--panel-solid); flex: none;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.avatar-head img { width: 100%; height: 100%; object-fit: cover; }
.avatar-head.sm { width: 28px; height: 28px; border-radius: 7px; }
.avatar-head.lg { width: 140px; height: 140px; border-radius: 22px; }
.avatar-head.full { width: 100%; height: 100%; border-radius: 0; border: none; }

/* satellite icon inline with a nickname link, e.g. leaderboard / tierlist rows */
.name-with-avatar { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Тиры: иконки-кружки (мод + значение тира) ---------- */
.tier-icon-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.tier-icon-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; }
.tier-icon-badge {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; border: 1px solid var(--border); background: var(--panel-2);
}
.tier-icon-cell.filled .tier-icon-badge { border-color: var(--gold-dim); box-shadow: 0 0 0 1px rgba(240,180,41,0.12); }
.tier-icon-cell .tier-icon-label { font-size: 11px; font-weight: 800; color: var(--text-dim); letter-spacing: .02em; }
.tier-icon-cell.filled .tier-icon-label { color: var(--gold-2); }
.tier-icon-cell.restricted .tier-icon-badge { border-color: var(--danger); background: rgba(239,90,82,0.1); }
.tier-icon-cell.restricted .tier-icon-label { color: var(--danger); }

/* ---------- Плашка рестрикта ---------- */
.rest-banner {
  border: 1px solid rgba(239,90,82,0.4); background: rgba(239,90,82,0.08); border-radius: var(--radius-sm);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.rest-banner .rest-title { color: var(--danger); font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.rest-banner .rest-row { font-size: 13px; color: var(--text-dim); }
.rest-banner .rest-row b { color: var(--text); font-weight: 700; }

/* ---------- "..." выпадающее меню профиля ---------- */
.profile-menu { position: relative; flex-shrink: 0; }
.profile-menu-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel);
  color: var(--text-dim); cursor: pointer; font-weight: 900; letter-spacing: 1px; transition: border-color .15s, color .15s;
}
.profile-menu-btn:hover { border-color: var(--border-strong); color: var(--text); }
.profile-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; z-index: 20;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 14px 32px rgba(0,0,0,0.4); padding: 6px; display: none; animation: dropdownIn .15s var(--ease);
}
.profile-menu-list.open { display: block; }
/* .profile-menu--footer: кнопка "..." перенесена в подвал карточки профиля (дальше от кнопок
   свернуть/закрыть в шапке модалки) — раскрывающийся список открывается вверх, а не вниз,
   чтобы не вылезать за пределы модалки. */
.profile-menu--footer .profile-menu-list { top: auto; bottom: calc(100% + 6px); }
.profile-menu-list button, .profile-menu-list a {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px;
  border: none; background: none; color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.profile-menu-list button:hover, .profile-menu-list a:hover { background: var(--panel-2); }

/* ---------- История: строка рестрикта отличается от смены тира ---------- */
.history-row.restriction-row { background: rgba(239,90,82,0.06); }
.history-row.restriction-row span:first-child { color: var(--danger); font-weight: 700; }
.restriction-history-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.restriction-history-row:last-child { border-bottom: none; }
.restriction-history-row .rh-main { display: flex; flex-direction: column; gap: 2px; }
.restriction-history-row .rh-reason { font-weight: 700; }
.restriction-history-row .rh-meta { color: var(--text-dim); font-size: 12px; }
.restriction-history-row .rh-status { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.restriction-history-row .rh-status.active { background: rgba(239,90,82,0.15); color: var(--danger); }
.restriction-history-row .rh-status.lifted { background: var(--panel-2); color: var(--text-dim); }

/* ---------- Полная страница профиля (/profile/:nickname) ----------
   Карточка сама сужается до ширины контента (width: fit-content): слева квадратный
   аватар-фон во всю высоту карточки, по центру — текстовый блок, отцентрованный по вертикали,
   справа — кнопка "..." вплотную к тексту. Правый паддинг тела зарезервирован под кнопку,
   поэтому карточка заканчивается сразу после неё — лишнего пространства справа не остаётся.
   Высота аватар-блока тянется по флексу (align-items:stretch) сама; ширину под квадрат
   выставляет JS (syncProfilePageAvatarSquare в main.js) — aspect-ratio внутри
   растянутого flex-элемента браузеры не резолвят и дают нулевую ширину (160px ниже —
   лишь запасное значение на случай, если JS ещё не отработал). */
.profile-page-card {
  display: flex;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
}
.profile-page-avatar { flex: none; width: 160px; overflow: hidden; background: var(--panel-solid); }
.profile-page-body { position: relative; display: flex; align-items: center; padding: 22px 54px 22px 24px; }
.profile-page-content { display: flex; flex-direction: column; }
.profile-page-content h2 { margin: 0; font-size: 22px; }
.profile-menu--page { position: absolute; top: 16px; right: 16px; }
/* Оборачивает основную карточку и карточку истории под ней в одну центрированную колонку —
   align-items:center вместо стандартного stretch, иначе .card ниже растянулась бы на всю
   ширину контейнера, а не подстроилась под ширину основной карточки (см. profileWidthSync). */
.profile-page-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.profile-page-history { max-width: 100%; }
@media (max-width: 560px) {
  .profile-page-card { flex-direction: column; width: 100%; }
  .profile-page-avatar { aspect-ratio: 16 / 9; width: 100%; }
  .profile-page-body { padding: 44px 24px 22px; }
  .profile-menu--page { top: 12px; right: 12px; }
  .profile-page-wrap { width: 100%; }
}

/* ---------- Модалка профиля (открывается по клику из поиска/лидерборда/тир-листа) ---------- */
.profile-modal { max-width: 460px; }
.profile-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.profile-modal-footer { display: flex; justify-content: flex-end; margin-top: 18px; }
.profile-modal-identity { display: flex; align-items: center; gap: 14px; }
.profile-modal-identity h2 { margin: 0; font-size: 22px; }
.profile-modal-rank {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--border); font-size: 13px; margin: 10px 0 16px;
}
.profile-modal-rank .num { font-style: italic; font-weight: 800; font-size: 16px; }
.profile-modal-section-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim);
  margin: 18px 0 10px; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.profile-modal-section-title .chev { transition: transform .2s var(--ease); font-size: 10px; }
.profile-modal-section-title.open .chev { transform: rotate(90deg); }

/* ---------- Публичная страница "Правила" (/rules) ---------- */
.rule-entry { border-bottom: 1px solid var(--border); padding: 14px 4px; }
.rule-entry:last-child { border-bottom: none; }
.rule-entry-head { display: flex; align-items: baseline; gap: 10px; }
.rule-entry-head .num { color: var(--gold); font-weight: 800; font-size: 14px; white-space: nowrap; }
.rule-entry-head .title { font-weight: 700; font-size: 15px; }
.rule-entry-desc { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.rule-entry-punishment {
  display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--text-dim);
}
.rule-entry-punishment.has-punishment { color: var(--danger); background: rgba(239,90,82,0.12); }

/* ---------- Детальный вид одной очереди (/queue#op, /admin#queues/op) ---------- */
.q-detail { display: grid; grid-template-columns: 440px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) {
  .q-detail { grid-template-columns: 1fr; }
}
.q-back {
  background: none; border: none; color: var(--text-dim); font-weight: 700; font-size: 13px;
  cursor: pointer; padding: 0; margin-bottom: 14px; display: inline-flex; align-items: center; gap: 6px;
}
.q-back:hover { color: var(--text); }
.q-sidebar { display: flex; flex-direction: column; gap: 14px; }
.q-head { display: flex; align-items: center; gap: 12px; }
.q-head .icon {
  width: 44px; height: 44px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none;
}
.q-head .name { font-weight: 800; font-size: 17px; }
.q-status-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800;
  padding: 3px 9px; border-radius: 999px; margin-top: 3px; letter-spacing: .02em; border: none; cursor: default;
}
.q-status-badge.open { color: var(--ok); background: rgba(62,192,121,0.14); }
.q-status-badge.closed { color: var(--danger); background: rgba(239,90,82,0.14); }
.q-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.q-stat-box {
  text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--border);
}
.q-stat-box .n { font-size: 18px; font-weight: 800; color: var(--gold-2); }
.q-stat-box .l { font-size: 10.5px; color: var(--text-dim); margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }
.q-main-action { width: 100%; }
.q-section { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 12px; }
.q-section-title {
  display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); margin-bottom: 10px;
}
.q-section-title .count { background: var(--panel-2); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--text); }
.q-empty-note { color: var(--text-dim); font-size: 13px; padding: 6px 2px; }
.q-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-radius: 8px; }
.q-row:hover { background: var(--panel-2); }
.q-row.mine { background: rgba(240,180,41,0.08); }
.q-row .pos { width: 18px; text-align: right; color: var(--text-dim); font-size: 12px; font-weight: 700; flex: none; }
.q-row .nick { flex: 1; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-row .nick.link { cursor: pointer; }
.q-row .nick.link:hover { text-decoration: underline; }
.q-tier-badge {
  font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 6px; color: var(--gold-2);
  background: rgba(240,180,41,0.12); border: 1px solid var(--gold-dim); flex: none;
}
.q-online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.q-kick-btn {
  flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-dim); cursor: pointer; font-size: 12px; line-height: 1;
  opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.q-row:hover .q-kick-btn { opacity: 1; }
.q-kick-btn:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.cooldown-row { flex-wrap: wrap; gap: 6px 10px; }
.q-my-position { font-size: 12px; color: var(--gold); font-weight: 700; }
.q-cooldown-note { font-size: 12px; color: var(--danger); }
.q-sidebar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.q-sidebar-actions .btn { flex: 1; }
.q-take-row { display: flex; gap: 8px; margin-bottom: 10px; }
.q-take-row input { flex: 1; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-family: inherit; }

/* ---------- Публичная страница "Магазин" (/shop) ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shop-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--panel); }
.shop-card-image { width: 100%; aspect-ratio: 1.6; border-radius: var(--radius-sm); object-fit: cover; margin-bottom: 12px; background: var(--panel-2); }
.shop-card-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.shop-card-desc { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; min-height: 18px; }
.shop-card-price { color: var(--gold); font-weight: 800; font-size: 14px; }


/* Плавное появление: opacity 0→1 + сдвиг снизу вверх на 10px, 500ms ease-out */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .5s ease-out both; }

/* ---------- Анонсы на сайте ---------- */
.announce-bar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin: 0 auto; max-width: calc(var(--page-width) - 64px); padding: 10px 16px; margin-top: 10px;
  border: 1px solid var(--gold-dim); border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(240,180,41,0.14), rgba(240,180,41,0.05));
  font-size: 14px;
}
.announce-bar-body { display: flex; gap: 10px; align-items: flex-start; }
.announce-bar-text { line-height: 1.45; }
.announce-bar-link { margin-left: 8px; color: var(--gold-2); font-weight: 700; white-space: nowrap; }
.announce-bar-close { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 15px; padding: 2px 6px; }
.announce-bar-close:hover { color: var(--text); }
.announcement-item { margin-bottom: 14px; }
.announcement-item h3 { margin: 0 0 4px; }
.announcement-meta { font-size: 12.5px; color: var(--text-dim); margin-bottom: 10px; }
.announcement-body { line-height: 1.55; word-break: break-word; }
.announcement-body code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }

.rule-category { background: rgba(255,255,255,0.04); margin-top: 10px; }
.rule-category .rule-entry-head .title { font-size: 17px; }

/* Плашка выбора способа связи в тест-сессии (сайт / Discord) */
.comm-banner { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; margin-bottom: 12px; border: 2px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.04); }
.comm-banner b { font-weight: 800; }
.comm-banner span { color: var(--text-dim); font-size: 13px; }
.comm-banner.pending { border-color: #f5b942; }
.comm-banner.discord { border-color: #5865f2; }
.comm-banner.site { border-color: #3ba55d; }
.comm-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.comm-actions .btn { text-decoration: none; }

/* Альты в форме наказания (пункт «Обход ограничений через дополнительные аккаунты») */
.alt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.alt-chips:empty { display: none; }
.alt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border, rgba(255,255,255,.12));
  font-size: 13px;
}
.alt-chip button {
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
  width: 20px; height: 20px; border-radius: 50%; line-height: 1; font-size: 11px;
}
.alt-chip button:hover { background: rgba(255,80,80,.25); color: #fff; }

/* ---------- Анонсы: перенос длинных строк, картинки, лайтбокс ---------- */
.announcement-item { min-width: 0; overflow: hidden; }
.announcement-item h3, .announcement-body, .announce-bar-text, .news-card h3, .news-body { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.announce-bar-body { flex: 1; min-width: 0; }
.announce-bar-text { flex: 1; min-width: 0; }
.announce-bar-thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.announcement-image { display: block; max-width: 100%; max-height: 460px; width: auto; height: auto; margin-top: 14px; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; background: var(--panel-2); }
.news-card { min-width: 0; }
.news-thumb { display: block; width: 100%; height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 4px; }
.img-lightbox { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,.86); cursor: zoom-out; animation: fadeUp .18s ease-out both; }
.img-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.an-image-field { display: flex; flex-direction: column; gap: 8px; }
.an-image-preview { display: none; position: relative; width: fit-content; max-width: 100%; }
.an-image-preview img { display: block; max-width: 100%; max-height: 180px; border-radius: 8px; border: 1px solid var(--border); }
.an-image-preview button { position: absolute; top: 6px; right: 6px; border: 0; border-radius: 6px; padding: 2px 8px; cursor: pointer; background: rgba(0,0,0,.7); color: #fff; }
.an-list-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; margin-right: 10px; }
