/* QuizQR: единственный файл стилей.
   Порядок: токены, база, компоненты, страницы. Шаблоны не содержат style="" и <style>
   (это проверяет tests/test_ui.py), новые стили добавляй сюда. */

/* ---------- токены ---------- */
:root {
  color-scheme: light dark;
  --accent: #3b6cf6;          /* кнопки, прогресс, акценты (белый текст на нём: контраст 4.7) */
  --accent-hover: #2f5ae0;
  --link: #2f57d4;            /* акцент для текста на фоне страницы */
  --accent-soft: rgba(59, 108, 246, 0.12);
  --ok: #157f3b;
  --ok-soft: rgba(26, 157, 75, 0.13);
  --bad: #c42f2f;
  --bad-soft: rgba(210, 63, 63, 0.12);
  --warn: #8a5a00;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --bg: #f4f6fb;
  --card: #ffffff;
  --surface: rgba(30, 45, 90, 0.05);
  --border: rgba(30, 45, 90, 0.13);
  --text: #161a23;
  --muted: #5d6370;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 4px 14px rgba(20, 30, 60, 0.06);
  --nav-h: 60px;
  --page-max: 1240px;
  --side-w: 340px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (min-width: 1600px) { :root { --page-max: 1400px; } }

/* Тема: ручной переключатель имеет приоритет над системной */
html[data-theme="light"] {
  color-scheme: light;
  --link: #2f57d4;
  --accent-soft: rgba(59, 108, 246, 0.12);
  --ok: #157f3b;
  --ok-soft: rgba(26, 157, 75, 0.13);
  --bad: #c42f2f;
  --bad-soft: rgba(210, 63, 63, 0.12);
  --warn: #8a5a00;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --bg: #f4f6fb;
  --card: #ffffff;
  --surface: rgba(30, 45, 90, 0.05);
  --border: rgba(30, 45, 90, 0.13);
  --text: #161a23;
  --muted: #5d6370;
  --shadow: 0 4px 14px rgba(20, 30, 60, 0.06);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --link: #8fa8ff;
  --accent-soft: rgba(110, 140, 255, 0.16);
  --ok: #4cc27a;
  --ok-soft: rgba(76, 194, 122, 0.14);
  --bad: #ff7a7a;
  --bad-soft: rgba(255, 122, 122, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --bg: #0e1015;
  --card: #171a21;
  --surface: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eceff6;
  --muted: #a2a9b8;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --link: #8fa8ff;
    --accent-soft: rgba(110, 140, 255, 0.16);
    --ok: #4cc27a;
    --ok-soft: rgba(76, 194, 122, 0.14);
    --bad: #ff7a7a;
    --bad-soft: rgba(255, 122, 122, 0.14);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --bg: #0e1015;
    --card: #171a21;
    --surface: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.12);
    --text: #eceff6;
    --muted: #a2a9b8;
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- база ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-padding-top: calc(var(--nav-h) + 12px); scrollbar-gutter: stable; }
body { margin: 0; font: 17px/1.55 var(--font); color: var(--text); background-color: var(--bg);
  transition: background-color 0.6s ease, color 0.6s ease;
  /* мягкие пятна по краям: на широком экране боковые поля не выглядят пустыми */
  background-image: radial-gradient(1000px 520px at 6% -8%, var(--accent-soft), transparent 70%),
                     radial-gradient(900px 520px at 100% 0%, var(--accent-soft), transparent 65%);
  background-repeat: no-repeat; }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.3px; }
h1 { font-size: 1.8rem; margin: 0 0 12px; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--link); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface); padding: 2px 6px; border-radius: 6px; }

:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 6px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }

.container { max-width: var(--page-max); margin: 0 auto; padding: 24px 16px 64px; }
.container.narrow { max-width: 640px; }   /* страницы ошибок */
.container.compact { max-width: 900px; }  /* вход и регистрация */
.container.medium { max-width: 1060px; }  /* тест и результат: колонка вопросов плюс боковая панель */

