/* Палитра — ART_BIBLE.md («Солнечный мультяшный двор») */
:root {
  --cream: #FEF0DB;
  --cream-2: #F6E3C4;
  --outline: #4A3628;
  --kiosk: #FDD26E;
  --kiosk-dark: #D89A55;
  --money: #C8285A;
  --money-dark: #8E1A3E;
  --green: #86A86D;
  --sky: #9FD6E8;
  --ink: #3B2A20;
  --muted: #8C7663;
  --panel-w: min(calc(34 * var(--game-vw)), 460px);
  --line: 3px;
  font-family: 'Rubik', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#app { position: fixed; left: 0; top: 0; width: var(--game-width, 100vw); height: var(--game-height, 100vh); transform-origin: 0 0; transform: translate(0, 0); overflow: hidden; }
.game-rotated #app { transform: rotate(90deg) translateY(-100%); }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

/* ── верх: деньги и ранг ── */
#hud { position: absolute; left: 14px; top: 12px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; width: min(calc(46 * var(--game-vw)), 420px); }
.money { display: flex; align-items: center; gap: 8px; background: var(--money); color: #fff; border: var(--line) solid var(--outline); border-radius: 999px; padding: 4px 18px 4px 4px; font-weight: 800; font-size: clamp(22px, calc(3.4 * var(--game-vw)), 40px); box-shadow: 0 4px 0 var(--outline); width: max-content; }
.money img { width: 1.35em; height: 1.35em; }
/* доход и связи — на плашках, чтобы читались на любом фоне (PT Сергея) */
.persec, .exp { width: fit-content; margin: 4px 0 0 14px; padding: 1px 10px; background: var(--cream); border: 2px solid var(--outline); border-radius: 999px; box-shadow: 0 2px 0 var(--outline); }
.persec { color: var(--money); font-weight: 800; font-size: clamp(13px, calc(1.6 * var(--game-vw)), 18px); }
.exp { color: #6B3FA0; font-weight: 800; font-size: clamp(12px, calc(1.4 * var(--game-vw)), 16px); }
.rank { background: var(--cream); border: var(--line) solid var(--outline); border-radius: 14px; padding: 5px 10px 8px; box-shadow: 0 4px 0 var(--outline); }
.rank-name { font-weight: 700; font-size: clamp(13px, calc(1.5 * var(--game-vw)), 17px); text-align: center; margin-bottom: 4px; }
.rank-bar { height: 12px; background: #E8D3B4; border: 2px solid var(--outline); border-radius: 999px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; width: 0; background: var(--money); transition: width .25s; }

/* ── кнопки x2 и ДЕФОЛТ (пока макет) ── */
.btn-x2 { position: absolute; font: inherit; font-weight: 900; color: var(--ink); background: var(--kiosk); border: var(--line) solid var(--outline); border-radius: 16px; box-shadow: 0 5px 0 var(--outline); cursor: pointer; padding: 8px 18px; font-size: clamp(16px, calc(2 * var(--game-vw)), 24px); }
.btn-x2 { top: 10px; left: calc((calc(100 * var(--game-vw)) - var(--panel-w) - 24px) * 0.58); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 18px 6px 8px; color: #fff; background: linear-gradient(#6DD43F, #3FA72A); border-radius: 18px; text-align: left; }
/* значок «видео» как в примере Сергея: жёлтый квадратик с чёрным треугольником */
.ad-ico { flex: none; width: clamp(34px, calc(3.6 * var(--game-vw)), 46px); height: clamp(34px, calc(3.6 * var(--game-vw)), 46px); display: grid; place-items: center; background: #FFC93C; border: 3px solid var(--outline); border-radius: 10px; box-shadow: inset 0 -3px 0 #E0A21E; }
.ad-ico i { width: 0; height: 0; margin-left: 4px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent var(--outline); }
.x2-txt { display: grid; line-height: 1.05; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.x2-txt b { font-weight: 900; font-size: clamp(18px, calc(2.2 * var(--game-vw)), 26px); white-space: nowrap; }
.x2-txt small { font-weight: 800; font-size: clamp(10px, calc(1 * var(--game-vw)), 13px); white-space: nowrap; opacity: .95; }
.btn-x2:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--outline); }
.btn-x2:active { transform: translate(-50%, 3px); }
.btn-x2.on { background: linear-gradient(#FFE27A, #F2B620); animation: glow 1.2s ease-in-out infinite; cursor: default; }
.btn-x2.on .x2-txt { color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.btn-x2.on .ad-ico { background: #fff; box-shadow: none; }
@keyframes glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18) drop-shadow(0 0 8px #FFE27A); } }
.btn-x2.wait { background: #CFC6B8; color: #fff; box-shadow: 0 5px 0 #9C8F80; border-color: #9C8F80; cursor: default; }
.btn-x2.wait .ad-ico { filter: grayscale(1); opacity: .6; }
.btn-x2.on:active, .btn-x2.wait:active { transform: translateX(-50%); box-shadow: 0 5px 0 var(--outline); }
.boosted { color: #E8A400 !important; }
/* ── панель улучшений ── */
#panel { position: absolute; right: 12px; top: 12px; bottom: 12px; width: var(--panel-w); background: var(--cream); border: var(--line) solid var(--outline); border-radius: 20px; box-shadow: 0 6px 0 var(--outline); display: flex; flex-direction: column; overflow: hidden; container-type: inline-size; }
.panel-head { display: flex; justify-content: flex-end; align-items: baseline; padding: 4px 14px 6px; border-bottom: 2px dashed #D9C2A0; gap: 8px; }
.tabs { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 8px 0; border-bottom: 2px solid var(--outline); background: #E9CFA5; position: relative; z-index: 2; box-shadow: 0 6px 7px -4px rgba(59, 42, 32, .35); }   /* мягкая тень на страницу: прокрутка уходит под вкладки */
/* вкладки как у папки: полоса вкладок темнее, выбранная сливается с содержимым — видно, где кончаются вкладки и начинается страница */
.tab { flex: 1 0 auto; max-width: 100%; min-height: 44px; overflow-wrap: break-word; position: relative; font: inherit; font-weight: 900; font-size: clamp(13px, calc(1.4 * var(--game-vw)), 17px); color: var(--muted); background: var(--cream-2);
  border: 2px solid var(--outline); border-bottom: none; border-radius: 12px 12px 0 0; padding: 7px 8px; cursor: pointer; }
.tab.on { color: var(--ink); background: var(--cream); margin-bottom: -2px; padding-bottom: 9px; }
.tab .dot { position: absolute; right: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--money); border: 2px solid var(--outline); display: none; }
.tab .dot.on { display: block; }
/* ── звук и «?», окно справки/статистики (M10) ── */
.corner-btns { position: absolute; top: 12px; right: calc(var(--panel-w) + 36px); display: flex; gap: 8px; z-index: 6; }
.round-btn { width: clamp(40px, calc(4.2 * var(--game-vw)), 52px); height: clamp(40px, calc(4.2 * var(--game-vw)), 52px); display: grid; place-items: center; padding: 0; font: inherit; font-weight: 900; font-size: clamp(20px, calc(2.4 * var(--game-vw)), 28px); color: var(--ink); background: var(--cream); border: var(--line) solid var(--outline); border-radius: 50%; box-shadow: 0 4px 0 var(--outline); cursor: pointer; }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--outline); }
.round-btn .cross { display: none; }
.round-btn.off .cross { display: inline; }
.round-btn.off .wave { display: none; }
.round-btn.off { color: var(--muted); }
#info { position: absolute; inset: 0; z-index: 26; background: rgba(59, 42, 32, .5); display: grid; place-items: center; }
.info-card { width: min(620px, calc(92 * var(--game-vw))); height: min(calc(86 * var(--game-vh)), 640px); display: flex; flex-direction: column; background: var(--cream); border: var(--line) solid var(--outline); border-radius: 22px; box-shadow: 0 8px 0 var(--outline); overflow: hidden; }
.info-tabs { display: flex; gap: 6px; padding: 10px 10px 0; align-items: center; }
.info-tab { flex: 1; font: inherit; font-weight: 900; font-size: clamp(14px, calc(1.6 * var(--game-vw)), 18px); color: var(--muted); background: var(--cream-2); border: var(--line) solid var(--outline); border-bottom: none; border-radius: 14px 14px 0 0; padding: 8px; cursor: pointer; }
.info-tab.on { color: var(--ink); background: #fff; }
.info-x { flex: none; width: 40px; height: 40px; font: inherit; font-weight: 900; font-size: 18px; color: #fff; background: var(--money); border: 2px solid var(--money-dark); border-radius: 50%; box-shadow: 0 3px 0 var(--money-dark); cursor: pointer; margin-left: 4px; }
.info-body { flex: 1; overflow-y: auto; background: #fff; border-top: var(--line) solid var(--outline); padding: 10px 14px; }
.help-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 2px dashed var(--cream-2); }
.help-item img { flex: none; width: clamp(56px, calc(7 * var(--game-vw)), 84px); height: clamp(56px, calc(7 * var(--game-vw)), 84px); object-fit: contain; }
.help-item b { font-size: clamp(15px, calc(1.7 * var(--game-vw)), 19px); color: var(--ink); }
.help-item p { margin: 2px 0 0; font-size: clamp(12px, calc(1.35 * var(--game-vw)), 15px); font-weight: 600; color: var(--ink); line-height: 1.3; }
.stat { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; border-bottom: 2px dashed var(--cream-2); font-size: clamp(13px, calc(1.45 * var(--game-vw)), 16px); color: var(--ink); }
.stat span { font-weight: 700; }
.stat b { text-align: right; }
.stat.sub { padding: 2px 2px 2px 14px; font-size: clamp(11px, calc(1.2 * var(--game-vw)), 14px); color: var(--muted); border-bottom: none; }
/* ── окно «Настройки» ── */
#langPick { position: absolute; inset: 0; z-index: 28; background: rgba(59, 42, 32, .5); display: grid; place-items: center; }
.lang-card { width: min(560px, calc(92 * var(--game-vw))); }
.lang-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lang-btn { font: inherit; font-weight: 900; font-size: clamp(13px, calc(1.5 * var(--game-vw)), 17px); color: #fff; background: #4A78C2; border: var(--line) solid var(--outline); border-radius: 12px; box-shadow: 0 3px 0 var(--outline); padding: 8px 4px; cursor: pointer; }
.lang-btn.on { background: #4CB937; }
#settings { position: absolute; inset: 0; z-index: 27; background: rgba(59, 42, 32, .5); display: grid; place-items: center; }
.set-card { max-height: calc(100% - 16px); overflow-y: auto; width: min(420px, calc(90 * var(--game-vw))); background: var(--cream); border: var(--line) solid var(--outline); border-radius: 22px; box-shadow: 0 8px 0 var(--outline); padding: 14px 22px 18px; color: var(--ink); }
.set-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.set-head b { font-weight: 900; font-size: clamp(22px, calc(2.6 * var(--game-vw)), 30px); color: var(--money); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 0; font-weight: 900; font-size: clamp(16px, calc(1.8 * var(--game-vw)), 21px); }
.set-tog { position: relative; width: 86px; height: 40px; border: var(--line) solid var(--outline); border-radius: 999px; background: #CFC6B8; cursor: pointer; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12); }
.set-tog::before { content: 'ВЫКЛ'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 900 12px Rubik, sans-serif; color: #7A6B5C; }
.set-tog i { position: absolute; left: 4px; top: 50%; width: 28px; height: 28px; transform: translateY(-50%); border-radius: 50%; background: #fff; border: 2px solid var(--outline); transition: left .15s; }
.set-tog.on { background: #4CB937; }
.set-tog.on::before { content: 'ВКЛ'; left: 12px; right: auto; color: #fff; }
.set-tog.on i { left: calc(100% - 34px); }
html:not([lang="ru"]) .set-tog::before { content: "OFF"; }
html:not([lang="ru"]) .set-tog.on::before { content: "ON"; }
.set-row input[type=range] { width: 52%; accent-color: var(--money); height: 22px; }
.set-lang { font: inherit; font-weight: 900; font-size: clamp(15px, calc(1.7 * var(--game-vw)), 19px); color: #fff; background: #4A78C2; border: var(--line) solid var(--outline); border-radius: 14px; box-shadow: 0 4px 0 var(--outline); padding: 6px 22px; cursor: pointer; min-width: 52%; }
.set-card hr { border: none; border-top: 2px dashed var(--cream-2); margin: 10px 0 14px; }
.set-reset { display: block; width: 100%; font: inherit; font-weight: 900; font-size: clamp(16px, calc(1.8 * var(--game-vw)), 20px); color: #fff; background: #E04848; border: var(--line) solid #9E2B2B; border-radius: 16px; box-shadow: 0 5px 0 #9E2B2B; padding: 10px; cursor: pointer; }
.set-reset.arm { background: #B32020; animation: pulse .6s ease-in-out infinite; }
.set-note { text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); margin-top: 8px; }
#btnSettings.off { color: var(--muted); }
/* ── отбивка «НОВЫЙ УРОВЕНЬ!» ── */
#levelUp { position: absolute; inset: 0; z-index: 29; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 45%, #FFE58A 0%, #FFB43C 45%, #E8742A 100%); cursor: pointer; }
.lvl-rays { position: absolute; left: 50%; top: 45%; width: 240vmax; height: 240vmax; margin: -120vmax 0 0 -120vmax; background: repeating-conic-gradient(rgba(255, 255, 255, .28) 0deg 10deg, rgba(255, 255, 255, 0) 10deg 20deg); animation: lvlSpin 14s linear infinite; }
@keyframes lvlSpin { to { transform: rotate(360deg); } }
.lvl-box { position: relative; display: grid; justify-items: center; gap: clamp(4px, calc(1.2 * var(--game-vh)), 12px); text-align: center; padding: 12px; }
.lvl-title { font-weight: 900; font-size: clamp(34px, calc(7 * var(--game-vw)), 86px); color: #fff; -webkit-text-stroke: 3px var(--outline); paint-order: stroke fill; text-shadow: 0 6px 0 var(--outline); letter-spacing: .02em; }
.lvl-path { font-weight: 800; font-size: clamp(18px, calc(2.6 * var(--game-vw)), 32px); color: var(--ink); background: var(--cream); border: var(--line) solid var(--outline); border-radius: 999px; box-shadow: 0 4px 0 var(--outline); padding: 4px 22px; }
.lvl-path b { color: var(--money); font-weight: 900; }
#lvlImg { height: clamp(140px, calc(42 * var(--game-vh)), 420px); max-width: calc(80 * var(--game-vw)); object-fit: contain; filter: drop-shadow(0 10px 0 rgba(74, 54, 40, .25)); }
.lvl-num { font-weight: 800; font-size: clamp(13px, calc(1.5 * var(--game-vw)), 18px); color: var(--ink); opacity: .8; }
.lvl-go { font: inherit; font-weight: 900; font-size: clamp(20px, calc(2.6 * var(--game-vw)), 32px); color: #fff; background: var(--money); border: var(--line) solid var(--money-dark); border-radius: 18px; box-shadow: 0 6px 0 var(--money-dark); padding: 8px 46px; cursor: pointer; animation: pulse 1.2s ease-in-out infinite; }
.lvl-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#levelUp.go .lvl-title { animation: lvlPop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
#levelUp.go .lvl-path { animation: lvlPop .6s .15s cubic-bezier(.2, 1.6, .4, 1) both; }
#levelUp.go #lvlImg { animation: lvlPop .7s .3s cubic-bezier(.2, 1.5, .4, 1) both; }
#levelUp.go .lvl-go { animation: lvlPop .5s .55s both, pulse 1.2s 1.1s ease-in-out infinite; }
@keyframes lvlPop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
/* ── выбор героя (M14) ── */
#heroPick { position: absolute; inset: 0; z-index: 27; background: var(--sky); display: grid; place-items: center; }
.hero-box { display: grid; gap: 18px; justify-items: center; padding: 16px; }
.hero-title { font-weight: 900; font-size: clamp(24px, calc(4 * var(--game-vw)), 44px); color: var(--ink); text-align: center; }
.hero-cards { display: flex; gap: clamp(14px, calc(3 * var(--game-vw)), 36px); }
.hero-card { display: grid; justify-items: center; gap: 6px; width: clamp(140px, calc(22 * var(--game-vw)), 240px); padding: 12px 10px 14px; font: inherit; color: var(--ink); background: var(--cream); border: var(--line) solid var(--outline); border-radius: 22px; box-shadow: 0 6px 0 var(--outline); cursor: pointer; }
.hero-card:hover { transform: translateY(-3px); }
.hero-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--outline); }
.hero-card.on { background: #FFF6D6; border-color: var(--money); }
.hero-card img { width: 100%; height: clamp(120px, calc(30 * var(--game-vh)), 260px); object-fit: contain; object-position: bottom; }
.hero-card b { font-weight: 900; font-size: clamp(20px, calc(2.6 * var(--game-vw)), 30px); }
.info-foot { padding: 8px 14px 12px; background: #fff; text-align: center; }
/* ── вкладка «Цели» (M09) ── */
.goals-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px; overflow-wrap: anywhere; padding: 2px 4px; color: var(--ink); }
.goals-head span { font-size: 12px; font-weight: 700; color: var(--muted); }
.goal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #fff; border: var(--line) solid var(--outline); border-radius: 14px; padding: 6px 8px; margin-bottom: 6px; }
.goal.ready { background: #FFF6D6; border-color: var(--money); }
.goal.got { opacity: .55; }
.goal-txt { flex: 1 1 5.5rem; min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.goal-txt b { display: block; font-size: clamp(12px, calc(1.25 * var(--game-vw)), 15px); }
.goal-txt small { display: block; font-size: clamp(10px, calc(1 * var(--game-vw)), 12px); color: var(--muted); font-weight: 700; }
.goal-bar { position: relative; min-height: 14px; margin-top: 4px; border: 2px solid var(--outline); border-radius: 999px; background: var(--cream-2); overflow: hidden; }
.goal-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--kiosk); }
.goal-bar span { position: relative; display: block; text-align: center; font-size: 10px; font-weight: 900; line-height: 1.1; padding: 0 3px; color: var(--ink); }
.goal-btn { min-height: 44px; max-width: 100%; margin-left: auto; overflow-wrap: anywhere; font: inherit; font-weight: 900; font-size: 14px; color: #fff; background: var(--money); border: 2px solid var(--money-dark); border-radius: 12px; box-shadow: 0 3px 0 var(--money-dark); padding: 5px 10px; cursor: pointer; }
.goal-btn:disabled { background: #CFC6B8; border-color: #9C8F80; box-shadow: 0 3px 0 #9C8F80; color: #fff; cursor: default; }
.goal.ready .goal-btn { animation: pulse 1s ease-in-out infinite; }
.goal-ok { font-weight: 900; font-size: 20px; color: #3E9B4F; padding: 0 8px; }
.medal { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--outline); background: #CFC6B8; color: #fff; font-weight: 900; font-size: 18px; }
.ach.ready .medal, .ach.got .medal { background: #FFC93C; color: #B5651D; }
.hide { display: none !important; }
.help-sum { text-align: center; font-weight: 800; font-size: clamp(13px, calc(1.4 * var(--game-vw)), 16px); color: var(--ink); }
.help-sum b { color: var(--money); }
.summon { font: inherit; font-weight: 900; font-size: clamp(14px, calc(1.5 * var(--game-vw)), 18px); color: #fff; background: var(--money); border: 3px solid var(--money-dark); border-radius: 14px;
  box-shadow: 0 4px 0 var(--money-dark); padding: 9px 10px; cursor: pointer; }
.summon:disabled { background: #CDBBA5; border-color: #9C8670; box-shadow: none; color: #fff; cursor: default; }
.summon:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--money-dark); }
.hgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hcard { position: relative; background: #fff; border: 2px solid var(--outline); border-radius: 12px; padding: 4px 3px 5px; text-align: center; cursor: pointer; }
.hcard img { width: 100%; height: clamp(56px, calc(7 * var(--game-vw)), 92px); object-fit: contain; }
.hcard .hn { font-weight: 800; font-size: clamp(10px, calc(1 * var(--game-vw)), 12px); line-height: 1.1; min-height: 2.2em; }
.hcard .hb { font-weight: 800; font-size: clamp(10px, calc(1 * var(--game-vw)), 12px); color: var(--money); }
.hcard .hl { position: absolute; left: 4px; top: 4px; background: var(--kiosk); border: 2px solid var(--outline); border-radius: 9px; font-size: 10px; font-weight: 900; padding: 0 5px; }
.hcard.duty { box-shadow: 0 0 0 3px var(--money) inset; }
.hcard .hd { display: none; position: absolute; right: 4px; top: 4px; font-size: 9px; font-weight: 900; color: #fff; background: var(--money); border-radius: 8px; padding: 1px 5px; }
.hcard.duty .hd { display: block; }
.hcard .hc { margin-top: 3px; font-weight: 900; font-size: clamp(9px, calc(.9 * var(--game-vw)), 11px); line-height: 1.15; color: var(--muted); }
.hcard.duty .hc { color: var(--money); }
.help-tip { font-size: clamp(10px, calc(1 * var(--game-vw)), 12px); font-weight: 700; color: var(--muted); text-align: center; margin: -2px 0 6px; }
.help-tip:empty { display: none; }
.reveal-tip { font-weight: 800; font-size: 14px; color: var(--ink); background: var(--kiosk); border-radius: 10px; padding: 5px 8px; margin: -4px 0 12px; }
.hcard.none { background: var(--cream-2); cursor: default; }
.hcard.none img { filter: brightness(0) opacity(.22); }
.hcard.none .hn, .hcard.none .hb { color: var(--muted); }
#reveal { position: absolute; inset: 0; z-index: 25; background: rgba(59, 42, 32, .45); display: grid; place-items: center; }
.reveal-card { width: min(360px, calc(86 * var(--game-vw))); background: var(--cream); border: var(--line) solid var(--outline); border-radius: 22px; box-shadow: 0 8px 0 var(--outline);
  padding: 14px 18px 18px; text-align: center; animation: revealIn .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes revealIn { from { transform: scale(.4) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.reveal-tag { font-weight: 900; font-size: 22px; color: var(--money); }
.reveal-card img { width: 70%; max-height: calc(38 * var(--game-vh)); object-fit: contain; margin: 6px 0; }
.reveal-name { font-weight: 900; font-size: 22px; }
.reveal-line { font-weight: 600; font-size: 15px; color: var(--muted); margin: 4px 0 8px; }
.reveal-bonus { font-weight: 900; font-size: 18px; color: var(--money); margin-bottom: 12px; }
/* ── стрелки ── */
.tab { font-size: clamp(11px, calc(1.2 * var(--game-vw)), 15px); padding: 7px 3px; }
.riv-head { display: flex; justify-content: space-between; align-items: baseline; font-size: clamp(13px, calc(1.4 * var(--game-vw)), 16px); }
.riv-head span { color: var(--muted); font-weight: 700; }
.riv-card { display: flex; gap: 10px; align-items: center; background: #fff; border: 2px solid var(--outline); border-radius: 14px; padding: 6px 10px; }
.riv-card img { height: clamp(90px, calc(13 * var(--game-vw)), 170px); width: auto; max-width: 42%; object-fit: contain; }
.riv-name { font-weight: 900; font-size: clamp(15px, calc(1.6 * var(--game-vw)), 19px); }
.riv-power { font-weight: 800; color: var(--ink); margin-top: 4px; }
.riv-mine { font-weight: 800; color: #2E7D6B; }
.riv-mine.weak { color: var(--money); }
.riv-reward { font-weight: 800; color: #6B3FA0; margin-top: 4px; }
.riv-taunt { font-style: italic; font-weight: 600; color: var(--muted); text-align: center; font-size: clamp(12px, calc(1.3 * var(--game-vw)), 15px); }
.riv-hint { font-size: 11px; color: var(--muted); text-align: center; }
.riv-strip { display: grid; grid-template-columns: 1fr 30px 1fr 30px 1fr; grid-auto-rows: auto; align-items: center; padding: 6px 0 4px; }
.rv { position: relative; background: var(--cream-2); border: 2px solid var(--outline); border-radius: 12px; text-align: center; padding: 4px 3px 5px; }
.rv .rv-n { display: block; font-weight: 800; font-size: clamp(10px, calc(1 * var(--game-vw)), 12px); line-height: 1.1; min-height: 2.2em; color: var(--ink); }
.rv-league { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-weight: 900; font-size: 10px; color: #fff; background: #6B3FA0; border: 2px solid var(--outline); border-radius: 8px; padding: 0 6px; z-index: 1; }
.rv-arrow { justify-self: center; align-self: center; display: grid; place-items: center; width: 28px; height: 28px; margin: 3px 0; font-weight: 900; font-size: 20px; line-height: 1; color: #fff; background: var(--money); border: 2px solid var(--outline); border-radius: 50%; box-shadow: 0 2px 0 var(--outline); }
.rv-arrow.done { background: #3E9B4F; }
.rv img { width: 100%; height: clamp(56px, calc(7 * var(--game-vw)), 92px); object-fit: contain; filter: brightness(0) opacity(.22); }
.rv b { font-size: clamp(10px, calc(1 * var(--game-vw)), 12px); font-weight: 800; color: #6B3FA0; }
.rv.won { background: #E3F2E6; } .rv.won img { filter: none; } .rv.won b { color: #2E7D6B; }
.rv.cur { background: #fff; box-shadow: 0 0 0 3px var(--money) inset; } .rv.cur img { filter: none; } .rv.cur b { color: var(--money); }
#duelBar { position: absolute; left: calc((calc(100 * var(--game-vw)) - var(--panel-w) - 24px) / 2); top: 182px; transform: translateX(-50%); width: min(calc(46 * var(--game-vw)), 520px); z-index: 12; pointer-events: none; text-align: center; }
.duel-top { display: flex; justify-content: space-between; gap: 10px; background: var(--money); color: #fff; font-weight: 800; border: var(--line) solid var(--outline); border-radius: 14px 14px 0 0; padding: 4px 12px; font-size: clamp(13px, calc(1.5 * var(--game-vw)), 17px); }
.duel-track { height: 16px; background: var(--cream); border: var(--line) solid var(--outline); border-top: none; border-radius: 0 0 12px 12px; overflow: hidden; }
.duel-track i { display: block; height: 100%; width: 0; background: #3FA34D; transition: width .1s; }
.duel-call { margin-top: 8px; font-weight: 900; font-size: clamp(24px, calc(3.4 * var(--game-vw)), 44px); color: var(--kiosk); text-shadow: 0 3px 0 var(--outline), 0 -2px 0 var(--outline), 2px 0 0 var(--outline), -2px 0 0 var(--outline); animation: pulse .6s ease-in-out infinite; }

/* ── сценка ── */
#dialog { position: absolute; left: 14px; right: calc(var(--panel-w) + 30px); bottom: 14px; height: 23%; z-index: 22; cursor: pointer; }
#dialog img { position: absolute; bottom: 100%; height: 140%; max-width: 40%; object-fit: contain; object-position: bottom; transform: translateY(18%); filter: drop-shadow(0 4px 0 rgba(74, 54, 40, .25)); }
#dialog img.full { object-fit: cover; object-position: top; height: 150%; width: auto; aspect-ratio: 0.82; clip-path: inset(0 0 22% 0); transform: translateY(35%); }
#dialog[data-side="l"] img { left: 2%; }
#dialog[data-side="r"] img { right: 2%; }
.dlg-box { position: absolute; inset: 0; background: var(--cream); border: var(--line) solid var(--outline); border-radius: 18px; box-shadow: 0 6px 0 var(--outline); padding: 12px 20px 10px; }
.dlg-name { display: inline-block; font-weight: 900; font-size: clamp(15px, calc(1.7 * var(--game-vw)), 21px); color: #fff; background: var(--money); border: 2px solid var(--money-dark); border-radius: 10px; padding: 2px 12px; margin-top: -26px; }
#dialog[data-side="r"] .dlg-name { float: right; }
.dlg-text { clear: both; font-weight: 700; font-size: clamp(16px, calc(2 * var(--game-vw)), 25px); line-height: 1.3; margin-top: 8px; }
.dlg-more { position: absolute; right: 14px; bottom: 12px; width: clamp(44px, calc(5 * var(--game-vw)), 64px); height: clamp(44px, calc(5 * var(--game-vw)), 64px); display: grid; place-items: center; padding-left: .12em; font-weight: 900; font-size: clamp(22px, calc(2.6 * var(--game-vw)), 32px); color: #fff; background: var(--money); border: var(--line) solid var(--money-dark); border-radius: 50%; box-shadow: 0 4px 0 var(--money-dark); animation: pulse 1s ease-in-out infinite; }
.dlg-skip { position: absolute; left: 16px; bottom: 8px; font: inherit; font-weight: 800; font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer; text-decoration: underline; }

#rivReady { position: absolute; inset: 0; z-index: 25; background: rgba(59, 42, 32, .45); display: grid; place-items: center; }
#rivReady .reveal-card img { width: 50%; max-height: calc(32 * var(--game-vh)); object-fit: contain; }
.crisis-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.crisis-go { background: var(--money) !important; color: #fff; border-color: var(--money-dark) !important; box-shadow: 0 4px 0 var(--money-dark) !important; }
.crisis-no { background: var(--cream-2) !important; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.reveal-ok { font: inherit; font-weight: 900; font-size: 20px; background: var(--kiosk); border: var(--line) solid var(--outline); border-radius: 14px; box-shadow: 0 4px 0 var(--outline); padding: 8px 34px; cursor: pointer; }
.panel-sub { font-size: clamp(11px, calc(1.2 * var(--game-vw)), 14px); font-weight: 600; color: var(--money); text-align: right; }
.list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--outline); border-radius: 14px; padding: 6px 8px; cursor: pointer; transition: transform .06s; }
.row:active { transform: translateY(2px); }
.row.poor { cursor: default; }
.row.poor .price { background: #CDBBA5; border-color: #9C8670; box-shadow: none; }
.row.locked { background: var(--cream-2); cursor: default; }
.row.locked .price { background: #CDBBA5; border-color: #9C8670; box-shadow: none; }
.row .ico { position: relative; width: clamp(40px, calc(4.2 * var(--game-vw)), 56px); height: clamp(40px, calc(4.2 * var(--game-vw)), 56px); }
.row .ico img { width: 100%; height: 100%; object-fit: contain; }
.row .lvl { position: absolute; right: -6px; bottom: -6px; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 11px; background: var(--kiosk); border: 2px solid var(--outline); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.row .name { font-weight: 700; font-size: clamp(13px, calc(1.35 * var(--game-vw)), 16px); line-height: 1.15; }
.row .eff { font-size: clamp(11px, calc(1.15 * var(--game-vw)), 13px); color: var(--muted); font-weight: 600; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.row .eff b { color: var(--money); }
.row .price { background: var(--money); color: #fff; border: 2px solid var(--money-dark); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: clamp(13px, calc(1.35 * var(--game-vw)), 16px); white-space: nowrap; box-shadow: 0 3px 0 var(--money-dark); }
.row.locked .name { color: var(--muted); }
.row.locked .ico img { filter: brightness(0) opacity(.25); }

/* ── всплывашки поверх сцены ── */
.pop { position: absolute; pointer-events: none; font-weight: 900; color: var(--money); font-size: clamp(20px, calc(2.6 * var(--game-vw)), 30px); text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff; animation: pop .9s ease-out forwards; }
.pop.passive { color: #17614F; font-size: clamp(17px, calc(2 * var(--game-vw)), 24px); text-shadow: 0 2px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 0 0 6px #fff; animation: popPassive 1.3s ease-out forwards; }
@keyframes popPassive { from { transform: translate(-50%, 0); opacity: 0; } 10% { opacity: 1; } 70% { opacity: 1; } to { transform: translate(-50%, -60px); opacity: 0; } }
@keyframes pop { from { transform: translate(-50%, 0) scale(.7); opacity: 1; } 20% { transform: translate(-50%, -14px) scale(1.15); } to { transform: translate(-50%, -80px) scale(1); opacity: 0; } }

.toast { position: absolute; left: calc((calc(100 * var(--game-vw)) - var(--panel-w) - 24px) / 2); top: 30%; transform: translateX(-50%); z-index: 15; pointer-events: none;
  background: var(--kiosk); border: var(--line) solid var(--outline); border-radius: 18px; box-shadow: 0 6px 0 var(--outline);
  padding: 12px 26px; font-weight: 900; font-size: clamp(20px, calc(2.8 * var(--game-vw)), 36px); text-align: center; width: max-content; max-width: calc(calc(100 * var(--game-vw)) - var(--panel-w) - 60px); animation: toast 2.6s ease-out forwards; }
@keyframes toast { 0% { transform: translate(-50%, 20px) scale(.6); opacity: 0; } 12% { transform: translate(-50%, 0) scale(1.08); opacity: 1; }
  20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -30px); opacity: 0; } }

/* ── загрузка ── */
#boot { position: absolute; inset: 0; background: var(--sky); display: grid; place-content: center; gap: 18px; z-index: 10; transition: opacity .3s; }
#boot.hide { opacity: 0; pointer-events: none; }
.boot-title { font-weight: 900; font-size: clamp(28px, calc(5 * var(--game-vw)), 56px); color: var(--ink); text-align: center; }
.boot-art { width: min(calc(40 * var(--game-vw)), 320px); max-height: calc(44 * var(--game-vh)); object-fit: contain; justify-self: center; }   /* низкий экран телефона: кнопка «ИГРАТЬ» должна влезть */
.boot-play { justify-self: center; font: inherit; font-weight: 900; font-size: clamp(24px, calc(3.5 * var(--game-vw)), 40px); color: #fff; background: var(--money); border: var(--line) solid var(--money-dark); border-radius: 18px; box-shadow: 0 6px 0 var(--money-dark); padding: 10px 48px; cursor: pointer; animation: pulse 1.4s ease-in-out infinite; }
.boot-bar { width: min(calc(60 * var(--game-vw)), 420px); height: 18px; border: var(--line) solid var(--outline); border-radius: 999px; background: var(--cream); overflow: hidden; justify-self: center; }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--kiosk); transition: width .2s; }

/* ── низкий альбомный экран (телефон лёжа) ── */
@media (max-height: 500px), (max-width: 500px) {
  :root { --line: 2px; --panel-w: min(calc(38 * var(--game-vw)), 360px); }
  #hud { left: 8px; top: 6px; gap: 3px; width: min(calc(40 * var(--game-vw)), 300px); }
  .money { font-size: 20px; padding: 2px 12px 2px 2px; }
  .rank { padding: 2px 8px 5px; border-radius: 10px; }
  .rank-bar { height: 8px; }
  #panel { right: 6px; top: 6px; bottom: 6px; border-radius: 14px; }
  .panel-head { padding: 2px 10px 3px; }
  .tabs { padding: 5px 5px 0; gap: 3px; }
  .tab { padding: 4px 8px; font-size: 11px; }
  /* карточки помощников: 2 в ряд, метки «ур.» и «выбран» над портретом, а не поверх (Сергей) */
  .hgrid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .hcard { padding-top: 22px; }
  .hcard img { height: 74px; }
  .hcard .hn, .hcard .hb, .hcard .hc { font-size: 12px; }
  .list { padding: 5px; gap: 5px; }
  .row { padding: 3px 6px; gap: 6px; border-radius: 10px; }
  .row .ico { width: 34px; height: 34px; }
  .row .lvl { min-width: 18px; height: 18px; font-size: 10px; right: -4px; bottom: -4px; }
  .row .price { padding: 4px 9px; }
  /* сверху места нет (деньги + кнопки) — x2 внизу слева сцены, где был «Кризис» */
  .btn-x2 { top: auto; bottom: 8px; left: 8px; transform: none; padding: 3px 10px 3px 4px; gap: 6px; border-radius: 12px; }
  .btn-x2:active { transform: translateY(3px); }
  .toast { font-size: 17px; padding: 8px 16px; border-radius: 12px; top: 34%; }
  #boot { gap: 8px; }
  .boot-title { font-size: 26px; }
  .boot-play { font-size: 22px; padding: 6px 36px; }
  /* окна «Новый помощник» и «Ты готов к бою»: картинка слева, текст справа — иначе кнопки уходят за низ экрана */
  .reveal-card { width: min(560px, calc(84 * var(--game-vw))); max-height: calc(100% - 12px); overflow-y: auto; display: grid; grid-template-columns: 34% 1fr; column-gap: 14px; align-items: center; padding: 10px 16px 12px; text-align: left; border-radius: 18px; }
  .reveal-card > * { grid-column: 2; }
  .reveal-card img, #rivReady .reveal-card img { grid-column: 1; grid-row: 1 / span 7; width: 100%; max-height: calc(72 * var(--game-vh)); margin: 0; }
  .reveal-tag { font-size: 18px; }
  .reveal-name { font-size: 18px; }
  .reveal-line { font-size: 12px; margin: 2px 0 4px; }
  .reveal-bonus { font-size: 15px; margin-bottom: 6px; }
  .reveal-tip { font-size: 12px; padding: 4px 8px; margin: 0 0 8px; }
  .reveal-ok { font-size: 17px; padding: 5px 26px; border-radius: 12px; justify-self: start; }
  .crisis-btns { justify-content: flex-start; }
  /* отбивка «Новый уровень» / финал: всё уменьшаем, чтобы влезла кнопка */
  .lvl-box { gap: 4px; padding: 6px; }
  .lvl-title { font-size: 34px; -webkit-text-stroke: 2px var(--outline); text-shadow: 0 3px 0 var(--outline); }
  .lvl-path { font-size: 14px; padding: 2px 14px; border-width: 2px; }
  #lvlImg { height: calc(38 * var(--game-vh)); }
  .lvl-go { font-size: 18px; padding: 5px 30px; border-radius: 12px; }
  /* настройки в две колонки: звук | музыка, громкость | язык */
  .lang-grid { gap: 5px; }
  .lang-btn { font-size: 12px; padding: 5px 3px; }
  #settings .set-card { width: min(620px, calc(86 * var(--game-vw))); padding: 8px 16px 10px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .set-card > .set-head, .set-card > hr, .set-card > .set-reset, .set-card > .set-note { grid-column: 1 / -1; }
  .set-head { margin-bottom: 2px; }
  .set-head b { font-size: 20px; }
  .set-row { padding: 4px 0; font-size: 14px; gap: 10px; }
  .set-tog { width: 64px; height: 30px; }
  .set-tog i { width: 22px; height: 22px; }
  .set-tog.on i { left: calc(100% - 28px); }
  .set-tog::before { font-size: 10px; right: 7px; }
  .set-tog.on::before { left: 8px; }
  .set-lang { font-size: 13px; padding: 4px 10px; }
  .set-card hr { margin: 4px 0 6px; }
  .set-reset { font-size: 15px; padding: 6px; }
  .set-note { font-size: 11px; margin-top: 4px; }
  /* во время разговора кнопка x2 внизу слева уходит, чтобы не наезжать на плашку диалога */
  body.talking .btn-x2 { visibility: hidden; }
  /* прогресс ранга — справа сверху у вкладок, шестерёнка и «?» — под ним (Сергей) */
  #hud .rank { position: fixed; top: 6px; right: calc(var(--panel-w) + 16px); width: 190px; padding: 2px 8px 4px; }
  .corner-btns { top: 48px; right: calc(var(--panel-w) + 16px); gap: 6px; }
  .rank-name { font-size: 11px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* полоса боя — по центру сцены, как раньше, но выше: сразу под плашкой «Бонусы» (не закрывает героя и босса) */
  #duelBar { top: 92px; }
  .duel-top { font-size: 12px; padding: 2px 8px; }
  .duel-track { height: 10px; }
  .duel-call { margin-top: 2px; font-size: 20px; }
  .ad-ico { width: 28px; height: 28px; border-width: 2px; border-radius: 7px; }
  .ad-ico i { border-width: 6px 0 6px 10px; margin-left: 3px; }
  .x2-txt b { font-size: 18px; }
  .x2-txt small { font-size: 9px; }
  #dialog { height: 36%; left: 8px; bottom: 8px; }
  .dlg-box { padding: 8px 14px 8px; }
}


/* Дополнения в палитре исходной игры. Размеры относятся к повёрнутому контейнеру. */
:root { --game-vw: 1vw; --game-vh: 1vh; }
.boost-ico { display: grid; place-items: center; width: 30px; height: 30px; }
.boost-ico img { width: 100%; height: 100%; object-fit: contain; }
.game-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; grid-column: 1/-1; }
.game-links button { min-height: 38px; border: 2px solid var(--outline); border-radius: 12px; padding: 6px 12px; background: var(--cream); color: var(--ink); box-shadow: 0 3px 0 var(--outline); font: 700 13px/1.2 'Rubik',sans-serif; cursor: pointer; }
.game-links button:active { transform: translateY(2px); }
.game-links button:focus-visible { outline: 3px solid var(--money); outline-offset: 2px; }
#boot { overflow-y: auto; padding: 8px; gap: 8px; }
#boot .boot-art { max-height: calc(28 * var(--game-vh)); }
#boot .boot-title { font-size: clamp(22px, calc(4 * var(--game-vw)), 42px); }
#boot .mobdev-invite-row { margin: 1px 0 4px; }
#boot .boot-links { margin-top: 3px; }
#settings .mobdev-invite-row { margin: 8px 0 2px; }
#app .mobdev-invite-button { font-family: 'Rubik',sans-serif; color: var(--ink); background: var(--kiosk); border-color: var(--outline); border-radius: 12px; box-shadow: 0 3px 0 var(--outline); text-shadow: none; }
#levelUp .mobdev-invite-row { grid-column: 1/-1; }
#levelUp .lvl-box { max-height: 100%; overflow-y: auto; }
#hud { top: 8px; }
.corner-btns { top: 8px; }
@media (max-height:500px), (max-width:500px) {
  #hud { top: 8px; width: auto; }
  .corner-btns { top: 50px; gap: 6px; }
  .round-btn { width: 38px; height: 38px; }
  #boot .boot-art { max-height: calc(24 * var(--game-vh)); }
  #boot .boot-title { font-size: 24px; }
  #boot .boot-play { padding: 5px 32px; font-size: 22px; }
  #boot .game-links button { min-height: 32px; font-size: 12px; padding: 5px 10px; }
  #boot .mobdev-invite-button { min-height: 34px; padding: 4px 12px; }
  #settings .set-card { max-height: calc(100% - 20px); }
  #settings .game-links { margin-top: 8px; }
  #settings .game-links button { min-height: 36px; }
  #levelUp .lvl-title { font-size: 28px; }
  #levelUp #lvlImg { height: calc(28 * var(--game-vh)); }
}
/* Ориентируемся на ширину панели внутри повёрнутой игры. */
@container (max-width: 280px) {
  .tabs { padding-bottom: 4px; }
  .tab { min-width: 42%; border-bottom: 2px solid var(--outline); border-radius: 9px; }
  .tab.on { margin-bottom: 0; padding-bottom: 4px; }
}
