@import url('./variables.css');

:root{
  /* Масштаб меток (пользовательский слайдер) + макет колонок */
  --marker-scale: 1;
  --left-w: 240px;
  --right-w: 320px;
  --left-scale: clamp(0.85, calc(var(--left-w) / 240px), 1.35);
  --right-scale: clamp(0.85, calc(var(--right-w) / 320px), 1.35);
}
*{ box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font-main); }
a { color: var(--text); text-decoration: none; }
.page-static a:hover{ text-decoration: underline; }
.btn{
      appearance:none;
      padding:8px 12px;
      border:1px solid var(--border);
      border-radius:10px;
      background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
      color:var(--text);
      box-shadow: 0 2px 10px rgba(0,0,0,.25);
      cursor:pointer;
      transition: background .15s ease, transform .05s ease, box-shadow .15s ease, color .15s ease, border-color .15s ease;
      backdrop-filter: saturate(120%) blur(2px);
      font-weight: 700;
      display: inline-block;
    }
    #left .btn{ padding: calc(8px * var(--left-scale)) calc(12px * var(--left-scale)); border-radius: calc(10px * var(--left-scale)); font-size: calc(13px * var(--left-scale)); }
    #right .btn{ padding: calc(8px * var(--right-scale)) calc(12px * var(--right-scale)); border-radius: calc(10px * var(--right-scale)); font-size: calc(13px * var(--right-scale)); }
    #right .auth-input, #right input[type="text"], #right input[type="number"], #right input[type="password"], #right input[type="email"], #right input[type="url"], #right input[type="search"]{ padding: calc(10px * var(--right-scale)) !important; border-radius: calc(10px * var(--right-scale)) !important; }
    .btn:hover{ background: linear-gradient(180deg, rgba(0, 166, 255, 0.05), rgba(255,255,255,.025)); transform: translateY(-1px); }
    .btn:active{ background: linear-gradient(180deg, rgba(229,57,53,.08), rgba(229,57,53,.04)); border-color: rgba(229,57,53,.35); box-shadow: 0 4px 14px rgba(229,57,53,.12); transform: translateY(0); }
    .btn:focus-visible{ outline: 2px solid rgba(229,57,53,.45); outline-offset: 2px; }
    .btn-accent{
      background: linear-gradient(180deg, rgba(229,57,53,.95), rgba(229,57,53,.8));
      border-color: rgba(229,57,53,.7);
      color:#fff;
      box-shadow: 0 6px 22px rgba(229,57,53,.25);
    }
    .btn-accent:hover{ background: linear-gradient(180deg, rgba(229,57,53,1), rgba(229,57,53,.9)); box-shadow: 0 8px 26px rgba(229,57,53,.32); transform: translateY(-1px); }
    .btn-accent:active,
    .btn-accent.active{
      background:#fff;
      color: var(--accent);
      border-color: rgba(229,57,53,.85);
      box-shadow: 0 4px 14px rgba(229,57,53,.2), 0 0 0 1px rgba(229,57,53,.12) inset;
      transform: translateY(0);
    }
    .icon-round{
      width:32px; height:32px;
      border-radius:12px;
      border:1px solid var(--border);
      background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
      color: var(--text);
      display:grid; place-items:center;
      cursor:pointer;
      box-shadow: 0 2px 10px rgba(0,0,0,.22);
      transition: background .15s ease, transform .05s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease;
    }
    .icon-round:hover{ background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025)); transform: translateY(-1px); }
    .icon-round:active{ background:#fff; color: var(--accent); border-color: rgba(229,57,53,.65); box-shadow: 0 4px 12px rgba(229,57,53,.15); transform: translateY(0); }
    /* Make the Close button readable on light modal */


    #siteAlertOverlay .btn-close{ background:#000 !important; color:#fff !important; border-color:#000 !important; }
    #siteAlertOverlay .btn-close:hover{ background:#111 !important; }
    #siteAlertOverlay .btn-close:disabled{ opacity:.6; background:#000 !important; color:#fff !important; }

    .glass{ background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02)); border:1px solid var(--border); border-radius:14px; box-shadow: 0 10px 30px rgba(0,0,0,.35); backdrop-filter: blur(10px) saturate(140%); }

    /* Общие стили для статических страниц (bug-report, cookies, privacy, changelog, admin) */
    .muted{ color: var(--muted); }
    body.page-static{ min-height:100%; }
    .page-static .container{ max-width: 920px; margin: 0 auto; padding: 20px 16px 32px; }
    .admin-page .container{ max-width:1200px; padding:16px; }
    .page-static header.topbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin: 12px 0 16px; }
    .admin-page header.topbar{ margin: 8px 0 14px; }
    .page-static .brand{ display:flex; align-items:center; gap:10px; font-weight:700; letter-spacing:.2px; }
    .page-static .brand .dot{ width:10px; height:10px; border-radius:50%; background: var(--accent); box-shadow: 0 0 10px rgba(229,57,53,.55); }
    .page-static nav.links{ display:flex; gap:8px; flex-wrap:wrap; }
    .page-static main.card{ padding:18px; }
    .page-static h1{ margin:0 0 10px; font-size:22px; line-height:1.25; }
    .page-static p{ margin:0 0 12px; line-height:1.7; color:var(--text); }
    .page-static ul{ margin:0 0 12px 18px; }
    .page-static code{ background: rgba(255,255,255,.08); border:1px solid var(--border); padding:2px 6px; border-radius:6px; color:var(--text); }
    .page-static footer.foot{ margin-top:16px; padding:10px 12px; font-size:13px; color:var(--muted); display:flex; justify-content:space-between; }