.muted { color: var(--muted); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.section-title { margin: 32px 0 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.stack > .card, .stack > .stats-grid { margin-bottom: 0; }

/* ---------- иконки (Lucide, спрайт static/icons.svg): цвет берут у текста ---------- */
.icon { flex: none; width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.25em; }
.btn .icon { vertical-align: 0; }
.medal { stroke-width: 2.2; }
.medal-1 { color: #d4a017; }
.medal-2 { color: #8e98a8; }
.medal-3 { color: #b87333; }

/* ---------- шапка ---------- */
.nav { position: sticky; top: 0; z-index: 100; min-height: var(--nav-h); backdrop-filter: blur(12px); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom: 1px solid var(--border); }
.nav-content { max-width: var(--page-max); margin: 0 auto; padding: 8px 16px; min-height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 900; font-size: 1.4rem; letter-spacing: -0.5px; color: var(--link); text-decoration: none; }
.nav nav { display: flex; align-items: center; gap: 4px; }
.nav nav a, .nav-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 12px; border-radius: 12px; font-size: 0.92rem; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav nav a .icon, .nav-btn .icon { width: 1.2rem; height: 1.2rem; vertical-align: 0; }
.nav nav a:hover, .nav-btn:hover { background: var(--surface); }
.nav nav a.active { color: var(--link); background: var(--accent-soft); }
.nav nav a.nav-accent { color: var(--link); }
form.inline { display: inline; margin: 0; }

/* ---------- карточки, сетки ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow); }
.card-flush { padding: 0; overflow: hidden; }
.card-dashed { background: transparent; border-style: dashed; box-shadow: none; text-align: center; }
.card-tint { background: linear-gradient(135deg, var(--accent-soft), transparent); }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.layout-grid > * { min-width: 0; }
@media (max-width: 991px) { .profile-sidebar { order: -1; } }
@media (min-width: 992px) { .layout-grid { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); align-items: start; } }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { display: block; padding: 20px; text-align: center; text-decoration: none; color: var(--text); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat b { display: block; font-size: 2rem; line-height: 1.1; color: var(--link); margin-bottom: 4px; }
.stat span { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); }
a.stat { transition: transform 0.2s, border-color 0.2s; }
a.stat:hover { transform: translateY(-3px); border-color: var(--accent); }
.stat-row { text-align: left; padding: 16px 20px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back-link:hover { color: var(--link); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 24px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a .icon { width: 1.1rem; height: 1.1rem; margin-right: 8px; vertical-align: -0.2em; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--muted); text-decoration: none; white-space: nowrap; border-radius: 10px 10px 0 0; }
.tabs a:hover { background: var(--surface); }
.tabs a[aria-current="page"] { color: var(--link); box-shadow: inset 0 -3px 0 var(--accent); }

/* ---------- кнопки ---------- */
.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 0; border-radius: var(--radius-sm); padding: 10px 22px; font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; text-decoration: none; transition: background 0.15s, transform 0.1s, opacity 0.15s; }
.btn:active, button:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-soft); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-light { background: #fff; color: #1e3fae; }
.btn-light:hover { background: #eef2ff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 0.88rem; border-radius: 10px; }
.btn.is-disabled, button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; pointer-events: none; }
.htmx-request button[type="submit"] { opacity: 0.6; pointer-events: none; }

/* ---------- формы ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.hint { margin: 6px 0 0; font-size: 0.85rem; color: var(--muted); }
form .hint + .btn-block { margin-top: 18px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select { width: 100%; min-height: 46px; padding: 10px 14px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.error { margin: 0 0 18px; padding: 14px 16px; font-weight: 600; color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad); border-radius: var(--radius-sm); }
.form-card { margin-top: 16px; }

/* ---------- таблицы ---------- */
.table-wrapper { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; text-align: left; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); background: var(--surface); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--accent-soft); }
tr.is-me td { background: var(--accent-soft); font-weight: 700; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-title { font-weight: 700; }
.cell-title a { color: inherit; text-decoration: none; }
.cell-title a:hover { color: var(--link); }
.cell-sub { font-size: 0.82rem; color: var(--muted); }
.show-sm, .show-inline-sm { display: none; }
.btn-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* «Мои локации»: иконка настроек раскрывает меню действий */
td.studio-actions { width: 1%; white-space: nowrap; text-align: right; }
.row-menu-btn { padding: 6px 10px; }
.row-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 8px;
  min-width: 210px;
  max-height: calc(100vh - 16px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.row-menu:popover-open { display: grid; gap: 6px; }
.row-menu .btn { width: 100%; justify-content: flex-start; }
.row-menu form { margin: 0; }
.rank-cell .icon, .mini-rank .icon { width: 1.35rem; height: 1.35rem; vertical-align: -0.3em; }
.rank-cell { width: 56px; font-weight: 900; font-size: 1.1rem; color: var(--muted); }

/* ---------- плашки, аватары ---------- */
.badge { display: inline-block; white-space: nowrap; padding: 3px 10px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; border-radius: 8px; background: var(--surface); color: var(--text); }
.badge-accent { background: var(--accent-soft); color: var(--link); }
.badge-rank { background: var(--accent); color: #fff; }
.badge-admin { background: var(--bad); color: #fff; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }

.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-weight: 800; font-size: 0.9rem; background: var(--accent-soft); color: var(--link); }
.avatar-lg { width: 84px; height: 84px; border-radius: 26px; font-size: 2.2rem; background: var(--accent); color: #fff; margin: 0 auto 14px; }

/* ---------- списки ---------- */
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }
.list-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--accent-soft); }
.list-item b { display: block; font-size: 1.05rem; }
.list-meta { font-size: 0.85rem; color: var(--muted); }
.list-score { font-size: 1.25rem; font-weight: 900; color: var(--link); white-space: nowrap; }
.list-score small { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.list-arrow { color: var(--muted); }

.empty { padding: 48px 20px; text-align: center; }
.empty-icon { margin-bottom: 10px; }
.empty-icon .icon { width: 2.8rem; height: 2.8rem; color: var(--link); }
.empty h2 { margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

/* ---------- главная ---------- */
.hero { text-align: center; padding: 40px 20px; color: #fff; border: 0; background: linear-gradient(135deg, #3b6cf6, #1e3fae); }
.hero h1 { font-size: 2.6rem; margin-bottom: 6px; color: #fff; }
.hero-lead { margin-bottom: 22px; font-size: 1.1rem; opacity: 0.95; }
.code-form { display: flex; gap: 8px; max-width: 420px; margin: 0 auto; }
/* input.hero-input: нужна специфичность выше, чем у общего input[type=text] */
input.hero-input { flex: 1; min-width: 0; color: #fff; background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.5); }
input.hero-input::placeholder { color: rgba(255, 255, 255, 0.85); }
input.hero-input:focus-visible { border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3); }
.hero-error { margin: 14px 0 0; padding: 10px 14px; font-weight: 700; color: #7f1d1d; background: #fee2e2; border-radius: 12px; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.step { margin-bottom: 0; text-align: center; }
.step-icon .icon { width: 2.2rem; height: 2.2rem; color: var(--link); }

/* ---------- прохождение теста ---------- */
.quiz-head { margin-bottom: 8px; }
.quiz-head h1 { margin-bottom: 4px; }
.quiz-progress { position: sticky; top: var(--nav-h); z-index: 50; padding: 10px 0; margin-bottom: 8px; background: var(--bg); }
.quiz-progress-text { display: block; margin-top: 6px; font-size: 0.85rem; font-weight: 700; color: var(--muted); }

progress { display: block; width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--border); appearance: none; -webkit-appearance: none; }
progress::-webkit-progress-bar { background: var(--border); }
progress::-webkit-progress-value { background: var(--accent); transition: width 0.25s; }
progress::-moz-progress-bar { background: var(--accent); }
.side-card progress { margin: 8px 0 10px; }

.question { margin-bottom: 16px; padding: 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.q-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.q-text { margin: 8px 0 14px; font-size: 1.15rem; font-weight: 700; }
.options { display: grid; gap: 10px; }
.options-row { grid-template-columns: 1fr 1fr; }
label.option { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 12px 16px; cursor: pointer; background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-sm); }
label.option:hover { border-color: var(--accent); }
label.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.option:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }
label.option input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.submit-bar { position: sticky; bottom: 0; z-index: 40; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 65%, transparent); }

/* ---------- результат ---------- */
.score-card { text-align: center; padding: 32px 20px; }
.score-number { margin: 4px 0 14px; font-size: 3.6rem; font-weight: 900; line-height: 1; color: var(--link); }
.score-card progress { max-width: 320px; height: 12px; margin: 0 auto 14px; }
.score-message { margin-bottom: 20px; font-size: 1.1rem; font-weight: 700; }
.result-item { display: grid; grid-template-columns: auto 1fr; gap: 14px; margin-bottom: 14px; padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--border); border-radius: var(--radius-sm); }
.result-item.ok { border-left-color: var(--ok); }
.result-item.bad { border-left-color: var(--bad); }
.result-icon .icon { width: 1.1rem; height: 1.1rem; stroke-width: 3; vertical-align: 0; }
.result-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 900; color: #fff; }
.ok .result-icon { background: var(--ok); }
.bad .result-icon { background: var(--bad); }
.result-item .q-text { margin: 0 0 6px; font-size: 1.02rem; }
.verdict { margin: 0 0 4px; font-weight: 700; }
.ok .verdict { color: var(--ok); }
.bad .verdict { color: var(--bad); }
.correct-answer { margin: 0 0 4px; }
.explanation { margin: 8px 0 0; padding: 10px 12px; font-size: 0.92rem; color: var(--muted); background: var(--surface); border-radius: 10px; }

/* ---------- админка ---------- */
.form-narrow { max-width: 560px; }
.answer-list { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.answer-list li { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; }
.answer-list li .icon { width: 1rem; height: 1rem; margin-left: 6px; stroke-width: 3; vertical-align: -0.15em; }
.answer-list li.correct { background: var(--ok-soft); border-color: var(--ok); font-weight: 700; }
.note { margin-top: 20px; padding: 14px 16px; background: var(--surface); border-left: 4px solid var(--accent); border-radius: 12px; }

/* ---------- двухколоночные раскладки: основной контент и боковая панель ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.side-card { padding: 20px; margin-bottom: 0; }
.side-title { margin: 0 0 10px; font-size: 1.05rem; }
.side-link { display: inline-block; margin-top: 10px; font-weight: 700; }
.creator-cta .row { margin-top: 16px; }

.mini-list { margin: 0; padding: 0; list-style: none; }
.mini-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--border); }
.mini-item:last-child { border-bottom: 0; }
a.mini-item:hover .mini-name { color: var(--link); }
.mini-rank { flex: none; width: 28px; text-align: center; font-weight: 800; color: var(--muted); }
.mini-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.mini-name .list-meta { display: block; font-weight: 400; }
.mini-score { font-weight: 800; color: var(--link); white-space: nowrap; }

.ladder { margin: 0; padding: 0; list-style: none; }
.ladder li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; }
.ladder li.is-current { background: var(--accent-soft); font-weight: 800; }

/* вход и регистрация: слева панель с преимуществами (только на широких экранах) */
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-brand { display: none; }
.auth-form { margin-bottom: 0; }
.auth-brand .brand-title { margin: 0 0 8px; font-size: 2.2rem; font-weight: 900; letter-spacing: -0.5px; }
.benefits { margin: 22px 0 0; padding: 0; list-style: none; }
.benefits li { position: relative; margin: 0 0 12px; padding-left: 28px; }
.benefits li .icon { position: absolute; left: 0; top: 0.25em; width: 1.1rem; height: 1.1rem; stroke-width: 3; }

/* админка: на широком экране меню разделов стоит слева колонкой */
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.admin-main { min-width: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.quick-card { display: block; padding: 20px; color: var(--text); text-decoration: none; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s; }
.quick-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.quick-card b { display: block; margin: 6px 0 4px; }
.quick-card .quick-text { font-size: 0.9rem; color: var(--muted); }
.quick-card .quick-icon .icon { width: 1.9rem; height: 1.9rem; color: var(--link); }

/* прохождение: боковая панель с навигацией по вопросам (на телефоне её заменяют закреплённые прогресс и кнопка) */
.quiz-main { min-width: 0; }
.quiz-side { display: none; }
.q-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0 16px; }
.q-chip { display: flex; align-items: center; justify-content: center; min-height: 44px; font-weight: 800; color: var(--text); text-decoration: none; border: 2px solid var(--border); border-radius: 12px; }
.q-chip:hover { border-color: var(--accent); }
.q-chip.is-answered { color: #fff; background: var(--accent); border-color: var(--accent); }
.question.is-answered { border-color: var(--accent); }

@media (min-width: 992px) {
  .split { grid-template-columns: minmax(0, 1fr) var(--side-w); }
  .split-left { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .sticky-side { position: sticky; top: calc(var(--nav-h) + 16px); }

  .quiz-side { display: block; }
  .quiz-progress, .submit-bar { display: none; }

  .auth-split { grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
  .auth-brand { display: flex; flex-direction: column; justify-content: center; padding: 40px; color: #fff; background: linear-gradient(135deg, #3b6cf6, #1e3fae); }
  .auth-form { padding: 40px; border: 0; border-radius: 0; box-shadow: none; }

  .admin-layout { grid-template-columns: 232px minmax(0, 1fr); gap: 24px; align-items: start; }
  .tabs { position: sticky; top: calc(var(--nav-h) + 16px); flex-direction: column; gap: 2px; margin: 0; padding: 10px; overflow: visible; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
  .tabs a { padding: 11px 14px; border-radius: 12px; display: flex; align-items: center; gap: 8px; white-space: normal; }
  .tabs a .icon { margin-right: 0; flex: none; }
  .tabs a[aria-current="page"] { background: var(--accent-soft); box-shadow: none; }
}

/* ---------- конструктор заданий ---------- */
.flashes { margin-bottom: 20px; }
.flash { margin: 0 0 10px; padding: 12px 16px; font-weight: 600; border: 1px solid; border-radius: var(--radius-sm); }
.flash-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok); }
.flash-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.flash-error { color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }

textarea { display: block; width: 100%; min-height: 80px; padding: 10px 14px; font: inherit; line-height: 1.45; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); resize: vertical; }
textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.form-wide { max-width: 760px; }
.fieldset-plain { margin: 0 0 18px; padding: 0; border: 0; }
.fieldset-plain legend { padding: 0; margin-bottom: 6px; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.check { display: flex !important; align-items: center; gap: 10px; font-size: 1rem !important; font-weight: 600 !important; color: var(--text) !important; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.type-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; padding: 4px; background: var(--surface); border-radius: var(--radius-sm); }
.type-switch a { padding: 8px 16px; font-weight: 700; color: var(--muted); text-decoration: none; border-radius: 10px; }
.type-switch a:hover { color: var(--text); }
.type-switch a.active { color: #fff; background: var(--accent); }

.option-rows { display: grid; gap: 8px; }
.option-row { display: flex; align-items: center; gap: 10px; }
.field .option-mark, .option-mark { flex: none; display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; margin: 0; cursor: pointer; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.option-mark input { width: 22px; height: 22px; margin: 0; accent-color: var(--ok); }
.option-mark:has(input:checked) { background: var(--ok-soft); border-color: var(--ok); }
.option-mark:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-bottom: 20px; }
.filters .field { flex: 1 1 190px; margin: 0; }
.filters .btn { min-height: 46px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }

.inline-form { display: flex; align-items: flex-start; gap: 10px; }
.inline-form .field { flex: 1; margin: 0; }
td .inline-form { align-items: center; }
td .inline-form input[type="text"] { min-height: 40px; }

.btn-danger { color: #fff; background: var(--bad); }
.btn-danger:hover { filter: brightness(0.92); }
.danger-zone { margin-top: 8px; padding: 14px 18px; border: 1px dashed var(--bad); border-radius: var(--radius-sm); }
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--bad); }
.danger-zone p { margin: 10px 0; color: var(--muted); }
.confirm-delete summary { list-style: none; display: inline-flex; }
.confirm-delete summary::-webkit-details-marker { display: none; }
.confirm-delete[open] summary { display: none; }

/* ---------- мобильные ---------- */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { padding: 16px 12px 56px; }
  h1 { font-size: 1.5rem; }
  .nav-content { padding: 6px 12px; }
  .nav-label { display: none; }               /* в шапке остаются иконки (у ссылок есть aria-label) */
  .nav nav a, .nav-btn { padding: 8px 10px; }
  .nav nav a .icon, .nav-btn .icon { width: 1.4rem; height: 1.4rem; }
  .nav nav a.nav-text { font-size: 0.92rem; }  /* вход и регистрация остаются с подписями, без иконок */
  .nav nav a.nav-text .nav-label { display: inline; }
  .nav nav a.nav-text > .icon { display: none; }
  .card { padding: 18px; margin-bottom: 18px; }
  .hero h1 { font-size: 2.1rem; }
  .code-form { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .step { display: grid; grid-template-columns: auto 1fr; gap: 0 14px; align-items: center; text-align: left; padding: 14px 16px; margin-bottom: 0; }
  .step-icon { grid-row: span 2; font-size: 1.6rem; }
  .step h3, .step p { margin: 0; }
  .steps-grid { gap: 12px; }
  .stat { padding: 16px; } .stat b { font-size: 1.6rem; }
  .field-row { grid-template-columns: 1fr; }
  .options-row { grid-template-columns: 1fr; }
  .list-item { padding: 14px 16px; }
  .page-head .btn { width: 100%; }
  .filters .field { flex-basis: 100%; }
  .inline-form { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 100%; }
  /* таблицы админки: на телефоне остаются главные колонки и кнопки, остальное уходит под название */
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .show-inline-sm { display: inline; }
  th, td { padding: 10px 10px; }
  .btn-sm { min-height: 40px; padding: 6px 12px; }
  td.actions { white-space: nowrap; }
  .rank-cell { width: 40px; }
  .cell-user { gap: 8px; min-width: 0; }
  .cell-title { overflow-wrap: anywhere; }   /* длинные ники не должны раздвигать таблицу */
}

/* самые узкие телефоны (320-380px): шапка должна поместиться без прокрутки */
@media (max-width: 400px) {
  .nav-content { gap: 4px; padding: 6px 8px; }
  .brand { font-size: 1.2rem; }
  .nav nav { gap: 0; }
  .nav nav a, .nav-btn { padding: 8px 7px; }
  .nav nav a.nav-text { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.cta-text { margin: 0; flex: 1 1 260px; }
.center-row { justify-content: center; }

/* ---------- Telegram-style QR Modal ---------- */
.qr-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 90vw;
  width: 380px;
}
.qr-modal::backdrop {
  background: rgba(15, 20, 30, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}
.qr-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.qr-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.qr-close-btn:hover {
  background: var(--border);
  color: var(--text);
}
.qr-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.qr-modal-slug {
  font-size: 0.85rem;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  margin-bottom: 20px;
}
.qr-box-wrapper {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 20px;
  background: #ffffff;
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-box-wrapper img {
  width: 100%;
  height: 100%;
  display: block;
}
.qr-logo-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.qr-logo-badge svg {
  width: 26px;
  height: 26px;
  fill: var(--accent);
}
.qr-actions-row {
  display: flex;
  gap: 10px;
}
.qr-actions-row .btn {
  flex: 1;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- атрибут hidden должен побеждать display у кнопок и блоков ---------- */
[hidden] { display: none !important; }

/* ---------- задания: интерактивные типы ---------- */
.emoji-cipher { margin: 16px 0; font-size: 3rem; letter-spacing: 6px; text-align: center; overflow-wrap: anywhere; }

.hotspot-wrapper { position: relative; max-width: 600px; margin: 0 auto; cursor: crosshair; }
.hotspot-img { display: block; width: 100%; height: auto; border-radius: 12px; }
.hotspot-marker { display: none; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--bad); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); transform: translate(-50%, -50%); pointer-events: none; }

.match-board { display: grid; gap: 10px; }
.match-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.match-left { flex: 1 1 160px; font-weight: 600; overflow-wrap: anywhere; }
.match-select { flex: 1 1 200px; }
.match-pic { flex: 0 0 auto; width: 120px; max-width: 40%; height: 90px; object-fit: cover; border-radius: 10px; background: var(--surface); }

.memory-game { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 480px) { .memory-game { grid-template-columns: repeat(3, 1fr); } }
.memory-card { min-height: 70px; padding: 8px; font-size: 1rem; overflow-wrap: anywhere; background: var(--bg); border: 2px solid var(--border); }
.memory-card.is-flipped { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.memory-card.is-matched { background: var(--ok-soft); border-color: var(--ok); color: var(--text); opacity: 1; }

.order-list { margin: 0; padding: 0; list-style: none; }
.order-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.order-text { overflow-wrap: anywhere; }

.riddle-hint { margin-top: 10px; }
.riddle-hint summary { cursor: pointer; font-weight: 600; color: var(--link); }

.photo-task { display: grid; gap: 10px; justify-items: start; }
.photo-pick { position: relative; cursor: pointer; }
.photo-pick:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }
.photo-preview { max-width: 100%; max-height: 320px; border-radius: 12px; }

.minigame { display: grid; gap: 10px; justify-items: start; }
.minigame-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 600; }
.minigame-area { position: relative; width: 100%; height: 260px; overflow: hidden; background: var(--bg); border: 2px dashed var(--border); border-radius: var(--radius-sm); }
.minigame-target { position: absolute; width: 48px; height: 48px; min-height: 0; padding: 0; border-radius: 50%; background: var(--bad); border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }

.map-task { display: grid; gap: 10px; justify-items: start; }
.map-task .field-row { width: 100%; }
.field-row-2 { grid-template-columns: repeat(2, 1fr); }

.reward-card { text-align: center; }
.reward-fragment { margin: 0; font-size: 1.6rem; font-weight: 900; color: var(--link); overflow-wrap: anywhere; }

/* ---------- админка: формы локаций и конструктор ---------- */
.divider { margin: 24px 0; border: 0; border-top: 1px solid var(--border); }
.field-label { margin: 0 0 8px; font-weight: 700; }
.mode-switch { margin-bottom: 18px; }
.task-picker { max-height: 380px; overflow-y: auto; }
.task-picker label { cursor: pointer; }
.picker-check { width: 40px; }
.danger-zone-wide { max-width: 760px; margin-top: 24px; }
.badge-off { background: var(--warn-soft); color: var(--warn); }
.flex-1 { flex: 1; }

/* ---------- конструктор локаций: секции ---------- */
.loc-section, .loc-section-basics, .loc-section-tasks, .loc-section-publish { margin: 0 0 26px; }
.loc-section-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; font-weight: 800; margin: 0 0 14px; color: var(--text); }
.loc-section-title .icon { width: 1.35rem; height: 1.35rem; color: var(--link); }
.loc-divider { margin: 30px 0; border: 0; border-top: 1px solid var(--border); }
.loc-field-row { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 4px; }
.loc-slug-field { margin-bottom: 4px; }
.loc-form-card { padding: 26px; }
.loc-form-actions { margin-top: 22px; }
.cat-filter-hint { font-size: 0.78rem; color: var(--muted); margin: 0 0 4px; }

/* режим заданий: карточка вместо сухой обёртки */
.mode-switch-card { margin-bottom: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mode-switch-card legend { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); padding: 0 4px; }

/* выбор заданий: карточки вместо таблицы */
.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin: 12px 0 4px; max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--card); }
.task-card { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.1s; }
.task-card:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 70%, var(--bg)); }
.task-card--selected { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 2px 8px var(--accent-soft); }
.task-card input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.task-card-body { display: flex; flex-direction: column; gap: 6px; }
.task-card-title { font-weight: 700; font-size: 0.95rem; overflow-wrap: anywhere; }
.task-card-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.task-card-source { overflow-wrap: anywhere; }
.task-card-link { font-size: 0.8rem; color: var(--link); text-decoration: none; }
.task-card-link:hover { text-decoration: underline; }
.task-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.empty-task-list { text-align: center; padding: 30px 20px; }

/* счетчик выбранных заданий и номер на карточке */
.task-selection-count { font-size: 0.9rem; color: var(--muted); font-weight: 600; margin-left: 8px; }
.task-card-pick { flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 0.78rem; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-right: 4px; }
.task-card--selected .task-card-pick { background: var(--accent); color: #fff; }
.task-search-field { margin-bottom: 10px; }

/* ---------- сопоставление с картинками ---------- */
.match-row { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; gap: 10px; }
.match-left { padding: 0 6px; font-weight: 700; }
.match-options { display: flex; flex-wrap: wrap; gap: 8px; }
.match-opt { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 14px; cursor: pointer; background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.match-opt:hover { border-color: var(--accent); }
.match-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.match-opt:has(input:focus-visible) { outline: 3px solid var(--link); outline-offset: 2px; }
.match-pic { display: block; width: 110px; max-width: 100%; height: 80px; object-fit: cover; border-radius: 8px; }

/* ---------- админка: картинки в парах и hotspot ---------- */
.pair-rows { display: grid; gap: 12px; }
.pair-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pair-side { flex: 1 1 220px; display: grid; gap: 6px; justify-items: start; }
.pair-side input[type="text"] { width: 100%; }
.pair-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--surface); }
.pair-upload { cursor: pointer; }
.pair-upload:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }
.pair-clear { font-size: 0.9rem !important; }
.pair-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hs-stage { margin: 0 0 8px; }
.hs-zone { position: absolute; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); background: rgba(196, 47, 47, 0.25); border: 3px solid var(--bad); pointer-events: none; }
.hs-radius input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------- кланы ---------- */
/* цвет клана выбирает clan_tone(tag): --tone и --tone-soft для значка и тега */
.tone-0 { --tone: #3b6cf6; --tone-soft: rgba(59, 108, 246, 0.14); }
.tone-1 { --tone: #0f9d8a; --tone-soft: rgba(15, 157, 138, 0.15); }
.tone-2 { --tone: #d9480f; --tone-soft: rgba(217, 72, 15, 0.14); }
.tone-3 { --tone: #9333ea; --tone-soft: rgba(147, 51, 234, 0.14); }
.tone-4 { --tone: #c2255c; --tone-soft: rgba(194, 37, 92, 0.14); }
.tone-5 { --tone: #5c940d; --tone-soft: rgba(92, 148, 13, 0.16); }
.tone-6 { --tone: #d19a00; --tone-soft: rgba(209, 154, 0, 0.17); }
.tone-7 { --tone: #0c8bd0; --tone-soft: rgba(12, 139, 208, 0.15); }
@media (prefers-color-scheme: dark) {
  .tone-0 { --tone: #8fa8ff; } .tone-1 { --tone: #3ddbc3; } .tone-2 { --tone: #ff9a66; } .tone-3 { --tone: #c79bff; }
  .tone-4 { --tone: #ff7fae; } .tone-5 { --tone: #a5d94a; } .tone-6 { --tone: #ffd24d; } .tone-7 { --tone: #5cc4ff; }
}

.clan-emblem { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 14px; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.3px; color: var(--tone, var(--link)); background: var(--tone-soft, var(--accent-soft)); border: 1px solid var(--tone, var(--link)); border-color: color-mix(in srgb, var(--tone, var(--link)) 40%, transparent); }
.clan-emblem-lg { width: 64px; height: 64px; border-radius: 20px; font-size: 1.05rem; }
.clan-tag { display: inline-block; padding: 2px 8px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.5px; border-radius: 8px; color: var(--tone, var(--link)); background: var(--tone-soft, var(--accent-soft)); vertical-align: 0.1em; }

.badge .icon { width: 0.9em; height: 0.9em; margin-right: 3px; vertical-align: -0.12em; }

/* рейтинг кланов */
.clan-list { display: grid; gap: 12px; margin: 0 0 24px; padding: 0; list-style: none; }
.clan-row { display: grid; grid-template-columns: 36px 44px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px 18px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.clan-row.is-me { border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--card) 70%); }
.clan-place { text-align: center; font-size: 1.1rem; font-weight: 900; color: var(--muted); }
.clan-place .icon { width: 1.5rem; height: 1.5rem; vertical-align: -0.3em; }
.clan-main { min-width: 0; }
.clan-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.clan-name b { font-size: 1.05rem; overflow-wrap: anywhere; }
.clan-meta { margin: 2px 0 6px; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.clan-row progress { height: 6px; }
.clan-score { text-align: right; line-height: 1.1; }
.clan-score b { display: block; font-size: 1.4rem; font-weight: 900; color: var(--link); }
.clan-score span { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.clan-action { margin: 0; }

/* карточка клана в профиле */
.clan-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.clan-head .side-title { margin: 0 0 4px; font-size: 1.2rem; overflow-wrap: anywhere; }
.clan-sub { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.clan-desc { margin: 0 0 14px; color: var(--muted); font-style: italic; }
.clan-lead { margin: 0 0 14px; }
.clan-subtitle { margin: 18px 0 4px; font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.clan-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; margin-bottom: 16px; }
.clan-stats > div { padding: 10px 12px; text-align: center; background: var(--surface); border-radius: var(--radius-sm); }
.clan-stats b { display: block; font-size: 1.35rem; line-height: 1.15; color: var(--link); }
.clan-stats span { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.invite { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.invite code { padding: 8px 12px; font-size: 1.05rem; font-weight: 700; letter-spacing: 1.5px; }
.clan-leave, .clan-create { margin-top: 16px; }
.clan-leave summary, .clan-create summary { display: flex; }
.clan-leave[open] summary, .clan-create[open] > summary.btn { margin-bottom: 12px; }
.clan-leave[open] { padding: 12px; border: 1px dashed var(--bad); border-radius: var(--radius-sm); }
.clan-leave[open] summary { display: none; }
.clan-form { margin-top: 4px; }
.clan-form .field { margin-bottom: 14px; }
.clan-form-grid { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 0 14px; }
.clan-form-wide { grid-column: 1 / -1; }

/* админка: список кланов */
.clan-admin-list { display: grid; gap: 16px; margin: 0 0 24px; padding: 0; list-style: none; }
.clan-admin { margin-bottom: 0; padding: 20px; }
.clan-admin-head { display: flex; align-items: center; gap: 16px; }
.clan-admin-head .clan-meta { margin: 4px 0 0; }
.clan-stats-inline { margin: 0; grid-template-columns: repeat(3, minmax(64px, 1fr)); }
.clan-admin-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.clan-admin-code .field-label { margin: 0 0 6px; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.clan-admin .confirm-delete[open] { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.clan-admin .confirm-delete .hint { margin: 0; }
.clan-edit { margin-top: 12px; }
.clan-edit > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 700; color: var(--link); }
.clan-edit[open] > summary { margin-bottom: 14px; }
.clan-create-admin { padding: 0; }
.clan-create-admin > summary { display: flex; align-items: center; gap: 10px; padding: 18px 24px; cursor: pointer; list-style: none; color: var(--link); }
.clan-create-admin > summary::-webkit-details-marker { display: none; }
.clan-create-admin > .clan-form { margin: 0; padding: 4px 24px 22px; }
.clan-create-admin .form-actions { align-items: center; justify-content: space-between; }

@media (max-width: 700px) {
  .clan-row { grid-template-columns: 28px 44px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .clan-action { grid-column: 3 / -1; }
  .clan-action .btn { width: 100%; }
  .clan-score b { font-size: 1.2rem; }
  .clan-admin-head { flex-wrap: wrap; }
  .clan-admin-head .clan-main { flex: 1 1 200px; }
  .clan-stats-inline { flex: 1 1 100%; }
  .clan-form-grid { grid-template-columns: 1fr; }
  .clan-create-admin > summary { padding: 16px 18px; }
  .clan-create-admin > .clan-form { padding: 4px 18px 18px; }
}

.profile-name { margin-bottom: 6px; overflow-wrap: anywhere; word-break: break-word; }
.profile-handle { margin: 0 0 10px; font-size: 0.92rem; overflow-wrap: anywhere; }
.profile-badges { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-bottom: 4px; }
.center .clan-form { text-align: left; }

.clan-head-body { flex: 1; min-width: 0; }
.invite code { flex: 1; min-width: 120px; text-align: center; overflow-wrap: anywhere; }

.clan-card .inline-form { flex-wrap: nowrap; align-items: stretch; }
.clan-card .inline-form input { flex: 1; min-width: 0; }
.clan-card .inline-form .btn { min-height: 46px; padding: 0 18px; flex: none; }

.invite { flex-wrap: nowrap; }
.invite .btn { flex: none; min-height: 40px; }

@media (max-width: 480px) {
  .avatar-lg { width: 72px; height: 72px; border-radius: 22px; font-size: 1.85rem; margin-bottom: 10px; }
  .clan-emblem-lg { width: 52px; height: 52px; border-radius: 16px; font-size: 0.95rem; }
  .clan-open-list .mini-item { flex-wrap: wrap; gap: 8px 10px; padding: 12px 0; }
  .clan-open-list .clan-join-form { flex: 1 1 100%; }
  .clan-open-list .clan-join-form .btn { width: 100%; }
}

@media (max-width: 340px) {
  .clan-card .inline-form { flex-wrap: wrap; }
  .clan-card .inline-form input { flex: 1 1 100%; }
  .clan-card .inline-form .btn { width: 100%; min-height: 42px; }
  .invite { flex-wrap: wrap; }
  .invite .btn { flex: 1 1 100%; }
}

/* ---------- улучшенный конструктор заданий ---------- */
.type-picker-panel {
  margin: 0 0 20px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.type-picker-label {
  display: block;
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.type-picker-panel .type-switch {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.type-picker-panel .type-switch a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.type-picker-panel .type-switch a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--link);
}
.type-picker-panel .type-switch a.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 3px 10px var(--accent-soft);
}

.task-type-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.label-row label,
.label-row .field-label {
  margin-bottom: 0;
}
.char-counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.editor-type-section {
  margin: 18px 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.editor-type-section > .field:last-child,
.editor-type-section > fieldset.field:last-child {
  margin-bottom: 0;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.option-row {
  transition: border-color 0.15s, background 0.15s;
}
.option-mark {
  gap: 6px;
  width: auto;
  min-width: 58px;
  padding: 0 10px;
}
.option-num {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}
.option-mark:has(input:checked) .option-num {
  color: var(--ok);
}
.option-row.is-correct input[type="text"] {
  border-color: var(--ok);
  background: var(--ok-soft);
  font-weight: 600;
}
.option-clear-btn {
  flex: none;
  width: 42px;
  min-height: 46px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
}
.option-clear-btn:hover {
  color: var(--bad);
  border-color: var(--bad);
  background: var(--bad-soft);
}

.pair-card {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.pair-card.is-filled {
  border-color: var(--ok);
}
.pair-index {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--surface);
  color: var(--muted);
}
.pair-card.is-filled .pair-index {
  background: var(--ok-soft);
  color: var(--ok);
}
.pair-media-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.pair-media-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.hs-upload-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.hs-upload-btn {
  cursor: pointer;
}
.hs-zone::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.ordering-preview {
  margin-top: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--link);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.emoji-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.emoji-chip {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 1.2rem;
  line-height: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.emoji-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.emoji-preview-box {
  margin-top: 12px;
  padding: 12px 16px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.emoji-preview-box .emoji-cipher {
  margin: 6px 0 0;
  font-size: 2.2rem;
}

@media (max-width: 600px) {
  .type-picker-panel {
    padding: 12px;
  }
  .type-picker-panel .type-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .type-picker-panel .type-switch a {
    padding: 8px 10px;
    font-size: 0.82rem;
  }
  .editor-type-section {
    padding: 14px 12px;
  }
  .pair-card {
    flex-direction: column;
    align-items: stretch;
  }
  .pair-card .pair-sep {
    align-self: center;
    transform: rotate(90deg);
  }
}

/* ---------- роли и иерархия ---------- */
.badge-owner {
  background: linear-gradient(135deg, #7c3aed, #d97706);
  color: #fff;
}
.badge-mod {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
}
.role-form {
  justify-content: flex-end;
}
.role-select {
  width: auto;
  min-width: 148px;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.roles-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.role-card {
  margin-bottom: 0;
  padding: 18px 20px;
}
.role-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.role-card-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- авторство и история правок задания ---------- */
.task-credit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 0;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border-radius: 8px;
}
.task-credit .icon {
  width: 0.95em;
  height: 0.95em;
  vertical-align: -0.15em;
  color: var(--link);
}
.task-author-sub {
  margin-top: 2px;
}
.task-audit-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 16px;
  padding-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.task-audit-box .icon {
  width: 1em;
  height: 1em;
  margin-right: 4px;
  vertical-align: -0.15em;
  color: var(--link);
}

/* ---------- рейтинг: период, пьедестал, ваше место ---------- */
.period-switch { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0 0 20px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.period-switch a { padding: 6px 16px; font-size: 0.9rem; font-weight: 700; color: var(--muted); text-decoration: none; border-radius: 999px; }
.period-switch a:hover { color: var(--link); }
.period-switch a.is-active { color: var(--link); background: var(--card); box-shadow: var(--shadow); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin: 0 0 24px; padding: 0; list-style: none; }
.podium-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px 14px; text-align: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.podium-item .icon { width: 1.8rem; height: 1.8rem; }
.podium-1 { order: 2; padding-top: 26px; padding-bottom: 22px; border-color: #d4a017; background: linear-gradient(180deg, rgba(212, 160, 23, 0.14), var(--card) 70%); }
.podium-2 { order: 1; }
.podium-3 { order: 3; }
.podium-item.is-me { border-color: var(--accent); }
.podium-name { max-width: 100%; overflow-wrap: anywhere; }
.podium-score { font-size: 1.6rem; font-weight: 900; line-height: 1.1; color: var(--link); }
.podium-sub { font-size: 0.75rem; color: var(--muted); }
.my-place { margin: 16px 0 0; padding: 12px 16px; text-align: center; background: var(--accent-soft); border-radius: var(--radius-sm); }
@media (max-width: 640px) {
  .podium { grid-template-columns: 1fr; }
  .podium-1, .podium-2, .podium-3 { order: 0; flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 12px; }
}
.table-wrapper .cell-user > span:last-child { flex: 1; min-width: 0; }
.cell-user progress { height: 6px; margin-top: 6px; }
.captcha-box { min-height: 65px; margin: 0 0 16px; }

/* ---------- таймер теста ---------- */
.quiz-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.quiz-head h1 { margin: 0; }
.quiz-timer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-weight: 800; font-variant-numeric: tabular-nums; }
.quiz-timer .timer-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.quiz-timer .timer-value { font-size: 1.15rem; letter-spacing: 0.02em; }
.quiz-timer.is-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.quiz-timer.is-critical { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse { 50% { opacity: 0.7; } }
@media (prefers-reduced-motion: reduce) { .quiz-timer.is-critical { animation: none; } }

/* ---------- переключатель темы ---------- */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px; background: none; color: var(--text); cursor: pointer; }
.theme-toggle:hover { background: var(--surface); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html:not([data-theme]) .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle .icon-moon { display: none; }
  html:not([data-theme]) .theme-toggle .icon-sun { display: block; }
}

/* ---------- волна смены темы, растущая от иконки ---------- */
.theme-wave {
  position: fixed;
  pointer-events: none;
  z-index: 55;
  border-radius: 50%;
  background: var(--bg);
  width: 300vmax;
  height: 300vmax;
  transform: translate(-50%, -50%) scale(0);
  opacity: 1;
  animation: theme-wave 0.8s ease-out forwards;
}
@keyframes theme-wave {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-wave { animation: none; display: none; }
}

/* ---------- confetti canvas ---------- */
#confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }

/* ---------- ссылки на профили ---------- */
.cell-user-link { color: inherit; text-decoration: none; }
.cell-user-link:hover .cell-title { color: var(--link); }
.mini-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.mini-link:hover .mini-name { color: var(--link); }
.podium-link { display: flex; flex-direction: column; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.podium-link:hover .podium-name { color: var(--link); }

/* ---------- настройки профиля ---------- */
.profile-history { min-width: 0; }
.profile-card { padding: 24px 20px; }
.profile-actions { display: grid; gap: 6px; margin-top: 14px; }
.profile-actions .side-link { margin-top: 2px; font-size: 0.9rem; }
.public-preview-bar { margin-bottom: 20px; padding: 14px 18px; }
.clan-code-form { margin-bottom: 4px; }
.clan-invite-label { margin-top: 14px; }

.settings-block { margin-bottom: 16px; }
.settings-block:last-child { margin-bottom: 0; }
.settings-block .field { margin-bottom: 0; }
.settings-block .inline-form { align-items: stretch; }
.settings-block .inline-form input { flex: 1; min-width: 0; }
.settings-block .inline-form .btn { flex: none; min-height: 46px; padding: 0 18px; }

.settings-form { display: grid; gap: 16px; }
.settings-form .field { margin-bottom: 0; }
.setting-item { display: grid; gap: 4px; }
.setting-item .hint { margin: 0 0 0 30px; }
.setting-notice { margin-top: 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.setting-notice p { margin: 0 0 10px; font-size: 0.92rem; }
.setting-notice p:last-child { margin-bottom: 0; }
.settings-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 0.9rem; }
.settings-link { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

.clan-create-summary { font-weight: 700; }
.task-editor-card { margin-bottom: 24px; }
.cf-turnstile { display: inline-block; }
.hs-editor-box { margin-bottom: 12px; }
.ordering-container { display: grid; gap: 8px; }

@media (max-width: 480px) {
  .settings-block .inline-form { flex-wrap: wrap; }
  .settings-block .inline-form input { flex: 1 1 100%; }
  .settings-block .inline-form .btn { width: 100%; min-height: 42px; }
}

/* email-поле: как остальные инпуты, без нативного автозаполнения-«жёлтого» */
input[type="email"]:-webkit-autofill, input[type="text"]:-webkit-autofill, input[type="password"]:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 100px var(--bg) inset;
}
.btn-telegram, .badge-telegram { color: #229ed9; }
.badge-telegram { background: rgba(34, 158, 217, 0.12); border-color: rgba(34, 158, 217, 0.35); }
.hint .icon { width: 1em; height: 1em; margin-right: 4px; vertical-align: -0.15em; color: #229ed9; }
input.code-input { text-align: center; font-size: 1.6rem; font-weight: 800; letter-spacing: 0.4em; font-variant-numeric: tabular-nums; }

/* ---------- анимации и микро-взаимодействия ---------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popScale {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes podiumRise {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(196, 47, 47, 0.55), 0 1px 6px rgba(0, 0, 0, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(196, 47, 47, 0), 0 1px 6px rgba(0, 0, 0, 0.4); }
  100% { box-shadow: 0 0 0 0 rgba(196, 47, 47, 0), 0 1px 6px rgba(0, 0, 0, 0.4); }
}
@keyframes rewardGlow {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: var(--shadow), 0 0 22px 4px var(--accent-soft); }
}
@keyframes heroGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes orderFlash {
  0% { background: var(--accent-soft); border-color: var(--accent); transform: scale(1.015); }
  100% { background: var(--bg); border-color: var(--border); transform: scale(1); }
}

.hero {
  background-size: 180% 180%;
  animation: riseIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both, heroGradient 10s ease infinite;
}
.card, .stat, .question, .result-item, .clan-row {
  animation: riseIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.steps-grid > .step:nth-child(1), .stats-grid > .stat:nth-child(1), .result-item:nth-child(1), .question:nth-child(1) { animation-delay: 0.03s; }
.steps-grid > .step:nth-child(2), .stats-grid > .stat:nth-child(2), .result-item:nth-child(2), .question:nth-child(2) { animation-delay: 0.08s; }
.steps-grid > .step:nth-child(3), .stats-grid > .stat:nth-child(3), .result-item:nth-child(3), .question:nth-child(3) { animation-delay: 0.13s; }
.result-item:nth-child(4), .question:nth-child(4), .clan-row:nth-child(2) { animation-delay: 0.17s; }
.result-item:nth-child(5), .question:nth-child(5), .clan-row:nth-child(3) { animation-delay: 0.21s; }
.result-item:nth-child(n+6), .question:nth-child(n+6), .clan-row:nth-child(n+4) { animation-delay: 0.25s; }

.podium-item {
  animation: podiumRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}
.podium-2 { animation-delay: 0.06s; }
.podium-1 { animation-delay: 0.14s; }
.podium-3 { animation-delay: 0.22s; }
.podium-item:hover, .clan-row:hover {
  transform: translateY(-3px);
}

.flash {
  animation: flashIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.btn, button {
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, opacity 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-soft);
}
.btn:active, button:active {
  transform: translateY(0) scale(0.97);
}

.theme-toggle svg {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.theme-toggle:hover svg {
  transform: rotate(18deg) scale(1.08);
}

label.option, .match-opt {
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease;
}
label.option:hover, .match-opt:hover {
  transform: translateY(-1px);
}
label.option:has(input:checked), .match-opt:has(input:checked) {
  animation: popScale 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.q-chip {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.q-chip.is-answered {
  animation: popScale 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.memory-card {
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.memory-card.is-flipped {
  animation: popScale 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.memory-card.is-matched {
  animation: popScale 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.order-item {
  transition: transform 0.18s ease, background-color 0.25s ease, border-color 0.25s ease;
}
.order-item.is-moved {
  animation: orderFlash 0.45s ease;
}

.hotspot-marker {
  animation: popScale 0.22s cubic-bezier(0.22, 1, 0.36, 1), pulseRing 1.8s infinite;
}

.minigame-target {
  transition: left 0.12s cubic-bezier(0.22, 1, 0.36, 1), top 0.12s cubic-bezier(0.22, 1, 0.36, 1), transform 0.1s ease;
}
.minigame-target:active {
  transform: scale(0.84);
}

.reward-card {
  animation: riseIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both, rewardGlow 3s ease-in-out infinite;
}

a.list-item {
  transition: background-color 0.18s ease, padding-left 0.18s ease;
}
a.list-item:hover {
  padding-left: 26px;
}

/* ---------- анимированный ползунок (слайдер) в меню и вкладках ---------- */
[data-slider] {
  position: relative;
}
.has-slider > a,
.has-slider > button,
.has-slider > form {
  position: relative;
  z-index: 1;
}
.slider-pill {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: 12px;
  background: var(--accent-soft);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.36s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s ease;
  will-change: transform, width, height;
}
.nav nav.has-slider > a.active {
  background: transparent;
}
.tabs.has-slider > a[aria-current="page"] {
  background: transparent;
  box-shadow: none;
}
@media (max-width: 991px) {
  .tabs.has-slider > .slider-pill {
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 -3px 0 var(--accent);
  }
}
.period-switch.has-slider > .slider-pill {
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.period-switch.has-slider > a.is-active,
.period-switch.has-slider > button.is-active {
  background: transparent;
  box-shadow: none;
}
.type-picker-panel .type-switch.has-slider > .slider-pill {
  border-radius: 12px;
  background: var(--accent);
  box-shadow: 0 3px 10px var(--accent-soft);
}
.type-picker-panel .type-switch.has-slider > a.active {
  background: transparent;
  box-shadow: none;
}

.profile-switch a,
.period-switch a,
.period-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.profile-switch .icon,
.period-switch .icon,
.period-tab .icon {
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.15em;
}
.period-tab {
  min-height: 0;
  padding: 6px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.period-tab:hover {
  color: var(--link);
}
.period-tab.is-active {
  color: var(--link);
  background: var(--card);
  box-shadow: var(--shadow);
}
.settings-tabs {
  margin-bottom: 20px;
}

/* ---------- глобальный поиск: вкладка в шапке, выпадающее окно и страница /search ---------- */
.nav-search-btn {
  position: relative;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-search-btn .icon {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}
.nav-search-btn:hover .icon,
.nav-search-btn.is-open .icon {
  transform: scale(1.1) rotate(-8deg);
  color: var(--link);
}
.nav-search-btn.is-open {
  color: var(--link);
  background: var(--accent-soft);
}
.nav nav.has-slider > a.nav-search-btn.is-open {
  background: transparent;
}
.nav-kbd,
.kbd-badge,
.search-key-hint kbd,
.search-tip-item kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 0 var(--border);
}
.nav-kbd {
  margin-left: 2px;
  min-width: 20px;
  font-size: 0.7rem;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.nav-search-btn:hover .nav-kbd,
.nav-search-btn.is-open .nav-kbd {
  color: var(--link);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--card);
}
.search-submit-btn .kbd-badge {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: none;
}

.search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 15, 28, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.search-backdrop.is-open {
  opacity: 1;
}

.search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 110;
  padding: 10px 16px 20px;
  pointer-events: none;
}
.search-dropdown-inner {
  max-width: 780px;
  margin: 0 auto;
  background: color-mix(in srgb, var(--card) 95%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(10, 18, 42, 0.24), 0 0 0 4px var(--accent-soft);
  overflow: hidden;
  pointer-events: auto;
  transform-origin: top center;
  opacity: 0;
  transform: translateY(-14px) scale(0.975);
}
.search-dropdown.is-open .search-dropdown-inner {
  animation: searchDropIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.search-dropdown.is-closing .search-dropdown-inner {
  animation: searchDropOut 0.18s ease-in forwards;
}

@keyframes searchDropIn {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes searchDropOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
}
@keyframes searchSpin {
  to { transform: rotate(360deg); }
}
@keyframes searchItemRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-drop-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.search-drop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--card);
  color: var(--link);
  box-shadow: var(--shadow);
  flex: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, color 0.2s ease;
}
.search-drop-form:focus-within .search-drop-icon {
  background: var(--accent);
  color: #fff;
  transform: scale(1.06);
}
input.search-drop-input,
input.search-page-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 6px 8px;
  font: inherit;
  font-size: 1.04rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
}
input.search-drop-input:focus-visible,
input.search-page-input:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
}
input.search-drop-input::-webkit-search-cancel-button,
input.search-page-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.search-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  flex: none;
  animation: searchSpin 0.65s linear infinite;
}
.search-clear-btn {
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  border: 0;
}
.search-clear-btn:hover {
  background: var(--bad-soft);
  color: var(--bad);
  transform: rotate(90deg) scale(1.06);
}
.search-submit-btn {
  flex: none;
  gap: 8px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 12px;
}

.search-drop-body {
  max-height: min(65vh, 450px);
  overflow-y: auto;
  padding: 16px;
}
.search-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.search-section-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}
.search-section-head .search-section-label {
  margin-bottom: 0;
}
.search-recent {
  margin-bottom: 16px;
}
.search-recent-clear {
  min-height: 0;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 6px;
}
.search-recent-clear:hover {
  color: var(--bad);
  background: var(--bad-soft);
}
.search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.search-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.14s ease, color 0.16s ease;
}
.search-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--link);
  transform: translateY(-1px);
}
.search-chip .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--muted);
}

.search-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}
.search-quick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}
.search-quick-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--shadow);
}
.search-quick-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--link);
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}
.search-quick-card:hover .search-quick-icon {
  background: var(--accent);
  color: #fff;
  transform: scale(1.06);
}
.search-quick-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-quick-text b {
  font-size: 0.95rem;
  line-height: 1.2;
}
.search-quick-text small {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.25;
}

.search-drop-group {
  margin-bottom: 14px;
}
.search-drop-group:last-of-type {
  margin-bottom: 10px;
}
.search-drop-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0 6px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}
.search-drop-group-title .icon {
  width: 1rem;
  height: 1rem;
  color: var(--link);
}
.search-drop-list {
  display: grid;
  gap: 4px;
}
.search-drop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 14px;
  animation: searchItemRise 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}
.search-drop-item:nth-child(1) { animation-delay: 0.02s; }
.search-drop-item:nth-child(2) { animation-delay: 0.05s; }
.search-drop-item:nth-child(3) { animation-delay: 0.08s; }
.search-drop-item:nth-child(4) { animation-delay: 0.11s; }
.search-drop-item:nth-child(5) { animation-delay: 0.14s; }
.search-drop-item:hover,
.search-drop-item.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transform: translateX(3px);
}
.search-drop-item-main {
  flex: 1;
  min-width: 0;
}
.search-drop-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.search-drop-item-title {
  font-weight: 700;
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}
.search-drop-item-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.search-drop-item-arrow {
  flex: none;
  font-weight: 800;
  color: var(--muted);
  transition: transform 0.18s ease, color 0.18s ease;
}
.search-drop-item:hover .search-drop-item-arrow,
.search-drop-item.is-active .search-drop-item-arrow {
  color: var(--link);
  transform: translateX(4px);
}
.search-drop-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 11px 14px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--link);
  text-decoration: none;
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 14px;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.16s ease;
}
.search-drop-more:hover,
.search-drop-more.is-active {
  background: var(--accent-soft);
  border-style: solid;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.search-drop-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}
.search-drop-empty b {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.search-drop-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.search-foot-hints {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.search-key-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.search-foot-all {
  font-weight: 700;
  text-decoration: none;
}
.search-foot-all:hover {
  text-decoration: underline;
}

mark.search-hl {
  padding: 0 3px;
  color: var(--link);
  background: var(--accent-soft);
  border-radius: 5px;
  font-weight: 800;
}

/* ---------- полноценная страница поиска (/search) ---------- */
.search-page-hero {
  position: relative;
  overflow: hidden;
  padding: 28px 26px 22px;
  background:
    radial-gradient(640px 240px at 8% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(520px 220px at 96% 110%, var(--accent-soft), transparent 70%),
    var(--card);
}
.search-hero-head {
  margin-bottom: 18px;
}
.search-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--link);
  background: var(--accent-soft);
  border-radius: 999px;
}
.search-hero-badge .icon {
  width: 1rem;
  height: 1rem;
}
.search-hero-lead {
  margin: 0;
  font-size: 1rem;
}
.search-page-form {
  margin-bottom: 12px;
}
.search-page-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.search-page-bar:focus-within {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: 0 8px 26px var(--accent-soft), 0 0 0 4px var(--accent-soft);
}
.search-page-icon {
  display: inline-flex;
  color: var(--link);
  flex: none;
}
.search-page-icon .icon {
  width: 1.35rem;
  height: 1.35rem;
}
.search-page-submit {
  flex: none;
  min-height: 44px;
  padding: 8px 20px;
  border-radius: 13px;
}
.search-tips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 0.83rem;
  color: var(--muted);
}
.search-tip-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.search-reset-link {
  margin-left: auto;
  font-weight: 700;
  color: var(--bad);
  text-decoration: none;
}
.search-reset-link:hover {
  text-decoration: underline;
}

.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.search-toolbar .period-switch,
.search-filter-tabs {
  margin-bottom: 0;
}
.search-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--link);
  background: var(--accent-soft);
  border-radius: 999px;
}
.search-summary {
  margin: 0;
  font-size: 0.92rem;
}

.search-section {
  margin-bottom: 28px;
  animation: riseIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.search-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.search-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-group-title h2 {
  margin: 0;
  font-size: 1.2rem;
}
.search-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--link);
}

.search-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 14px;
}
.search-entity-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 0;
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.search-cards-grid > .search-entity-card:nth-child(1) { animation-delay: 0.02s; }
.search-cards-grid > .search-entity-card:nth-child(2) { animation-delay: 0.05s; }
.search-cards-grid > .search-entity-card:nth-child(3) { animation-delay: 0.08s; }
.search-cards-grid > .search-entity-card:nth-child(4) { animation-delay: 0.11s; }
.search-cards-grid > .search-entity-card:nth-child(5) { animation-delay: 0.14s; }
.search-cards-grid > .search-entity-card:nth-child(n+6) { animation-delay: 0.17s; }
.search-entity-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 28px var(--accent-soft);
}
.search-entity-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--link);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.search-entity-card:hover .search-entity-icon {
  background: var(--accent);
  color: #fff;
  transform: scale(1.06);
}
.search-entity-main {
  flex: 1;
  min-width: 0;
}
.search-entity-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 3px;
}
.search-entity-title {
  font-size: 1.02rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.search-entity-sub {
  margin: 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
.search-entity-arrow {
  flex: none;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--muted);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s ease;
}
.search-entity-card:hover .search-entity-arrow {
  color: var(--link);
  transform: translateX(5px);
}

.search-guide-list {
  display: grid;
  gap: 14px;
}
.search-guide-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.search-guide-item b {
  display: block;
  margin-bottom: 2px;
  font-size: 0.95rem;
}
.search-guide-item p {
  margin: 0;
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .nav-kbd,
  .search-submit-btn .kbd-badge,
  .search-foot-hints {
    display: none;
  }
  .search-dropdown {
    padding: 8px 10px 14px;
  }
  .search-drop-form {
    padding: 10px 12px;
    gap: 8px;
  }
  .search-drop-body {
    padding: 12px;
    max-height: 70vh;
  }
  .search-quick-grid {
    grid-template-columns: 1fr 1fr;
  }
  .search-page-hero {
    padding: 20px 16px 18px;
  }
  .search-page-bar {
    flex-wrap: wrap;
    padding: 8px 10px;
  }
  .search-page-submit {
    width: 100%;
  }
  .search-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- исправление вкладок настроек (.settings-tabs / .period-switch) на мобильных ---------- */
.period-switch {
  max-width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  align-items: center;
}
.period-switch::-webkit-scrollbar {
  display: none;
}
.period-switch a,
.period-tab {
  flex: 0 0 auto;
  white-space: nowrap;
}
.settings-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 20px;
}
/* контент настроек уже, а верхняя навигация профиля остаётся на всю ширину */
.settings-narrow { max-width: 640px; margin: 0 auto; padding: 0 16px; }

@media (max-width: 600px) {
  .profile-switch {
    display: flex;
    width: 100%;
  }
  .profile-switch a {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
  }
  .settings-tabs {
    display: flex;
    width: 100%;
    gap: 2px;
    padding: 4px;
    border-radius: 16px;
  }
  .settings-tabs.has-slider > .slider-pill {
    border-radius: 12px;
  }
  .settings-tabs .period-tab {
    flex: 1 1 0;
    min-width: max-content;
    justify-content: center;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 0.83rem;
    gap: 5px;
    border-radius: 12px;
  }
  .settings-tabs .period-tab .icon {
    width: 0.95em;
    height: 0.95em;
    vertical-align: 0;
  }
}

@media (max-width: 400px) {
  .settings-tabs .period-tab {
    padding: 7px 6px;
    font-size: 0.78rem;
    gap: 3px;
  }
  .settings-tabs .period-tab .icon {
    display: none;
  }
}

/* ---------- блок выхода в настройках аккаунта с выезжающим красным подтверждением ---------- */
.settings-logout-zone {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.settings-logout-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-logout-info {
  flex: 1 1 200px;
  min-width: 0;
}
.settings-logout-info b {
  display: block;
  margin-bottom: 2px;
  font-size: 0.96rem;
}
.settings-logout-info .hint {
  margin: 0;
}
.btn-logout-trigger {
  color: var(--bad);
  background: var(--card);
  border-color: color-mix(in srgb, var(--bad) 38%, var(--border));
}
.btn-logout-trigger:hover,
.btn-logout-trigger.is-open {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: var(--bad);
}
.btn-logout-trigger .icon {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-logout-trigger:hover .icon,
.btn-logout-trigger.is-open .icon {
  transform: translateX(2px);
}

.logout-confirm-drawer {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-8px);
  margin-top: 0;
  pointer-events: none;
  transition:
    grid-template-rows 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.26s ease,
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    margin-top 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}
.logout-confirm-drawer.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  margin-top: 14px;
  pointer-events: auto;
}
.logout-confirm-clip {
  overflow: hidden;
  min-height: 0;
  visibility: hidden;
  transition: visibility 0s linear 0.34s;
}
.logout-confirm-drawer.is-open .logout-confirm-clip {
  visibility: visible;
  transition-delay: 0s;
}
.logout-confirm-box {
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--bad-soft), color-mix(in srgb, var(--bad-soft) 35%, var(--card)));
  border: 1.5px solid var(--bad);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 26px var(--bad-soft);
}
.logout-confirm-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.logout-confirm-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--bad);
  color: #fff;
  box-shadow: 0 4px 12px var(--bad-soft);
}
.logout-confirm-drawer.is-open .logout-confirm-icon {
  animation: warnPop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes warnPop {
  0% { transform: scale(0.75) rotate(-10deg); }
  55% { transform: scale(1.1) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.logout-confirm-copy {
  flex: 1;
  min-width: 0;
}
.logout-confirm-copy b {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
  color: var(--bad);
}
.logout-confirm-copy p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text);
}
.logout-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.logout-confirm-form {
  margin: 0;
}
.logout-confirm-submit {
  box-shadow: 0 4px 14px var(--bad-soft);
}
.logout-confirm-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--bad-soft);
}

