/* REC: TACTICAL — shared components */

/* ================= HEADER ================= */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 1000;
  height: var(--header-h);
}
.site-header::before {
  content: ""; position: absolute; inset: 0;
  background: var(--bg-glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.site-header__inner {
  position: relative; height: 100%;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
}
.brand { display: inline-flex; align-items: center; justify-self: start; height: 40px; }
.brand img { height: 28px; width: auto; opacity: 0.65; transition: opacity var(--t) ease; }
.brand:focus-visible img { opacity: 1; }
@media (hover: hover) { .brand:hover img { opacity: 1; } }

.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 8px;
  border: 1px solid transparent;
  font-size: 15px; font-weight: 550; color: #9aa1aa; white-space: nowrap;
  transition: color var(--t) ease, background-color var(--t) ease, border-color var(--t) ease;
}
.nav-dd.is-open > .nav-link { color: #fff; background: rgba(255, 255, 255, 0.05); }
@media (hover: hover) { .nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); } }
.nav-link .ext { width: 10px; height: 10px; opacity: 0.55; stroke-width: 2.4; }
.nav-link .chev { width: 12px; height: 12px; opacity: 0.6; transition: transform var(--t) var(--ease); }
.nav-dd.is-open > .nav-link .chev { transform: rotate(180deg); }
.nav-link.is-active, .nav-link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.08); }

.nav-dd { position: relative; }
/* the menu opens centred under its button, 10px below the header; the padding keeps the hover path.
   The panel never fades (opacity < 1 on an ancestor would drop the menu's backdrop blur mid-animation) —
   the menu itself fades and slides from / back up to its button. */