.page-static form{ display:grid; gap:12px; }
.page-static label{ display:flex; flex-direction:column; gap:6px; font-weight:600; }
.page-static input,
.page-static textarea,
.page-static select{ width:100%; padding:10px; border-radius:10px; border:1px solid var(--border); background:#0f131d; color:var(--text); font-size:14px; font-family: inherit; }
    .page-static textarea{ min-height:140px; resize:vertical; }
    .page-static .alert{ padding:10px 12px; border-radius:10px; border:1px solid var(--border); background: rgba(255,255,255,.04); }
    .page-static .alert.error{ border-color:#ff6b6b; color:#ff6b6b; }
    .page-static .alert.success{ border-color:#2ecc71; color:#2ecc71; }
    .page-static .locked{ display:flex; align-items:center; gap:8px; padding:10px 12px; border-radius:10px; border:1px dashed var(--border); background:rgba(255,255,255,.03); }
    .page-static .entry{ border:1px solid var(--border); border-radius:12px; padding:12px 14px; background:rgba(255,255,255,.03); margin-bottom:10px; }
    .page-static .entry h3{ margin:0 0 6px; font-size:16px; display:flex; align-items:center; gap:8px; }
    .page-static .entry ul{ margin:0; padding-left:18px; color:var(--text); line-height:1.6; }
    .page-static .badge{ display:inline-flex; align-items:center; gap:6px; padding:4px 8px; border-radius:999px; background:rgba(229,57,53,.12); border:1px solid rgba(229,57,53,.35); color:var(--text); font-weight:700; letter-spacing:.2px; }
    .page-static .grid{ display:grid; gap:12px; }
    .page-static .grid.cols-2{ grid-template-columns: repeat(2, 1fr); }
    .page-static .grid.cols-3{ grid-template-columns: repeat(3, 1fr); }
    @media (max-width: 960px){
      .page-static .grid.cols-3,
      .page-static .grid.cols-2{ grid-template-columns: 1fr; }
    }
    .page-static .card{ padding:14px; }
    .page-static .metric{ display:flex; align-items:center; justify-content:space-between; }
    .page-static .metric .label{ color:var(--muted); font-size:13px; }
    .page-static .metric .value{ font-size:22px; font-weight:700; }
    .page-static .chart{ height:120px; display:flex; align-items:flex-end; gap:4px; }
    .page-static .bar{ width: calc((100% - 116px) / 30); background: linear-gradient(180deg, rgba(229,57,53,.9), rgba(229,57,53,.6)); border-radius:4px 4px 0 0; }
    .page-static .bar[aria-current="true"]{ box-shadow:0 0 0 1px rgba(255,255,255,.15) inset; }
    .page-static .sparkline{ height:36px; display:flex; align-items:flex-end; gap:2px; margin-top:8px; }
    .page-static .sbar{ flex:1 1 auto; background: linear-gradient(180deg, rgba(229,57,53,.85), rgba(229,57,53,.55)); border-radius:2px 2px 0 0; }
    .page-static .sbar[aria-current="true"]{ box-shadow:0 0 0 1px rgba(255,255,255,.18) inset; }
    .page-static table{ width:100%; border-collapse:collapse; font-size:13px; }
    .page-static th, .page-static td{ padding:8px 6px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top; }
    .page-static th{ color:var(--muted); font-weight:600; }
    .page-static tbody tr:hover{ background: rgba(255,255,255,.03); }
    .page-static .nowrap{ white-space:nowrap; }
    .page-static .filters{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
    .page-static .input{ padding:8px; border-radius:10px; border:1px solid var(--border); background:#0f131d; color:var(--text); }

    /* Базовые инпуты/заголовки для внутренних форм */
    .input-dark{
      width:100%;
      padding: var(--space-8);
      border-radius: var(--radius-8);
      border:1px solid var(--border);
      background:#0f131d;
      color:var(--text);
      font-size:14px;
    }
    .title-sm{ margin:0 0 var(--space-8) 0; font-size:16px; }
    .form-label{ display:block; }
    .textarea-lg{ min-height:120px; resize:vertical; }

    /* Утилиты отступов/флексов на базе токенов */
    .flex{ display:flex; }
    .flex-column{ flex-direction:column; }
    .items-center{ align-items:center; }
    .justify-between{ justify-content:space-between; }
    .justify-end{ justify-content:flex-end; }
    .flex-wrap{ flex-wrap:wrap; }
    .gap-6{ gap: var(--space-6); }
    .gap-8{ gap: var(--space-8); }
    .gap-10{ gap: var(--space-10); }
    .gap-12{ gap: var(--space-12); }
    .p-6{ padding: var(--space-6); }
    .p-8{ padding: var(--space-8); }
    .p-10{ padding: var(--space-10); }
    .p-12{ padding: var(--space-12); }
    .p-14{ padding: var(--space-14); }
    .p-16{ padding: var(--space-16); }
    .pt-0{ padding-top:0; }
    .mb-4{ margin-bottom: var(--space-4); }
    .mb-0{ margin-bottom:0; }
    .mb-10{ margin-bottom: var(--space-10); }
    .mb-8{ margin-bottom: var(--space-8); }
    .mt-10{ margin-top: var(--space-10); }
    .mt-12{ margin-top: var(--space-12); }
    .mt-6{ margin-top: var(--space-6); }
    .w-100{ width:100%; }
    .rounded-8{ border-radius: var(--radius-8); }
    .rounded-10{ border-radius: var(--radius-10); }
    .rounded-12{ border-radius: var(--radius-12); }
    .rounded-14{ border-radius: var(--radius-14); }
    .overflow-auto{ overflow:auto; }
    .w-110{ width:110px; }
    .grid{ display:grid; gap: var(--space-10); }
    .grid.gap-8{ gap: var(--space-8); }
    .grid.cols-2{ grid-template-columns: repeat(2, 1fr); }

    /* Layout: left seasons, center map, right account */
    #app{ position:relative; display:grid; grid-template-columns: var(--left-w) 1fr var(--right-w); grid-template-rows: 1fr; height:100vh; gap:12px; padding:12px; }
    #left{ grid-column:1; grid-row:1; padding:12px; overflow:auto; position:relative; display:flex; flex-direction:column; gap:10px; }
    #center{ grid-column:2; grid-row:1; padding:12px; overflow:hidden; display:flex; align-items:center; justify-content:center; }
    #right{ grid-column:3; grid-row:1; padding:12px; overflow:auto; position: relative; padding-bottom: 200px; }
    #right h3{ text-align:center; margin:0 0 var(--space-10) 0; font-size:15px; }
    /* Column resizers */
    .col-resizer{ position:absolute; top:0; bottom:0; width:6px; cursor: col-resize; z-index: 100; opacity:0; pointer-events:auto; transition: opacity .12s ease; touch-action: none; }
    .col-resizer::after{ content:""; position:absolute; top:0; bottom:0; left:2px; width:2px; background: rgba(255,255,255,.15); }
    #left:hover .col-resizer, #right:hover .col-resizer{ opacity:1; }
    .col-resizer:hover::after{ background: rgba(229,57,53,.45); }
    #left .col-resizer{ right:0; }
    #right .col-resizer{ left:0; }

    /* Seasons list */
    .seasons{ display:flex; flex-direction:column; gap:6px; overflow-x: hidden; padding-bottom: 12px; }
    .season-row{ display:grid; grid-template-columns: auto 1fr auto; align-items:center; column-gap:6px; margin: 4px 0; }
  .season-btn{ position:relative; display:flex; align-items:center; justify-content:flex-start; gap:8px; min-height:32px; padding:6px 10px; font-size:13px; border-radius:10px; background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01)); border:1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,.25); text-align:left; width:100%; }
  /* Grid shrink fix on mobile: allow the middle track to compress so the right color chip stays visible */
  .season-row .season-btn{ min-width:0; padding-right:34px; }
  #left .season-row .season-btn{ padding-right: calc(34px * var(--left-scale)); }
  #left .season-btn{ font-size: calc(13px * var(--left-scale)); min-height: calc(32px * var(--left-scale)); padding: calc(6px * var(--left-scale)) calc(10px * var(--left-scale)); border-radius: calc(10px * var(--left-scale)); }
  .season-btn:hover{ background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); transform: translateY(-1px); }
  .season-btn:focus-visible{ outline: 2px solid rgba(229,57,53,.45); outline-offset: 2px; }
  .season-btn.active{ outline: none; background: linear-gradient(180deg, rgba(229,57,53,.10), rgba(229,57,53,.05)); border-color: rgba(229,57,53,.35); box-shadow: 0 4px 18px rgba(229,57,53,.12), 0 1px 0 rgba(229,57,53,.25) inset; }
  .season-btn.active::before{ content:""; position:absolute; left:4px; top:6px; bottom:6px; width:3px; border-radius:3px; background: var(--accent); box-shadow: 0 0 8px rgba(229,57,53,.45); }
  /* Mini-season visual style: light gray with dark text */
  .season-btn.mini{ background: #cecece; color:#111827; border-color:#cbd5e1; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
  .season-btn.mini:hover{ background:#ffffff; transform: translateY(-1px); }
  .season-btn.mini.active{ background: linear-gradient(180deg, rgba(236, 236, 236, 0.84), rgb(245, 245, 245)); border-color: rgba(229,57,53,.35); }
  .season-btn.mini.active::before{ background:#ff0000; box-shadow:none; }
  .season-plus{ width:28px; height:28px; border-radius:9px; border:1px solid var(--border); background: rgba(255,255,255,.06); color: var(--text); display:grid; place-items:center; cursor:pointer; }
  #left .season-plus{ width: calc(28px * var(--left-scale)); height: calc(28px * var(--left-scale)); border-radius: calc(9px * var(--left-scale)); }
  .season-plus:hover{ background: rgba(255,255,255,.1); }
  .season-plus.active{ background: linear-gradient(180deg, rgba(229,57,53,.16), rgba(229,57,53,.08)); border-color: rgba(229,57,53,.35); }
  .season-title{ flex: 1 1 auto; min-width:0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; text-align:center; margin-left: 0; }
  .season-emoji{ display:none; }
  .season-emoji-chip{ width:24px; height:24px; display:grid; place-items:center; border-radius:8px; border:1px solid var(--border); background: var(--chip-bg, rgba(255,255,255,.06)); font-size:16px; line-height:1; position:relative; overflow:hidden; aspect-ratio: 1 / 1; }
  #left .season-emoji-chip{ width: calc(24px * var(--left-scale)); height: calc(24px * var(--left-scale)); border-radius: calc(8px * var(--left-scale)); }
  #left .season-emoji-chip .season-logo{ width: calc(16px * var(--left-scale)); height: calc(16px * var(--left-scale)); }
  /* Tinted logo mask inside the chip; uses background-color as tint */
  .season-emoji-chip .season-logo{ width:16px; height:16px; display:block; background-color: var(--logo-color, currentColor);
    mask-size: contain; mask-position: center; mask-repeat: no-repeat;
    -webkit-mask-size: contain; -webkit-mask-position: center; -webkit-mask-repeat: no-repeat; }
  /* Right-aligned counter inside season button (matches chapter count style) */
  .season-btn .season-count{ position:absolute; right:10px; top:50%; transform: translateY(-50%); margin-left:0; color: var(--muted); font-weight: 600; opacity:.95; }
  /* Mini-seasons: make counter dark for contrast on light button */
  .season-btn.mini .season-count{ color:#111827; opacity:.95; }
    .chapter-head.btn{ display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; min-height:36px; padding:8px 12px; border-radius:12px; background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)); border:1px solid var(--border); box-shadow: 0 6px 18px rgba(0,0,0,.35); font-size:14px; }
    #left .chapter-head.btn{ font-size: calc(14px * var(--left-scale)); min-height: calc(36px * var(--left-scale)); padding: calc(8px * var(--left-scale)) calc(12px * var(--left-scale)); border-radius: calc(12px * var(--left-scale)); }
    .chapter-head.btn:hover{ background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); transform: translateY(-1px); }
    .chapter-head.btn:focus-visible{ outline: 2px solid rgba(229,57,53,.45); outline-offset: 2px; }
    .chapter.open .chapter-head.btn{ border-color: rgba(229,57,53,.35); box-shadow: 0 4px 18px rgba(229,57,53,.12); }
    .chapter-head.btn strong{ font-weight:800; letter-spacing:.2px; }
    .chapter-head .chev{ transition: transform .2s ease; opacity:.9; }
    .chapter.open .chev{ transform: rotate(90deg); }
    .chapter-list{ display:none; margin-top:8px; }
  .chapter-list > .season-btn{ margin-top:6px; }
  .chapter.open .chapter-list{ display:block; }

    .panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: var(--space-10); }

    /* Map area */
    #mapStage{ position:relative; width:100%; height:100%; background: var(--panel-2); border-radius:12px; border:1px solid var(--border); overflow:hidden; cursor: grab; }
    #mapImage{ width:100%; height:100%; object-fit: fill; user-select:none; pointer-events:none; }
    #mapContent{ position:absolute; top:0; left:0; transform-origin: 0 0; will-change: transform; }
    #markerLayer{ position:absolute; inset:0; pointer-events:auto; z-index: 5; }
  .marker {
      position: absolute;
      display: block;
      width: calc(16px * var(--marker-scale));
      height: calc(16px * var(--marker-scale));
      /* Жёстко фиксируем круг: убираем влияние внутренних отступов/дефолтных стилей кнопок */
      padding: 0 !important;
      box-sizing: border-box;
      -webkit-appearance: none;
      appearance: none;
      /* Обеспечиваем идеальный круг */
      aspect-ratio: 1 / 1 !important;
      border-radius: 50% !important;
      /* Сбрасываем системный фон кнопки, чтобы инлайн-цвет был виден */
      background: transparent;
      border: calc(3px * var(--marker-scale)) solid #fff;
      box-shadow: 0 2px 10px rgba(0,0,0,0.4);
      z-index: 6;
      cursor: pointer;
      pointer-events: auto;
      transition: transform .1s ease, box-shadow .2s ease;
    }
    .marker:hover{ transform: scale(1.06); }
    .marker.red { background-color: #FF0000; }
    .marker.orange { background-color: #FF7F00; }
    .marker.yellow { background-color: #E0B61B; }
    .marker.green { background-color: #008500; }
    .marker.blue { background-color: #0000FF; }
    .marker.violet { background-color: #8F00FF; }
    .marker .delete-btn { display: none; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); background: rgba(255,0,0,0.8); color: white; border: none; padding: 2px 6px; border-radius: 4px; cursor: pointer; font-size: 12px; }
    .marker:hover .delete-btn { display: block; }
    .marker.flash { box-shadow: 0 0 0 3px rgba(229,57,53,.35), 0 8px 18px rgba(229,57,53,.35); }

    /* Палитра цветов для выбора и легенды */
    .color-picker, .legend { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
    .color-swatch, .legend-swatch {
      width: 20px;
      height: 20px;
      /* Force square aspect for perfect circles */
      aspect-ratio: 1 / 1;
      border-radius: 50%;
      border: 2px solid var(--border);
      cursor: pointer;
    }
    .color-swatch.selected { outline:2px solid var(--accent); }
    .legend-item { display:flex; align-items:center; gap:4px; cursor:pointer; font-size:13px; user-select:none; touch-action: manipulation; }
    .legend-item.active .legend-swatch { outline:2px solid var(--accent); }
    /* Тост для подтверждения удаления */
    #deleteToast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:100; background:rgba(0,0,0,0.85); color:#fff; padding:8px 12px; border-radius:8px; display:none; font-size:13px; }
    #deleteToast button { margin-left:8px; background:transparent; border:1px solid var(--border); color:var(--accent); padding:2px 6px; border-radius:4px; cursor:pointer; }
    /* Оверлей прогресса скачивания */
    #progressOverlay { position:fixed; bottom:60px; left:50%; transform: translateX(-50%); width:240px; background:rgba(0,0,0,0.85); color:#fff; padding:8px 12px; border-radius:8px; display:none; z-index:100; font-size:13px; }
    #progressBar { height:6px; background: var(--accent); border-radius:3px; width:0%; transition: width .2s ease; margin-top:4px; }
    /* Всплывающий выбор цвета для редактирования */
    .color-popup { position:absolute; display:flex; gap:6px; padding:6px; background: rgba(0,0,0,0.9); border:1px solid var(--border); border-radius:8px; z-index:200; }
    .color-popup .color-swatch { width:18px; height:18px; border-radius:50%; border:2px solid var(--border); }
    .color-popup .color-swatch:hover { outline:2px solid var(--accent); }

    /* Infos */
    /* Legend will be rendered into #infoBar to match glass style */
    #infoBar {
      position: absolute;
      left: 12px;
      bottom: 12px;
      padding: 8px 10px;
      font-size: 13px;
      color: var(--muted);
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
      border: 1px solid  rgba(255, 255, 255, 0.323);
      box-shadow: 0 10px 26px rgba(0,0,0,.35);
      backdrop-filter: blur(8px) saturate(140%);
      z-index: 20;
    }
    /* Coordinates panel – shown only for admins. Placed inside the map and aligned to bottom‑right of the map area */
    #mapStage #coordsAdmin {
      position: absolute;
      right: 12px;
      bottom: 12px;
      padding: 8px 10px;
      font-size: 13px;
      color: var(--muted);
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(12,14,18,.9), rgba(12,14,18,.85));
      border: 1px solid rgba(255,255,255,0.04);
      box-shadow: 0 8px 26px rgba(0,0,0,0.6);
      backdrop-filter: blur(8px) saturate(140%);
      display: none;
      z-index: 60;
    }

    /* Onboarding overlay */
    #tourOverlay{ position:fixed; inset:0; z-index:2000; display:none; align-items:flex-start; justify-content:center; }
  #tourOverlay[aria-hidden="false"]{ display:flex; }
  #tourOverlay .tour-dim{ position:fixed; inset:0; width:100vw; height:100vh; pointer-events:auto; }
  #tourOverlay .tour-dim-path{ transition: d .3s ease; }
  #tourOverlay .tour-pop{ position:absolute; max-width:min(420px, 92vw); max-height: calc(100vh - 24px); overflow:auto; background: rgba(25,27,35,.9); backdrop-filter: blur(6px); color:#fff; border:1px solid rgba(255,255,255,.12); border-radius:12px; padding:14px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
  #tourPop{ top:20px; left:20px; }
  #tourOverlay .tour-pop h4{ margin:0 0 6px 0; font-size:16px; }
  #tourOverlay .tour-pop p{ margin:4px 0; font-size:13px; color:#d1d5db; }
  #tourOverlay .tour-actions{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:10px; }
  #tourOverlay .tour-actions .left{ display:flex; gap:8px; }
  #tourOverlay .tour-actions .right{ display:flex; gap:8px; }
    #tourOverlay .tour-btn{
      padding:8px 12px;
      border-radius:10px;
      border:1px solid var(--border, rgba(255,255,255,.18));
      background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
      color:#fff;
      cursor:pointer;
      font-size:13px;
      box-shadow: 0 2px 10px rgba(0,0,0,.22);
      transition: background .15s ease, transform .05s ease, box-shadow .15s ease, border-color .15s ease, color .15s ease;
    }
    #tourOverlay .tour-btn:hover{ background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025)); transform: translateY(-1px); }
    #tourOverlay .tour-btn:active{ background:#fff; color: var(--accent); border-color: rgba(229,57,53,.55); box-shadow: 0 4px 12px rgba(229,57,53,.12); transform: translateY(0); }
    #tourOverlay .tour-btn.primary{ background: linear-gradient(180deg, rgba(229,57,53,.95), rgba(229,57,53,.8)); border-color: rgba(229,57,53,.7); box-shadow: 0 6px 22px rgba(229,57,53,.25); }
  #tourOverlay .tour-btn.primary:hover{ background: linear-gradient(180deg, rgba(229,57,53,1), rgba(229,57,53,.9)); box-shadow: 0 8px 26px rgba(229,57,53,.32); }
  #tourOverlay .tour-btn.primary:active{ background:#fff; color: var(--accent); border-color: rgba(229,57,53,.85); box-shadow: 0 4px 14px rgba(229,57,53,.18); }
  #tourOverlay .tour-progress{ font-size:12px; color:#9ca3af; }
  #tourOverlay .spotlight{ position:fixed; pointer-events:none; border-radius:12px; box-shadow: 0 0 0 2px rgba(255,255,255,.25), 0 0 0 8px rgba(229,57,53,.06), 0 20px 60px rgba(0,0,0,.45); transition: all .25s ease; }
  #tourSpot{ inset:40% 40% 40% 40%; }
  @media (prefers-reduced-motion: reduce){
    #tourOverlay .tour-dim-path{ transition:none; }
    #tourOverlay .spotlight{ transition:none; }
  }

    /* Cookie dialog readability */
    #cookieDialog .btn:not(.btn-accent){ background:#f4f4f5 !important; color:#0b0b0f !important; border:1px solid #d2d2d6 !important; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
    #cookieDialog .btn:not(.btn-accent):hover{ background:#ffffff !important; }
    /* User label size control — same place as admin panel, only for users */
    #mapStage #labelSizeCtrl{
      position: absolute;
      right: 12px;
      bottom: 12px;
      padding: 8px 10px;
      font-size: 13px;
      color: var(--muted);
      border-radius: 10px;
      background: linear-gradient(180deg, rgba(12,14,18,.9), rgba(12,14,18,.85));
      border: 1px solid rgba(255,255,255,0.04);
      box-shadow: 0 8px 26px rgba(0,0,0,0.6);
      backdrop-filter: blur(8px) saturate(140%);
      display: none;
      z-index: 60;
      align-items: center;
      gap: 8px;
    }
    #labelSizeCtrl .range{ width: 140px; }
    #labelSizeCtrl .value{ color: var(--text); font-weight: 600; min-width: 46px; text-align: right; }
    /* Make inner spans brighter for contrast */
    #coordsAdmin span {
      color: var(--text);
      font-weight: 600;
    }

    /* YouTube preview */
    #ytPreview{ position:absolute; width:320px; height:180px; background:#000; border:1px solid var(--border); border-radius:12px; overflow:hidden; display:none; z-index:5; box-shadow: 0 18px 48px rgba(0,0,0,.55); }
    #ytPreview iframe{ width:100%; height:100%; border:0; display:block; }
    #ytPreview #ytPreviewShield{ position:absolute; inset:0; background: transparent; z-index: 2; cursor: default; }
    /* Action buttons for mobile-pinned preview */
  #ytPreview .preview-actions{ position:absolute; top:6px; right:6px; display:none; z-index:3; gap:6px; }
  #ytPreview .preview-actions .icon-round{ width:28px; height:28px; border-radius:10px; }
  
  #adminControls{
    position:absolute;
    left: var(--space-12);
    top: var(--space-12);
    display:none;
    gap: var(--space-8);
    padding: var(--space-8);
    border-radius: var(--radius-12);
  }
  #accountFab{ position:absolute; right: var(--space-12); top: var(--space-12); z-index:80; display:none; }
  #coordsAdmin{ display:none; }
  #labelSizeCtrl{ display:none; }

    /* Custom site-styled alert modal (overrides native alert) */
    #siteAlertOverlay{ position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(3,4,6,0.55); z-index:1200; }
    .siteAlert{ width: min(560px, 92%); background: #ffffff; color: #0b0b0f; border-radius:12px; padding:16px 18px; box-shadow: 0 30px 70px rgba(0,0,0,0.6); border:1px solid rgba(0,0,0,0.06); font-size:14px; }
    .siteAlert .title{ font-weight:700; margin-bottom:8px; color: #0b0b0f; }
    .siteAlert .message{ color:#111; margin-bottom:14px; white-space:pre-wrap; }
    .siteAlert .actions{ display:flex; justify-content:flex-end; gap:8px; }
    .siteAlert .btn{ border-radius:10px; padding:10px 12px; background: #f4f4f5; color:#0b0b0f; border:1px solid #d2d2d6; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
    .siteAlert .btn:hover{ background:#ffffff; }
    .siteAlert .btn-close{ background:#f4f4f5; }
  .siteAlert .btn-ok{ min-width:86px; background: linear-gradient(180deg, rgba(229,57,53,.95), rgba(229,57,53,.8)); border-color: rgba(229,57,53,.7); color:#fff; box-shadow: 0 6px 18px rgba(229,57,53,.2); }
  .siteAlert .btn-ok:active{ background:#fff; color: var(--accent); }

  /* Общие оверлеи */
  .overlay{
    position:fixed;
    inset:0;
    background:rgba(3,4,6,0.55);
    backdrop-filter: blur(6px);
    align-items:center;
    justify-content:center;
    display:none;
  }
  #accountOverlay{ z-index:1400; }
  #cookieOverlay{ z-index:1500; }
  #accountModal{
    width:min(560px,92%);
    padding: var(--space-14);
    border-radius: var(--radius-12);
    max-height:92svh;
    overflow:auto;
  }
  #cookieDialog{
    width:min(640px,92%);
    padding: var(--space-16);
    border-radius: var(--radius-14);
    background:#ffffff;
    color:#0b0b0f;
    box-shadow:0 30px 70px rgba(0,0,0,.6);
    border:1px solid rgba(0,0,0,0.06);
  }
  #cookieTitle{ font-weight:700; font-size:18px; margin-bottom: var(--space-8); color:#0b0b0f; }
  #cookieText{ color:#111; line-height:1.6; margin-bottom: var(--space-14); }
  .cookie-actions{ display:flex; justify-content:flex-end; gap: var(--space-8); }

    /* ====== Auth styles ====== */
    .auth-card{ padding:12px; border-radius:12px; }
    .auth-tabs{ display:flex; gap:8px; margin-bottom:8px; justify-content:center; }
    .auth-tabs .tab{ padding:8px 12px; border-radius:10px; border:1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)); color:var(--text); cursor:pointer; box-shadow: 0 2px 10px rgba(0,0,0,.22); font-weight:700; }
    .auth-tabs .tab:hover{ background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025)); transform: translateY(-1px); }
    .auth-tabs .tab.active{ background: linear-gradient(180deg, rgba(229,57,53,.95), rgba(229,57,53,.8)); border-color: rgba(229,57,53,.7); box-shadow: 0 6px 18px rgba(229,57,53,.25); }
    .auth-tabs .tab.active:active{ background:#fff; color: var(--accent); }
    .auth-form{ display:grid; gap:12px; }
    .form-row{ display:flex; flex-direction:column; gap:6px; }
    .auth-input{ width:100%; padding:10px; border-radius:10px; border:1px solid var(--border); background:#0f131d; color:var(--text); }
    .input-with-icon{ position:relative; }
    .input-with-icon .icon-btn{ position:absolute; right:8px; top:50%; transform: translateY(-50%); background:transparent; border:0; color:var(--muted); cursor:pointer; padding:4px; border-radius:8px; }
    .input-with-icon .icon-btn:hover{ color:var(--text); }
    .error-text{ color:#ff6b6b; font-size:12px; }
    .hint{ color: var(--muted); font-size:12px; }
    .strength{ height:6px; border-radius:6px; background:rgba(255,255,255,0.08); overflow:hidden; }
    .strength > span{ display:block; height:100%; width:0%; background: var(--accent); transition: width .2s ease, background .2s ease; }
    .btn[disabled]{ opacity:.6; pointer-events:none; }
    /* Trailers panel — compact */
    .trailer-header{ display:flex; align-items:center; justify-content:space-between; padding: 2px 6px 2px; }
    #trailersBlock .trailer-title{ margin: 0; font-size: 12px; line-height: 1.2; opacity:.95; }
    #left #trailersBlock .trailer-title{ font-size: calc(12px * var(--left-scale)); }
    .trailer-actions{ display:flex; gap:6px; }
    .trailer-actions .icon-round{ width:28px; height:28px; border-radius:10px; line-height:1; }
    #left .trailer-actions .icon-round{ width: calc(28px * var(--left-scale)); height: calc(28px * var(--left-scale)); }
    .trailer-player{ width: calc(100% - 12px); margin: 2px 6px 2px; border-radius:10px; overflow:hidden; border:1px solid var(--border); background:#000; }
    .trailer-player iframe{ display:block; width:100%; aspect-ratio:16/9; border:0; }
    .trailer-tabs{ padding: 4px 6px 6px; display:flex; gap:6px; overflow-x:auto; white-space:nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .trailer-tabs::-webkit-scrollbar{ display: none; }
    .trailer-tabs .tab{ padding:6px 12px; border-radius:10px; border:1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)); color:var(--text); cursor:pointer; font-size:12px; box-shadow: 0 2px 8px rgba(0,0,0,.18); font-weight:700; }
    #left .trailer-tabs .tab{ font-size: calc(12px * var(--left-scale)); padding: calc(6px * var(--left-scale)) calc(12px * var(--left-scale)); border-radius: calc(10px * var(--left-scale)); }
    .trailer-tabs .tab:hover{ background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025)); transform: translateY(-1px); }
    .trailer-tabs .tab:active{ background: linear-gradient(180deg, rgba(229,57,53,.08), rgba(229,57,53,.04)); border-color: rgba(229,57,53,.35); box-shadow: 0 4px 12px rgba(229,57,53,.12); transform: translateY(0); color: var(--accent); }
    .trailer-tabs .tab.active{ background: linear-gradient(180deg, rgba(229,57,53,.95), rgba(229,57,53,.8)); border-color: rgba(229,57,53,.7); box-shadow: 0 6px 16px rgba(229,57,53,.2); color:#fff; }
    .trailer-tabs .tab.active:active{ background:#fff; color: var(--accent); }
    /* Trailers block pinned to bottom of left column */
    #trailersBlock{
      position: sticky !important;
      bottom: 12px;
      width: auto !important; max-width: 100% !important;
      margin-top: auto !important;
      z-index: 50;
    }
    /* Mobile account floating button */
    #accountFab{ width:40px; height:40px; border-radius:14px; border:1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015)); display:none; place-items:center; color: var(--text); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
    #accountFab:hover{ background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.025)); }
    #accountFab:active{ background:#fff; color: var(--accent); border-color: rgba(229,57,53,.6); }
    
    #trailerActions{ padding: 2px 6px 2px; display:flex; gap:8px; justify-content:flex-end; }
    #trailerActions .btn{ padding:8px 12px; border-radius:10px; }
    #trailerActions .btn-ghost{ background: rgba(255,255,255,.06); border-color: var(--border); }
    #trailerActions .btn-ghost:hover{ background: rgba(255,255,255,.1); }
    /* Quick links block in account panel */
#infoLinksBlock{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
      z-index: 60;
      display:flex;
  flex-direction:column-reverse;
  align-items:stretch;
  gap:6px;
  
}
.links-header{ display:flex; align-items:center; gap:10px; }
.links-toggle{
  background: #242428;
  flex:1;
  min-width:0;
  justify-content: space-between;
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  font-size:13px;
  border-color: var(--border);
  padding: 10px 12px;
}
.links-toggle .chev{ transition: transform .2s ease; opacity:.9; }
#infoLinksBlock.open .links-toggle .chev{ transform: rotate(180deg); }
#infoLinksBlock.open .links-toggle{
  background: linear-gradient(180deg, rgba(229,57,53,.10), rgba(229,57,53,.05));
      border-color: rgba(229,57,53,.35);
      box-shadow: 0 4px 18px rgba(229,57,53,.12);
    }
.links-list{
      display:none;
      flex-direction:column;
      gap:6px;
  margin-bottom:4px;
  align-items:center;
}
#infoLinksBlock.open .links-list{ display:flex; }
.link-item{
      width:80%;
      justify-content:center;
      gap:8px;
      font-weight:700;
      border-radius:10px;
      background: #242428;
      border:1px solid var(--border);
      box-shadow: 0 2px 10px rgba(0,0,0,.18);
      font-size:13px;
  height: 42px;
  text-align:center;
}
#right .link-item{ width:80%; }
#infoLinksBlock .links-list .link-item{ width:100%; }
.link-item:hover{ background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02)); transform: translateY(-1px); }
.link-text{ flex:1; text-align:center; }
.links-inline-lang{ display:flex; align-items:center; gap:8px; flex-shrink:0; position:relative; z-index:2; }
.links-inline-lang .lang-flag{
  width:36px;
  height:30px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#1b1b1f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  cursor:pointer;
  font-size:16px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.links-inline-lang .lang-flag.active{
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(229,57,53,0.4);
  background: rgba(229,57,53,0.14);
}
.links-inline-lang .lang-flag:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.links-inline-lang .lang-flag:active{ transform: translateY(1px); }
@media (max-width: 900px){
  .links-inline-lang{ display:none; }
}
    /* ====== Admin add-marker UI polish ====== */
    #adminPanel{ display:none; margin-top: var(--space-12); }
    #adminPanel .grid{ display:grid; gap: var(--space-8); }
    #adminPanel .grid.cols-2{ grid-template-columns: 1fr 1fr; }
    #adminPanel label{ font-size:12px; color: var(--muted); }
    #adminPanel input{ height: 38px; line-height: 38px; font-size: 14px; }
    #adminPanel .btn{ height: 38px; }
    #autoSummary{ display:none; }
    #clStatus{ min-height:18px; }
  #adminControls{ z-index: 600; }
#coordsAdmin{ z-index: 590; }
#labelSizeCtrl{ z-index: 590; }
.pick-pulse{ position:absolute; width:18px; height:18px; border-radius:50%; border:3px solid var(--accent); pointer-events:none; transform: translate(-50%, -50%); animation: ppulse .7s ease-out forwards; }
  @keyframes ppulse{ from{ opacity:.9; transform: translate(-50%, -50%) scale(1); } to{ opacity:0; transform: translate(-50%, -50%) scale(1.8); } }

/* Language switcher */
.btn-lang{ min-width:56px; padding:6px 10px; font-weight:600; }

  /* ====== Mobile layout ======*/
  @media (max-width: 900px){
      :root{ --left-w: 100%; --right-w: 100%; }
      #app{ display:flex; flex-direction:column; gap:10px; padding:10px; height:auto; min-height:100svh; }
      #left, #center, #right{ padding:10px; overflow:visible; }
      #right{ padding-bottom: 0; display:none; }
      #center{ order:-1; }
      .col-resizer{ display:none !important; }
      /* Map stage becomes a column: map viewport on top, utility bars below */
      #center #mapStage{ display:flex; flex-direction:column; gap:8px; }
      #center #mapContent{ position:relative; height: min(68svh, 520px); border-radius:12px; overflow:hidden; }
      #center #mapImage{ width:100%; height:100%; object-fit: fill; }
      /* Legend and slider flow below the map */
      #center #infoBar{ position:static; margin:0; padding:8px 10px; font-size:14px; display:block; }
      #center #infoBar .legend{ display:flex; flex-wrap:nowrap; overflow:auto; gap:8px; padding-top:6px; -webkit-overflow-scrolling: touch; scrollbar-width:none; }
      #center #infoBar .legend::-webkit-scrollbar{ display:none; }
      #center #labelSizeCtrl{ position:static; display:flex !important; align-items:center; justify-content:space-between; gap:10px; }
      #center #labelSizeCtrl .range{ width:100%; }
      #coordsAdmin{ display:none !important; }
      /* Seasons and account blocks spacing */
      #left h3, #right h3{ font-size:16px !important; }
      /* Trailers should not be pinned on mobile */
      #trailersBlock{ position: static !important; left:auto; right:auto; bottom:auto; width:auto !important; max-width: none !important; margin-top:12px !important; }
      /* Hide trailer actions (кнопка скачать и ссылка) on phones */
      #trailersBlock .trailer-actions{ display:none !important; }
      /* Hide account FAB on phones */
      #accountFab{ display:none !important; }
    }
  


    /* Dark buttons in cookie dialog for readability on light background */
    #cookieDialog .btn:not(.btn-accent){ background:#292929 !important; color:#fff !important; border-color:#0b0b0f !important; }
    #cookieDialog .btn:not(.btn-accent):hover{ background:#373737 !important; }
  
