:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f2f5);
  --text: var(--tg-theme-text-color, #16181d);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --accent: var(--tg-theme-button-color, #3a7bd5);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
  --step-empty: color-mix(in srgb, var(--hint) 18%, transparent);
  --display: "Unbounded", system-ui, sans-serif;
  --body: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased;
       padding-bottom: env(safe-area-inset-bottom, 0px); }
button { font: inherit; color: inherit; }

/* Шапка */
.head { position: sticky; top: 0; z-index: 5; background: var(--bg);
        border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; }
.menu-btn { width: 40px; height: 40px; border: 0; background: none; border-radius: 10px;
            display: grid; place-items: center; cursor: pointer; }
.menu-btn svg { width: 22px; height: 22px; stroke: var(--text); }
.section-title { font-weight: 600; font-size: 16px; }

/* Вкладки */
.tabs { display: flex; gap: 4px; padding: 4px 16px 10px; }
.tab { flex: 1; border: 0; background: none; padding: 8px 0; border-radius: 10px;
       color: var(--hint); font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--bg2); color: var(--text); }
.menu-btn:focus-visible, .item:focus-visible,
.tab:focus-visible, .seg:focus-visible, .row:focus-visible, .bar:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }

main { padding: 20px 16px 32px; max-width: 560px; margin: 0 auto; }
.view[hidden] { display: none; }

/* Профиль */
.name { font: 700 22px/1.2 var(--display); margin: 0; overflow-wrap: anywhere; }
.meta { margin: 6px 0 0; color: var(--hint); }
.tag { color: var(--accent); }

.level { display: flex; align-items: flex-end; gap: 14px; margin-top: 28px; }
.level-num { font: 700 64px/0.85 var(--display); letter-spacing: -0.03em; }
.level-num small { font-size: 18px; color: var(--hint); letter-spacing: 0; margin-left: 2px; }
.level-text { padding-bottom: 4px; }
.rank { font-weight: 600; }
.place { color: var(--hint); }

.stairs { display: flex; align-items: flex-end; gap: 3px; height: 92px; margin: 22px 0 10px; }
.step { flex: 1; background: var(--step-empty); border-radius: 3px 3px 1px 1px;
        position: relative; overflow: hidden; }
