/* Рабочий интерфейс «Карточка бойца» */
:root {
  --bg: #0b141d;
  --content: #172533;
  --content-2: #1e3040;
  --text: #f4f7fa;
  --text-secondary: #8da0b2;
  --accent: #65b1f3;
  --accent-soft: rgba(101, 177, 243, .1);
  --separator: #2c4051;
  --hover: #243848;
  --gold: #f0aa3d;
  --silver: #c4d1dc;
  --bronze: #cf8b62;
  --lime: #adff2f;
  --shadow: rgba(0, 0, 0, .45);
}

html, body, #root { min-height: 100%; }
body {
  background:
    radial-gradient(circle at 78% -18%, rgba(50, 93, 130, .3), transparent 34rem),
    #080e14;
}
button { font-family: inherit; }
.phone {
  width: 100%;
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  overflow: visible;
  border-radius: 0;
  background: var(--bg);
  box-shadow: 0 20px 80px rgba(0,0,0,.32);
}
.vk-top {
  min-height: 58px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
  color: var(--text-secondary);
  background: rgba(15, 26, 36, .95);
  border-bottom-color: var(--separator);
  backdrop-filter: blur(16px);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.vk-top .dot { width: 7px; height: 7px; background: #69dc98; box-shadow: 0 0 0 4px rgba(105,220,152,.1); }
.widget-token-action {
  min-height: 30px;
  margin-left: auto;
  padding: 0 11px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: rgba(101,177,243,.08);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
.widget-token-action:hover { background: rgba(101,177,243,.16); }
.widget-token-action:disabled { opacity: .6; cursor: wait; }

.cut-card {
  isolation: isolate;
  border: 0 !important;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.cut-card::before,
.cut-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.cut-card::before {
  inset: 0;
  z-index: -2;
  background: var(--separator);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.cut-card::after {
  inset: 1px;
  z-index: -1;
  background: inherit;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}
.ui-label {
  color: #8ba6bd;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.combat-layout {
  max-width: 1020px;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 246px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

/* Левая карточка профиля */
.fighter-card {
  position: sticky;
  top: 80px;
  padding: 22px 20px 19px;
  text-align: center;
  border: 1px solid var(--separator);
  background: linear-gradient(180deg, #22384a, #15232e 72%);
  box-shadow: 0 14px 34px rgba(0,0,0,.2);
}
.fighter-avatar {
  width: 92px;
  height: 92px;
  margin: 15px auto 13px;
  padding: 4px;
  position: relative;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(101,177,243,.1);
  box-shadow: 0 0 0 5px rgba(101,177,243,.08), inset 0 0 18px rgba(101,177,243,.12);
}
.fighter-avatar::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 9px;
  width: 10px;
  height: 10px;
  border: 2px solid #213546;
  border-radius: 50%;
  background: #69dc98;
}
.fighter-avatar .cell-avatar {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 900;
}
.fighter-avatar .cell-avatar img,
.rating-row .cell-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}
.fighter-card h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; letter-spacing: -.02em; }
.fighter-identity { margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); font-size: 10px; }
.data-status { margin: 13px auto 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text-secondary); font-size: 9px; }
.data-status i { width: 6px; height: 6px; border-radius: 50%; background: #687988; }
.data-status.ready { color: #83dda5; }
.data-status.ready i { background: #69dc98; }
.data-status.empty { color: #e5aa69; }
.data-status.empty i { background: #e5aa69; }
.fighter-values { margin: 18px 0 12px; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--separator); background: rgba(8,16,23,.22); }
.fighter-values > div { padding: 14px 8px; }
.fighter-values > div + div { border-left: 1px solid var(--separator); }
.fighter-values strong { display: block; color: var(--gold); font-size: 23px; line-height: 1; }
.fighter-values span { display: block; margin-top: 5px; color: var(--text-secondary); font-size: 8px; font-weight: 800; text-transform: uppercase; }

.outline-action, .primary-action, .text-action {
  border: 0;
  cursor: pointer;
  font-weight: 900;
}
.outline-action {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #526a7c;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  text-transform: uppercase;
}
.outline-action:hover { background: rgba(255,255,255,.04); border-color: var(--accent); }
.primary-action {
  min-height: 41px;
  padding: 0 16px;
  color: #141b20;
  background: var(--gold);
  font-size: 10px;
  text-transform: uppercase;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.primary-action:hover { filter: brightness(1.08); }
.text-action { padding: 3px 0; color: var(--accent); background: transparent; font-size: 10px; }
.text-action:hover { color: #a7d5fb; }
.full { width: 100%; }
.fighter-card > .text-action { margin-top: 10px; }

/* Правая часть и вкладки */
.combat-content { min-width: 0; }
.combat-tabs { height: 47px; display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid var(--separator); background: #111d27; }
.combat-tabs button { border: 0; border-right: 1px solid var(--separator); background: transparent; color: var(--text-secondary); font-size: 10px; font-weight: 900; text-transform: uppercase; cursor: pointer; }
.combat-tabs button:last-child { border-right: 0; }
.combat-tabs button.active { color: #111b20; background: var(--lime); }
.combat-tabs button:not(.active):hover { color: var(--text); background: #172735; }
.combat-panel { margin-top: 12px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(180px, .7fr); gap: 12px; }
.score-hero, .season-summary, .season-progress, .leaders-preview, .ranking-card, .archive-item, .empty-state.cut-card { border: 1px solid var(--separator); background: var(--content); }
.score-hero { min-height: 195px; padding: 22px; background: radial-gradient(circle at 95% 85%, rgba(173,255,47,.1), transparent 43%), linear-gradient(135deg,#182c3c,#17302f); }
.score-hero h2 { max-width: 430px; margin: 9px 0 8px; font-size: clamp(28px,4vw,44px); line-height: .94; letter-spacing: -.05em; text-transform: uppercase; }
.score-hero h2 em { display: block; color: var(--lime); font-style: normal; }
.score-hero p { margin: 0; color: var(--text-secondary); font-size: 11px; }
.score-hero .primary-action { margin-top: 21px; background: var(--lime); }
.season-summary { min-height: 195px; padding: 20px; }
.season-summary > strong { display: block; margin-top: 12px; color: var(--gold); font-size: 31px; line-height: 1; }
.season-summary p { min-height: 30px; margin: 7px 0 16px; color: var(--text-secondary); font-size: 10px; line-height: 1.45; }
.season-summary .primary-action { width: 100%; }
.season-progress { margin-top: 12px; padding: 18px 19px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.section-heading h3, .archive-heading h3 { margin: 3px 0 0; font-size: 16px; }
.season-dates { display: flex; justify-content: space-between; margin-top: 16px; font-size: 10px; font-weight: 800; }
.armored-progress { height: 8px; margin-top: 8px; border: 1px solid #355065; background: #0c161f; }
.armored-progress i { display: block; height: 100%; background: linear-gradient(90deg,var(--accent),#a6d7ff); box-shadow: 0 0 12px rgba(101,177,243,.25); }
.progress-meta { display: flex; justify-content: space-between; margin-top: 7px; color: var(--text-secondary); font-size: 8px; }
.leaders-preview { margin-top: 12px; }
.leader-heading, .ranking-heading { padding: 17px 18px 13px; }

/* Рейтинг */
.rating-list { border-top: 1px solid var(--separator); }
.rating-row { min-height: 61px; display: grid; grid-template-columns: 26px 40px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 8px 15px; border-bottom: 1px solid var(--separator); }
.rating-row:last-child { border-bottom: 0; }
.rating-row.current { background: rgba(101,177,243,.11); }
.rating-place { color: var(--text-secondary); font-size: 11px; font-weight: 900; text-align: center; }
.place-1 { color: #ffc85c; }.place-2 { color: var(--silver); }.place-3 { color: var(--bronze); }
.rating-row .cell-avatar { width: 38px; height: 38px; overflow: hidden; border: 1px solid var(--accent); border-radius: 50%; font-size: 11px; font-weight: 900; }
.rating-person { min-width: 0; }
.rating-person strong, .rating-person span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-person strong { font-size: 12px; }
.rating-person span { margin-top: 2px; color: var(--text-secondary); font-size: 9px; }
.rating-score { padding-left: 8px; text-align: right; }
.rating-score strong { display: block; color: var(--accent); font-size: 14px; }
.rating-score span { display: block; color: var(--text-secondary); font-size: 8px; }
.rating-list.compact { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); padding: 14px; gap: 7px; border-top: 1px solid var(--separator); }
.rating-list.compact .rating-row { min-width: 0; min-height: 111px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 12px 7px; text-align: center; border: 0; border-top: 3px solid #8ea1b2; background: #13232f; }
.rating-list.compact .rating-row:first-child { border-top-color: #ffc85c; }
.rating-list.compact .rating-row:nth-child(3) { border-top-color: var(--bronze); }
.rating-list.compact .rating-place { display: none; }
.rating-list.compact .rating-person strong { font-size: 10px; }
.rating-list.compact .rating-person span { max-width: 130px; font-size: 8px; }
.rating-list.compact .rating-score { padding: 0; text-align: center; }
.rating-list.compact .rating-score span { display: none; }
.ranking-card { min-height: 0; }
.empty-state { padding: 42px 18px; color: var(--text-secondary); text-align: center; font-size: 12px; }

/* Архив */
.archive-heading { padding: 5px 3px 14px; }
.archive-heading p { margin: 6px 0 0; color: var(--text-secondary); font-size: 10px; }
.archive-list { display: grid; gap: 9px; }
.archive-item { min-height: 82px; display: grid; grid-template-columns: 70px minmax(0,1fr); align-items: center; gap: 14px; padding: 14px; }
.season-number { height: 48px; display: grid; place-items: center; color: var(--gold); background: #233645; font-size: 16px; font-weight: 900; }
.archive-copy strong { display: block; font-size: 12px; }
.archive-copy span { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 9px; }
.archive-copy p { margin: 6px 0 0; color: var(--text); font-size: 10px; }

/* Форма данных */
.data-page { max-width: 680px; margin: 0 auto; padding: 24px 20px 38px; }
.back-link { margin: 0 0 12px; padding: 0; border: 0; color: var(--accent); background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.reg .data-card { padding: 23px; border: 1px solid var(--separator); border-radius: 0; background: var(--content); }
.reg .data-card h2 { margin-top: 5px; font-size: 22px; }
.reg .desc { max-width: 560px; color: var(--text-secondary); line-height: 1.55; }
.field input { height: 46px; border-radius: 0; background: #0d1720; }
.field input:focus { box-shadow: 0 0 0 3px var(--accent-soft); }
.btn.primary-action { width: 100%; margin-top: 14px; border-radius: 0; color: #141b20; background: var(--gold); }
.img-help { margin-top: 18px; border: 1px solid var(--separator); border-radius: 0; background: #12212d; }
.pill { vertical-align: 3px; border-radius: 0; }

/* Модальные окна */
.modal-overlay { background: rgba(3,8,12,.78); backdrop-filter: blur(7px); }
.modal { overflow: hidden; border: 1px solid var(--separator); border-radius: 0; background: #14222e; }
.modal-h { border-bottom-color: var(--separator); }
.modal-h .mx { padding: 0 3px; border: 0; background: transparent; }
.reward-row { border-top-color: var(--separator); }
.reward-place { width: 30px; font-size: 11px; font-weight: 900; }
.reward-place.gold { color: var(--gold); }.reward-place.silver { color: var(--silver); }.reward-place.bronze { color: var(--bronze); }
.reward-val { max-width: 45%; overflow-wrap: anywhere; text-align: right; color: var(--gold); }
.widget-token-modal { max-width: 540px; }
.widget-token-value {
  width: 100%;
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--separator);
  color: var(--text);
  background: #0d1720;
  font: 11px/1.45 monospace;
  overflow-wrap: anywhere;
}
.widget-token-value:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.widget-token-error { margin: 0; color: #ff9e9e; font-size: 13px; line-height: 1.5; }

@media (max-width: 760px) {
  .phone { max-width: none; min-height: 100vh; }
  .vk-top { min-height: 54px; padding: 0 14px; }
  .widget-token-action { padding: 0 8px; font-size: 8px; }
  .combat-layout { padding: 12px; grid-template-columns: 1fr; gap: 12px; }
  .fighter-card { position: static; padding: 18px 16px 16px; }
  .fighter-avatar { width: 82px; height: 82px; margin-top: 13px; }
  .fighter-values { max-width: 340px; margin-left: auto; margin-right: auto; }
  .fighter-card > .outline-action, .fighter-card > .text-action { max-width: 340px; margin-left: auto; margin-right: auto; }
  .combat-tabs { position: sticky; top: 54px; z-index: 12; height: 44px; }
  .overview-grid { grid-template-columns: 1fr; }
  .score-hero { min-height: 180px; padding: 19px; }
  .score-hero h2 { font-size: 34px; }
  .season-summary { min-height: 150px; }
  .rating-list.compact { grid-template-columns: 1fr; }
  .rating-list.compact .rating-row { min-height: 64px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; text-align: left; border-top-width: 1px; }
  .rating-list.compact .rating-person strong { font-size: 11px; }
  .rating-list.compact .rating-score { text-align: right; }
  .rating-row { grid-template-columns: 22px 36px minmax(0,1fr) auto; gap: 8px; padding-inline: 11px; }
  .rating-row .cell-avatar { width: 34px; height: 34px; }
  .season-progress { padding: 16px; }
  .progress-meta { gap: 10px; }
  .archive-item { grid-template-columns: 58px minmax(0,1fr); }
  .season-number { width: 58px; }
  .data-page { padding: 16px 12px 30px; }
  .reg .data-card { padding: 18px 15px; }
}

@media (min-width: 761px) and (max-width: 930px) {
  .combat-layout { grid-template-columns: 220px minmax(0,1fr); padding: 16px; }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Мини-карточка участника (клик по строке рейтинга) */
.rating-row.clickable { cursor: pointer; transition: background .12s ease; }
.rating-row.clickable:hover { background: var(--hover); }
.rating-list.compact .rating-row.clickable:hover { background: #1a2c3c; }
.usercard-head { display: flex; align-items: center; gap: 14px; padding: 18px 16px; border-bottom: 1px solid var(--separator); }
.usercard-head .cell-avatar { width: 56px; height: 56px; overflow: hidden; border: 2px solid var(--accent); border-radius: 50%; font-size: 18px; font-weight: 900; flex-shrink: 0; }
.usercard-head .cell-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.usercard-who { min-width: 0; flex: 1; }
.usercard-place { display: block; font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.usercard-place.p1 { color: #ffc85c; }
.usercard-place.p2 { color: var(--silver); }
.usercard-place.p3 { color: var(--bronze); }
.usercard-place.other { color: #8ba6bd; }
.usercard-name { margin-top: 3px; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usercard-nick { font-size: 11px; color: var(--text-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usercard-x { margin-left: auto; align-self: flex-start; padding: 0 3px; border: 0; background: transparent; cursor: pointer; color: var(--text-secondary); font-size: 20px; line-height: 1; flex-shrink: 0; }
.usercard-x:hover { color: var(--text); }
.usercard-values { margin: 14px 16px 0; display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--separator); background: rgba(8,16,23,.22); }
.usercard-values > div { padding: 13px 8px; text-align: center; }
.usercard-values > div + div { border-left: 1px solid var(--separator); }
.usercard-values strong { display: block; color: var(--gold); font-size: 21px; line-height: 1; }
.usercard-values span { display: block; margin-top: 5px; color: var(--text-secondary); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.usercard-foot { padding: 16px; }
.usercard-foot .primary-action { display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.usercard-foot .primary-action svg { flex-shrink: 0; }