@media (max-width: 480px) {
  .settings-logout-bar .btn-logout-trigger {
    width: 100%;
  }
  .logout-confirm-box {
    padding: 14px;
  }
  .logout-confirm-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .logout-confirm-form,
  .logout-confirm-submit,
  .logout-confirm-cancel {
    width: 100%;
  }
}


.search-clan-card,
.search-drop-default,
.search-drop-results,
.search-location-card,
.search-page-clear,
.search-quick-section,
.search-sections,
.search-tab-empty,
.search-task-item,
.search-user-card {
  box-sizing: border-box;
}

/* ---------- обновлённый рейтинг: шапка, пьедестал игроков и кланов, таблица с кланами ---------- */
.leaderboard-hero,
.clan-page-hero {
  position: relative;
  overflow: hidden;
  padding: 28px 26px 20px;
  margin-bottom: 24px;
  background:
    radial-gradient(640px 260px at 6% -12%, var(--accent-soft), transparent 70%),
    radial-gradient(520px 240px at 96% 115%, var(--accent-soft), transparent 70%),
    var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
}
.clan-page-hero {
  background:
    radial-gradient(640px 260px at 6% -12%, var(--tone-soft, var(--accent-soft)), transparent 70%),
    radial-gradient(520px 240px at 96% 115%, var(--tone-soft, var(--accent-soft)), transparent 70%),
    var(--card);
  border-color: color-mix(in srgb, var(--tone, var(--accent)) 35%, var(--border));
}
.leaderboard-hero-top,
.clan-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.leaderboard-hero-copy {
  flex: 1 1 380px;
  min-width: 0;
}
.leaderboard-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--link);
  background: var(--accent-soft);
  border-radius: 999px;
}
.leaderboard-hero-badge .icon {
  width: 1rem;
  height: 1rem;
}
.leaderboard-hero h1,
.clan-page-hero h1 {
  margin: 0 0 6px;
  font-size: 1.95rem;
}
.leaderboard-hero-lead,
.clan-hero-desc {
  margin: 0;
  font-size: 0.98rem;
  max-width: 640px;
}

