/* КЛАНСКИ на телефоне (30.10.2026). Подключается на каждой странице ПОСЛЕДНИМ.
   Телефон держат горизонтально (mobile-fit.js просит повернуть), а у такого экрана высота 360–430px при ширине до 932px:
   прежняя «мобильная» вёрстка включалась только до 900px, поэтому широкие телефоны (932px) получали десктопный макет на экране высотой 430px.
   Здесь:
     • M  — любой «мобильный» экран: ширина ≤900px ИЛИ горизонтальный экран ниже 520px → шапка с меню «три полоски» вместо ряда пунктов и нижней панели;
     • PL — телефон горизонтально (высота ≤520px): компактная главная (карточка героя в углу, медальоны, статистика справа, кнопки «Магазин / В БОЙ / Кабинет» внизу),
            страницы разделов в две колонки по бокам от героя, меньше отступы и шрифты. Убраны «Новый сезон» и значок настроек. */

/* ======================================================================
   M. Шапка: [☰] [знак] [название страницы] … [валюта] [🔔] [аватар]
   ====================================================================== */
.hh-burger, .hh-pagename, .hh-nav-backdrop { display: none; }

@media (max-width: 900px), (orientation: landscape) and (max-height: 520px) {
  :root { --hh-h: 48px; }
  .hh-header, .hub .hh-header { height: var(--hh-h); padding: 0 8px; gap: 8px; -webkit-backdrop-filter: none; backdrop-filter: none; justify-content: flex-start; }
  .hub [data-reveal-top], body.app-on .hub [data-reveal-top] { transform: none; }
  .hh-logo-mark { height: 30px; }
  .hh-logo-word { display: none; }

  .hh-burger {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; flex: none; width: 40px; height: 36px; padding: 0; cursor: pointer;
    border-radius: 10px; border: 1px solid rgba(255, 150, 70, 0.45); background: rgba(255, 255, 255, 0.07); -webkit-tap-highlight-color: transparent;
  }
  .hh-burger i { display: block; width: 18px; height: 2px; border-radius: 2px; background: #ffd98a; transition: transform 0.2s, opacity 0.2s; }
  body.nav-open .hh-burger { background: rgba(255, 120, 40, 0.22); border-color: rgba(255, 170, 80, 0.8); }
  body.nav-open .hh-burger i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.nav-open .hh-burger i:nth-child(2) { opacity: 0; }
  body.nav-open .hh-burger i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .hh-pagename { display: flex; align-items: center; gap: 7px; flex: 1 1 0; min-width: 0; padding: 0 4px; color: #ffd98a; font: 700 15px/1.1 var(--f-ui, system-ui, sans-serif); }
  .hh-pagename-ic { display: inline-flex; flex: none; font-size: 18px; }
  .hh-pagename-ic .ic { width: 1em; height: 1em; }
  .hh-pagename-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* пункты меню — выпадающая панель под кнопкой */
  .hh-nav, .hub .hh-nav {
    display: none; position: fixed; left: 8px; right: auto; top: calc(var(--hh-h) + 6px); bottom: auto; width: min(240px, calc(100vw - 16px)); z-index: 130; margin: 0;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; padding: 6px; max-height: calc(100vh - var(--hh-h) - 16px); overflow-y: auto;
    background: rgba(14, 8, 5, 0.98); border: 1px solid rgba(255, 150, 70, 0.4); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), 0 0 24px rgba(255, 100, 40, 0.14);
  }
  body.nav-open .hh-nav { display: flex; }
  body.nav-open .hh-nav-backdrop { display: block; position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, 0.35); }
  .hh-nav .hh-nav-link {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; height: auto; padding: 10px 12px; font-size: 15px; font-weight: 600; text-align: left;
    border: 0; border-radius: 10px; background: transparent; box-shadow: none; color: #e9d7bd;
  }
  .hh-nav .hh-nav-link::before, .hh-nav .hh-nav-link::after { display: none !important; }
  .hh-nav .hh-nav-link-icon { flex: none; width: 26px; font-size: 20px; justify-content: center; filter: none; color: #fff; }
  .hh-nav .hh-nav-link-text { font-size: 15px; }
  .hh-nav .hh-nav-link-active, .hh-nav .hh-nav-link-active:hover { background: rgba(255, 120, 40, 0.2); color: #ffd98a; box-shadow: inset 3px 0 0 #ff8a3a; border: 0; }
  .hh-nav .hh-nav-link-battle { color: #ff9a62; }
  .hh-nav .hh-nav-link-city, .hh-nav .hh-nav-link-city.hh-nav-link-active { color: #ffc93c; font-weight: 800; text-shadow: none; }
  body main { padding-bottom: 24px; }

  /* справа: валюта, колокольчик, аватар */
  .hh-header-right { flex: none; margin-left: auto; gap: 6px; }
  .hh-currency-group { padding: 2px 4px; }
  .hh-currency-chip { padding: 2px 7px; gap: 4px; font-size: 12.5px; }
  .hh-currency-icon { font-size: 15px; }
  .hh-plus { width: 17px; height: 17px; }
  .hh-plus::before { width: 9px; height: 2.2px; }
  .hh-plus::after { width: 2.2px; height: 9px; }
  .hh-icon-btn { padding: 4px; }
  .hh-icon-btn .ic { width: 22px; height: 22px; }
  .hh-dot { width: 8px; height: 8px; top: 2px; right: 3px; }
  .hh-user { padding: 2px; gap: 0; border-color: transparent; background: none; }
  .hh-user-text, .hh-chevron { display: none; }
  .hh-avatar { width: 32px; height: 32px; box-shadow: 0 0 0 1.5px #1a0d07, 0 0 0 3px #d8561a; }
  .hh-notif-toast { width: min(280px, 70vw); }
  #challengeLayer { top: calc(var(--hh-h) + 6px); }
}
@media (max-width: 440px) { .hh-currency-icon { display: none; } .hh-pagename-ic { display: none; } .hh-pagename { font-size: 13px; } .hh-header { gap: 6px; padding-left: 6px; padding-right: 6px; } .hh-currency-chip { padding: 2px 5px; font-size: 11.5px; } .hh-header-right { gap: 3px; } }

/* ======================================================================
   PL. Телефон горизонтально
   ====================================================================== */
@media (orientation: landscape) and (max-height: 520px) {
  /* ---------- Главная ---------- */
  body[data-view="home"] .view-home { display: block; overflow: hidden; padding: 0; pointer-events: none; }
  .hm-left, .hm-right { display: block; position: absolute; }
  .hm-left > *, .hm-right > * { pointer-events: auto; }
  .hm-left { left: 8px; top: 8px; width: 160px; }
  .hm-status, .hm-tips, .hm-wait, .hm-season, .hm-settings, .hm-lines { display: none !important; }

  /* медальоны характеристик: 2×2 фишки под карточкой героя */
  .hm-medals { position: absolute; left: 8px; top: 92px; width: 164px; height: auto; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; --u: 1px; pointer-events: none; }
  .med { position: relative !important; left: auto !important; top: auto !important; width: auto; margin: 0; display: flex; align-items: center; gap: 5px; padding: 3px 7px 3px 3px; text-align: left;
    border-radius: 999px; background: rgba(10, 6, 4, 0.66); border: 1px solid color-mix(in srgb, var(--mc) 60%, transparent); pointer-events: auto; }
  .med-disc { flex: none; width: 26px; height: 26px; margin: 0; }
  .med-ring { -webkit-mask: radial-gradient(circle farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.6px)); mask: radial-gradient(circle farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.6px)); }
  .med-glow, .med-bezel { display: none; }
  .med-face { inset: 2px; }
  .med-face .ic { width: 16px; height: 16px; animation: none; }
  .med-label { display: none; }
  .med .med-val, .med[data-k] .med-val { margin: 0; font-size: 16px; line-height: 1; text-shadow: none; }

  /* правая колонка: статистика боёв и рейтинг — компактные карточки */
  .hm-right { right: 8px; top: 8px; width: clamp(196px, 27vw, 250px); --u: 0.6px; }
  .hm-right .ui-card { margin-bottom: 8px; }
  .hm-right .ui-card-head { height: 28px; padding: 0 8px; gap: 8px; font-size: 12.5px; }
  .hm-right .ui-card-head .ic { width: 18px; height: 18px; }
  .hm-battle-row { min-height: 0 !important; padding: 6px 0 6px !important; }
  .hm-battle-row .ic { width: 18px; height: 18px; }
  .hm-battle-row span { margin-top: 2px; font-size: 10.5px; }
  .hm-battle-row b { margin-top: 1px; font-size: 18px; letter-spacing: -0.02em; }
  .hm-rating-row { padding: 6px 0 6px !important; }
  .hm-rating-row span { font-size: 10.5px; }
  .hm-rating-row b { margin-top: 3px; font-size: 16px; }
  .hm-rating-foot { padding: 7px 10px; font-size: 11.5px; }
  .hm-rating-foot .ic { width: 14px; height: 14px; }

  /* кнопки «Магазин / В БОЙ / Кабинет» — внизу по центру */
  .hm-cta { position: absolute; left: 50%; right: auto; bottom: 10px; margin: 0 0 0 -190px; width: 380px; height: 50px; z-index: 6; --u: 0.5px; }
  .cta-side { width: 112px; height: 38px; font-size: 13px; }
  .cta-side .cta-in { gap: 6px; }
  .cta-side .cta-in .ic { width: 22px; height: 22px; }
  .cta-shop .cta-in, .cta-cab .cta-in { transform: none; }
  .cta-main { width: 170px; height: 50px; font-size: 22px; }
  .cta-main .cta-in { gap: 8px; }
  .cta-main .cta-in .ic { width: 30px; height: 30px; }
  .cta-side .cta-bg, .cta-side .cta-bg::before { clip-path: polygon(0 50%, 14px 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 14px 100%); }
  .cta-cab .cta-bg, .cta-cab .cta-bg::before { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 12px 50%); }
  .cta-main .cta-bg, .cta-main .cta-bg::before, .cta-main .cta-bg::after { clip-path: polygon(0 50%, 20px 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%); }
  .cta-spark { display: none; }

  /* карточка героя: развёрнутая — по размеру экрана */
  .hm-hero-host.open { --u: 0.78px; width: min(300px, calc(100vw - 16px)); }
}

/* ---------- Страницы разделов во фрейме: две колонки по бокам от героя ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  html.embedded { --hero-gap: clamp(150px, 30vw, 300px); }
  html.embedded main { column-count: 2; column-gap: var(--hero-gap); padding: 8px 10px 20px; }
  html.embedded:has(.hm-hero-host) main::before { content: ""; display: block; height: 70px; }
  html.embedded.fight main { column-count: 1; column-gap: 0; padding: 6px 8px 14px; }
  html.embedded main > h1 { font-size: 1.15rem; margin: 2px 0 8px; }
}

/* ---------- Плашка характеристик (.sp-feet): компактная, 2 ряда по центру ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .sp-feet { bottom: 6px; display: grid; grid-template-columns: repeat(4, auto); gap: 4px 10px; padding: 5px 12px; border-radius: 16px; width: auto; max-width: min(250px, 28vw); }
  .sp-feet .sf-disc { width: 22px; height: 22px; }
  .sp-feet .sf-disc .ic { width: 14px; height: 14px; }
  .sp-feet .sf-val { font-size: 14px; }
  .sp-feet .sf-stat { gap: 4px; }
  .sp-feet .sf-cbx { grid-column: 1 / -1; flex-direction: row; gap: 8px; padding: 2px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.15); }
  .sp-feet .sf-delta { font-size: 11px; top: -9px; }
  .clan-lobby .sp-feet { top: 56px; bottom: auto; }
}

/* ---------- Колонки вокруг героя: берём --hero-gap, слоты — внутри просвета ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  html.embedded #duelPanels.dl-grid { grid-template-columns: minmax(0, 1fr) var(--hero-gap) minmax(0, 1fr); }
  html.embedded main.duel-page { padding: 8px 10px 20px; }
  .duel-page { --r: min(0.72px, calc((100vw - 24px) / 1100)); }
  .sp-slots { top: 58px; width: calc(var(--hero-gap, 220px) - 12px); --sl: calc((var(--hero-gap, 220px) - 12px) * 0.2737); }
  .sp-slots-col { gap: 6px; }
  .sp-slots .sl-ico { font-size: 22px; }
  .sp-slots .sl-cap { font-size: 8px; }
  .sp-slots .sl-emoji { font-size: 24px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .sp-feet .sf-online { grid-column: 1 / -1; flex-direction: row; gap: 8px; padding: 0 0 2px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.15); }
  .sp-feet .sf-online .sf-name { font-size: 10px; }
  .sp-feet .sf-online b { font-size: 14px; }
}

/* Кнопка «В бой» рассчитана на колонку 525 r — сжимаем под фактическую колонку */
@media (orientation: landscape) and (max-height: 520px) {
  html.embedded .dl-fight { --r: calc((100vw - var(--hero-gap, 220px) - 24px) / 1050); }
}

/* ---------- 3D-мир и арена: компактный HUD ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .w-top { left: 8px; top: 8px; gap: 6px; }
  .w-btn, .w-online { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 9px; }
  .arena-body .w-online { max-width: 84px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .w-minimap canvas { width: 96px !important; height: 96px !important; }
  .w-side { width: 112px; right: 8px; top: 8px; }
  .w-jump { width: 64px; height: 64px; right: 14px; bottom: 16px; font-size: 12px; }
}
