:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e232b;
  --border: #2a313b;
  --text: #e6e9ee;
  --muted: #8b95a3;
  --accent: #4fd1c5;
  --accent-ink: #062b28;
  --danger: #f2706b;
  --discord: #5865f2;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 18px; }
.brand small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }
.logo { color: var(--accent); }
.userbox { display: flex; align-items: center; gap: 10px; }
.userbox img { border-radius: 50%; background: var(--panel-2); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; min-width: 0;
}
.card.narrow { max-width: 460px; margin: 40px auto; }
h1 { margin: 0 0 8px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
input, textarea, select {
  display: block; width: 100%; margin-top: 4px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 10px; font: inherit;
}
input[type=color] { padding: 2px; height: 36px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row input, .row select { width: auto; margin-top: 0; }
.xyz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

button, .btn {
  display: inline-block; border: 1px solid transparent; border-radius: 7px; padding: 8px 14px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--accent); color: var(--accent-ink);
}
button:disabled { opacity: .5; cursor: default; }
.ghost, .btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.ghost:hover { background: var(--panel-2); }
.danger { background: transparent; color: var(--danger); border-color: transparent; padding: 4px 8px; }
.danger:hover { background: rgba(242, 112, 107, .12); }
.btn.discord { background: var(--discord); color: #fff; width: 100%; padding: 11px; }
.icon { background: transparent; color: var(--muted); border: none; padding: 4px 8px; }
.icon:hover { color: var(--text); background: var(--panel-2); }

.badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.admin { color: var(--accent); border-color: var(--accent); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  background: none; color: var(--muted); border: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 10px 14px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table .desc { color: var(--muted); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.table .coords { font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: nowrap; }
.table .actions { white-space: nowrap; text-align: right; }
.card:has(.table) { overflow-x: auto; }
.pending { color: #e8b85a; }

.agreement { max-width: 680px; margin: 32px auto; }
.agreement-text { max-height: 52vh; overflow-y: auto; margin: 14px 0; padding: 4px 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.agreement-text h3 { margin: 14px 0 4px; }
.agreement-text p { margin: 0 0 8px; line-height: 1.55; }
.agree-check { margin: 4px 0 14px; align-items: flex-start; line-height: 1.4; }
.agree-check input { margin-top: 3px; }

h3 { margin: 14px 0 4px; font-size: 14px; }
label.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-size: 14px; }
label.check input { width: auto; margin: 0; }
.paths-card { margin-top: 16px; }
.paths-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin: 10px 0 14px; }
.paths-stats label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-size: 13px; }
.paths-stats input { width: auto; margin: 0; }
.paths-stats .n { margin-left: auto; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
#paths-list { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.tours-grid { grid-template-columns: minmax(340px, 460px) 1fr; }
@media (max-width: 860px) { .tours-grid { grid-template-columns: 1fr; } }
.steps { list-style: none; margin: 8px 0; padding: 0; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start;
  padding: 10px; margin-bottom: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
}
.step::before {
  counter-increment: step; content: counter(step);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; margin-top: 4px;
}
.step select, .step textarea { margin-top: 0; }
.step textarea { margin-top: 6px; font-size: 14px; }
.step .tools { display: flex; flex-direction: column; gap: 2px; }
.form-actions { margin-top: 14px; }
.tours-list { display: grid; gap: 10px; }
.tour-card { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: var(--panel-2); }
.tour-card h4 { margin: 0; font-size: 15px; }
.tour-card .route { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
.tour-card .route li { margin: 2px 0; }
.tour-card .route .note { color: var(--text); opacity: .75; white-space: pre-wrap; overflow-wrap: anywhere; }
.dot {width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-top: 4px; }

.alert { background: rgba(242, 112, 107, .1); border: 1px solid rgba(242, 112, 107, .4); color: #ffc9c6; padding: 10px 12px; border-radius: 7px; margin: 12px 0; }
.alert.ok { background: rgba(79, 209, 197, .1); border-color: rgba(79, 209, 197, .4); color: #b9f3ec; }
.code { font: 700 34px/1 ui-monospace, Consolas, monospace; letter-spacing: .12em; text-align: center; padding: 18px; margin: 16px 0 6px; background: var(--panel-2); border-radius: var(--radius); }
.dev { margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 12px; }
.dev input { margin-bottom: 8px; }

#map { width: 100%; height: auto; aspect-ratio: 5 / 3; background: #0b0e12; border-radius: 8px; border: 1px solid var(--border); cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
.map-info { margin-top: 8px; min-height: 44px; flex: 1; }
.map-foot { align-items: flex-start; flex-wrap: nowrap; }
#map-cursor { margin-top: 8px; white-space: nowrap; }

.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 10; max-width: calc(100vw - 32px);
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}
.toast.error { border-left-color: var(--danger); }

/* ---- Роли ---- */
.perm-list { display: grid; gap: 6px; margin: 6px 0 10px; }
.perm-list label { display: flex; gap: 8px; align-items: flex-start; margin: 0; color: var(--text); font-size: 14px; }
.perm-list input { width: auto; margin: 3px 0 0; }
.perm-list label.disabled { opacity: .45; }
.roles-list { display: grid; gap: 10px; }
.role-card { border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 8px; padding: 10px 12px; background: var(--panel-2); }
.role-card h4 { margin: 0; font-size: 15px; }
.role-card ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* ---- Журнал ---- */
.logs-filter { margin: 4px 0 12px; }
.logs-filter input { min-width: 180px; }
.logs-wrap { overflow-x: auto; }
.logs-table td { font-size: 13px; }
.logs-table .when { white-space: nowrap; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.logs-table .act { white-space: nowrap; }
.logs-table .details { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; max-width: 360px; overflow-wrap: anywhere; }
.badge.src-mod { color: #b9a6ff; border-color: #5b4b99; }
.badge.warn { color: var(--danger); border-color: rgba(242, 112, 107, .5); }

/* ---- Гиды на карте ---- */
.guides-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.guide-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 99px; padding: 3px 10px 3px 4px; font-size: 13px; cursor: pointer; color: var(--text); font-weight: 400; }
.guide-chip img { width: 20px; height: 20px; border-radius: 50%; }
.guide-chip .muted { font-size: 12px; }
.guide-chip img.head { width: 30px; height: 20px; border-radius: 0; image-rendering: pixelated; object-fit: contain; }

/* ---- Вход по паролю / аккаунт ---- */
.password-login { margin-top: 16px; }
.password-login .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 8px 0; }
.password-login .or::before, .password-login .or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.btn.wide, button.wide { width: 100%; }
.narrow-card { max-width: 520px; }
.download-card { margin-bottom: 16px; }
.dl-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 14px 0 8px; font-size: 13px; }
.dl-meta dt { color: var(--muted); }
.dl-meta dd { margin: 0; overflow-wrap: anywhere; }
.dl-login { margin-top: 14px; text-align: center; }
.dl-login a { color: var(--accent); }

/* ---------- Записи туров ---------- */
.badge.ok { color: #7ee2a8; border-color: rgba(126, 226, 168, .45); }
.replay-stage { position: relative; margin: 12px 0 8px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #78a6ed; }
.replay-canvas { display: block; width: 100%; height: min(62vh, 620px); min-height: 320px; cursor: grab; touch-action: none; }
.replay-canvas:active { cursor: grabbing; }
.replay-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.replay-label {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 12px; line-height: 1.2;
  padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, .55); color: #fff;
}
.replay-label.guide { color: #ffd25a; }
.replay-label.participant { color: #8fb7ff; outline: 1px solid #3a7bff; }
.replay-empty { padding: 48px 16px; text-align: center; background: var(--panel); margin: 0; }
.replay-controls { flex-wrap: nowrap; }
.replay-controls .replay-timeline { flex: 1; min-width: 80px; padding: 0; }
.replay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-top: 12px; }
.replay-steps { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; max-height: 220px; overflow-y: auto; }
.replay-steps button { font-size: 13px; padding: 3px 8px; }
.replay-chat { max-height: 220px; overflow-y: auto; font-size: 13px; overflow-wrap: anywhere; }
.replay-shots { display: flex; gap: 8px; flex-wrap: wrap; }
.replay-shots img { width: 150px; height: auto; border-radius: 6px; border: 1px solid var(--border); display: block; }
.replay-danger { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 860px) {
  .replay-grid { grid-template-columns: 1fr; }
  .replay-controls { flex-wrap: wrap; }
  .replay-controls .replay-timeline { flex-basis: 100%; order: -1; }
}
.replay-volume { width: 90px; padding: 0; }
.replay-speaking { min-height: 1.5em; color: #8fb7ff; }
.replay-progress { width: 100%; height: 10px; accent-color: var(--accent); }

/* ---------- Инструкция ---------- */
.tabs .tab-link { color: var(--muted); padding: 10px 14px; margin-left: auto; white-space: nowrap; text-decoration: none; border-bottom: 2px solid transparent; }
.tabs .tab-link:hover { color: var(--text); }
.help { max-width: 860px; margin: 24px auto; padding: 0 16px; }
.help h2 { margin-top: 28px; scroll-margin-top: 70px; }
.help li { margin: 4px 0; }
.help code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 4px; font-size: 14px; }
.kbd { display: inline-block; min-width: 22px; text-align: center; font: 600 12px/1.6 ui-monospace, Consolas, monospace; padding: 0 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--panel-2); }
.help-keys td:first-child { white-space: nowrap; width: 90px; }
.help-faq dt { font-weight: 600; margin-top: 12px; }
.help-faq dd { margin: 2px 0 0; color: var(--muted); }
@media (max-width: 600px) { .help { margin: 12px auto; } }

/* ---------- Каркас: меню слева по группам ---------- */
main:has(> .app:not([hidden])) { max-width: none; padding: 0; }
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.sidebar {
  border-right: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto;
}
.nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; min-height: 100%; }
.nav button, .nav .nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; color: var(--muted); border: none; border-radius: 8px;
  padding: 8px 10px; font-weight: 500; text-decoration: none;
}
.nav button:hover, .nav .nav-link:hover { background: var(--panel-2); color: var(--text); }
.nav button.active { background: rgba(79, 209, 197, .12); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 18px; text-align: center; color: var(--accent); opacity: .85; flex: none; }
.nav-group {
  margin: 14px 10px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.nav button.nav-group { margin: 14px 0 4px; padding: 4px 10px; font-size: 11px; justify-content: space-between; }
.nav-toggle .caret { transition: transform .15s; }
.nav-toggle.open .caret { transform: rotate(180deg); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; }
.nav-spacer { flex: 1; min-height: 18px; }
.nav-count {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; font-size: 11px; line-height: 18px; text-align: center;
  background: var(--danger); color: #1a0c0b; font-weight: 700;
}
.content { padding: 22px 26px 60px; min-width: 0; max-width: 1280px; }
.page-title { font-size: 22px; margin: 0 0 16px; }
.bottombar, .nav-backdrop { display: none; }

/* ---------- Главная ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; align-items: start; }
.home-hello { grid-column: 1 / -1; background: linear-gradient(135deg, rgba(79, 209, 197, .12), transparent 60%), var(--panel); }
.home-hello h2 { font-size: 20px; }
.home-big { font-size: 34px; font-weight: 700; margin: 0 0 4px; line-height: 1.1; }
.home-guide { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.dot.online { width: 8px; height: 8px; border-radius: 50%; background: #7ee2a8; display: inline-block; }
.card h2 + p { margin-top: 0; }

/* ---------- Телефон: нижнее меню, «Ещё» открывает полное меню ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 58px; width: min(290px, 84vw); height: auto; z-index: 30;
    transform: translateX(-100%); transition: transform .2s; border-right: 1px solid var(--border);
  }
  body.nav-open .sidebar { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: 0 0 58px 0; background: rgba(0, 0, 0, .5); z-index: 25; }
  .nav-backdrop[hidden] { display: none; }
  .content { padding: 16px 16px 84px; }
  .page-title { font-size: 19px; }
  .bottombar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: var(--panel); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottombar button {
    display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; border: none;
    color: var(--muted); font-size: 11px; font-weight: 500; padding: 6px 2px; border-radius: 8px;
  }
  .bottombar .ico { font-size: 18px; line-height: 1; color: inherit; }
  .bottombar button.active { color: var(--accent); }
  .topbar small { display: none; }
  .userbox #username, .userbox #role { display: none; }
}

/* ---------- Картинки тура ---------- */
.tour-images { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tour-image { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.tour-image .thumb { display: block; width: 72px; height: 54px; border-radius: 5px; overflow: hidden;
  background: repeating-conic-gradient(#2a313b 0 25%, #1e232b 0 50%) 0 0 / 12px 12px; }
.tour-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tour-image-fields { display: grid; gap: 4px; }
.tour-image-fields input, .tour-image-fields select { margin-top: 0; padding: 5px 8px; }
.file-pick { cursor: pointer; margin-bottom: 4px; }

/* ---------- Инструкция по картинкам ---------- */
.help-steps { display: grid; gap: 22px; margin: 8px 0 8px; }
.help-step { margin: 0; }
.help-step figcaption { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.step-no { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 17px; flex: none; }
.shot { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.shot img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.shot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.step-marks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; font-size: 16px; }
.step-marks li { display: flex; align-items: center; gap: 10px; }
.mark-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #ff3b3b; color: #fff; font-weight: 700; font-size: 14px; flex: none; }

/* ---------- О нас ---------- */
.about-hero {
  position: relative; overflow: hidden; border-radius: 18px; border: 1px solid var(--border);
  padding: 44px 36px; margin-bottom: 22px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(192, 132, 252, .22), transparent 55%),
              radial-gradient(120% 140% at 100% 100%, rgba(79, 209, 197, .20), transparent 55%), var(--panel);
}
.about-hero-grid {
  position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(80% 90% at 70% 40%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(80% 90% at 70% 40%, #000, transparent 75%);
}
.about-hero-text { position: relative; max-width: 640px; }
.about-kicker {
  display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(79, 209, 197, .45); background: rgba(79, 209, 197, .08);
}
.about-hero h2 { font-size: clamp(26px, 4.2vw, 40px); line-height: 1.12; margin: 14px 0 12px; letter-spacing: -.01em; }
.about-grad { background: linear-gradient(90deg, #c084fc, #f472b6 35%, #fb923c 65%, #4fd1c5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.about-hero p { color: var(--muted); font-size: 16px; margin: 0; max-width: 520px; }

.m-creative { --glow: #c084fc; --glow-2: #f472b6; }
.m-dev { --glow: #fb923c; --glow-2: #4fd1c5; }
.about-team { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.member {
  position: relative; border-radius: 18px; padding: 1px; overflow: hidden;
  background: linear-gradient(140deg, color-mix(in srgb, var(--glow) 70%, transparent), var(--border) 40%, color-mix(in srgb, var(--glow-2) 60%, transparent));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
}
.member:hover { transform: translateY(-4px); box-shadow: 0 18px 50px -18px var(--glow); }
.member > * { position: relative; }
.member::before { content: ''; position: absolute; inset: 1px; border-radius: 17px; background: var(--panel); }
.member-stage {
  height: 250px; display: grid; place-items: center; perspective: 900px; border-radius: 17px 17px 0 0;
  background: radial-gradient(55% 65% at 50% 48%, color-mix(in srgb, var(--glow) 38%, transparent), transparent 72%);
}
.member-shadow {
  position: absolute; bottom: 34px; left: 50%; width: 120px; height: 18px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent); filter: blur(2px);
}
.head3d { --s: 120px; width: var(--s); height: var(--s); position: relative; z-index: 1; animation: head-bob 4s ease-in-out infinite; opacity: 0; transition: opacity .5s; transform-style: preserve-3d; }
.member.ready .head3d { opacity: 1; }
@keyframes head-bob { 50% { translate: 0 -8px; } }
.head3d .spin, .head3d .cube { position: absolute; inset: 0; transform-style: preserve-3d; }
.head3d .spin { transform: rotateX(12deg) rotateY(-24deg); }
.head3d .cube.hat { transform: scale3d(1.125, 1.125, 1.125); }
.head3d .face { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; backface-visibility: hidden; }
.head3d .front  { transform: translateZ(calc(var(--s) / 2)); }
.head3d .back   { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.head3d .right  { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.head3d .left   { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.head3d .top    { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.head3d .bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.head3d .cube.base .right, .head3d .cube.base .left { filter: brightness(.82); }
.head3d .cube.base .bottom { filter: brightness(.6); }
.head3d .ears { position: absolute; inset: 0; transform-style: preserve-3d; }
.head3d .ear-part { position: absolute; transform-style: preserve-3d; }
.head3d .ear { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; backface-visibility: hidden; }
.head3d .ear.back { transform: rotateY(180deg); filter: brightness(.85); }
.head3d .snout { position: absolute; transform-style: preserve-3d; }
.head3d .snout-face { position: absolute; left: 0; top: 0; image-rendering: pixelated; backface-visibility: hidden; }
.member-stage { height: 280px; }
.member.has-ears .head3d { margin-top: 70px; }

.member-body { padding: 4px 26px 26px; text-align: center; }
.member-nick { font-size: 28px; margin: 0 0 8px; letter-spacing: .01em; }
.member-role {
  display: inline-block; padding: 5px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; color: #0f1216;
  background: linear-gradient(90deg, var(--glow), var(--glow-2));
}
.member-about { color: var(--muted); margin: 16px auto; max-width: 420px; line-height: 1.55; }
.member-tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.member-tags li {
  font-size: 12px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2);
  color: color-mix(in srgb, var(--glow) 70%, var(--text));
}

.about-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.about-facts div { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 16px 18px; display: grid; gap: 4px; }
.about-facts b { font-size: 18px; }
.about-facts span { color: var(--muted); font-size: 13px; }
.about-foot { text-align: center; color: var(--muted); margin: 26px 0 8px; }
.heart { color: #f472b6; display: inline-block; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } }

@media (max-width: 860px) {
  .about-team { grid-template-columns: 1fr; }
  .about-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-hero { padding: 30px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .head3d, .heart { animation: none; }
  .member, .member:hover { transition: none; transform: none; }
}

/* ---------- О нас: студия, контакты, донаты ---------- */
.tg-ico { width: 16px; height: 16px; fill: currentColor; flex: none; }
.about-studio {
  display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 12px 14px; max-width: 520px;
  border: 1px solid var(--border); border-radius: 14px; background: rgba(15, 18, 22, .55); backdrop-filter: blur(4px);
}
.about-studio > div { display: grid; gap: 2px; flex: 1; min-width: 0; }
.about-studio span { color: var(--muted); font-size: 13px; }
.studio-mark { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(135deg, #c084fc, #fb923c); flex: none; }
.tg-btn { display: inline-flex; align-items: center; gap: 8px; background: #2aabee; color: #fff; border-color: #2aabee; white-space: nowrap; text-decoration: none; }
.tg-btn:hover { background: #229ed9; }
.member-contact {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 7px 14px; border-radius: 99px; font-size: 14px;
  color: var(--text); text-decoration: none; border: 1px solid color-mix(in srgb, var(--glow) 55%, var(--border)); background: var(--panel-2);
  transition: background .2s, border-color .2s;
}
.member-contact .tg-ico { color: #2aabee; }
.member-contact:hover { background: color-mix(in srgb, var(--glow) 16%, var(--panel-2)); border-color: var(--glow); }

.donate {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; margin-top: 22px; padding: 28px;
  border-radius: 18px; border: 1px solid var(--border);
  background: radial-gradient(90% 120% at 100% 0%, rgba(244, 114, 182, .16), transparent 60%),
              radial-gradient(90% 120% at 0% 100%, rgba(251, 146, 60, .12), transparent 60%), var(--panel);
}
.donate h2 { margin: 12px 0 8px; font-size: 26px; }
.donate-form { display: grid; gap: 4px; margin-top: 14px; max-width: 460px; }
.donate-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.donate-amounts button {
  padding: 9px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-weight: 700; cursor: pointer; transition: transform .15s, border-color .15s, background .15s;
}
.donate-amounts button:hover { transform: translateY(-2px); }
.donate-amounts button.on { border-color: #f472b6; background: color-mix(in srgb, #f472b6 18%, var(--panel-2)); }
.donate-go { margin-top: 6px; background: linear-gradient(90deg, #c084fc, #f472b6, #fb923c); color: #1a1020; border: none; font-weight: 700; padding: 12px 18px; }
.donate-go:disabled { opacity: .5; cursor: not-allowed; }
.donate-thanks { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid #f472b6; background: color-mix(in srgb, #f472b6 12%, transparent); }
.donate-side { border-left: 1px solid var(--border); padding-left: 20px; }
.donate-total { display: grid; gap: 2px; margin-bottom: 14px; }
.donate-total b { font-size: 40px; line-height: 1; background: linear-gradient(90deg, #f472b6, #fb923c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.donate-total span { color: var(--muted); }
.donate-side h3 { margin: 0 0 10px; font-size: 16px; }
.donors { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.donors li { display: flex; align-items: center; gap: 10px; }
.donor-place { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--border); flex: none; }
.donors li:nth-child(1) .donor-place { background: #f5c451; color: #2b2000; border-color: #f5c451; }
.donors li:nth-child(2) .donor-place { background: #c9d1db; color: #1b2027; border-color: #c9d1db; }
.donors li:nth-child(3) .donor-place { background: #d89a63; color: #2b1600; border-color: #d89a63; }
.donor-nick { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donor-sum { color: #f472b6; font-weight: 700; }
@media (max-width: 860px) {
  .donate { grid-template-columns: 1fr; padding: 20px; }
  .donate-side { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .about-studio { flex-wrap: wrap; }
}

/* Аватар — голова скина: пиксели без размытия, квадрат со скруглением как у блока */
#avatar.skin-head { image-rendering: pixelated; border-radius: 6px; box-shadow: 0 0 0 1px var(--border), 0 2px 6px rgba(0, 0, 0, .35); }

/* ---------- Меню пользователя ---------- */
.userbox { position: relative; }
.user-toggle {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.user-toggle:hover, .user-toggle.open { background: var(--panel-2); border-color: var(--border); }
.user-toggle .caret { color: var(--muted); font-size: 12px; transition: transform .2s; }
.user-toggle.open .caret { transform: rotate(180deg); }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 8px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6); animation: um-in .14s ease-out;
}
@keyframes um-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.um-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.um-head img { border-radius: 10px; background: var(--panel-2); flex: none; }
#um-avatar.skin-head { image-rendering: pixelated; border-radius: 8px; box-shadow: 0 0 0 1px var(--border); }
.um-who { display: grid; gap: 4px; justify-items: start; min-width: 0; }
.um-who b { font-size: 16px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-items { display: grid; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu [role="menuitem"] {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px;
  background: transparent; border: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.user-menu [role="menuitem"]:hover, .user-menu [role="menuitem"]:focus-visible { background: var(--panel-2); outline: none; }
.user-menu .ico { width: 18px; text-align: center; color: var(--muted); }
.user-menu .um-logout, .user-menu .um-logout .ico { color: var(--danger); }
.user-menu .um-logout:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
@media (max-width: 860px) {
  .user-toggle { padding: 4px; }
  .user-menu { position: fixed; right: 12px; top: 56px; width: min(280px, calc(100vw - 24px)); }
}

/* ---------- Спец-зона (инструкция и главная) ---------- */
.zone-box { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; align-items: start; }
.zone-map {
  position: relative; aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--border); overflow: hidden;
  background: repeating-linear-gradient(45deg, rgba(242, 112, 107, .10) 0 8px, transparent 8px 16px), var(--panel-2);
}
.zone-square {
  position: absolute; inset: 22%; border: 2px solid var(--accent); border-radius: 6px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, var(--panel)); text-align: center; font-size: 11px; color: var(--muted); line-height: 1.25;
  place-items: end center; padding-bottom: 6px;
}
.zone-square b { color: var(--accent); font-size: 18px; }
.zone-dot { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #ffb020; box-shadow: 0 0 0 3px rgba(255, 176, 32, .3); }
.chat-line { font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #000a; padding: 2px 6px; border-radius: 4px; white-space: normal; }
.c-aqua { color: #55ffff; } .c-red { color: #ff5555; } .c-green { color: #55ff55; } .c-white { color: #fff; }
.home-zone { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.home-zone p { margin-top: 0; }
@media (max-width: 600px) { .zone-box { grid-template-columns: 1fr; } .zone-map { max-width: 180px; } }

/* ---------- Технические работы ---------- */
.maint {
  display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 36px; align-items: center;
  max-width: 980px; margin: 48px auto; padding: 0 16px;
}
.maint-art { background: #fff; border-radius: 28px; padding: 18px; box-shadow: 0 30px 80px -30px rgba(79, 209, 197, .45); transform: rotate(-2deg); }
.maint-art img { display: block; width: 100%; height: auto; }
.maint-text h1 { font-size: clamp(28px, 4.5vw, 42px); line-height: 1.1; margin: 14px 0 14px; }
.maint-message {
  font-size: 17px; padding: 14px 16px; border-radius: 14px; border: 1px solid #f5c451;
  background: color-mix(in srgb, #f5c451 12%, transparent); white-space: pre-wrap;
}
.maint-banner {
  display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px 16px; border-radius: 12px; border: 1px solid #f5c451;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, #f5c451 16%, var(--panel)) 0 14px, var(--panel) 14px 28px);
}
.maint-card { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; }
.maint-card-art { background: #fff; border-radius: 18px; padding: 8px; }
.maint-card-art img { display: block; width: 100%; height: auto; }
.maint-card-body h2 { margin-top: 0; }
.maint-state { font-weight: 700; }
.maint-state.on { color: #f5c451; }
.maint-state.off { color: var(--accent); }
.btn.warn { background: #f5c451; border-color: #f5c451; color: #2b2000; }
@media (max-width: 760px) {
  .maint { grid-template-columns: 1fr; margin: 24px auto; gap: 22px; }
  .maint-art { max-width: 280px; margin: 0 auto; }
  .maint-card { grid-template-columns: 1fr; }
  .maint-card-art { max-width: 160px; }
}

/* ---------- Маскот Сниф (фигура из скина) ---------- */
.mascot { --u: 6px; width: calc(var(--u) * 16); height: calc(var(--u) * 50); position: relative; perspective: 1000px; }
.mascot.big { --u: 8.5px; }
.home-mascot .mascot { --u: 5px; }
.fig-spin { position: absolute; left: 0; bottom: calc(var(--u) * 3); width: calc(var(--u) * 16); height: calc(var(--u) * 32); transform-style: preserve-3d; }
.fig3d { position: absolute; inset: 0; transform-style: preserve-3d; }
.fig-part, .fig-hat, .fig-tail, .fig-tail-seg { position: absolute; transform-style: preserve-3d; }
.fig-hat { inset: 0; }
.fig-part.head { z-index: 2; }
.fig-face, .fig-tail-seg canvas { position: absolute; image-rendering: pixelated; backface-visibility: hidden; }
.fig-tail-seg { transform-origin: 50% 0; }
.fig-tail-seg canvas { inset: 0; width: 100%; height: 100%; }
.fig-tail-seg canvas.back { transform: rotateY(180deg); }
.fig-prop { position: absolute; transform-style: preserve-3d; }
.fig-prop-layer { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
.fig-part .side { filter: brightness(.86); }
.fig-part .bottom { filter: brightness(.7); }
.fig-part .back { filter: brightness(.93); }
/* уши Ears на фигуре — те же детали, что у голов в «О нас» */
.fig3d .ears { position: absolute; inset: 0; transform-style: preserve-3d; }
.fig3d .ear-part, .fig3d .snout { position: absolute; transform-style: preserve-3d; }
.fig3d .ear { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; backface-visibility: hidden; }
.fig3d .ear.back { transform: rotateY(180deg); filter: brightness(.85); }
.fig3d .snout-face { position: absolute; left: 0; top: 0; image-rendering: pixelated; backface-visibility: hidden; }

/* «сцена» под маскотом: бирюзовое свечение и тень, в стиле сайта */
.mascot-stage { position: relative; display: grid; place-items: end center; }
.mascot-stage::before {
  content: ''; position: absolute; left: 50%; bottom: 6px; width: 70%; height: 16px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(79, 209, 197, .45), transparent); filter: blur(2px);
}
.mascot-stage::after {
  content: ''; position: absolute; inset: 10% 5% 0; z-index: -1; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(79, 209, 197, .16), transparent);
}
.login-mascot { margin: -8px auto 4px; width: max-content; }
.home-hello { position: relative; }
.home-mascot { float: right; margin: -10px -4px -12px 12px; }
.hero-mascot { position: absolute; right: 40px; bottom: 0; }
.about-hero-text { max-width: calc(100% - 220px); }
@media (min-width: 861px) { .about-hero { min-height: calc(8.5px * 50 + 8px); } }
.mascot-card {
  margin-top: 22px; padding: 26px 28px; border-radius: 18px; border: 1px solid var(--border);
  background: radial-gradient(80% 120% at 100% 0%, rgba(79, 209, 197, .14), transparent 60%), var(--panel);
}
.mascot-card h2 { margin: 12px 0 8px; font-size: 26px; }
.mascot-card p { max-width: 640px; }
.maint-art.mascot-stage { background: none; box-shadow: none; transform: none; padding: 0; min-height: 300px; }
.maint-card-art.mascot-stage { background: none; padding: 0; min-height: 200px; }
@media (max-width: 860px) {
  .hero-mascot { position: static; margin-top: 10px; }
  .about-hero-text { max-width: none; }
  .home-mascot { display: none; }
}
@media (prefers-reduced-motion: reduce) { .fig-spin { translate: none !important; } }

/* ---------- Маскот: реплики и частицы ---------- */
.mascot { cursor: pointer; outline: none; }
.mascot:focus-visible { box-shadow: 0 0 0 2px var(--accent); border-radius: 12px; }
.mascot-fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 3; }
.mascot-particle { position: absolute; image-rendering: pixelated; pointer-events: none; }
.mascot-bubble {
  position: absolute; left: 50%; top: calc(var(--u) * 8); z-index: 4; width: max-content; max-width: 220px;
  padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; line-height: 1.35; text-align: center;
  color: #0f1216; background: #fff; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .55), 0 0 0 2px var(--accent);
  transform: translate(-50%, -100%) scale(.6); opacity: 0; pointer-events: none;
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
}
.mascot-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; background: #fff;
  transform: translateX(-50%) rotate(45deg); box-shadow: 2px 2px 0 0 var(--accent);
}
.mascot-bubble.show { transform: translate(-50%, -100%) scale(1); opacity: 1; }

/* ---------- Стикерпак ---------- */
.stickers-page { max-width: 1100px; margin: 28px auto; padding: 0 16px 40px; }
.stickers-hero h1 { font-size: clamp(28px, 4.5vw, 40px); margin: 12px 0 10px; }
.stickers-hero p { max-width: 700px; }
.stickers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
.sticker {
  margin: 0; padding: 12px; border-radius: 16px; border: 1px solid var(--border); display: grid; gap: 10px; justify-items: center;
  background: repeating-conic-gradient(#1b2028 0 25%, #171b21 0 50%) 0 0 / 24px 24px;
  transition: transform .2s, border-color .2s;
}
.sticker:hover { transform: translateY(-3px); border-color: var(--accent); }
.sticker img { width: 100%; height: auto; aspect-ratio: 1; min-height: 120px; }
.sticker img:not([src]) { background: radial-gradient(closest-side, rgba(79, 209, 197, .18), transparent); animation: sticker-wait 1.2s ease-in-out infinite; }
@keyframes sticker-wait { 50% { opacity: .4; } }
.sticker figcaption { width: 100%; }
.sticker .btn { width: 100%; }
.stickers-howto ol { padding-left: 20px; }
.stickers-howto li { margin: 6px 0; }

/* ---------- О нас: благодарности ---------- */
.m-thanks { --glow: #f5c451; --glow-2: #c084fc; }
.about-thanks { margin-top: 22px; display: grid; gap: 12px; }
.about-thanks .about-kicker { justify-self: start; color: #f5c451; border-color: rgba(245, 196, 81, .45); background: rgba(245, 196, 81, .08); }
.about-thanks .member { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: center; }
.about-thanks .member-stage { height: 220px; border-radius: 17px 0 0 17px; }
.about-thanks .member-body { text-align: left; padding: 22px 26px; }
.about-thanks .member-about { margin: 14px 0; max-width: 560px; }
.about-thanks .member-tags { justify-content: flex-start; }
@media (max-width: 760px) {
  .about-thanks .member { grid-template-columns: 1fr; }
  .about-thanks .member-stage { border-radius: 17px 17px 0 0; }
  .about-thanks .member-body { text-align: center; }
  .about-thanks .member-tags { justify-content: center; }
}

/* ---------- Пасхалка: секретные стикеры Gefesha ---------- */
.m-thanks .member-stage[data-secret] { cursor: pointer; user-select: none; }
.member-stage.poke .head3d { animation: secret-poke .32s ease-out; }
@keyframes secret-poke { 0% { scale: 1; } 40% { scale: .88; } 100% { scale: 1; } }
.secret { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(8, 10, 14, .72); backdrop-filter: blur(4px); }
.secret[hidden] { display: none; }
.secret-box { position: relative; width: min(920px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 26px; border-color: rgba(245, 196, 81, .5); box-shadow: 0 0 0 1px rgba(192, 132, 252, .25), 0 24px 70px rgba(0, 0, 0, .5); }
.secret-box h2 { margin: 10px 0 6px; }
.secret-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-size: 26px; cursor: pointer; }
.secret-close:hover { background: rgba(255, 255, 255, .08); }
@media (prefers-reduced-motion: reduce) { .member-stage.poke .head3d { animation: none; } }

/* лого — ссылка на главную */
a.brand { color: inherit; text-decoration: none; border-radius: 8px; }
a.brand:hover .logo { filter: brightness(1.25); }
a.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.about-studio { flex-wrap: wrap; }
.about-studio > div { min-width: 160px; }
.about-studio .btn { flex: 0 0 auto; }
.about-studio { max-width: 640px; }
.about-studio > .studio-links { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 1 auto; min-width: 0; }
.studio-links .btn { white-space: nowrap; }

/* ---------- Статистика гидов ---------- */
.stats-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; justify-content: space-between; }
.stats-head h2 { margin: 0 0 4px; }
.stats-head p { max-width: 620px; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; font: inherit; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent); color: #0f1216; font-weight: 700; }
.stats-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.stats-total { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.stats-total b { font-size: 26px; }
.stats-total span { color: var(--muted); font-size: 13px; }
.stats-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; align-items: end; }
.stats-podium:empty { display: none; }
.stats-place { border: 1px solid var(--border); border-radius: 14px; padding: 16px 10px 14px; display: grid; justify-items: center; gap: 4px; text-align: center; background: rgba(255, 255, 255, .02); min-width: 0; }
.stats-place.p1 { border-color: rgba(245, 196, 81, .6); background: linear-gradient(180deg, rgba(245, 196, 81, .12), transparent); padding-top: 26px; }
.stats-place.p2 { border-color: rgba(195, 204, 216, .45); }
.stats-place.p3 { border-color: rgba(205, 127, 50, .45); }
.stats-place.me { box-shadow: 0 0 0 2px var(--accent) inset; }
.stats-medal { font-size: 24px; }
.stats-place .stats-head-ico { width: 48px; height: 48px; }
.stats-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-num { color: var(--accent); font-weight: 700; }
.stats-head-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: rgba(255, 255, 255, .06); overflow: hidden; flex: none; }
.stats-head-ico canvas { width: 100%; height: 100%; image-rendering: pixelated; object-fit: contain; }
.stats-guide { display: inline-flex; align-items: center; gap: 8px; }
.stats-you { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: #0f1216; font-weight: 700; }
.stats-rank { width: 40px; }
.stats-table tr.me td { background: rgba(79, 209, 197, .08); }
@media (max-width: 640px) {
  .stats-totals, .stats-podium { grid-template-columns: 1fr; }
  .stats-table th:nth-child(5), .stats-table td:nth-child(5), .stats-table th:nth-child(6), .stats-table td:nth-child(6) { display: none; }
}

/* ---------- Мини-игры: рекорды ---------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 18px; }
.game-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: rgba(255, 255, 255, .02); min-width: 0; }
.game-card header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-card header b { font-size: 16px; }
.game-ico { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 9px; background: rgba(79, 209, 197, .12); color: var(--accent); font-weight: 800; font-size: 13px; }
.game-tetris .game-ico { background: rgba(91, 141, 239, .15); color: #8fb0ff; }
.game-minesweeper .game-ico { background: rgba(242, 112, 107, .14); color: #f2706b; }
.game-snake .game-ico { background: rgba(126, 226, 168, .14); color: #7ee2a8; }
.game-g2048 .game-ico { background: rgba(245, 196, 81, .14); color: #f5c451; }
.game-me { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.game-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.game-top li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 5px 8px; border-radius: 9px; }
.game-top li .muted { grid-column: 2 / 4; margin-top: -4px; font-size: 11px; }
.game-top li.me { background: rgba(79, 209, 197, .08); }
.game-top .stats-guide span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-score { color: var(--accent); }

/* ---------- Форма гидов ---------- */
.band-layout { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 22px; margin-top: 16px; align-items: start; }
.band-preview { display: grid; justify-items: center; gap: 8px; }
#form-view { width: 100%; max-width: 320px; aspect-ratio: 320 / 400; height: auto; border-radius: 16px; cursor: grab; touch-action: none;
  background: radial-gradient(circle at 50% 40%, rgba(79, 209, 197, .16), transparent 70%), rgba(255, 255, 255, .02); border: 1px solid var(--border); }
#form-view:active { cursor: grabbing; }
#form-flat { width: 100%; max-width: 320px; height: auto; aspect-ratio: 1; touch-action: none; image-rendering: pixelated; border-radius: 8px; background: repeating-conic-gradient(#20262e 0% 25%, #191e24 0% 50%) 0 0 / 16px 16px; }
.band-hint { margin: 0; text-align: center; }
.band-controls h3 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.band-controls h3:first-child { margin-top: 0; }
.band-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.band-card { display: grid; justify-items: start; gap: 4px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, .02); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.band-card:hover { border-color: var(--accent); }
.band-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: rgba(79, 209, 197, .08); }
.band-card img { width: 96px; height: 48px; image-rendering: pixelated; border-radius: 4px; background: repeating-conic-gradient(#20262e 0% 25%, #191e24 0% 50%) 0 0 / 12px 12px; }
.band-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.band-row input[type="range"] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.band-row input[type="color"] { width: 48px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; padding: 2px; }
.band-checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.band-limb { flex-wrap: wrap; }
.band-file { position: relative; overflow: hidden; }
.band-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#form-status.ok { color: var(--accent); }
.band-howto { margin-top: 14px; }
.band-howto summary { cursor: pointer; color: var(--accent); }
@media (max-width: 760px) {
  .band-layout { grid-template-columns: 1fr; }
}

.form-items { display: grid; gap: 8px; }
.form-item { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, .02); cursor: pointer; }
.form-item:has(input:checked) { border-color: var(--accent); background: rgba(79, 209, 197, .08); }
.form-item input { accent-color: var(--accent); width: 18px; height: 18px; }
.form-item img { width: 64px; height: auto; image-rendering: pixelated; border-radius: 6px; background: repeating-conic-gradient(#20262e 0% 25%, #191e24 0% 50%) 0 0 / 12px 12px; }
.form-item > span { display: grid; gap: 2px; min-width: 0; }

/* ---------- Редактор скина ---------- */
.ed-bar { display: grid; gap: 8px; width: 100%; }
.ed-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ed-tools { display: grid; grid-template-columns: repeat(6, 1fr); width: 100%; }
.ed-tools button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; }
.ed-tools button + button { border-left: 1px solid var(--border); }
.ed-tools .ed-ico { font-size: 17px; line-height: 1; }
.ed-size button { padding: 6px 11px; }
.ed-btn { border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.ed-btn:hover:not(:disabled) { border-color: var(--accent); }
.ed-btn:disabled { opacity: .4; cursor: default; }
.ed-btn.active { background: var(--accent); color: #0f1216; border-color: var(--accent); font-weight: 700; }
.ed-bar input[type="color"] { width: 38px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: transparent; padding: 2px; cursor: pointer; }
.ed-palette { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.ed-swatch { width: 18px; height: 18px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 4px; padding: 0; cursor: pointer; }
.ed-swatch:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
#form-stage.painting #form-view, #form-stage.painting #form-flat { cursor: crosshair; }
#form-stage[data-view="3d"] #form-flat, #form-stage[data-view="2d"] #form-view { display: none; }
#form-stage[data-view="both"] #form-flat { max-width: 256px; }
.ed-parts { display: grid; gap: 6px; }
.ed-parts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ed-parts-row > span { width: 92px; }
.ed-part { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 8px; padding: 4px 8px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: line-through; }
.ed-part.active { color: var(--text); border-color: var(--accent); text-decoration: none; background: rgba(79, 209, 197, .08); }

.ed-ears { display: grid; gap: 8px; }
.ears-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ears-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.ears-grid select { background: var(--panel, #161a20); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font: inherit; }
.ears-sub { display: grid; gap: 4px; padding-left: 10px; border-left: 2px solid var(--border); }
.ears-range { display: grid; grid-template-columns: 82px minmax(0, 1fr) 40px; align-items: center; gap: 8px; font-size: 13px; }
.ears-range input { accent-color: var(--accent); }
.ears-val { text-align: right; font-weight: 600; }
.ears-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }

/* ---------- Все отчёты: карточки гидов и отчётов ---------- */
.rall-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 14px 0; }
.rall-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.rall-filters select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font: inherit; min-width: 150px; }
.rall-filters .seg { flex-wrap: wrap; }
.rg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rg-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 96px; min-height: 168px; padding: 0; overflow: hidden; text-align: left;
  font: inherit; color: inherit; background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; cursor: pointer; transition: border-color .15s, transform .15s; }
.rg-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.rg-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.rg-info { display: flex; flex-direction: column; gap: 6px; padding: 14px 4px 14px 14px; min-width: 0; }
.rg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rg-name { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rg-role { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; }
.rg-tenure { margin: 0; }
.rg-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: auto; }
.rg-stat { display: grid; justify-items: center; align-content: center; gap: 2px; aspect-ratio: 1; max-height: 72px; border-radius: 10px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--border); }
.rg-stat b { font-size: 20px; line-height: 1; }
.rg-stat span { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.1; }
.rg-skin { position: relative; overflow: hidden; }
.rg-skin-cv { position: absolute; top: 8px; left: 50%; width: 96px; height: 192px; transform: translateX(-50%); image-rendering: pixelated; }
/* плавный градиент снизу: фигура растворяется к ногам */
.rg-skin::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 42%, var(--panel-2) 92%); pointer-events: none; }
.rall-list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 20px 0 10px; }
.rall-list-head h3 { margin: 0; font-size: 15px; }
.rt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rt-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.rt-top { display: flex; justify-content: space-between; gap: 8px; }
.rt-tour { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; flex-wrap: wrap; }
@media (max-width: 520px) { .rg-grid { grid-template-columns: 1fr; } }

/* ---------- Мои отчёты: карточки со скриншотом ---------- */
.rm-card { grid-template-columns: minmax(0, 1fr) 42%; }
.rm-card .rg-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rm-card .rg-head .badge { flex: none; font-size: 11px; }
.rm-people { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rm-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* скриншот уходит в фон карточки и слева: тот же плавный градиент снизу */
.rm-pic::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to right, var(--panel-2), transparent 30%); pointer-events: none; }
.rm-pic::after { z-index: 1; }
.rm-del { position: absolute; top: 8px; right: 8px; z-index: 2; }

/* ---------- Тур по сайту со Снифом ---------- */
.stour { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.stour.no-target { background: rgba(8, 10, 14, .62); backdrop-filter: blur(2px); pointer-events: auto; }
/* подсветка: всё вокруг цели затемнено огромной тенью */
.stour-spot { position: fixed; border-radius: 12px; box-shadow: 0 0 0 2px var(--accent), 0 0 0 9999px rgba(8, 10, 14, .62);
  transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.stour-spot::after { content: ''; position: absolute; inset: -6px; border-radius: 16px; border: 2px solid var(--accent); opacity: .5; animation: stour-pulse 1.6s ease-out infinite; }
@keyframes stour-pulse { from { transform: scale(.96); opacity: .7; } to { transform: scale(1.08); opacity: 0; } }
.stour-card { position: fixed; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 6px; width: min(480px, calc(100vw - 32px));
  padding: 14px 16px 14px 10px; border-radius: 18px; border: 1px solid var(--accent); pointer-events: auto;
  background: radial-gradient(80% 120% at 0% 100%, rgba(79, 209, 197, .16), transparent 60%), var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5); transition: left .25s, top .25s; }
.stour.no-target .stour-card { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.stour-mascot .mascot { --u: 4.2px; }
/* флажок в левой лапке торчит вправо — отступ, чтобы он не закрывал текст */
.stour-mascot { margin-right: 30px; }
/* лёжа: Сниф на верхнем краю карточки, текст — во всю ширину */
.stour-card.lie { grid-template-columns: minmax(0, 1fr); padding-left: 18px; }
.stour-card.lie .stour-mascot { position: absolute; right: 70px; bottom: calc(100% - 4.2px * 3 - 1px); margin: 0; pointer-events: auto; }
.stour-card.lie .stour-mascot::before, .stour-card.lie .stour-mascot::after { display: none; }
.stour-mascot .mascot-bubble { display: none; }
.stour-body { display: grid; gap: 6px; align-self: center; }
.stour-body h3 { margin: 0; font-size: 18px; }
.stour-body p { margin: 0; line-height: 1.5; }
.stour-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.stour-gap { flex: 1; }
@media (max-width: 520px) {
  .stour-card { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .stour-mascot { display: none; }
}
@media (prefers-reduced-motion: reduce) { .stour-spot, .stour-card { transition: none; } .stour-spot::after { animation: none; } }

/* ---------- Telegram ---------- */
.btn.telegram { background: #2aabee; color: #fff; border-color: #2aabee; }
.btn.telegram:hover { background: #229ed9; }
#login-tg { width: 100%; margin-top: 8px; }
.tg-wait { margin-top: 10px; padding: 10px 12px; border: 1px dashed #2aabee; border-radius: 10px; }
.tg-wait p { margin: 0 0 4px; }

/* ---------- Зоны ---------- */
.point-kind { margin: 4px 0 6px; }
.zone-box { display: grid; gap: 8px; margin-bottom: 6px; }
.zone-box .xyz { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.zone-badge { margin-left: 6px; }
.map-zone-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0;
  padding: 10px 12px; border: 1px dashed var(--accent); border-radius: 10px; background: rgba(79, 209, 197, .08); }
#map.drawing { cursor: crosshair; }
input[readonly] { opacity: .7; }

/* ---------- Инструкция к редактору формы ---------- */
.form-card { position: relative; }
.form-help-btn { position: absolute; top: 14px; right: 14px; padding: 6px 12px; font-size: 13px; z-index: 2; }
.form-help { position: absolute; top: 52px; right: 14px; z-index: 20; width: min(440px, calc(100% - 28px)); max-height: min(70vh, 640px); overflow: auto;
  padding: 14px 16px; border-radius: 14px; border: 1px solid var(--accent); background: var(--panel); box-shadow: 0 18px 50px rgba(0, 0, 0, .5); }
.form-help h3 { margin: 0; font-size: 16px; }
.form-help ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; }
.form-help ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
@media (max-width: 640px) {
  .form-help-btn { position: static; margin-bottom: 8px; }
  .form-help { top: 60px; left: 14px; right: 14px; width: auto; }
}