.leaderboard-hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(122px, 1fr));
  gap: 10px;
  flex: 0 1 540px;
}
.leaderboard-metric {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.leaderboard-metric-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--link);
}
.leaderboard-metric-body {
  min-width: 0;
}
.leaderboard-metric-body b {
  display: block;
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.leaderboard-metric-body span {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.15;
  color: var(--muted);
}

.leaderboard-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.clan-hero-toolbar {
  justify-content: flex-start;
}
.leaderboard-toolbar .period-switch,
.leaderboard-tabs,
.leaderboard-periods {
  margin-bottom: 0;
}

.leaderboard-split {
  align-items: start;
}
.leaderboard-main,
.leaderboard-sidebar,
.leaderboard-section {
  min-width: 0;
}
.leaderboard-section {
  animation: riseIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---------- пьедестал почёта (игроки и кланы) ---------- */
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.podium-clans {
  margin-bottom: 22px;
}
.podium-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 16px 16px;
  text-align: center;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.podium-clan-item {
  border-color: color-mix(in srgb, var(--tone, var(--accent)) 35%, var(--border));
}
.podium-1 {
  order: 2;
  padding-top: 22px;
  padding-bottom: 20px;
  border-color: rgba(212, 160, 23, 0.65);
  background:
    radial-gradient(280px 140px at 50% 0%, rgba(212, 160, 23, 0.22), transparent 75%),
    var(--card);
  box-shadow: 0 12px 30px rgba(212, 160, 23, 0.14), var(--shadow);
}
.podium-2 {
  order: 1;
  border-color: rgba(142, 152, 168, 0.55);
  background:
    radial-gradient(240px 120px at 50% 0%, rgba(142, 152, 168, 0.18), transparent 75%),
    var(--card);
}
.podium-3 {
  order: 3;
  border-color: rgba(184, 115, 51, 0.55);
  background:
    radial-gradient(240px 120px at 50% 0%, rgba(184, 115, 51, 0.18), transparent 75%),
    var(--card);
}
.podium-item.is-me {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow);
}

.podium-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}
.podium-place-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.podium-place-pill .icon {
  width: 1.15rem;
  height: 1.15rem;
}
.podium-place-1 {
  background: rgba(212, 160, 23, 0.18);
  color: #b5830a;
}
.podium-place-2 {
  background: rgba(142, 152, 168, 0.2);
  color: var(--text);
}
.podium-place-3 {
  background: rgba(184, 115, 51, 0.18);
  color: #9c5c21;
}
html[data-theme="dark"] .podium-place-1 { color: #fbbf24; }
html[data-theme="dark"] .podium-place-3 { color: #f59e0b; }

.podium-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  max-width: 100%;
}
.podium-avatar-ring,
.podium-emblem-ring {
  display: inline-flex;
  padding: 4px;
  border-radius: 26px;
  background: var(--surface);
  border: 2px solid var(--border);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease;
}
.podium-avatar-ring .avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  font-size: 1.65rem;
  margin: 0;
}
.podium-1 .podium-avatar-ring,
.podium-1 .podium-emblem-ring {
  border-color: rgba(212, 160, 23, 0.65);
  box-shadow: 0 6px 18px rgba(212, 160, 23, 0.22);
}
.podium-2 .podium-avatar-ring,
.podium-2 .podium-emblem-ring {
  border-color: rgba(142, 152, 168, 0.6);
}
.podium-3 .podium-avatar-ring,
.podium-3 .podium-emblem-ring {
  border-color: rgba(184, 115, 51, 0.6);
}
.podium-link:hover .podium-avatar-ring,
.podium-link:hover .podium-emblem-ring {
  transform: scale(1.05);
  border-color: var(--accent);
}
.podium-name {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.podium-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
}
.podium-clan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 9px 3px 4px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: var(--tone-soft, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 35%, transparent);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.podium-clan-chip:hover {
  transform: translateY(-1px);
  border-color: var(--tone, var(--accent));
}
.podium-clan-name {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.podium-clan-desc {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.leaderboard-rank-pill {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  padding: 2px 8px;
}

.podium-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.podium-score {
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--link);
  font-variant-numeric: tabular-nums;
}
.podium-1 .podium-score {
  font-size: 1.85rem;
}
.podium-sub {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.podium-clan-action {
  width: 100%;
  margin: 4px 0 0;
}

/* ---------- таблица лидеров с колонкой кланов ---------- */
.leaderboard-table-wrap {
  border-radius: var(--radius);
  overflow: hidden;
}
.leaderboard-table th {
  padding: 13px 16px;
}
.leaderboard-table td {
  padding: 13px 16px;
}
.is-podium-row td {
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}
.rank-medal-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--surface);
}
.rank-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.cell-user-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cell-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.cell-user progress {
  height: 5px;
  margin-top: 2px;
  max-width: 260px;
}

