/* «Рубежи» — оформление игры. Токены цвета и шрифтов — из общего
   assets/css/style.css; здесь только раскладка и детали игры.
   Всё приложение — один блок .rb-app: карта, бой, лавка, настройки живут в нём
   слоями. Так «во весь экран» разворачивает игру целиком, а не один холст. */

.rb-section { padding-top: clamp(16px, 3vw, 36px); }

.rb-app {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - var(--nav-h) - 24px); min-height: 380px;
  border-radius: var(--radius); overflow: hidden; background: var(--bg);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--nav-h) + 8px);
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body); color: var(--text);
}
@media (max-width: 700px) and (orientation: portrait) {
  .rb-app { aspect-ratio: auto; height: calc(100svh - var(--nav-h) - 24px); min-height: 520px; max-height: none; border-radius: var(--radius-sm); }
  .rb-section .container { padding-left: 8px; padding-right: 8px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  /* Телефон боком: игра — всё, что ниже шапки сайта. Больше — только «во весь экран». */
  .rb-app { aspect-ratio: auto; height: calc(100svh - var(--nav-h) - 8px); min-height: 280px; max-height: none; border-radius: 10px; }
  .rb-section { padding-top: 8px; }
  .rb-toast { font-size: .8rem; padding: 7px 12px; max-width: 60%; top: 56px; }
  .rb-hint { bottom: 70px; font-size: .8rem; }
}
.rb-app:fullscreen { max-height: none; aspect-ratio: auto; border-radius: 0; border: 0; width: 100vw; height: 100vh; }
.rb-app:-webkit-full-screen { max-height: none; border-radius: 0; border: 0; width: 100vw; height: 100vh; }
.rb-app.is-psevdo { position: fixed; inset: 0; z-index: 1000; max-height: none; min-height: 0; aspect-ratio: auto; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; }
html.rb-lock, html.rb-lock body { overflow: hidden; }

.rb-apploading, .rb-err { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: .95rem; padding: 20px; text-align: center; }
.rb-app:not(.is-loading) .rb-apploading { display: none; }

.rb-ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rb-app button { font: inherit; color: inherit; cursor: pointer; }
.rb-app [hidden], .rb-boj [hidden] { display: none !important; }  /* бой живёт и в редакторе, вне .rb-app */

/* ---------- Общие мелочи ---------- */
.rb-stat {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; font-variant-numeric: tabular-nums;
  background: rgba(12, 10, 19, .72); border: 1px solid var(--border); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-weight: 600; font-size: .92rem; line-height: 1;
}
.rb-stat i { font-style: normal; color: var(--text-3); font-weight: 500; }
.rb-lives .rb-ic { color: var(--rose); fill: rgba(240,143,176,.25); }
.rb-gold .rb-ic, .rb-mon .rb-ic { color: var(--gold-2); }
.rb-wave .rb-ic { color: var(--violet-2); }
.rb-zv .rb-ic { color: var(--gold-2); fill: rgba(240,180,111,.35); }
.rb-tb {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 42px; padding: 0 10px;
  border-radius: 12px; border: 1px solid var(--border-strong); background: rgba(12, 10, 19, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-weight: 600; font-size: .9rem; transition: background .15s, border-color .15s;
}
.rb-tb:hover { background: rgba(40, 34, 60, .85); border-color: rgba(255,255,255,.28); }
.rb-tb[aria-pressed="false"] { color: var(--text-3); }
.rb-x {
  position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface);
}
.rb-mbox .btn .rb-ic, .rb-kpanel .btn .rb-ic { margin-right: 6px; }

/* ---------- Карта королевства ---------- */
.rb-karta { position: absolute; inset: 0; display: flex; flex-direction: column; }
.rb-kbar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 10px; pointer-events: none; }
.rb-kbar > * { pointer-events: auto; }
.rb-kbar-l, .rb-kbar-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rb-title { font-family: var(--font-display); font-size: 1.35rem; color: var(--gold-2); text-shadow: 0 2px 8px rgba(0,0,0,.8); margin-right: 4px; }
.rb-kscroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.rb-kmap { position: relative; height: 100%; aspect-ratio: 16 / 9; min-width: 100%; }
.rb-kcanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rb-flags { position: absolute; inset: 0; }
.rb-flag {
  position: absolute; width: 46px; height: 58px; margin: -54px 0 0 -12px; padding: 0; border: 0; background: none;
  display: block; transition: transform .15s;
}
.rb-flag:hover:not(:disabled), .rb-flag.is-sel { transform: translateY(-3px) scale(1.08); }
.rb-fpole { position: absolute; left: 10px; top: 6px; width: 3px; height: 48px; border-radius: 2px; background: #6a4a2a; box-shadow: 0 6px 6px -2px rgba(0,0,0,.6); }
.rb-fnum {
  position: absolute; left: 13px; top: 6px; min-width: 28px; height: 24px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
  border-radius: 2px 8px 8px 2px; background: #c0503a; color: #fff4dc; font-weight: 700; font-size: .85rem; border: 1px solid rgba(0,0,0,.4);
  box-shadow: 0 3px 8px rgba(0,0,0,.5);
}
.rb-fnum .rb-ic { width: 15px; height: 15px; }
.rb-flag.is-done .rb-fnum { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #241406; }
.rb-flag.is-lock .rb-fnum { background: #4a4462; color: var(--text-3); }
.rb-flag.is-lock { cursor: default; opacity: .8; }
.rb-flag.is-boss .rb-fnum { background: #6a2a3a; }
.rb-flag.is-boss.is-done .rb-fnum { background: linear-gradient(135deg, var(--gold-2), var(--gold)); }
.rb-flag.is-next .rb-fnum { animation: rb-pulse 1.4s ease-in-out infinite; }
.rb-flag.is-sel .rb-fnum { outline: 2px solid #fff4dc; outline-offset: 2px; }
.rb-flag-b .rb-fnum { background: #3d3793; }
@keyframes rb-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(240,180,111,.7); } 50% { box-shadow: 0 0 0 8px rgba(240,180,111,0); } }
.rb-fstars { position: absolute; left: -4px; top: 52px; display: flex; gap: 1px; }
.rb-fstars i { width: 11px; height: 11px; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 35%); background: rgba(255,255,255,.2); }
.rb-fstars i.on { background: var(--gold-2); }
.rb-fm { position: absolute; top: 34px; width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0,0,0,.5); }
.rb-fm-g { left: 38px; background: var(--rose); }
.rb-fm-z { left: 38px; top: 45px; background: var(--violet-2); }

.rb-kpanel {
  position: absolute; z-index: 5; right: 12px; top: 64px; bottom: 12px; width: min(360px, calc(100% - 24px)); overflow-y: auto;
  padding: 20px 18px 18px; border-radius: var(--radius-sm); background: rgba(18, 14, 28, .94); border: 1px solid var(--border-strong);
  box-shadow: 0 20px 60px rgba(0,0,0,.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 10px;
}
.rb-kpanel h3 { font-family: var(--font-display); font-size: 1.45rem; color: var(--gold-2); margin: 0; padding-right: 40px; line-height: 1.2; }
.rb-kpanel p { margin: 0; color: var(--text-2); font-size: .9rem; line-height: 1.5; }
.rb-eyebrow { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--violet-2); }
.rb-pstars { display: flex; gap: 4px; }
.rb-pstars span .rb-ic { width: 26px; height: 26px; color: rgba(255,255,255,.2); fill: rgba(255,255,255,.06); }
.rb-pstars span.on .rb-ic { color: var(--gold-2); fill: var(--gold); }
.rb-segs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--border); }
/* «.rb-segs .rb-seg», а не «.rb-seg»: общее «.rb-app button { font: inherit }»
   специфичнее одного класса и раздувало шрифт до 16px — «Железный» на телефоне
   вылезал за край панели. min-width: 0 — чтобы flex мог ужать кнопки. */