.step i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); }
.step.final { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.step.final.done i { background: var(--text); }
.xp { margin: 0; color: var(--hint); }
.xp b { color: var(--text); font-weight: 600; }

.facts { margin: 28px 0 0; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0;
             border-top: 1px solid var(--line); }
.facts dt { color: var(--hint); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.facts dd span { display: block; color: var(--hint); font-size: 13px; }

/* Топ */
.segs { display: flex; background: var(--bg2); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg { flex: 1; border: 0; background: none; padding: 7px 0; border-radius: 9px;
       font-weight: 500; color: var(--hint); cursor: pointer; }
.seg[aria-pressed="true"] { background: var(--bg); color: var(--text); font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.row { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; align-items: center;
       gap: 10px; padding: 12px 4px; border: 0; border-top: 1px solid var(--line);
       background: none; text-align: left; cursor: pointer; }
.row.me { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 10px; }
.pos { font: 700 15px/1 var(--display); color: var(--hint); text-align: center; }
.pos.p1, .pos.p2, .pos.p3 { color: var(--accent); }
.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.val { text-align: right; font-variant-numeric: tabular-nums; }
.val span { display: block; font-size: 12px; color: var(--hint); }

/* Чат */
.big { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; margin: 24px 0 30px; }
.big b { display: block; font: 700 26px/1.1 var(--display); letter-spacing: -0.02em; }
.big span { color: var(--hint); }
h2 { font: 600 16px/1.3 var(--body); margin: 0 0 4px; }
.chart-note { color: var(--hint); margin: 0 0 12px; min-height: 1.45em; }
.chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; }
.bar { flex: 1; min-height: 2px; border: 0; padding: 0; background: var(--accent);
       border-radius: 2px 2px 0 0; opacity: .55; cursor: pointer; }
.bar.today, .bar.active { opacity: 1; }
.axis { display: flex; justify-content: space-between; color: var(--hint); font-size: 12px;
        margin-top: 6px; }

/* Боковое меню */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4);
         opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 21; width: min(82vw, 300px);
          background: var(--bg); padding: 18px 10px calc(18px + env(safe-area-inset-bottom, 0px));
          transform: translateX(calc(-100% - 40px)); transition: transform .25s cubic-bezier(.2,.7,.2,1);
          box-shadow: 8px 0 24px rgba(0,0,0,.18); overflow-y: auto; }
body.menu-open .scrim { opacity: 1; pointer-events: auto; }
body.menu-open .drawer { transform: none; }
.drawer h2 { padding: 4px 12px 12px; margin: 0; color: var(--hint); font-weight: 500; }
.item { display: block; width: 100%; text-align: left; border: 0; background: none;
        padding: 12px; border-radius: 12px; cursor: pointer; }
.item + .item { margin-top: 2px; }
.item b { display: block; font-weight: 600; }
.item span { color: var(--hint); font-size: 13px; }
.item[aria-current="true"] { background: var(--bg2); }
.lang-title { margin-top: 18px !important; }
.langs { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.lang-btn { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 12px; cursor: pointer; font-weight: 500; }
.lang-btn[aria-pressed="true"] { background: var(--bg2); font-weight: 600; }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .scrim, .drawer { transition: none; } }

/* Взаимодействия */
.block { margin-top: 28px; }
.block:first-child { margin-top: 0; }
.block h2 { margin-bottom: 6px; }
.emo { font-size: 20px; text-align: center; }
.meter { height: 4px; border-radius: 2px; background: var(--step-empty); margin-top: 6px; }
.meter i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.exp-meter { position: relative; height: 10px; border-radius: 5px; margin: 10px 0 18px; }
.exp-meter i { border-radius: 5px; }
.exp-meter .mk { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--text); opacity: .35; transform: translateX(-1px); }
.exp-meter .mk b { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 400; white-space: nowrap; }
.perk { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; }
.perk .lv { min-width: 46px; color: var(--hint); font-size: 13px; }
.perk.off { opacity: .45; }
.reserve { opacity: .55; }
.pair { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair em { font-style: normal; color: var(--hint); padding: 0 4px; }
.row.static { cursor: default; }
/* «Чем пользуются» в админке: без колонки под номер места, название переносится, а не обрезается */
.usage-row { grid-template-columns: 1fr auto; align-items: start; }
.usage-row .who { white-space: normal; overflow: visible; text-overflow: clip; }
.usage-row[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 10px; }

/* Лента сообщений чата (админка → «Чаты») */
.feed-row { padding: 10px 4px; border-top: 1px solid var(--line); }
.feed-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--hint); }
.feed-head b { font-weight: 600; font-size: 14px; }
.feed-text { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kind-detail { padding: 6px 4px 16px; border-top: 1px dashed var(--line); }
.empty { color: var(--hint); padding: 10px 4px; border-top: 1px solid var(--line); margin: 0; }
.big.two { margin-top: 0; }

/* Дуэли */
:root { --p1: var(--accent); --p2: #c2412d; --sand: #e9cf9f; --sky: #f6d7a7; }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.side .fname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .lv { color: var(--hint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side.p2 { text-align: right; }
.hp { height: 8px; border-radius: 4px; background: var(--step-empty); margin-top: 8px; overflow: hidden; }
.hp i { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }
.side.p1 .hp i { background: var(--p1); }
.side.p2 .hp i { background: var(--p2); margin-left: auto; }
.hpn { font: 700 13px/1 var(--display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.ammo { display: flex; gap: 3px; margin-top: 6px; }
.side.p2 .ammo { justify-content: flex-end; }
.ammo span { width: 6px; height: 11px; border-radius: 3px 3px 1px 1px; background: var(--step-empty); }
.ammo span.on { background: #b8892f; }
.arena { position: relative; height: 230px; margin: 14px 0 8px; border-radius: 16px; overflow: hidden;
         background: linear-gradient(to bottom, var(--sky) 0 66%, var(--sand) 66% 100%); }
.sun { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: #f4a259; top: 18px; left: 50%;
       transform: translateX(-50%); opacity: .8; }
.cactus { position: absolute; bottom: 70px; width: 10px; height: 40px; border-radius: 5px; background: #6a994e; opacity: .7; }
.cactus::before, .cactus::after { content: ""; position: absolute; width: 7px; height: 16px; border-radius: 4px; background: inherit; }
.cactus::before { left: -8px; top: 10px; } .cactus::after { right: -8px; top: 4px; }
.cactus.c1 { left: 8%; } .cactus.c2 { right: 6%; height: 30px; }
.fighter { position: absolute; bottom: 6px; width: 120px; transition: transform .15s; }
.fighter.f1 { left: 5%; }
.fighter.f2 { right: 5%; }
.fighter.f2 svg { transform: scaleX(-1); }
.fighter svg { display: block; width: 100%; overflow: visible; }
.pop { position: absolute; top: 14px; font: 700 17px/1 var(--display); pointer-events: none;
       white-space: nowrap; transform: translateX(-50%); color: #3b2a1a; }
.pop.dmg { color: #c62828; } .pop.crit { color: #e65100; font-size: 20px; } .pop.blk { color: #6d5a43; }
.flash { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
         background: radial-gradient(#fff6c2, #ffb300 55%, transparent 70%); pointer-events: none; }
.trail { position: absolute; height: 2px; background: linear-gradient(90deg, transparent, #fff3c4, transparent);
         pointer-events: none; }
.round-line { text-align: center; color: var(--hint); margin: 0 0 14px; }
.round-line b { color: var(--text); }
.pick h2 { margin: 14px 0 8px; }
.zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.zone { border: 1px solid var(--line); background: none; border-radius: 12px; padding: 11px 0;
        font-weight: 500; cursor: pointer; }
.zone[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.zone:focus-visible, .go:focus-visible, .mini:focus-visible, .face:focus-visible, .sw:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.go { width: 100%; margin-top: 18px; border: 0; border-radius: 12px; padding: 14px; font-weight: 600;
      background: var(--accent); color: var(--accent-text); cursor: pointer; }
.go:disabled { opacity: .4; cursor: default; }
.note { text-align: center; color: var(--hint); padding: 14px 0; margin: 0; }
.note strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.log { list-style: none; padding: 0; margin: 22px 0 0; }
.log li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.log li b { display: block; font-weight: 600; margin-bottom: 2px; }
.log .auto { color: var(--hint); }

.hero-fighter { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: center; margin-bottom: 16px; }
.preview { background: linear-gradient(to bottom, var(--sky) 0 70%, var(--sand) 70%); border-radius: 16px; padding: 10px 12px 4px; }
.coins { margin-top: 8px; font-weight: 600; }
.coins-line { margin: 0 0 4px; color: var(--hint); } .coins-line b { color: var(--text); }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0;
            border-top: 1px solid var(--line); }
.item-row b { display: block; font-weight: 600; }
.item-row span { color: var(--hint); font-size: 13px; }
.acts { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.mini { border: 1px solid var(--line); background: none; border-radius: 9px; padding: 6px 10px; font-size: 13px;
        font-weight: 500; cursor: pointer; white-space: nowrap; }
.mini.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.mini:disabled { opacity: .4; cursor: default; }
.tag-on { font-size: 13px; color: var(--hint); white-space: nowrap; }
.r-common { color: var(--text); } .r-rare { color: #2f7de1; } .r-epic { color: #9b4fd6; } .r-legend { color: #d98b00; }
.look .hint { color: var(--hint); margin: 14px 0 8px; }
.look .hint.small { font-size: 13px; margin-top: 8px; }
.custom-face { margin: 0 0 8px; font-size: 14px; }
.icon { flex-shrink: 0; width: 54px; height: 40px; border-radius: 10px; background: var(--bg2); display: grid; place-items: center; }
.icon svg { width: 46px; height: 34px; }
.item-row .info { flex: 1; min-width: 0; }
.faces { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.face { font-size: 22px; padding: 6px 0; border: 1px solid transparent; background: var(--bg2); border-radius: 10px; cursor: pointer; }
.face[aria-pressed="true"] { border-color: var(--accent); background: none; }
.face-input { width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
              background: var(--bg); color: var(--text); font: inherit; }
.sws { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw.none { background: repeating-linear-gradient(45deg, var(--bg2) 0 4px, var(--line) 4px 6px); }

@media (prefers-reduced-motion: no-preference) {
  .recoil { animation: recoil1 .25s ease; }
  .f2.recoil { animation: recoil2 .25s ease; }
  .hurt { animation: hurt .4s ease; }
  .sway { animation: sway .4s ease; }
  .duck { animation: duck .45s ease; }
  .ko1 { animation: ko1 .7s ease forwards; }
  .ko2 { animation: ko2 .7s ease forwards; }
  .pop { animation: pop 1s ease-out forwards; }
  .flash { animation: flash .2s ease-out forwards; }
  .trail { animation: trail .3s ease-out forwards; }
  @keyframes recoil1 { 40% { transform: translateX(-8px); } }
  @keyframes recoil2 { 40% { transform: translateX(8px); } }
  @keyframes hurt { 20%, 60% { transform: translateX(-6px); opacity: .5; } 40%, 80% { transform: translateX(6px); } }
  @keyframes sway { 50% { transform: translateY(-10px) rotate(-4deg); } }
  @keyframes duck { 50% { transform: translateY(12px) scaleY(.88); } }
  @keyframes ko1 { to { transform: rotate(-82deg) translate(-30px, 18px); opacity: .7; } }
  @keyframes ko2 { to { transform: rotate(82deg) translate(30px, 18px); opacity: .7; } }
  @keyframes pop { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -38px); } }
  @keyframes flash { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
  @keyframes trail { from { transform: scaleX(0); opacity: 1; } 60% { transform: scaleX(1); opacity: 1; } to { opacity: 0; } }
}

/* Новое: карта активности, ДР, сезон, турнир, админка */
.heat-h { margin-top: 30px !important; }
.heat { margin-top: 6px; }
.hm-row { display: grid; grid-template-columns: 30px repeat(24, 1fr); gap: 2px; margin-bottom: 2px; align-items: center; }
.hm-d { font-size: 11px; color: var(--hint); }
.hm-c { aspect-ratio: 1; border: 0; padding: 0; border-radius: 2px; background: var(--accent); cursor: pointer; }
.hm-c.active { outline: 2px solid var(--text); }
.hm-axis span { font-size: 10px; color: var(--hint); }
.bday { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.bday-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding-bottom: 6px; }
select, .field input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.field input::placeholder { color: var(--hint); opacity: .6; }
.hint-line { color: var(--hint); font-size: 13px; margin: 6px 0 0; }
.upd { align-items: flex-start; }
.upd .info p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; }
.upd-date { font-weight: 400; white-space: nowrap; }
.season { background: var(--bg2); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.season-top { display: flex; justify-content: space-between; gap: 10px; }
.season-top span { color: var(--hint); font-size: 13px; }
.season p { margin: 6px 0 0; font-size: 13px; color: var(--hint); }
/* Недельный модификатор дуэлей */
.wm-card { display: flex; gap: 12px; align-items: center; background: var(--bg2); border-radius: 14px; padding: 10px 14px; margin: 10px 0; }
.wm-emoji { font-size: 26px; line-height: 1; }
.wm-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wm-body b { font-size: 14px; }
.wm-body span { font-size: 13px; color: var(--hint); }
.wm-body small { font-size: 12px; color: var(--hint); opacity: .75; }
.emo-icon { font-size: 22px; }
.sups { display: flex; flex-wrap: wrap; gap: 8px; }
.sup { border: 1px solid var(--line); background: none; border-radius: 12px; padding: 8px 10px; cursor: pointer; font-weight: 500; }
.sup span { color: var(--hint); font-size: 12px; }
.sup[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.sup[aria-pressed="true"] span { color: inherit; }
.pop.heal { color: #2e7d32; }
.match { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.match em { font-style: normal; color: var(--hint); padding: 0 4px; }
.match i { color: var(--hint); font-style: normal; font-size: 13px; }
.match s { color: var(--hint); }
.prizes { margin: 0; line-height: 1.7; }
.field { display: block; margin: 12px 0; }
.field span { display: block; color: var(--hint); font-size: 13px; margin-bottom: 6px; }
.field input, .field select { width: 100%; }
.row-field { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; margin: 6px 0; }
.row-field span { margin: 0; }
.check { display: flex; gap: 10px; align-items: center; margin: 14px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.go.ghost { background: var(--bg2); color: var(--text); }
.go.danger { background: #c62828; color: #fff; margin-top: 18px; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; padding-left: 10px; padding-right: 10px; }

/* Предложения */
.idea-form textarea { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; }
.idea-form .go { margin-top: 10px; }
.idea-form { margin-bottom: 18px; }
.idea { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.vote { flex-shrink: 0; border: 1px solid var(--line); background: none; border-radius: 12px; padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 46px; }
.vote b { font-size: 13px; }
.vote.on { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: var(--accent); }
.idea-body { flex: 1; min-width: 0; }
.idea-body p { margin: 0 0 6px; overflow-wrap: anywhere; white-space: pre-wrap; }
.idea-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--hint); font-size: 13px; }
.idea-meta select { padding: 4px 6px; font-size: 13px; }
.chip { border-radius: 8px; padding: 2px 8px; font-size: 12px; background: var(--bg2); }
.chip.st-accepted { color: #2f7de1; } .chip.st-done { color: #2e7d32; } .chip.st-declined { color: #c62828; }

/* Обновление бота */
.updating { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(3px); padding: 24px; }
.upd-box { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; max-width: 300px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.upd-box strong { display: block; font-size: 17px; margin: 12px 0 6px; }
.upd-box span { color: var(--hint); }
.upd-spin { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--step-empty); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.field small { display: block; color: var(--hint); font-size: 12px; margin-top: 4px; }
.price-field { grid-template-columns: 54px 1fr 110px; }
.price-field .icon { width: 54px; }
.rel-econ { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.rel-econ b { display: block; margin-bottom: 6px; }
.rel-econ-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rel-econ-grid .field { margin: 0; }

/* Помощь */
.help-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: none; font-weight: 700; cursor: pointer; color: var(--hint); }
.help-btn:focus-visible, .help-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.help { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.help-head { position: sticky; top: 0; background: var(--bg); display: flex; align-items: center; justify-content: space-between; padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
.help-head h2 { margin: 0; font-size: 18px; }
.help-close { border: 0; background: var(--bg2); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 15px; }
.help-body { max-width: 560px; margin: 0 auto; }
.help-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.help-item summary { font-weight: 600; cursor: pointer; list-style: none; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary::after { content: "+"; float: right; color: var(--hint); }
.help-item[open] summary::after { content: "−"; }
.help-item p { margin: 8px 0 0; line-height: 1.5; }
body.help-open { overflow: hidden; }

/* Отношения */
.wip { background: color-mix(in srgb, #f5a623 16%, transparent); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0 0 14px; }
.rel-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; color: var(--hint); font-size: 14px; }
.rel-sub { display: block; color: var(--hint); font-size: 13px; font-weight: 400; }
.rel-row .emo { font-size: 22px; }
.card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.card .two { margin-top: 10px; }
.card .segs { margin: 10px 0 0; }
.rel-head { display: flex; gap: 12px; align-items: center; }
.rel-big { font-size: 40px; }
.acts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act-btn { display: flex; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); background: none; border-radius: 12px; padding: 10px; cursor: pointer; }
.act-btn .emo { font-size: 22px; }
.act-btn b { display: block; font-weight: 600; font-size: 14px; }
.act-btn small { color: var(--hint); font-size: 12px; }
.act-btn:disabled { opacity: .45; cursor: default; }
.act-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Кланы */
.rule { background: var(--bg2); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.rule summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.rule p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; }
.clan-head { display: flex; gap: 12px; align-items: center; }
.clan-emo { font-size: 44px; }
.card .two .go, .two .go { margin-top: 0; }

/* Переключатели-слайдеры (все галочки в приложении) */
.check input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px;
  background: var(--step-empty); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.check input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.check input[type="checkbox"]:checked { background: var(--accent); }
.check input[type="checkbox"]:checked::after { transform: translateX(18px); }
.check input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check.sm { margin: 6px 0; font-size: 13px; }
/* Коллекция приветствий */
.gtext { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.gtext::placeholder { color: var(--hint); opacity: .7; }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gcard { border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.gcard.off img { opacity: .35; }
.gparts { display: flex; flex-wrap: wrap; gap: 2px 6px; margin: 4px 0; }
.gparts .check.sm { margin: 0; font-size: 12px; }
.gcard img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--bg2); }
.gname { width: 100%; margin-top: 6px; font: inherit; font-size: 13px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.pick-card { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: none; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.pick-card b { display: block; }
.pick-card span { color: var(--hint); font-size: 13px; }
.pick-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pick-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.pick-row .pick-card { flex: 1; margin-bottom: 0; }
.pick-row .mini { align-self: center; white-space: nowrap; }
.pick-card.locked { opacity: .55; border-style: dashed; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.shot { padding: 0; border: 0; background: none; cursor: pointer; }
.shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.shot-full { position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, .94); display: flex; align-items: center; justify-content: center; }
.shot-full img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.who.pa { white-space: normal; }
.part-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.seg small { color: var(--hint); font-weight: 400; }
.grow { display: flex; gap: 6px; align-items: center; }
.grow select { flex: 1; padding: 5px 6px; font-size: 13px; }
/* Эмблемы и персонажи */
.emb-img { object-fit: contain; vertical-align: middle; }
.emb-big { width: 52px; height: 52px; border-radius: 12px; }
.emb-sm { width: 30px; height: 30px; border-radius: 6px; }
.emb-xs { width: 20px; height: 20px; border-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { font-size: 14px; padding: 4px 10px; }

.state { padding: 60px 8px; text-align: center; color: var(--hint); }
.state strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }

@media (prefers-reduced-motion: no-preference) {
  .stairs.grow .step i { animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
                         animation-delay: calc(var(--n) * 22ms); }
  @keyframes rise { from { transform: translateY(100%); } }
}

/* загрузка картинок: подсветка, когда тащат файлы */
.dropzone { transition: box-shadow .15s, background .15s; border-radius: 12px; }
.dropzone.dragging { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* ---------- Дуэли: лицо из картинки (photo-face-app.js) ---------- */
body.pf-open { overflow: hidden; }
.pf-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 6, 4, .82); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pf-in { max-width: 520px; margin: 0 auto; padding: 12px 16px 40px; background: var(--bg, #1f1510); min-height: 100%; box-sizing: border-box; }
.pf-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.pf-head b { font-size: 16px; }
.pf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.pf-crop { display: block; width: 100%; max-width: 420px; aspect-ratio: 1; border-radius: 8px; touch-action: none; margin: 6px auto; }
.pf-crop.small { max-width: 260px; }
.pf-vars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 10px; }
.pf-vars button { padding: 0; border: 2px solid #4a3426; border-radius: 8px; background: #120c09; overflow: hidden; aspect-ratio: 1; color: #a88a6a; font-size: 11px; }
.pf-vars button[aria-pressed="true"] { border-color: #d0a63c; box-shadow: 0 0 0 2px #d0a63c66; }
.pf-vars button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-vars button.err { color: #e07a5a; font-size: 10px; padding: 4px; }
.pf-ai h3 { font-size: 13px; margin: 10px 0 4px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.pf-left { color: #d0a63c; }
.pf-prevs { display: flex; gap: 10px; justify-content: center; align-items: flex-end; flex-wrap: wrap; }
.pf-prevs figure { margin: 0; text-align: center; font-size: 11px; opacity: .85; }
.pxc { image-rendering: pixelated; display: block; border-radius: 8px; background: linear-gradient(#43152d, #87242a 60%, #cf5a2a); }
#pf-prof { width: 198px; } #pf-battle { width: 200px; }
.pf-sl { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.pf-sl span { width: 128px; flex: none; } .pf-sl input { flex: 1; min-width: 0; } .pf-sl b { width: 30px; text-align: right; }
.pf-chk { display: flex; gap: 4px; align-items: center; font-size: 13px; }
.pf-actions { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg, #1f1510); justify-content: center; }
.pfbtn { margin-top: 6px; }
.pf-snack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1001; padding: 10px 16px; border-radius: 10px;
  background: #3a281c; color: #efe2c8; border: 1px solid #d0a63c; font-size: 14px; box-shadow: 0 6px 20px #0008; pointer-events: none; }
/* «Мои лица»: плитки (первая — нарисованный персонаж), выбранная подсвечена, ✕ — убрать из списка */
.pf-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; margin: 6px 0 4px; }
.pf-lib-h { margin-top: 14px; }
.pf-tile { position: relative; aspect-ratio: 30 / 37; border: 2px solid #4a3426; border-radius: 8px; background: linear-gradient(#43152d, #87242a 60%, #cf5a2a); overflow: hidden; }
.pf-tile[aria-pressed="true"] { border-color: #d0a63c; box-shadow: 0 0 0 2px #d0a63c66; }
.pf-tile-use { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; color: #efe2c8; font-size: 11px; }
.pf-tile-use img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: block; }
.pf-tile-char { background: #2a1c14; padding: 4px; line-height: 1.2; }
.pf-tile-del { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid #5a4030; background: #1a120ecc; color: #efe2c8; font-size: 12px; line-height: 1; cursor: pointer; }

/* Медали в профиле стрелка */
.medals { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.medal { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px;
  padding: 0 6px; border-radius: 9px; background: rgba(255, 220, 140, .12); border: 1px solid rgba(255, 220, 140, .35);
  font-size: 17px; line-height: 1; }
.medal.more { font-size: 12px; color: var(--muted, #b9a98d); }