.cell-clan {
  min-width: 170px;
}
.table-clan-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: var(--tone-soft, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 30%, transparent);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.table-clan-link:hover {
  transform: translateY(-1px);
  border-color: var(--tone, var(--accent));
  box-shadow: var(--shadow);
}
.table-clan-link .clan-emblem {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 0.68rem;
}
.table-clan-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.table-clan-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clan-empty-dash {
  font-size: 0.84rem;
}
.cell-games {
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cell-score {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cell-score b {
  display: block;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--link);
}
.cell-score-unit {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

/* ---------- карточки кланов в рейтинге ---------- */
.clan-row {
  position: relative;
  border-left: 4px solid var(--tone, var(--accent));
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}
.clan-row.is-top-clan {
  background: linear-gradient(90deg, var(--tone-soft, var(--accent-soft)), var(--card) 42%);
}
.clan-row progress::-webkit-progress-value {
  background: var(--tone, var(--accent));
}
.clan-row progress::-moz-progress-bar {
  background: var(--tone, var(--accent));
}
.clan-title-link {
  color: var(--text);
  text-decoration: none;
}
.clan-title-link:hover {
  color: var(--link);
}
.clan-row-desc {
  margin: 3px 0 6px;
  font-size: 0.84rem;
  line-height: 1.35;
}
.clan-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 4px 0 8px;
}
.clan-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.clan-meta-pill .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--tone, var(--link));
  vertical-align: 0;
}
.clan-actions-col {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.clan-view-btn {
  white-space: nowrap;
}

/* ---------- баннер вступления и создания клана на странице рейтинга ---------- */
.clan-cta-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  margin-bottom: 0;
  background: linear-gradient(135deg, var(--accent-soft), var(--card) 75%);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}