.rb-segs .rb-seg { font-size: .82rem; font-weight: 600; min-width: 0; }
.rb-seg { flex: 1; min-height: 38px; border-radius: 9px; border: 0; background: none; font-size: .82rem; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 3px; padding: 0 4px; }
.rb-seg .rb-ic { width: 14px; height: 14px; color: var(--teal); }
.rb-seg.is-on { background: rgba(240,180,111,.16); color: var(--gold-2); }
.rb-seg:disabled { opacity: .45; cursor: default; }
.rb-rznote { font-size: .82rem !important; }
.rb-hpick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .85rem; color: var(--text-2); }
.rb-chip { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .82rem; font-weight: 600; }
.rb-chip.is-on { border-color: rgba(240,180,111,.7); color: var(--gold-2); background: rgba(240,180,111,.1); }
.rb-chip-more { color: var(--text-3); border-style: dashed; }
.rb-go { margin-top: auto; justify-content: center; position: sticky; bottom: 0; box-shadow: 0 -8px 20px rgba(18,14,28,.9); }
@media (max-height: 520px) {
  .rb-kpanel { top: 8px; bottom: 8px; padding: 14px 14px 12px; gap: 8px; }
  .rb-kpanel h3 { font-size: 1.15rem; }
  .rb-kpanel p { font-size: .82rem; }
  .rb-pstars span .rb-ic { width: 20px; height: 20px; }
  .rb-seg { min-height: 34px; }
}
.rb-rec b { font-size: .85rem; }
.rb-rec ol { margin: 6px 0 0; padding-left: 22px; font-size: .88rem; color: var(--text-2); }