.nav-dd__panel {
  position: absolute; top: 100%; left: 50%; z-index: 5;
  padding-top: calc((var(--header-h) - 38px) / 2 + 10px);
  translate: -50% 0;
  visibility: hidden;
  transition: visibility 0s linear var(--t);
}
.nav-dd.is-open .nav-dd__panel { visibility: visible; transition-delay: 0s; }
.nav-dd__menu {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 190px; padding: 6px; border-radius: 10px;
  background: var(--bg-glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: 50% 0;
  transition: opacity var(--t) ease, transform var(--t) var(--ease);
}
.nav-dd.is-open .nav-dd__menu { opacity: 1; transform: none; }
.lang .nav-dd__menu { min-width: 175px; max-height: calc(100dvh - var(--header-h) - 24px); overflow-y: auto; }
.nav-dd__item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; border-radius: 6px;
  font-size: 14px; font-weight: 500; line-height: 1.2; color: #9aa1aa; text-align: left; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.nav-dd__item:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; outline-offset: -2px; }
@media (hover: hover) { .nav-dd__item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; outline-offset: -2px; } }
.nav-dd__item .icon { flex: none; width: 15px; height: 15px; color: #9aa1aa; transition: color .15s ease; }
.nav-dd__item:focus-visible .icon { color: #fff; }
@media (hover: hover) { .nav-dd__item:hover .icon { color: #fff; } }
.nav-dd__item .ext { width: 10px; height: 10px; margin-left: auto; padding-left: 0; opacity: .55; stroke-width: 2.4; }
.nav-dd__item .flag { width: 21px; height: 15px; border-radius: 2.5px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18); }
.nav-dd__item[aria-checked="true"] { color: #fff; }
.nav-dd__item[aria-checked="true"]::after { content: ""; flex: none; margin-left: auto; width: 6px; height: 6px; border-radius: 1.5px; background: #fff; }
.nav-dd__sep { flex: none; height: 1px; margin: 3px 8px; background: var(--line); }

.header-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.header-actions .divider { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.flag { width: 25px; height: 18px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.lang-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; font-weight: 600; letter-spacing: .04em; transition: background-color var(--t) ease, color var(--t) ease; }
.nav-dd.is-open > .lang-btn { background: rgba(255,255,255,.05); color: #fff; }
@media (hover: hover) { .lang-btn:hover { background: rgba(255,255,255,.05); color: #fff; } }
.lang-btn .chev { width: 12px; height: 12px; opacity: .6; transition: transform var(--t) var(--ease); }
.nav-dd.is-open > .lang-btn .chev { transform: rotate(180deg); }
.burger { display: none; }

/* account: avatar + nickname (→ profile) and sign-out; a guest gets «Войти» */
.hacct { display: flex; align-items: center; gap: 2px; min-height: 38px; }
.hacct.is-pending { min-width: 96px; visibility: hidden; } /* session not known yet: hold the place, show nothing */
.hacct__me {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px 0 5px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap;
  transition: background-color var(--t) ease, color var(--t) ease;
}
@media (hover: hover) { .hacct__me:hover { background: rgba(255, 255, 255, 0.05); color: #fff; } }
.hacct__me[aria-current="page"] { background: rgba(255, 255, 255, 0.08); color: #fff; }
.hacct__nick { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.hacct__out { color: var(--text-3); }
.ava { position: relative; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 5px; overflow: hidden; background: #1b1f25; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.ava__ini { font-family: var(--font-osd); font-size: 14px; line-height: 1; color: var(--text-2); }
.ava__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.ava__img.is-on { opacity: 1; }

@media (max-width: 1280px) {
  .nav-link { padding: 0 11px; font-size: 14.5px; }
}
@media (max-width: 1100px) {
  .site-header__inner { grid-template-columns: 1fr auto; }
  .nav, .header-actions .lang, .header-actions .divider { display: none; }
  .burger { display: inline-grid; }
}
@media (max-width: 1100px) {
  /* touch layout: the avatar and the burger; signing out lives in the menu */
  .hacct__out { display: none; }
}
@media (max-width: 680px) {
  .brand img { height: 24px; }
  .hacct__nick, .hacct__in .btn-label { display: none; }
  .hacct__me { width: 40px; padding: 0; justify-content: center; }
  .hacct__in { width: 40px; padding: 0; }
}

/* ================= MOBILE MENU ================= */
.m-menu {
  position: fixed; inset: 0; z-index: 1100;
  width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--text);
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.25s ease, overlay 0.25s allow-discrete, display 0.25s allow-discrete;
}
.m-menu[open] { opacity: 1; display: flex; }
@starting-style { .m-menu[open] { opacity: 0; } }
.m-menu::backdrop { background: transparent; }
.m-menu__head { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); padding-inline: var(--gutter); border-bottom: 1px solid var(--line); flex: none; }
.m-menu__head img { height: 24px; width: auto; }
.m-menu__body { flex: 1; overflow-y: auto; padding: 18px var(--gutter) 28px; display: flex; flex-direction: column; gap: 26px; }
.m-menu__nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 0; border-bottom: 1px solid var(--line);
  font-family: var(--font-osd); font-size: 21px; letter-spacing: .05em; text-transform: uppercase; color: var(--head);
  transition: color var(--t) ease;
}
.m-menu__nav a[aria-current="page"], .m-menu__nav a.is-active { color: #fff; }
.m-menu__nav a .icon { color: var(--text-4); width: 16px; height: 16px; }
.m-menu__socials { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; } /* any number of configured links fills the row */
.m-menu__socials a { display: grid; place-items: center; gap: 6px; padding: 14px 6px; border-radius: var(--r-3); border: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.m-menu__socials .icon { width: 22px; height: 22px; }
.m-menu__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.m-menu__lang { display: grid; gap: 10px; }
.m-menu__lang-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  padding: 4px; border-radius: var(--r-3); border: 1px solid var(--line-2); background: rgba(255,255,255,.02);
}
.m-menu__lang-grid .seg__btn { justify-content: center; padding: 0 8px; height: 38px; gap: 6px; font-size: 13px; }
.m-menu__lang-grid .seg__btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.1); color: #fff; }
.m-menu__cta { display: grid; gap: 10px; margin-top: auto; }
.m-menu__cta:empty { display: none; }
.m-menu__me .ava { width: 24px; height: 24px; border-radius: 4px; }
.m-menu__me .ava__ini { font-size: 12px; }

/* ================= FOOTER ================= */
.site-footer {
  position: relative;
  background: var(--bg-footer);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 64px 0 32px;
}
.footer__top { display: grid; grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(0, 1fr)); gap: 40px; }
.footer__brand img { height: 34px; width: auto; opacity: .85; }
.footer__brand p { margin-top: 16px; max-width: 300px; font-size: 13.5px; color: var(--text-3); line-height: 1.6; }
.footer__socials { display: flex; gap: 6px; margin-top: 20px; }
.footer__socials a { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-3); border: 1px solid var(--line); color: var(--text-3); transition: color var(--t) ease, border-color var(--t) ease; }
@media (hover: hover) { .footer__socials a:hover { color: #fff; border-color: var(--line-strong); } }
.footer__socials .icon { width: 17px; height: 17px; }
.footer__col h2 {
  font-family: var(--font-osd); font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--head); -webkit-text-stroke: .4px currentColor; margin-bottom: 18px;
}
.footer__col ul { display: grid; gap: 10px; }
.footer__col a, .footer__col button { font-size: 14.5px; color: #9aa1aa; transition: color var(--t) ease; text-align: left; }
@media (hover: hover) { .footer__col a:hover, .footer__col button:hover { color: #fff; } }
.footer__bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }
.footer__disclaimer { max-width: 820px; font-size: 13.5px; line-height: 1.6; color: #88909d; }
.footer__meta { display: flex; align-items: center; gap: 16px; flex: none; }
.footer__copy { font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-4); white-space: nowrap; }
/* the fixed «to top» button covers the right end of the last footer line where the gutter is narrow: keep that corner free */
.footer__meta { padding-right: clamp(0px, 24px - (100vw - 1440px) / 2, 24px); }
@media (max-width: 1100px) {
  .footer__top { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer__brand { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
  .footer__brand p { margin-top: 0; max-width: 420px; }
  .footer__socials { margin-top: 0; }
  .footer__meta { padding-right: 48px; }
}
@media (max-width: 760px) {
  .footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 24px; }
  .footer__brand { display: grid; gap: 14px; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
  .footer__meta { width: 100%; justify-content: space-between; }
  .footer__copy { white-space: normal; min-width: 0; }
}

/* ================= HUD CORNER BRACKETS ================= */
.hud { position: relative; }
.hud::before {
  --c: var(--hud-c, rgba(255, 255, 255, 0.95));
  --l: var(--hud-len, 15px);
  --w: var(--hud-w, 2px);
  content: ""; position: absolute; inset: var(--hud-inset, -1px); z-index: 4; pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l);
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.45));
  opacity: 0;
  transition: opacity var(--t) ease;
}
.hud:focus-visible::before, .hud.is-active::before, .hud--on::before { opacity: 1; }
@media (hover: hover) { .hud:hover::before { opacity: 1; } }
.hud--soft { --hud-c: rgba(255, 255, 255, 0.55); --hud-len: 12px; --hud-w: 1.5px; }
.hud--soft::before { filter: none; }

/* ================= CAMERA OSD (live HUD) ================= */
.cam { position: absolute; pointer-events: none; z-index: 3; color: #e9ecef; font-family: var(--font-osd); text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 0 1px rgba(0,0,0,.9); }
.cam__c { position: absolute; width: 44px; height: 44px; border: 0 solid rgba(236, 239, 242, 0.86); filter: drop-shadow(0 0 3px rgba(255,255,255,.25)); }
.cam__c--tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.cam__c--tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.cam__c--bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.cam__c--br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.cam__rec { position: absolute; top: 20px; left: 22px; display: flex; align-items: center; gap: 9px; font-size: 22px; letter-spacing: .02em; }
.cam__rec .dot { width: 13px; height: 13px; }
.cam__meta { position: absolute; top: 12px; right: 96px; text-align: right; font-size: 20px; line-height: 1.25; letter-spacing: .03em; white-space: pre; font-variant-numeric: tabular-nums; }
.cam__bat { position: absolute; top: 22px; right: 22px; width: 44px; height: 22px; border: 2px solid currentColor; border-radius: 3px; padding: 2px; display: flex; gap: 2px; }
.cam__bat::after { content: ""; position: absolute; right: -6px; top: 5px; width: 3px; height: 8px; background: currentColor; border-radius: 0 2px 2px 0; }
.cam__bat i { flex: 1; background: currentColor; }
.cam__bat i:last-child { animation: rec-blink 2.4s steps(1) infinite; }
.cam__tc { position: absolute; left: 22px; bottom: 18px; font-size: 16px; letter-spacing: .06em; opacity: .85; font-variant-numeric: tabular-nums; }
.cam__mode { position: absolute; right: 22px; bottom: 18px; font-size: 16px; letter-spacing: .06em; opacity: .85; }
.cam--compact .cam__rec { font-size: 18px; top: 14px; left: 16px; }
.cam--compact .cam__meta { font-size: 15px; top: 10px; right: 76px; }
.cam--compact .cam__bat { top: 15px; right: 16px; width: 36px; height: 18px; }
.cam--compact .cam__bat::after { top: 3px; }
.cam--compact .cam__c { width: 30px; height: 30px; }
.cam--compact .cam__tc, .cam--compact .cam__mode { font-size: 13px; bottom: 12px; }
.cam--compact .cam__tc { left: 16px; } .cam--compact .cam__mode { right: 16px; }

/* power-on sequence: one orchestrated moment per session */
.cam.is-booting .cam__c { animation: cam-corner .7s var(--ease) both; }
.cam.is-booting .cam__c--tr { animation-delay: .05s; } .cam.is-booting .cam__c--bl { animation-delay: .1s; } .cam.is-booting .cam__c--br { animation-delay: .15s; }
.cam.is-booting .cam__rec, .cam.is-booting .cam__meta, .cam.is-booting .cam__bat, .cam.is-booting .cam__tc, .cam.is-booting .cam__mode { animation: cam-flicker .9s steps(1) .45s both; }
@keyframes cam-corner { from { opacity: 0; width: 4px; height: 4px; } to { opacity: 1; } }
@keyframes cam-flicker { 0% { opacity: 0; } 20% { opacity: 1; } 32% { opacity: 0; } 44% { opacity: 1; } 52% { opacity: .3; } 60%, 100% { opacity: 1; } }

/* ================= SCENE LAYERS ================= */
.scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.scene__media {
  position: absolute; top: -30px; left: -36px;
  width: calc(100% + 72px); max-width: none; height: calc(100% + 60px);
  object-fit: cover; will-change: transform;
}
.scene__noise {
  position: absolute; inset: -40px;
  background: url("../img/ui/noise.webp") repeat; background-size: 160px 160px;
  opacity: 0.1; animation: grain 0.28s steps(1) infinite;
}
.scene__grid {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
}
.scene__fade { position: absolute; inset: 0; }
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-18px, 10px); } 40% { transform: translate(12px, -16px); }
  60% { transform: translate(-8px, 18px); } 80% { transform: translate(16px, 6px); } 100% { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) { .scene__noise { animation: none; } }

/* ================= PAGE HERO (inner pages) ================= */
/* the photo dissolves along an eased curve (no visible start or end of the fade). The scene runs --scene-tail
   further down than the hero, under the start of the next section, so a short hero's photo has room to fade out
   instead of stopping at its edge; the next section paints above it. The profile keeps its fade inside (profile.css) */
.page-hero {
  --title-shadow: 0 2px 18px rgba(0, 0, 0, 0.85); --scene-tail: 200px; --scene-fade: 420px;
  position: relative; isolation: isolate; overflow: hidden; padding: calc(var(--header-h) + 76px) 0 64px;
}
@supports (overflow: clip) { .page-hero { overflow: clip visible; } }
.page-hero > .scene { bottom: calc(var(--scene-tail) * -1); }
.page-hero .scene__media { --scene-end: 30px; }
.page-hero .scene__noise { --scene-end: 40px; }
.page-hero .scene__grid { --scene-end: 0px; }
.page-hero .scene__media, .page-hero .scene__noise, .page-hero .scene__grid {
  -webkit-mask-image: linear-gradient(to bottom,
    #000 calc(100% - var(--scene-end) - var(--scene-fade)),
    rgba(0, 0, 0, 0.965) calc(100% - var(--scene-end) - var(--scene-fade) * 0.88),
    rgba(0, 0, 0, 0.864) calc(100% - var(--scene-end) - var(--scene-fade) * 0.76),
    rgba(0, 0, 0, 0.713) calc(100% - var(--scene-end) - var(--scene-fade) * 0.64),
    rgba(0, 0, 0, 0.531) calc(100% - var(--scene-end) - var(--scene-fade) * 0.52),
    rgba(0, 0, 0, 0.345) calc(100% - var(--scene-end) - var(--scene-fade) * 0.4),
    rgba(0, 0, 0, 0.181) calc(100% - var(--scene-end) - var(--scene-fade) * 0.28),
    rgba(0, 0, 0, 0.062) calc(100% - var(--scene-end) - var(--scene-fade) * 0.16),
    transparent calc(100% - var(--scene-end)));
  mask-image: linear-gradient(to bottom,
    #000 calc(100% - var(--scene-end) - var(--scene-fade)),
    rgba(0, 0, 0, 0.965) calc(100% - var(--scene-end) - var(--scene-fade) * 0.88),
    rgba(0, 0, 0, 0.864) calc(100% - var(--scene-end) - var(--scene-fade) * 0.76),
    rgba(0, 0, 0, 0.713) calc(100% - var(--scene-end) - var(--scene-fade) * 0.64),
    rgba(0, 0, 0, 0.531) calc(100% - var(--scene-end) - var(--scene-fade) * 0.52),
    rgba(0, 0, 0, 0.345) calc(100% - var(--scene-end) - var(--scene-fade) * 0.4),
    rgba(0, 0, 0, 0.181) calc(100% - var(--scene-end) - var(--scene-fade) * 0.28),
    rgba(0, 0, 0, 0.062) calc(100% - var(--scene-end) - var(--scene-fade) * 0.16),
    transparent calc(100% - var(--scene-end)));
}
.page-hero .scene__fade {
  background:
    linear-gradient(90deg, rgba(6, 7, 9, 0.94) 0%, rgba(6, 7, 9, 0.6) 46%, rgba(6, 7, 9, 0.25) 100%),
    linear-gradient(to bottom, rgba(7, 8, 10, 0.6) 0%, transparent 30%);
}
.page-hero__inner { position: relative; z-index: 2; }
.page-hero__title { margin-top: 20px; }
.page-hero__lead { margin-top: 20px; max-width: 560px; color: var(--text-photo); text-shadow: var(--text-shadow); }
.page-hero .cam { top: calc(var(--header-h) + 22px); right: var(--gutter); width: min(560px, 42vw); height: calc(100% - var(--header-h) - 70px); }
@media (max-width: 900px) { .page-hero .cam { display: none; } }
@media (max-width: 680px) {
  .page-hero { padding-top: calc(var(--header-h) + 44px); padding-bottom: 40px; }
  .page-hero { --scene-tail: 120px; --scene-fade: 300px; }
}

/* ================= SECTION HEAD ================= */
.section { position: relative; padding: var(--section-y) 0; }
.section--line { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 44px; }
.section-head__main { display: grid; gap: 18px; }
.section-head p { max-width: 520px; color: var(--text-2); }
@media (max-width: 760px) { .section-head { flex-direction: column; align-items: flex-start; gap: 20px; margin-bottom: 32px; } }

/* ================= PANEL ================= */
.panel {
  position: relative;
  background: rgba(12, 14, 18, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
}
.panel--pad { padding: 24px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.panel__title { font-family: var(--font-osd); font-size: 19px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--head); -webkit-text-stroke: .5px currentColor; }
.panel__sub { margin-top: 4px; font-size: 13px; color: var(--text-3); }
.panel__body { padding: 20px 24px; }

/* ================= TABS ================= */
.tabs__list { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs__list::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; height: 46px; padding: 0 16px;
  font-size: 14.5px; font-weight: 500; color: var(--text-3); white-space: nowrap;
  transition: color var(--t) ease;
}
@media (hover: hover) { .tab:hover { color: var(--text); } }
.tab[aria-selected="true"] { color: #fff; }
.tab::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: #fff; transform: scaleX(0); transition: transform .3s var(--ease); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .count { margin-left: 6px; font-size: 12px; color: var(--text-4); }

/* chips (filters) */
.chips { display: flex; flex-wrap: wrap; gap: 8px 6px; }
.chip {
  height: 32px; padding: 0 13px; border-radius: 6px; background: rgba(255, 255, 255, 0.05);
  font-size: 13px; font-weight: 500; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px;
  transition: color var(--t) ease, background-color var(--t) ease;
}
@media (hover: hover) { .chip:hover { color: #fff; background: rgba(255, 255, 255, 0.09); } }
.chip[aria-pressed="true"] { color: var(--btn-text); background: var(--btn); }
.chip .count { font-size: 11.5px; opacity: .6; }
/* touch: a 44px hit area around the 32px chip, the look stays the same */
@media (pointer: coarse) {
  .chip { position: relative; }
  .chip::after { content: ""; position: absolute; inset: -6px -3px; }
}

/* ================= ACCORDION ================= */
.acc__item { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.acc__btn {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  width: 100%; padding: 22px 0; text-align: left;
  font-size: 15.5px; line-height: 1.5; font-weight: 500; color: var(--head);
  transition: color var(--t) ease;
}
.acc__item.is-open .acc__btn { color: #fff; }
@media (hover: hover) { .acc__btn:hover { color: #fff; } }
.acc__btn:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.acc__sign { position: relative; flex: none; width: 20px; height: 20px; margin-top: 2px; }
.acc__sign::before, .acc__sign::after { content: ""; position: absolute; left: 3px; right: 3px; top: 9px; height: 2px; background: #fff; border-radius: 1px; transition: transform .3s var(--ease); }
.acc__sign::after { transform: rotate(90deg); }
.acc__item.is-open .acc__sign::after { transform: rotate(0deg); }
.acc__panel { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s var(--ease), opacity .35s var(--ease); }
.acc__item.is-open .acc__panel { grid-template-rows: 1fr; opacity: 1; }
.acc__inner { overflow: hidden; }
.acc__inner > div { padding: 0 44px 24px 0; font-size: 15px; line-height: 1.62; color: #9aa1aa; }
.acc__inner p + p { margin-top: 10px; }
.acc__inner a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255,255,255,.3); }

/* ================= MODAL (native dialog) ================= */
.modal {
  --w: 520px;
  width: min(var(--w), calc(100vw - 32px));
  max-width: none; max-height: calc(100dvh - 48px);
  margin: auto; padding: 0;
  border: 1px solid var(--line-2); border-radius: 0;
  background: #0b0d10; color: var(--text);
  box-shadow: var(--shadow-pop);
  /* square corners: the HUD corner brackets sit exactly on them; not clipped, the body scrolls itself */
  overflow: visible;
  flex-direction: column; /* layout lives on the base rule so it survives the closing transition */
  opacity: 0; transform: scale(0.985); /* fades in place — no rise */
  transition: opacity .26s ease, transform .32s var(--ease), overlay .32s allow-discrete, display .32s allow-discrete;
}
.modal[open] { display: flex; opacity: 1; transform: none; }
@starting-style { .modal[open] { opacity: 0; transform: scale(0.985); } }
.modal::backdrop {
  background: rgba(4, 6, 8, 0.72);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .26s ease, overlay .32s allow-discrete, display .32s allow-discrete;
}
.modal[open]::backdrop { opacity: 1; }
@starting-style { .modal[open]::backdrop { opacity: 0; } }
.modal--sm { --w: 440px; } .modal--lg { --w: 720px; } .modal--xl { --w: 960px; }
.modal__head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); flex: none; }
.modal__title { font-family: var(--font-osd); font-size: 21px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; -webkit-text-stroke: .5px currentColor; line-height: 1.1; }
.modal__sub { margin-top: 6px; font-size: 13.5px; color: var(--text-3); }
.modal__close { margin: -6px -8px 0 0; }
.modal__body { padding: 22px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
.modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); flex: none; background: rgba(255,255,255,.015); }
.modal .stack { display: grid; gap: 16px; }
.modal .stack > [data-redeem-result]:empty { display: none; } /* no double gap before the result appears */
@media (max-width: 600px) {
  .modal { width: 100%; max-height: 92dvh; margin: auto 0 0; border-bottom: 0; transform: none; }
  @starting-style { .modal[open] { transform: none; } }
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 auto; }
  .modal::after { inset: 0; }
}

/* ================= IN-PLACE FEEDBACK ================= */
/* REC.say(): the control itself tells the result for a moment — its label («Сохранено», «Ссылка скопирована») and
   icon turn into the answer; icon-only controls answer in their tooltip, tinted the same way. No toasts. */
.is-said { transition: color .15s ease, border-color .15s ease; }
.is-said--ok:not(.btn--primary) { color: var(--ok); }
.is-said--err:not(.btn--primary) { color: var(--err); }
.btn--outline.is-said--ok, .icon-btn--line.is-said--ok { border-color: rgba(143, 199, 155, 0.45); }
.btn--outline.is-said--err, .icon-btn--line.is-said--err { border-color: rgba(239, 122, 111, 0.45); }
.tip.tip--ok { color: var(--ok); }
.tip.tip--err { color: var(--err); }
.tip.tip--info { color: #fff; }
/* a finished one-off action leaves its result where the button was (e.g. «Чек отправлен повторно»), on a tinted plate */
.modal__said { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--r-3); background: var(--ok-bg); font-size: 14px; font-weight: 600; color: #c4e2ca; }
.modal__said .icon { flex: none; color: var(--ok); }

/* ================= TOOLTIPS ================= */
/* one bubble for every [data-tip] (positioned by core.js; a popover, so it also shows above open dialogs).
   No outline: a near-black plate lifted off the page by a soft two-layer shadow */
.tip {
  position: fixed; inset: auto; left: 0; top: 0; z-index: 3000; margin: 0;
  width: max-content; max-width: min(260px, calc(100vw - 16px)); height: auto; overflow: visible;
  padding: 7px 10px; border: 0; outline: 0; border-radius: var(--r-2);
  background: rgba(3, 4, 5, 0.97);
  box-shadow: 0 14px 34px -6px rgba(0, 0, 0, 0.85), 0 3px 10px rgba(0, 0, 0, 0.6);
  font: 500 12.5px/1.35 var(--font-ui); color: #e6e9ed; text-align: center; letter-spacing: 0;
  pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity .12s ease;
}
.tip.is-on { opacity: 1; visibility: visible; }
@starting-style { .tip.is-on { opacity: 0; } }
/* a hint, not text: the plain arrow over marks with a tip (no I-beam, no «?»); controls keep the hand */
[data-tip] { cursor: default; }
button[data-tip], a[data-tip], label[data-tip] { cursor: pointer; }

/* ================= TABLE ================= */
.table-wrap { overflow-x: auto; }
.table { width: 100%; font-size: 14px; }
.table th { padding: 12px 16px; text-align: left; font-family: var(--font-osd); font-size: 12px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--text-4); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ================= MISC ================= */
.skel { display: block; border-radius: 4px; background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.085) 50%, rgba(255,255,255,.04) 75%); background-size: 200% 100%; animation: skel 1.3s linear infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 36px 20px; color: var(--text-3); font-size: 14px; }
.empty > .icon { width: 26px; height: 26px; color: var(--text-4); margin-bottom: 4px; }
.empty b { color: var(--text); font-weight: 600; font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 24px; font-size: 14px; }
.kv dt { color: var(--text-3); } .kv dd { color: var(--text); text-align: right; }
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-3); border: 1px solid var(--line-2); background: rgba(255,255,255,.02); font-size: 13.5px; line-height: 1.5; color: var(--text-2); }
.note .icon { margin-top: 1px; color: var(--text-3); }
.note--warn { border-color: var(--accent-line); background: var(--accent-bg); color: #e9d3a6; }
.note--warn .icon { color: var(--accent); }
.note--err { border-color: rgba(239,122,111,.3); background: var(--err-bg); color: #f0b8b2; }
.note--ok { border-color: rgba(143,199,155,.3); background: var(--ok-bg); color: #c4e2ca; }
.note--ok .icon { color: var(--ok); }
.avatar { width: 64px; height: 64px; border-radius: var(--r-3); background: #14181d; border: 1px solid var(--line-2); object-fit: cover; }
.divider-title { display: flex; align-items: center; gap: 20px; font-family: var(--font-osd); font-size: 14px; letter-spacing: .32em; text-transform: uppercase; color: var(--text-2); }
.divider-title::before, .divider-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line-3)); }
.divider-title::after { background: linear-gradient(90deg, var(--line-3), transparent); }
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 900; width: 44px; height: 44px; border-radius: var(--r-3); background: rgba(12,14,18,.9); border: 1px solid var(--line-2); color: var(--text-2); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity var(--t) ease, color var(--t) ease, border-color var(--t) ease; }
.to-top.is-visible { opacity: 1; pointer-events: auto; }
@media (hover: hover) { .to-top:hover { color: #fff; border-color: var(--line-strong); } }
@media (max-width: 680px) { .to-top { right: 16px; bottom: 16px; } .footer__meta { padding-right: 52px; } }

/* ================= LIGHTBOX ================= */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(4, 6, 8, 0.9); color: var(--text);
  grid-template-rows: auto 1fr auto;
  opacity: 0; transition: opacity .25s ease, overlay .25s allow-discrete, display .25s allow-discrete;
}
.lightbox[open] { opacity: 1; display: grid; }
@starting-style { .lightbox[open] { opacity: 0; } }
.lightbox::backdrop { background: rgba(4,6,8,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gutter); }
.lightbox__count { font-family: var(--font-osd); font-size: 16px; letter-spacing: .08em; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.lightbox__stage { position: relative; display: grid; place-items: center; padding: 0 88px; min-height: 0; }
.lightbox__frame {
  position: relative; width: min(100%, calc((100dvh - 190px) * 16 / 9), 1440px); aspect-ratio: 16 / 9;
  border: 1px solid rgba(255,255,255,.14); border-radius: 8px; overflow: hidden; background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: lb-in .35s var(--ease) both;
}
.lightbox__frame img, .lightbox__frame video, .lightbox__frame iframe { width: 100%; height: 100%; object-fit: contain; border: 0; background: #000; }
@keyframes lb-in { from { opacity: 0; transform: scale(.96); } }
.lightbox__nav { position: absolute; top: 50%; translate: 0 -50%; width: 48px; height: 48px; border-radius: var(--r-3); display: grid; place-items: center; color: var(--text-2); transition: color var(--t) ease, background-color var(--t) ease; }
@media (hover: hover) { .lightbox__nav:hover { color: #fff; background: rgba(255,255,255,.06); } }
.lightbox__nav .icon { width: 26px; height: 26px; }
.lightbox__nav--prev { left: 20px; } .lightbox__nav--next { right: 20px; }
.lightbox__caption { padding: 16px var(--gutter) 22px; text-align: center; font-size: 14.5px; color: var(--text-2); min-height: 60px; }
.lightbox__caption b { color: #fff; font-weight: 600; }
.lightbox .icon-btn .icon { width: 22px; height: 22px; }
@media (max-width: 760px) {
  .lightbox__stage { padding: 0 12px; }
  .lightbox__frame { width: 100%; }
  .lightbox__nav { top: auto; bottom: -58px; translate: none; }
  .lightbox__nav--prev { left: 12px; } .lightbox__nav--next { right: 12px; }
}

/* modal corner brackets (dialogs live in the top layer, so no .hud wrapper);
   drawn on the border like the card brackets, the dialog does not clip them */
.modal::after {
  --c: rgba(255, 255, 255, 0.45); --l: 12px; --w: 1.5px;
  content: ""; position: absolute; inset: -1px; pointer-events: none; z-index: 5;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l);
  background-repeat: no-repeat;
}
html.is-locked { overflow: hidden; }
html { scrollbar-gutter: stable; }

/* ================= NEWS CARDS ================= */
.news-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr)); gap: 16px; }
.news-grid .ncard__media { aspect-ratio: auto; height: clamp(180px, 15vw, 230px); }
.ncard {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--r-4); border: 1px solid var(--line); background: #0b0d10;
  transition: border-color var(--t) ease, background-color var(--t) ease;
}
.ncard:focus-within { border-color: transparent; background: #0d1014; }
@media (hover: hover) { .ncard:hover { border-color: transparent; background: #0d1014; } }
.ncard__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 9px 9px 0 0; background: #0d1014; }
.ncard__media img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.78) saturate(.9); transition: filter .3s ease, transform .6s var(--ease); }
@media (hover: hover) { .ncard:hover .ncard__media img { filter: brightness(.95); transform: scale(1.02); } }
.ncard__media .badge { position: absolute; left: 20px; top: 16px; background: rgba(5,6,8,.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #e6e9ed; }
.ncard__body { display: grid; gap: 10px; padding: 18px 20px 22px; align-content: start; flex: 1; }
.ncard__meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.ncard__meta i { width: 3px; height: 3px; border-radius: 50%; background: var(--text-4); }
.ncard__title { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--text); letter-spacing: -.005em; }
.ncard__title a::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.ncard__excerpt { font-size: 14px; line-height: 1.55; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ncard--feature .ncard__title { font-size: 21px; }
.ncard--feature .ncard__media { aspect-ratio: 16 / 8.2; }
.news-grid .ncard--feature .ncard__media { aspect-ratio: auto; }
@media (max-width: 1100px) {
  .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news-grid .ncard--feature { grid-column: 1 / -1; }
  .news-grid .ncard__media { height: auto; aspect-ratio: 16 / 9; }
  .news-grid .ncard--feature .ncard__media, .ncard--feature .ncard__media { aspect-ratio: 21 / 9; }
}
@media (max-width: 680px) {
  .news-grid { grid-template-columns: minmax(0, 1fr); }
  .news-grid .ncard--feature .ncard__media, .ncard--feature .ncard__media { aspect-ratio: 16 / 9; }
}

/* auth dialog social buttons & divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--font-osd);
  margin: 2px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn--google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-weight: 500;
  transition: background-color var(--t) ease, border-color var(--t) ease, color var(--t) ease;
}
.btn--google .icon {
  width: 18px;
  height: 18px;
  flex: none;
}
@media (hover: hover) {
  .btn--google:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
  }
}