.clan-cta-copy {
  flex: 1 1 280px;
  min-width: 0;
}
.clan-cta-copy .side-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}
.clan-cta-copy .hint {
  margin: 0;
}
.clan-cta-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.clan-cta-controls .clan-code-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.clan-cta-controls .clan-code-form input {
  width: 170px;
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

/* ---------- боковая панель рейтинга и виджет кланов ---------- */
.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.side-card-head .side-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}
.side-card-head .side-title .icon {
  color: var(--link);
}
.leaderboard-me-card .side-title {
  margin: 0;
}
.leaderboard-me-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.leaderboard-me-score b {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--link);
  font-variant-numeric: tabular-nums;
}
.leaderboard-me-score span {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.side-clan-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--tone-soft, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 35%, transparent);
}
.side-clan-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.side-clan-info {
  flex: 1;
  min-width: 0;
}
.side-clan-title {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}
.side-clan-title:hover {
  color: var(--link);
}
.side-clan-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}
.side-clan-empty {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.side-clan-empty .hint {
  margin: 0 0 10px;
}

.side-clans-card .clan-emblem,
.home-board-card .clan-emblem {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.7rem;
}
.side-clan-list .side-clan-item.is-me {
  padding-left: 6px;
  padding-right: 6px;
  background: var(--accent-soft);
  border-radius: 10px;
}
.side-clan-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.home-board-card .side-card-head {
  flex-wrap: wrap;
}
.home-board-switch {
  margin: 0;
  padding: 3px;
}
.home-board-switch .period-tab {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* ---------- лестница рангов ---------- */
.ladder li {
  align-items: center;
  transition: background-color 0.16s ease;
}
.ladder-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ladder-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.ladder li.is-achieved .ladder-dot {
  background: var(--ok);
}
.ladder li.is-current .ladder-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ladder-threshold {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- страница клана (/leaderboard/clans/{id}) ---------- */
.clan-hero-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1 1 320px;
  min-width: 0;
}
.clan-hero-copy {
  min-width: 0;
}
.clan-hero-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.clan-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

@media (max-width: 820px) {
  .leaderboard-hero-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    flex: 1 1 100%;
  }
}

@media (max-width: 640px) {
  .leaderboard-hero,
  .clan-page-hero {
    padding: 20px 16px 16px;
  }
  .leaderboard-hero h1,
  .clan-page-hero h1 {
    font-size: 1.55rem;
  }
  .podium {
    grid-template-columns: 1fr;
  }
  .podium-1,
  .podium-2,
  .podium-3 {
    order: 0;
    flex-direction: column;
    padding: 16px 14px;
  }
  .clan-hero-identity {
    flex-direction: column;
    align-items: flex-start;
  }
  .clan-cta-controls,
  .clan-cta-controls .clan-code-form {
    width: 100%;
  }
  .clan-cta-controls .clan-code-form input {
    flex: 1;
    width: auto;
  }
}

.leaderboard-sidebar .clan-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.podium-item .badge .icon {
  width: 0.95em;
  height: 0.95em;
}
.rank-medal-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 38px;
  height: 28px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.rank-medal-wrap .icon {
  width: 1.05rem;
  height: 1.05rem;
  vertical-align: 0;
}
.rank-medal-1 {
  background: rgba(212, 160, 23, 0.18);
  color: #b5830a;
}
.rank-medal-2 {
  background: rgba(142, 152, 168, 0.2);
  color: var(--text);
}
.rank-medal-3 {
  background: rgba(184, 115, 51, 0.18);
  color: #9c5c21;
}
html[data-theme="dark"] .rank-medal-1 { color: #fbbf24; }
html[data-theme="dark"] .rank-medal-3 { color: #f59e0b; }

/* ---------- обновлённый информационный блок «Как устроен квест» на главной (не выглядит как кнопки) ---------- */
.how-strip {
  margin: 0 0 24px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.how-strip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.how-strip-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
}
.how-strip-title .icon {
  width: 1.15rem;
  height: 1.15rem;
  color: var(--link);
}
.how-strip-sub {
  font-size: 0.84rem;
}
.how-strip .steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.how-strip .step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 8px;
  padding: 14px 16px;
  margin: 0;
  background: color-mix(in srgb, var(--card) 68%, transparent);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: none;
  cursor: default;
  user-select: text;
}
.how-strip .step:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -13px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  pointer-events: none;
}
.step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}
.step-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--surface);
  border-radius: 999px;
}
.how-strip .step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--link);
}
.how-strip .step-icon .icon {
  width: 1.1rem;
  height: 1.1rem;
}
.step-body h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
}
.step-body p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .how-strip .steps-grid {
    grid-template-columns: 1fr;
  }
  .how-strip .step:not(:last-child)::after {
    display: none;
  }
}