@media (max-width: 700px) {
  .rb-kpanel { top: auto; left: 8px; right: 8px; width: auto; max-height: 72%; bottom: 8px; }
  .rb-title { font-size: 1.1rem; }
  .rb-tb-t span { display: none; }
}

/* ---------- Бой ---------- */
.rb-bojwrap, .rb-boj { position: absolute; inset: 0; }
.rb-boj { outline: none; overflow: hidden; }
.rb-canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: pointer; }
.rb-boj.is-target .rb-canvas { cursor: crosshair; }
.rb-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 10px; pointer-events: none; z-index: 3; }
.rb-top > * { pointer-events: auto; }
.rb-stats, .rb-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.rb-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; padding: 10px; pointer-events: none; z-index: 3; }
.rb-bottom > * { pointer-events: auto; }
.rb-hero-grp, .rb-spells { display: flex; gap: 8px; align-items: flex-end; }
.rb-hero {
  position: relative; width: 60px; height: 60px; border-radius: 50%; border: 2px solid var(--gold-2); padding: 0;
  background: radial-gradient(circle at 40% 35%, #3a3056, #16121f); box-shadow: 0 6px 20px rgba(0,0,0,.5);
  display: inline-flex; align-items: center; justify-content: center; color: var(--gold-2);
}
.rb-hero .rb-ic { width: 28px; height: 28px; }
.rb-hero.is-sel { box-shadow: 0 0 0 4px rgba(240,180,111,.45), 0 6px 20px rgba(0,0,0,.5); }
.rb-hp { position: absolute; left: 6px; right: 6px; bottom: -6px; height: 6px; border-radius: 3px; background: rgba(12,10,19,.9); overflow: hidden; border: 1px solid rgba(0,0,0,.5); }
.rb-hp i { display: block; height: 100%; width: calc(var(--hp, 1) * 100%); background: linear-gradient(90deg, #7ad48a, #b6ecb8); }
.rb-hero-lvl { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--gold); color: #241406; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.rb-dead { position: absolute; inset: 0; border-radius: 50%; display: none; align-items: center; justify-content: center; background: rgba(12,10,19,.75); color: var(--text); font-weight: 700; }
.rb-hero.is-dead .rb-dead { display: flex; }
.rb-sk {
  position: relative; width: 50px; height: 50px; border-radius: 14px; border: 1px solid var(--border-strong); padding: 0; overflow: hidden;
  background: rgba(22, 18, 34, .88); display: inline-flex; align-items: center; justify-content: center; color: var(--text-3);
  box-shadow: 0 6px 16px rgba(0,0,0,.45);
}
.rb-sk .rb-ic { width: 24px; height: 24px; position: relative; z-index: 1; }
.rb-sk.is-ready { color: var(--gold-2); border-color: rgba(240,180,111,.6); }
.rb-sk.is-armed { background: rgba(240,180,111,.25); box-shadow: 0 0 0 3px rgba(240,180,111,.5); }
.rb-cd { position: absolute; inset: 0; background: conic-gradient(rgba(12,10,19,.78) calc(var(--cd, 0) * 360deg), transparent 0); }
.rb-sp.is-ready { color: #ffd0a0; }

.rb-calls { position: absolute; left: 0; top: 0; z-index: 2; }
.rb-call {
  position: absolute; left: -25px; top: -25px; width: 50px; height: 50px; border-radius: 50%; padding: 0;
  border: 2px solid var(--gold-2); background: radial-gradient(circle at 40% 35%, #c0503a, #5a1f22);
  color: #fff4dc; display: flex; align-items: center; justify-content: center; flex-direction: column;
  box-shadow: 0 0 0 0 rgba(240,180,111,.6), 0 6px 18px rgba(0,0,0,.55); animation: rb-pulse 1.6s ease-in-out infinite;
}
.rb-call .rb-ic { width: 22px; height: 22px; }
.rb-call span { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: .75rem; font-weight: 700; color: var(--gold-2); text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.rb-call span:empty { display: none; }
.rb-call::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(rgba(240,180,111,.55) calc(var(--t, 1) * 360deg), transparent 0); -webkit-mask: radial-gradient(circle, transparent 27px, #000 28px); mask: radial-gradient(circle, transparent 27px, #000 28px); }

.rb-ring { position: absolute; left: 0; top: 0; z-index: 4; width: 0; height: 0; }
.rb-ring-bg { position: absolute; left: -64px; top: -64px; width: 128px; height: 128px; border-radius: 50%; border: 2px dashed rgba(240,180,111,.45); pointer-events: none; }
.rb-rb {
  position: absolute; left: -25px; top: -25px; width: 50px; height: 50px; border-radius: 50%; padding: 0;
  border: 2px solid rgba(240,180,111,.75); background: radial-gradient(circle at 40% 35%, #3d3560, #17121f);
  color: var(--gold-2); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0,0,0,.55);
  transition: box-shadow .12s, background .12s;
}
.rb-rb .rb-ic { width: 22px; height: 22px; }
.rb-rb em {
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .72rem; font-weight: 800; line-height: 1;
  padding: 3px 6px; border-radius: 8px; background: #16121f; border: 1px solid rgba(240,180,111,.6); color: var(--gold-2); white-space: nowrap;
}
.rb-rb em.rb-lbl { color: var(--text); border-color: var(--border-strong); font-weight: 600; }
.rb-rb.is-dis { filter: grayscale(.8); opacity: .75; }
.rb-rb.is-dis em { color: #e8734c; }
.rb-rb.is-lock { border-color: var(--border-strong); color: var(--text-3); }
.rb-rb.is-sell { border-color: rgba(154,157,212,.7); color: var(--violet-2); }
.rb-rb.is-armed { background: radial-gradient(circle at 40% 35%, #f0b46f, #b8672a); color: #241406; box-shadow: 0 0 0 4px rgba(240,180,111,.4), 0 6px 16px rgba(0,0,0,.55); }
.rb-pips { position: absolute; top: -6px; display: flex; gap: 2px; }
.rb-pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.2); border: 1px solid rgba(0,0,0,.5); }
.rb-pips i.on { background: var(--gold-2); }

.rb-info {
  position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); bottom: 78px; width: min(420px, calc(100% - 20px));
  padding: 12px 14px; border-radius: 12px; background: rgba(18, 14, 28, .95); border: 1px solid var(--border-strong); box-shadow: 0 12px 40px rgba(0,0,0,.6);
  font-size: .85rem; line-height: 1.45; pointer-events: none;
}
.rb-info.is-low { bottom: auto; top: auto; bottom: 78px; }
.rb-info b { color: var(--gold-2); font-family: var(--font-display); font-size: 1.05rem; }
.rb-info p { margin: 4px 0 0; color: var(--text-2); }
.rb-info .rb-info-st { color: var(--text); font-variant-numeric: tabular-nums; }
.rb-info .rb-info-c { color: var(--gold-2); display: flex; align-items: center; gap: 4px; }
.rb-info .rb-ic { width: 14px; height: 14px; }

.rb-toast, .rb-hint, .rb-apptoast {
  position: absolute; left: 50%; top: 62px; transform: translate(-50%, -8px); z-index: 6; max-width: min(520px, calc(100% - 24px));
  padding: 10px 16px; border-radius: 12px; background: rgba(18, 14, 28, .95); border: 1px solid rgba(240,180,111,.45);
  font-size: .9rem; line-height: 1.45; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.rb-hint { top: auto; bottom: 80px; border-color: var(--border-strong); }
.rb-toast.is-on, .rb-hint.is-on, .rb-apptoast.is-on { opacity: 1; transform: translate(-50%, 0); }
.rb-apptoast { z-index: 20; }

.rb-modal, .rb-nastr {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(8, 6, 14, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.rb-mbox {
  position: relative; width: min(460px, 100%); max-height: 100%; overflow-y: auto; padding: 24px 22px; border-radius: var(--radius); text-align: center;
  background: linear-gradient(180deg, #1b1529, #120e1c); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.rb-mbox h3 { font-family: var(--font-display); font-size: 1.8rem; margin: 0 0 6px; color: var(--gold-2); }
.rb-mbox.is-lose h3 { color: #e8734c; }
.rb-m-sub { color: var(--text-2); margin: 4px 0 10px; font-size: .92rem; }
.rb-m-coins { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-2); font-weight: 700; font-size: 1.1rem; margin: 6px 0; }
.rb-m-xp, .rb-m-note { color: var(--text-2); font-size: .88rem; margin: 4px 0; }
.rb-mbtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.rb-mbtns .btn { display: inline-flex; align-items: center; }
.rb-stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 6px; }
.rb-bigstar .rb-ic { width: 46px; height: 46px; color: rgba(255,255,255,.18); fill: rgba(255,255,255,.05); }
.rb-bigstar.on .rb-ic { color: var(--gold-2); fill: var(--gold); }
.rb-bigstar.on { animation: rb-star .5s cubic-bezier(.2, 1.6, .5, 1) both; }
.rb-bs0 { animation-delay: .2s !important; } .rb-bs1 { animation-delay: .45s !important; } .rb-bs2 { animation-delay: .7s !important; }
@keyframes rb-star { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.rb-nbox { text-align: left; }
.rb-nbox h4 { margin: 16px 0 6px; font-size: .95rem; color: var(--gold-2); }
.rb-row { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: .92rem; }
.rb-row input { width: 18px; height: 18px; accent-color: var(--gold); }
.rb-savestr { width: 100%; font: 12px/1.4 ui-monospace, monospace; background: rgba(0,0,0,.35); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px; resize: vertical; user-select: text; -webkit-user-select: text; }
.rb-nmsg { min-height: 1.3em; font-size: .85rem; color: var(--teal); margin: 6px 0 0; }
.rb-danger { color: #e8734c !important; border-color: rgba(232,115,76,.5) !important; }
.rb-nbox a { color: var(--gold-2); }

.rb-load { position: absolute; inset: 0; z-index: 12; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.rb-load-box { width: min(300px, 70%); text-align: center; color: var(--text-2); font-size: .92rem; }
.rb-bar { margin-top: 10px; height: 6px; border-radius: 3px; background: rgba(240,180,111,.15); overflow: hidden; }
.rb-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .15s; }

.rb-rotate {
  position: absolute; z-index: 8; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 8px; align-items: center; padding: 8px 10px 8px 14px;
  border-radius: 12px; background: rgba(107,111,174,.25); border: 1px solid rgba(154,157,212,.5); font-size: .82rem; line-height: 1.35;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.rb-rotate button { flex: none; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: rgba(12,10,19,.5); display: inline-flex; align-items: center; justify-content: center; }
.rb-app:not([data-scr="karta"]) .rb-rotate { display: none; }
.rb-app.rb-panel-open .rb-rotate { display: none; }

/* Узкий экран боя: панели плотнее, подписи короче. */
.rb-boj.is-uzko .rb-stat { padding: 5px 8px; font-size: .84rem; }
.rb-boj.is-uzko .rb-tb { min-width: 38px; height: 38px; padding: 0 7px; }
.rb-boj.is-uzko .rb-sk { width: 46px; height: 46px; }
.rb-boj.is-uzko .rb-hero { width: 54px; height: 54px; }
.rb-boj.is-uzko [data-a="zvuk"] { display: none; }  /* звук — в настройках карты; в узкой строке важнее скорость и пауза */
.rb-boj.is-uzko .rb-stats, .rb-boj.is-uzko .rb-tools { gap: 4px; }
.rb-boj.is-uzko .rb-stat .rb-ic { width: 15px; height: 15px; }
.rb-boj.is-uzko .rb-toast { font-size: .8rem; padding: 8px 12px; max-width: 86%; }
.rb-hero-ic canvas { width: 48px; height: 48px; display: block; }
.rb-boj.is-uzko .rb-hero-ic canvas { width: 44px; height: 44px; }

/* ---------- Лавка ---------- */
.rb-lavka { position: absolute; inset: 0; display: flex; flex-direction: column; background: radial-gradient(ellipse at top, #1d1630, #0c0a13 70%); }
.rb-lhead { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.rb-lhead h3 { font-family: var(--font-display); color: var(--gold-2); font-size: 1.4rem; margin: 0; flex: 1; }
.rb-lwallet { display: flex; gap: 6px; }
.rb-ltabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.rb-ltab { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; font-weight: 600; font-size: .9rem; color: var(--text-2); white-space: nowrap; }
.rb-ltab.is-on { color: var(--gold-2); border-bottom-color: var(--gold-2); }
.rb-lbody { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.rb-lnote { margin: 0 0 12px; color: var(--text-2); font-size: .86rem; line-height: 1.5; max-width: 70ch; }
.rb-tree { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.rb-tcol { display: flex; flex-direction: column; gap: 6px; }
.rb-tname { display: flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--gold-2); min-height: 26px; }
.rb-tnode {
  position: relative; text-align: left; padding: 8px 10px 8px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,.03);
  display: flex; flex-direction: column; gap: 2px; min-height: 76px;
}
.rb-tnode span { font-weight: 600; font-size: .84rem; }
.rb-tnode small { color: var(--text-3); font-size: .74rem; line-height: 1.3; }
.rb-tnode em { font-style: normal; display: inline-flex; align-items: center; gap: 3px; margin-top: auto; font-size: .8rem; font-weight: 700; color: var(--gold-2); }
.rb-tnode em .rb-ic { width: 13px; height: 13px; }
.rb-tnode.is-own { border-color: rgba(95,212,196,.45); background: rgba(95,212,196,.07); }
.rb-tnode.is-own em { color: var(--teal); }
.rb-tnode.is-can { border-color: rgba(240,180,111,.6); background: rgba(240,180,111,.08); }
.rb-tnode.is-next em { color: var(--text-3); }
.rb-tnode.is-lock { opacity: .45; cursor: default; }
.rb-tnode.is-armed { box-shadow: 0 0 0 2px var(--gold-2); }
.rb-lfoot { margin-top: 14px; }
.rb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rb-card { display: flex; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,.03); }
.rb-card.is-sel { border-color: rgba(240,180,111,.55); }
.rb-prev { width: 96px; height: 96px; flex: none; border-radius: 12px; background: radial-gradient(circle at 50% 70%, #2a2440, #14101d); }
.rb-prevs { display: flex; flex-direction: column; gap: 6px; }
.rb-prevs .rb-prev { width: 72px; height: 72px; }
.rb-cbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rb-cbody h4 { margin: 0; font-family: var(--font-display); font-size: 1.1rem; color: var(--text); }
.rb-cbody h4 small { font-family: var(--font-body); font-size: .75rem; color: var(--violet-2); font-weight: 500; }
.rb-cbody p { margin: 0; font-size: .82rem; color: var(--text-2); line-height: 1.45; }
.rb-cstat { display: flex; align-items: center; gap: 6px; }
.rb-xp { display: inline-block; width: 70px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.rb-xp i { display: block; height: 100%; background: var(--gold-2); }
.rb-skills { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: .78rem; color: var(--text-2); }
.rb-skills li { display: flex; gap: 6px; align-items: flex-start; }
.rb-skills li div { flex: 1; }
.rb-skills li span { display: block; color: var(--text-3); }
.rb-skills .rb-ic { width: 13px; height: 13px; color: var(--gold-2); transform: translateY(2px); }
.rb-skills b { color: var(--text); font-weight: 600; }
.rb-skills i { font-style: normal; color: var(--violet-2); font-size: .72rem; }
.rb-buy {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid rgba(240,180,111,.6); background: rgba(240,180,111,.1); color: var(--gold-2); font-weight: 700; font-size: .85rem;
}
.rb-buy .rb-ic { width: 15px; height: 15px; }
.rb-buy.is-dis { border-color: var(--border); color: var(--text-3); background: none; }
.rb-buy.is-armed { background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #241406; }
.rb-buy.is-on { border-color: rgba(95,212,196,.5); color: var(--teal); background: rgba(95,212,196,.08); }
.rb-tag { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--teal); }
.rb-tag .rb-ic { width: 14px; height: 14px; }
.rb-gear { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 4px; }
.rb-gitem { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; align-items: center; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.03); }
.rb-gitem b { font-size: .82rem; }
.rb-gitem .rb-pips { position: static; }
.rb-gitem small { grid-column: 1 / -1; font-size: .74rem; color: var(--text-3); }
.rb-gitem .rb-buy, .rb-gitem .rb-tag { grid-column: 3; grid-row: 1; justify-self: end; min-height: 32px; }

/* ---------- Под игрой ---------- */
.rb-koshel-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.rb-links { font-size: .85rem; color: var(--text-3); }
.rb-links a { color: var(--text-2); }
.rb-rules { margin-top: 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.rb-rules summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; font-weight: 600; }
.rb-rules summary::-webkit-details-marker { display: none; }
.rb-rules summary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s; }
.rb-rules[open] summary svg { transform: rotate(180deg); }
.rb-rules-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); padding: 0 16px 16px; }
.rb-rules .card { padding: 18px; }
.rb-rules h3 { font-family: var(--font-display); font-size: 1.1rem; margin: 0 0 8px; color: var(--gold-2); }
.rb-rules p { margin: 0; color: var(--text-2); line-height: 1.55; font-size: .92rem; }
kbd { font: 600 12px/1 var(--font-body); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .rb-flag.is-next .rb-fnum, .rb-call, .rb-bigstar.on { animation: none; }
}

/* Слой фона боя: холст размера карты, двигается CSS-трансформом (boj.js). */
.rb-fonwrap { position: absolute; inset: 0; overflow: hidden; background: #0c0a13; pointer-events: none; }
.rb-fon { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }

@media (max-width: 480px) {
  /* Узкий телефон: название игры уже есть в заголовке страницы — строку карты
     отдаём звёздам, монетам и кнопкам, чтобы они не переносились в два ряда. */
  .rb-title { display: none; }
  .rb-kbar-l, .rb-kbar-r { flex-wrap: nowrap; gap: 6px; }
  .rb-kbar .rb-tb { min-width: 40px; height: 40px; }
}
@media (max-width: 520px) {
  /* Лавка на узком телефоне: картинка над текстом, снаряжение не вылезает за карточку. */
  .rb-cards { grid-template-columns: minmax(0, 1fr); }
  .rb-card { flex-direction: column; }
  .rb-prev { width: 80px; height: 80px; }
  .rb-prevs { flex-direction: row; }
  .rb-gitem { grid-template-columns: auto minmax(0, 1fr) auto; }
  .rb-ltab { padding: 0 10px; }
  .rb-lhead h3 { font-size: 1.15rem; }
}
.rb-gear, .rb-gitem { min-width: 0; }

/* Ссылки в общую лавку сайта (герои, специализации, облики продаются там):
   выглядят как кнопки рядом, но это переход на другую страницу. */
a.rb-tb, a.rb-buy, a.rb-chip { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
a.rb-buy.rb-vlavku { color: var(--gold-2); margin-top: 8px; }
.rb-lnote a.rb-vlavku { margin: 0 0 0 6px; vertical-align: middle; }