/* ---------- интерактивный индикатор надёжности пароля ---------- */
.pw-checker {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.pw-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.pw-meter-title {
  font-weight: 700;
  color: var(--muted);
}
.pw-strength-label {
  font-weight: 800;
  color: var(--muted);
}
.pw-strength-label[data-level="1"] { color: var(--bad); }
.pw-strength-label[data-level="2"] { color: var(--warn); }
.pw-strength-label[data-level="3"] { color: var(--link); }
.pw-strength-label[data-level="4"] { color: var(--ok); }

.pw-meter-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.pw-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  transition: background-color 0.2s ease;
}
.pw-meter-bars[data-level="1"] .pw-bar:nth-child(-n+1) { background: var(--bad); }
.pw-meter-bars[data-level="2"] .pw-bar:nth-child(-n+2) { background: var(--warn); }
.pw-meter-bars[data-level="3"] .pw-bar:nth-child(-n+3) { background: var(--accent); }
.pw-meter-bars[data-level="4"] .pw-bar:nth-child(-n+4) { background: var(--ok); }

.pw-rules {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.pw-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
  transition: color 0.16s ease;
}
.pw-rule-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.pw-rule.is-met {
  color: var(--ok);
  font-weight: 600;
}
.pw-rule.is-met .pw-rule-dot {
  background: var(--ok);
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--ok-soft);
}
.pw-rule.is-unmet {
  color: var(--text);
}
.pw-rule.is-unmet .pw-rule-dot {
  background: var(--warn);
}

.pw-match-status.is-ok {
  color: var(--ok);
  font-weight: 700;
}
.pw-match-status.is-bad {
  color: var(--bad);
  font-weight: 700;
}

.quiz-timer.is-expired {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.quiz-timer.is-expired .timer-label {
  color: rgba(255, 255, 255, 0.9);
}


/* ---------- объединённые разделы админки, конструктор заданий и локаций ---------- */
.admin-alert-banner {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--surface);
  border-color: var(--accent);
}
.section-head-row {
  margin: 24px 0 12px;
}
.section-head-row .section-title {
  margin: 0;
}
.subsection-title {
  margin: 18px 0 10px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.admin-sub-switch {
  margin-top: 10px;
}
.admin-collapsible-hub {
  margin-bottom: 20px;
  padding: 16px 20px;
}
.admin-collapsible-hub > summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.hub-inner {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 16px;
}
.admin-hub-block {
  margin-bottom: 28px;
}
.admin-more-menu {
  position: relative;
}
.admin-more-panel {
  margin-top: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  min-width: 280px;
  text-align: left;
}

/* сгруппированный выбор формата в конструкторе заданий */
.type-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.type-group-card {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.type-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.type-group-head .icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--link);
}
.type-group-card .type-switch {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.type-picker-panel .task-type-banner {
  margin: 0;
}

/* пошаговая структура конструктора заданий */
.editor-step-box {
  display: grid;
  gap: 14px;
}
.editor-step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.editor-step-num {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--link);
  font-weight: 800;
  font-size: 0.9rem;
}
.editor-step-title {
  margin: 0 0 2px;
  font-size: 1.05rem;
  font-weight: 800;
}
.task-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.quick-cat-details {
  margin-top: 6px;
  font-size: 0.84rem;
}
.quick-cat-details > summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 600;
}
.quick-cat-box {
  margin-top: 6px;
}
.task-live-preview {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 10px;
}
.task-live-preview .q-text {
  margin: 0;
}

/* улучшения конструктора локаций */
.loc-active-check {
  margin-top: 10px;
}
.loc-task-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.loc-task-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.loc-task-filters select {
  width: auto;
  min-width: 150px;
  min-height: 40px;
  padding: 6px 10px;
}
.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.task-card-order {
  display: none;
  gap: 4px;
}
.task-card--selected .task-card-order {
  display: inline-flex;
}
.task-move-btn {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 0.8rem;
  line-height: 1;
}


/* ==========================================================================
   FULL-WIDTH TECHNICAL WORKBENCH (Админка /admin/* и Мастерская /my/*)
   На ПК: полноширинная (100vw) двухколоночная IDE/панель с высокой плотностью.
   На смартфоне: компактный адаптивный стек без потери функциональности.
   ========================================================================== */

body:has(.workspace-shell) {
  background-image: none;
}
body:has(.workspace-shell) .nav-content {
  max-width: none;
  width: 100%;
  padding: 6px 20px;
}

.container.workspace-shell {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 14px 20px 44px;
  font-size: 13.75px;
  line-height: 1.42;
  font-variant-numeric: tabular-nums;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: none;
}

/* Боковая панель навигации и заголовок консоли */
.workspace-aside {
  min-width: 0;
}
.workspace-aside-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.72rem;
}
.workspace-tag {
  display: inline-block;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--link);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 4px;
}

/* Компактная типографика и шапки страниц внутри рабочей среды */
.workspace-shell .page-head {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.workspace-shell h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.workspace-shell h2 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0 0 8px;
}
.workspace-shell .section-title {
  margin: 18px 0 10px;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.workspace-shell .back-link {
  font-size: 0.78rem;
  margin-bottom: 2px;
}
.workspace-shell p {
  margin: 0 0 8px;
}
.workspace-shell .card,
.workbench-pane {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: none;
}
.workspace-shell .form-wide,
.workspace-shell .danger-zone-wide {
  max-width: none;
  width: 100%;
}

.pane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.pane-head .loc-section-title {
  margin: 0;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Компактные технические плитки метрик и быстрых действий */
.workspace-shell .stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.workspace-shell .stat {
  padding: 10px 12px;
  text-align: left;
  border-radius: 6px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}
.workspace-shell .stat b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem;
  margin: 0;
  order: 2;
}
.workspace-shell .stat span {
  font-size: 0.68rem;
  order: 1;
}
.workspace-shell a.stat:hover {
  transform: none;
  background: var(--surface);
}
.workspace-shell .quick-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.workspace-shell .quick-card {
  padding: 12px 14px;
  border-radius: 6px;
  box-shadow: none;
}
.workspace-shell .quick-card:hover {
  transform: none;
  background: var(--surface);
}
.workspace-shell .quick-card .quick-icon .icon {
  width: 1.35rem;
  height: 1.35rem;
}
.workspace-shell .quick-card .quick-text {
  font-size: 0.8rem;
}

/* Плотные технические таблицы */
.workspace-shell .table-wrapper {
  border-radius: 6px;
  box-shadow: none;
  margin-bottom: 14px;
}
.workspace-shell th {
  padding: 7px 12px;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.workspace-shell td {
  padding: 7px 12px;
  font-size: 0.84rem;
}
.workspace-shell .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.76rem;
  border-radius: 6px;
}
.workspace-shell .badge {
  padding: 2px 7px;
  font-size: 0.66rem;
  border-radius: 4px;
}

/* Компактные поля ввода, селекты и кнопки */
.workspace-shell .field {
  margin-bottom: 10px;
}
.workspace-shell .field label {
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.workspace-shell .hint {
  margin-top: 4px;
  font-size: 0.76rem;
}
.workspace-shell input[type="text"],
.workspace-shell input[type="password"],
.workspace-shell input[type="email"],
.workspace-shell input[type="number"],
.workspace-shell input[type="search"],
.workspace-shell select {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 0.85rem;
  border-radius: 6px;
}
.workspace-shell textarea {
  min-height: 68px;
  padding: 7px 10px;
  font-size: 0.86rem;
  border-radius: 6px;
}
.workspace-shell .btn,
.workspace-shell button {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 6px;
  box-shadow: none;
}
.workspace-shell .btn-sm {
  min-height: 27px;
  padding: 3px 8px;
  font-size: 0.76rem;
  border-radius: 5px;
}
.workspace-shell .filters {
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.workspace-shell .filters .field {
  flex: 1 1 160px;
}
.workspace-shell .filters .btn {
  min-height: 34px;
}
.workspace-shell label.option {
  min-height: 36px;
  padding: 6px 10px;
  border-width: 1px;
  border-radius: 6px;
  font-size: 0.84rem;
}
.workspace-shell label.option input {
  width: 16px;
  height: 16px;
}
.workspace-shell .option-mark,
.workspace-shell .field .option-mark {
  width: 34px;
  height: 34px;
  border-radius: 6px;
}
.workspace-shell .option-mark input {
  width: 16px;
  height: 16px;
}

/* Двухколоночный полноширинный конструктор локаций и заданий */
.loc-workbench-grid,
.task-workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.loc-area-basics,
.loc-area-tasks,
.loc-area-publish,
.task-area-editor,
.task-area-inspector {
  min-width: 0;
  margin-bottom: 0;
}
.loc-mix-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.loc-shuffle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border-radius: 6px;
}

/* Компактная панель выбора формата в конструкторе заданий */
.workspace-shell .type-picker-panel {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  box-shadow: none;
}
.workspace-shell .type-groups {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 0;
}
.workspace-shell .type-group-card {
  padding: 8px 10px;
  border-radius: 6px;
  gap: 6px;
}
.workspace-shell .type-group-card .type-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.workspace-shell .type-picker-panel .type-switch a {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 0.78rem;
  border-radius: 5px;
}
.workspace-shell .editor-type-section {
  padding: 12px;
  margin: 10px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Плотная сетка карточек заданий в конструкторе локации */
.workspace-shell .task-cards {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-height: 62vh;
  padding: 8px;
  border-radius: 6px;
}
.workspace-shell .task-card {
  padding: 8px 10px;
  gap: 5px;
  border-width: 1px;
  border-radius: 6px;
}
.workspace-shell .task-card--selected {
  transform: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.workspace-shell .task-card-title {
  font-size: 0.84rem;
  line-height: 1.3;
}
.workspace-shell .task-card-meta {
  font-size: 0.74rem;
  justify-content: space-between;
}

/* На широких экранах (>= 992px): разворачиваем двухколоночные рабочие станции */
@media (min-width: 992px) {
  .workspace-shell .admin-layout {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 16px;
  }
  .workspace-aside {
    position: sticky;
    top: calc(var(--nav-h) + 12px);
  }
  .workspace-shell .tabs {
    position: static;
    padding: 6px;
    border-radius: 6px;
    box-shadow: none;
  }
  .workspace-shell .tabs a {
    padding: 7px 10px;
    font-size: 0.83rem;
    border-radius: 5px;
  }

  .loc-workbench-grid {
    grid-template-columns: 370px minmax(0, 1fr);
    grid-template-areas:
      "basics tasks"
      "publish tasks";
    gap: 14px;
  }
  .loc-area-basics { grid-area: basics; }
  .loc-area-publish { grid-area: publish; }
  .loc-area-tasks { grid-area: tasks; }

  .task-workbench-grid {
    grid-template-columns: minmax(0, 1.55fr) 360px;
    gap: 14px;
  }
  .task-area-inspector {
    position: sticky;
    top: calc(var(--nav-h) + 12px);
  }
}

/* На смартфонах и планшетах (<= 991px): компактный технический вид без распирания экрана */
@media (max-width: 991px) {
  .workspace-aside-head {
    display: none;
  }
  .workspace-shell .tabs {
    margin-bottom: 12px;
    padding: 4px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
  }
  .workspace-shell .tabs a {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 5px;
  }
}

@media (max-width: 600px) {
  body:has(.workspace-shell) .nav-content {
    padding: 6px 10px;
  }
  .container.workspace-shell {
    padding: 10px 10px 44px;
    font-size: 13.5px;
  }
  .workspace-shell .page-head .btn {
    width: auto;
  }
  /* 16px шрифт в полях ввода на телефоне, чтобы мобильный браузер не делал авто-зум */
  .workspace-shell input[type="text"],
  .workspace-shell input[type="password"],
  .workspace-shell input[type="email"],
  .workspace-shell input[type="number"],
  .workspace-shell input[type="search"],
  .workspace-shell select,
  .workspace-shell textarea {
    min-height: 38px;
    font-size: 16px;
  }
  .workspace-shell .btn,
  .workspace-shell button {
    min-height: 36px;
  }
  .workspace-shell .btn-sm {
    min-height: 30px;
    padding: 4px 8px;
  }
  .workspace-shell .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .workspace-shell .type-groups {
    grid-template-columns: 1fr;
  }
  .workspace-shell .task-cards {
    grid-template-columns: 1fr;
    max-height: 460px;
  }
  .loc-mix-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .admin-more-panel {
    min-width: min(260px, 84vw);
  }
}


/* Отключаем потребительские задержки анимаций в техническом интерфейсе (.workspace-shell),
   чтобы таблицы, карточки и вкладки переключались мгновенно (0 мс) */
.workspace-shell .card,
.workspace-shell .stat,
.workspace-shell .workbench-pane,
.workspace-shell .clan-row,
.workspace-shell .flash {
  animation: none !important;
  transition: none !important;
}
html.ws-loading .admin-main {
  opacity: 0.72;
  transition: opacity 0.08s linear;
}


/* Чистые модальные окна управления локацией и аккаунтом (центрируются на ПК и смартфоне, не ломают таблицы) */
.admin-dialog {
  width: 460px;
  max-width: 94vw;
}
.admin-dialog-card {
  text-align: left;
  padding: 18px 20px;
  border-radius: 10px;
  display: grid;
  gap: 14px;
}
.admin-dialog-head {
  display: grid;
  gap: 4px;
  padding-right: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.admin-dialog-head .qr-modal-slug {
  margin-bottom: 0;
}
.admin-dialog-section {
  display: grid;
  gap: 6px;
}
.admin-dialog-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.admin-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-dialog-stack {
  display: grid;
  gap: 8px;
}
.admin-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Вспомогательные блоки для страницы импорта JSON и метаданных редактора */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.alert-error {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--text);
}
.editor-meta-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

/* Двухколоночная сетка и блок примера на странице импорта JSON (/admin/tasks/import) */
.json-import-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
.json-import-grid > * {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 992px) {
  .json-import-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 16px;
  }
}
.json-example-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}
.json-example-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
}
.json-example-pre {
  margin: 0;
  padding: 12px 14px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  max-height: 460px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  color: var(--text);
}
.json-import-textarea {
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 360px;
}

/* Полоски распределения результатов на странице статистики локации */
.loc-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.loc-bucket-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* уведомление о cookie */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 120; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; max-width: 760px; margin: 0 auto; padding: 16px 20px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { flex: 1 1 280px; margin: 0; font-size: 0.92rem; }
