/* UI на ассетах оригинальной страницы user_info (html-ui/static/chrome) */

:root {
  --ink: #3a2412;
  --ink-muted: #5c4030;
  --value-red: #a01818;
  --banner-red: #8b1a1a;
  --gold: #c9a227;
  --parchment: #f3e6c8;
  --font-body: Tahoma, "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink);
  /* Деревянный фон как bg2.gif в игре */
  background: #2a1810 url("/static/chrome/bg2.gif") repeat;
}

a { color: #8b0000; text-decoration: none; }
a:hover { color: #c00; text-decoration: underline; }

.site-header {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 12px 4px;
  text-align: center;
}

.site-brand-img {
  display: block;
  margin: 0 auto 8px;
  max-width: min(420px, 90vw);
  height: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  min-height: 22px;
}

.site-nav a.tbl-shp_menu-center-act,
.site-nav a.tbl-shp_menu-center-inact {
  margin-left: -3px;
  font-size: 12px;
}
.site-nav a.tbl-shp_menu-center-act:first-child,
.site-nav a.tbl-shp_menu-center-inact:first-child {
  margin-left: 0;
}
.site-nav a.tbl-shp_menu-center-act:hover,
.site-nav a.tbl-shp_menu-center-inact:hover {
  filter: brightness(1.05);
}

.page {
  max-width: 1100px;
  margin: 0 auto 40px;
  padding: 0 24px 40px;
}

/* —— Левое меню (стиль форума dwar) —— */
body.has-side-menu {
  padding-left: calc(220px * 1.2);
}
body.has-side-menu .page {
  padding-top: 16px;
}

.side-menu {
  --side-w: calc(203px * 1.2);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 50;
  width: var(--side-w);
  height: 100vh;
  height: 100dvh;
}
.side-menu-full {
  width: var(--side-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
}
.side-menu-logo {
  display: block;
  line-height: 0;
  flex: 0 0 auto;
}
.side-menu-logo img {
  display: block;
  width: var(--side-w);
  height: calc(84px * 1.2);
}
.side-menu-body {
  flex: 1 1 auto;
  width: var(--side-w);
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: url("/static/chrome/forum-side/menu_bg.gif") repeat-y top center;
  background-size: 100% auto;
  color: #5c1010;
  font-family: Tahoma, "Times New Roman", Times, serif;
  font-size: 15px;
  overflow: hidden;
  border-bottom: 1px solid #8a6b1a;
}
.side-menu-auth-row {
  display: flex;
  align-items: flex-start;
  width: var(--side-w);
  flex: 0 0 auto;
}
.side-menu-auth-l,
.side-menu-auth-r {
  display: block;
  flex: 0 0 auto;
}
.side-menu-auth-l {
  width: calc(18px * 1.2);
  height: calc(94px * 1.2);
}
.side-menu-auth-r {
  width: calc(22px * 1.2);
  height: calc(94px * 1.2);
}
.side-menu-auth-card {
  flex: 1 1 auto;
  width: calc(163px * 1.2);
  min-height: calc(66px * 1.2);
  margin: 8px 0 4px;
  background: url("/static/chrome/forum-side/login_bg_on1.gif") no-repeat center top;
  background-size: 100% 100%;
  display: flex;
  align-items: center;
}
.side-menu-auth-text {
  padding: 8px 10px 8px 16px;
  line-height: 1.35;
  color: #5c1010;
}
.side-menu-auth-text strong {
  color: #8b0000;
}
.side-menu-role {
  color: #5c4030;
  font-weight: normal;
  font-size: 14px;
}
.side-menu-help {
  flex: 0 0 auto;
  margin: 0 10px 0 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #8b1a1a;
  border-radius: 50%;
  background: rgba(247, 237, 212, 0.85);
  color: #8b1a1a;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}
.side-menu-help:hover {
  background: #efe0b8;
  color: #c00;
}
.side-menu-links {
  padding: 6px 12px 4px 18px;
  flex: 0 0 auto;
}
.side-menu-heading {
  font-weight: bold;
  color: #8b0000;
  margin: 4px 0 6px 12px;
  font-size: 15px;
}
.side-menu-item {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 3px 0;
  line-height: 1.3;
}
.side-menu-item img {
  flex: 0 0 auto;
  width: calc(16px * 1.2);
  height: calc(10px * 1.2);
}
.side-menu-item a {
  color: #5c1010;
  text-decoration: none;
}
.side-menu-item a:hover,
.side-menu-item a.is-active {
  color: #a00000;
  text-decoration: underline;
}
.side-menu-logout {
  display: inline;
  margin: 0;
  padding: 0;
}
.side-menu-logout button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #5c1010;
  cursor: pointer;
  text-align: left;
}
.side-menu-logout button:hover {
  color: #a00000;
  text-decoration: underline;
}
.side-menu-grow {
  flex: 1 1 auto;
  min-height: 12px;
  width: 100%;
}
.side-menu-line {
  display: block;
  width: calc(165px * 1.2);
  height: calc(13px * 1.2);
  margin: 8px auto 6px;
  flex: 0 0 auto;
}
.side-menu-disclaimer {
  margin: 0 14px 14px;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.35;
  color: #5c1010;
  text-align: left;
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  body.has-side-menu {
    padding-left: 0;
  }
  .side-menu {
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.45);
  }
}

.controls-panel {
  margin-top: 28px;
}

/* paper-doll внутри #userCanvas — без своей «карточки» */
#userCanvas .paper-doll {
  background: transparent;
  border: none;
  box-shadow: none;
}

#userCanvas .doll-center {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 245, 200, 0.08), transparent 65%);
  border: 1px solid rgba(138, 107, 26, 0.35);
}

/* Убрать старые name-banner / character-layout на странице персонажа */
.character-layout { display: contents; }
.name-banner { display: none; }
.stats-panel { display: none; }

/* Рамка user_info: tbl-usi_* */
.panel {
  position: relative;
  background: transparent;
  border: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  padding: 0;
  margin-bottom: 12px;
}

.panel-frame {
  border-collapse: collapse;
  width: 100%;
}
.panel-frame td { padding: 0; vertical-align: top; }
.panel-inner {
  padding: 12px 14px 16px;
  background: url("/static/chrome/tbl-usi_bg-light.gif") repeat;
}

.flash-error {
  background: #f8d4d4;
  border: 1px solid #8b1a1a;
  color: #5c1010;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.flash-ok {
  background: #d4f0d4;
  border: 1px solid #1a5c1a;
  color: #103510;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  margin: 12px 0;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.auth-form input,
.auth-form select {
  padding: 6px 8px;
  font-size: 14px;
}
.token-once {
  display: block;
  word-break: break-all;
  margin-top: 8px;
  padding: 8px;
  background: #1a1a1a;
  color: #f0e6c8;
}
.simple-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}
.simple-table th,
.simple-table td {
  border: 1px solid #8a7a5a;
  padding: 6px 8px;
  text-align: left;
}
.muted { opacity: 0.8; font-size: 13px; }

/* Имя — красный баннер tbl-usi-hdr */
.name-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
}

.name-banner .medal {
  width: 22px;
  height: 22px;
}

.name-banner h1 {
  margin: 0;
  min-width: min(100%, 360px);
  text-align: center;
  font-family: Tahoma, sans-serif;
  font-size: 15px;
  font-weight: bold;
  color: #fcf5b7;
  text-shadow: 2px 1px #4b0000;
  background: url("/static/chrome/tbl-usi-hdr.gif") center -50px repeat-x;
  background-color: #7a1515;
  border: 1px solid #c9a227;
  padding: 4px 28px 6px;
  line-height: 1.3;
}

.character-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 820px) {
  .character-layout { grid-template-columns: 1fr; }
}

/* Paper-doll */
.paper-doll {
  background: url("/static/chrome/tbl-usi_bg.gif") repeat;
  border: 1px solid #8a6b1a;
  padding: 10px 8px 8px;
  box-sizing: border-box;
}

.doll-grid {
  display: grid;
  /* слева слоты | портрет | справа слоты — средняя колонка шире бижутерии */
  grid-template-columns: 70px 220px 70px;
  grid-template-rows: 70px 70px 70px 70px 70px;
  gap: 4px 10px;
  justify-items: center;
  align-items: center;
  width: 380px;
  min-width: 380px;
  min-height: 370px;
  box-sizing: border-box;
}

.doll-slot-wrap {
  display: block;
  position: relative;
  z-index: 1;
  width: 70px;
  height: 70px;
}
.doll-slot-wrap:hover,
.doll-slot-wrap:focus-within {
  z-index: 20;
}

.doll-slot-link {
  display: block;
  color: inherit;
  text-decoration: none;
  width: 100%;
  height: 100%;
}
.doll-slot-link:hover {
  color: inherit;
  text-decoration: none;
}
.doll-slot-link .doll-slot {
  width: 100%;
  height: 100%;
}

.doll-slot {
  width: 70px;
  height: 70px;
  background: url("/static/chrome/item_slot.png") no-repeat center center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  image-rendering: auto;
  cursor: default;
}
.doll-slot-link .doll-slot {
  cursor: pointer;
}

.doll-slot img.slot-item-img,
.doll-slot > img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-top: 2px;
}

/* Оверлеи руны/оправы как на artifact_info (images/enchants/*) */
.doll-slot .enchants {
  position: absolute;
  left: 5px;
  bottom: 5px;
  width: 20px;
  height: 20px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  line-height: 0;
}
.doll-slot .enchants img {
  position: absolute;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  max-width: none;
  margin: 0;
  object-fit: unset;
  image-rendering: auto;
}
.doll-slot .enchants .enchant-frame {
  width: 20px;
  height: 20px;
}
.doll-slot .enchants .enchant-rune {
  width: 16px;
  height: 17px;
  margin: 3px 0 0 2px;
}

.rings-row .doll-slot-wrap {
  width: calc(70px * 0.75);
  height: calc(70px * 0.75);
}
.cell-ring .doll-slot,
.doll-slot.ring {
  width: calc(70px * 0.75);
  height: calc(70px * 0.75);
  background-size: calc(70px * 0.75) calc(70px * 0.75);
}
.cell-ring .doll-slot img.slot-item-img,
.doll-slot.ring img.slot-item-img,
.doll-slot.ring > img {
  width: calc(60px * 0.75);
  height: calc(60px * 0.75);
}

.slot-fallback {
  font-size: 9px;
  color: #fcf5b7;
  text-align: center;
  padding: 4px;
  line-height: 1.1;
  text-shadow: 0 1px 2px #000;
}

/* Всплывашка характеристик (как artifact_alt в игре); hoverable для ссылок */
.item-alt {
  display: none;
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  z-index: 30;
  min-width: 242px;
  max-width: 338px;
  padding: 8px 10px;
  background: #f7edd4;
  border: 1px solid #8a6b1a;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.45);
  color: #3a2412;
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  pointer-events: auto;
  white-space: normal;
  overflow-wrap: break-word;
  box-sizing: border-box;
}
/* Мост через зазор 8px, чтобы курсор не «терял» hover при переходе на карточку */
.item-alt::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  width: 10px;
}
.doll-slot-wrap:hover .item-alt,
.doll-slot-wrap:focus-within .item-alt {
  display: block;
}
/* Правая колонка — тултип слева от слота */
.cell-bracers .item-alt,
.cell-off .item-alt,
.cell-legs .item-alt,
.cell-boots .item-alt,
.cell-quiver .item-alt {
  left: auto;
  right: calc(100% + 8px);
}
.cell-bracers .item-alt::before,
.cell-off .item-alt::before,
.cell-legs .item-alt::before,
.cell-boots .item-alt::before,
.cell-quiver .item-alt::before {
  left: auto;
  right: -10px;
}
.item-alt-title {
  font-weight: 700;
  color: #8b1a1a;
  margin-bottom: 2px;
}
.item-alt-type {
  color: #5c4030;
  margin-bottom: 6px;
  font-size: 10px;
}
.item-alt-stats {
  list-style: none;
  margin: 0;
  padding: 0;
}
.item-alt-stats li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(138, 107, 26, 0.25);
  padding: 2px 0;
}
.item-alt-stats .stat-name { color: #3a2412; flex: 0 0 auto; }
.item-alt-stats .stat-value { color: #a01818; font-weight: 700; white-space: nowrap; }
.item-alt-stats .item-alt-effect {
  align-items: flex-start;
}
.item-alt-stats .item-alt-effect .stat-value {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: right;
  min-width: 0;
  flex: 1 1 auto;
}
.item-alt-effect-link {
  color: #a01818;
  font-weight: 700;
  text-decoration: underline;
}
.item-alt-effect-link:hover {
  color: #7a1010;
}

/* Позиции user_info:
   верх: наплечники | шлем | наручи
   L: оружие → броня → кольчуга
   R: 2-е → поножи → сапоги */
.cell-shoulders  { grid-column: 1; grid-row: 1; }
.cell-helmet     { grid-column: 2; grid-row: 1; }
.cell-bracers    { grid-column: 3; grid-row: 1; }
.cell-main       { grid-column: 1; grid-row: 2; }
.cell-off        { grid-column: 3; grid-row: 2; }
.cell-chest      { grid-column: 1; grid-row: 3; }
.cell-legs       { grid-column: 3; grid-row: 3; }
.cell-chainmail  { grid-column: 1; grid-row: 4; }
.cell-boots      { grid-column: 3; grid-row: 4; }
.doll-bottom {
  grid-column: 1 / -1;
  grid-row: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  height: 70px;
  box-sizing: border-box;
}
.cell-bow,
.cell-quiver {
  flex: 0 0 70px;
  width: 70px;
  height: 70px;
}

.doll-center {
  grid-column: 2;
  grid-row: 2 / 5;
  width: 100%;
  min-height: 200px;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 245, 200, 0.12), transparent 65%);
  border: 1px solid rgba(138, 107, 26, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  overflow: hidden;
}
.doll-center .level-badge {
  position: relative;
  z-index: 1;
}

.level-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c03030, #5c1010);
  border: 2px solid #c9a227;
  color: #fff8e7;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.rings-row {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  min-width: calc(70px * 0.75 * 4 + 12px);
  height: calc(70px * 0.75);
}
.rings-row .doll-slot-wrap {
  flex: 0 0 calc(70px * 0.75);
  width: calc(70px * 0.75);
  height: calc(70px * 0.75);
}

.set-label {
  text-align: center;
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink-muted);
}

.player-source-info {
  margin-left: 4px;
  vertical-align: middle;
  text-decoration: none;
}
.player-source-info img {
  width: 10px;
  height: 10px;
  border: 0;
  vertical-align: middle;
}
.player-source-refresh {
  display: inline;
  margin: 0;
  padding: 0;
}
.player-source-refresh button {
  display: inline-block;
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  vertical-align: middle;
  line-height: 0;
}
.player-source-refresh img {
  width: 12px;
  height: 12px;
  border: 0;
  vertical-align: middle;
}

/* Правая колонка статов — right_table / parchment */
.stats-panel {
  background: #f7edd4 url("/static/chrome/right_table.jpg") -601px 0 repeat-y;
  border: 1px solid #8a6b1a;
  overflow: hidden;
}

.stats-tabs {
  display: flex;
  gap: 0;
  padding: 6px 6px 0;
  background: url("/static/chrome/tbl-usi_bg.gif") repeat;
}

.stats-tabs a {
  display: inline-block;
  padding: 5px 12px;
  margin-right: 2px;
  font-size: 11px;
  font-weight: bold;
  border: 1px solid #8a6b1a;
  border-bottom: none;
  background: #e8d4a8;
  color: #3a2412;
  text-decoration: none;
}
.stats-tabs a.active {
  background: url("/static/chrome/tbl-usi-hdr.gif") center -50px repeat-x;
  background-color: #8b1a1a;
  color: #fcf5b7;
  text-shadow: 1px 1px #4b0000;
}

.stats-body {
  border-top: 1px solid #8a6b1a;
  background: rgba(247, 237, 212, 0.92);
  max-height: 520px;
  overflow-y: auto;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(139, 90, 40, 0.18);
  font-size: 12px;
}
.stat-row:nth-child(even) {
  background: rgba(255, 248, 220, 0.65);
}
.stat-row .label { color: #3a2412; font-weight: bold; }
.stat-row .value { color: var(--value-red); font-weight: bold; white-space: nowrap; }

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.breakdown-table th,
.breakdown-table td {
  padding: 3px 4px;
  border-bottom: 1px solid rgba(139, 90, 40, 0.15);
  text-align: right;
}
.breakdown-table th:first-child,
.breakdown-table td:first-child { text-align: left; }
.breakdown-table th {
  background: #e8d4a8;
  color: #3a2412;
}
.source-section-title {
  text-align: left !important;
  color: #8b1a1a !important;
  background: #e8d4a8 !important;
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.source-section-fill {
  background: #e8d4a8 !important;
  padding: 3px 4px;
}

/* Верх: кукла + игровая информация (независимо от breakdown) */
#character-card .common-content {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#character-card .character-top {
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: 100%;
}
#character-card .doll-col {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
}
#character-card .userinfo-spacer {
  flex: 0 0 10px;
  width: 10px;
}
#character-card .stats-col {
  flex: 1 1 auto;
  min-width: 220px;
  max-width: 100%;
}
#character-card #userCanvas,
#character-card .paper-doll {
  width: 400px;
  max-width: 400px;
}
#character-card .paper-doll {
  box-sizing: border-box;
}

/* По источникам: свой скролл, не влияет на ширину куклы */
#character-card .source-breakdown-wrap {
  margin-top: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.source-breakdown-panel {
  margin-top: 0;
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}
.source-breakdown-scroll {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.source-breakdown-panel .breakdown-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}
.source-breakdown-panel .breakdown-table th,
.source-breakdown-panel .breakdown-table td {
  white-space: nowrap;
  background-clip: padding-box;
}
.source-breakdown-panel .breakdown-table .col-sticky-start,
.source-breakdown-panel .breakdown-table .col-sticky-end {
  position: sticky;
  z-index: 2;
  background-color: #f3e6c8;
  background-image: none;
}
.source-breakdown-panel .breakdown-table .col-sticky-start {
  left: 0;
  box-shadow: 2px 0 3px rgba(58, 36, 18, 0.14);
}
.source-breakdown-panel .breakdown-table .col-sticky-end {
  right: 0;
  box-shadow: -2px 0 3px rgba(58, 36, 18, 0.14);
}
.source-breakdown-panel .breakdown-table tr.bg_l > .col-sticky-start,
.source-breakdown-panel .breakdown-table tr.bg_l > .col-sticky-end {
  background-color: #ebe0c4;
}
.source-breakdown-panel .breakdown-table tr:first-child > .col-sticky-start,
.source-breakdown-panel .breakdown-table tr:first-child > .col-sticky-end {
  z-index: 3;
  background-color: #e4d4a8;
}
.source-breakdown-panel .breakdown-table .source-section-title.col-sticky-start {
  z-index: 3;
  background: #e8d4a8 !important;
}
.source-breakdown-panel .breakdown-table .source-section-fill.col-sticky-end {
  z-index: 3;
  background: #e8d4a8 !important;
}
.breakdown-table .nowrap-cell {
  white-space: nowrap;
}

.controls { margin-top: 14px; display: grid; gap: 10px; }
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 720px) {
  .controls-grid { grid-template-columns: 1fr; }
}

.fieldset {
  border: 1px solid #8a6b1a;
  padding: 8px 10px;
  background: rgba(255, 250, 240, 0.55);
  overflow: visible;
}
.fieldset legend {
  font-weight: bold;
  color: #8b1a1a;
  padding: 0 4px;
}
.fieldset--hdr {
  border-color: #DB9F73;
  padding-top: 10px;
}
.fieldset--hdr > .fieldset-hdr {
  display: flex;
  justify-content: center;
  margin: 0 0 10px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0;
}
.form-stack label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.veschi-block {
  margin: 0.55rem 0;
}
.veschi-block:first-of-type { margin-top: 0.25rem; }
.plates-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.plates-row .plates-family {
  flex: 1 1 58%;
  min-width: 0;
}
.plates-row .plates-tier {
  flex: 1 1 42%;
  min-width: 0;
}
.plates-row select:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.veschi-title {
  font-weight: 600;
  color: #5a3a1a;
  margin-bottom: 0.25rem;
  font-size: 0.95em;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  margin: 4px 0;
}
.form-row label,
.form-row-head {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.tactic-block input[type="number"] {
  width: 4.2em;
}

.hint-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.hint-i {
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  border: 1px solid #8a6b1a;
  border-radius: 50%;
  background: #f7edd4;
  color: #8b1a1a;
  font: italic 700 11px/13px Georgia, "Times New Roman", serif;
  text-align: center;
  cursor: help;
}
.hint-i:hover,
.hint-i:focus {
  background: #efe0b8;
  outline: none;
}
.hint-alt {
  display: none;
  position: absolute;
  left: calc(100% + 8px);
  top: 0;
  z-index: 40;
  width: 300px;
  padding: 8px 10px;
  background: #f7edd4;
  border: 1px solid #8a6b1a;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.45);
  color: #3a2412;
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  font-style: normal;
  font-weight: 400;
}
.hint-alt::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  width: 10px;
}
.hint-wrap:hover .hint-alt,
.hint-wrap:focus-within .hint-alt {
  display: block;
}
.hint-wrap--flip .hint-alt {
  left: auto;
  right: calc(100% + 8px);
}
.hint-wrap--flip .hint-alt::before {
  left: auto;
  right: -10px;
}
.hint-alt p {
  margin: 0 0 7px;
}
.hint-alt p:last-child {
  margin-bottom: 0;
}
.hint-lead {
  padding-bottom: 7px;
  margin: 0 0 7px;
  border-bottom: 1px solid rgba(138, 107, 26, 0.35);
}
.hint-alt strong {
  color: #8b1a1a;
}

input[type="text"],
input[type="number"],
select {
  font-family: inherit;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #8a6b1a;
  background: #fffaf0;
  color: var(--ink);
  max-width: 100%;
}

/* Кнопки в стиле вкладок навигации (tbl-shp_menu inact → act на hover) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: max-content;
  max-width: 100%;
  align-self: flex-start; /* не растягивать в column-flex формах */
  height: 19px;
  margin: 0;
  padding: 0 0 0 16px;
  border: 0;
  background: url("/static/chrome/tbl-shp_menu-inact_2.png") 0 0 no-repeat;
  color: #461c0b;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  line-height: 16px;
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
  vertical-align: middle;
  box-sizing: content-box;
  appearance: none;
  -webkit-appearance: none;
}
.btn > span {
  display: inline-block;
  flex: 0 0 auto;
  width: auto;
  height: 19px;
  margin: 0 0 0 -2px; /* перекрытие стыка left-cap / body, без белой щели */
  padding: 0 20px 0 10px;
  border: 0;
  background: url("/static/chrome/tbl-shp_menu-inact_2.png") 100% -19px no-repeat;
  color: inherit;
  font: inherit;
  line-height: 16px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.btn:hover,
.btn:focus-visible {
  color: #ffe9ba;
  background-image: url("/static/chrome/tbl-shp_menu-act_2.png");
  text-decoration: none;
  outline: none;
}
.btn:hover > span,
.btn:focus-visible > span {
  color: #ffe9ba;
  background-image: url("/static/chrome/tbl-shp_menu-act_2.png");
  background-position: 100% -19px;
}
.btn-secondary,
.btn-danger {
  background-image: url("/static/chrome/tbl-shp_menu-inact_2.png");
  color: #461c0b;
}
.btn-secondary > span,
.btn-danger > span {
  background-image: url("/static/chrome/tbl-shp_menu-inact_2.png");
}
.btn-secondary:hover,
.btn-secondary:focus-visible,
.btn-danger:hover,
.btn-danger:focus-visible {
  background-image: url("/static/chrome/tbl-shp_menu-act_2.png");
  color: #ffe9ba;
}
.btn-secondary:hover > span,
.btn-secondary:focus-visible > span,
.btn-danger:hover > span,
.btn-danger:focus-visible > span {
  background-image: url("/static/chrome/tbl-shp_menu-act_2.png");
  color: #ffe9ba;
}

.player-list { list-style: none; padding: 0; margin: 0; }
.player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(139, 90, 40, 0.2);
  background: rgba(255, 250, 240, 0.4);
}
.player-list li:nth-child(even) { background: rgba(232, 212, 168, 0.35); }
.player-list a.player-link {
  font-size: 14px;
  font-weight: bold;
  color: var(--value-red);
}
.player-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.player-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: #3a2412;
  max-width: min(440px, 94vw);
  box-shadow: none;
}
.player-dialog::backdrop {
  background: rgba(40, 20, 0, 0.5);
}
.player-dialog-panel {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.player-dialog-title {
  margin: 0 0 12px;
  font-weight: bold;
  color: #8b1a1a;
  font-size: 14px;
}
.player-dialog-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  font-size: 12px;
  color: #3a2412;
}
.player-dialog-field input {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #8a6b1a;
  background: rgba(255, 250, 240, 0.9);
  color: #3a2412;
}
.player-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.muted { color: var(--ink-muted); font-size: 11px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th,
.data-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(139, 90, 40, 0.18);
  text-align: left;
}
.data-table th {
  background: #e8d4a8;
  color: #8b1a1a;
}
.data-table tr:nth-child(even) td {
  background: rgba(255, 248, 220, 0.5);
}

/* Превью бойцов на странице «Бой 1 на 1» — два столбца таблицы (рядом) */
.battle-preview {
  margin-top: 1.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(138, 107, 26, 0.35);
}
table.battle-dolls {
  width: 100%;
  border-collapse: separate;
  border-spacing: 12px 0;
  table-layout: fixed;
  margin-bottom: 12px;
}
table.battle-dolls > tbody > tr > td.battle-doll-col,
td.battle-doll-col {
  width: 50%;
  vertical-align: top;
  text-align: center;
}
.battle-doll-title {
  margin: 0 0 6px;
  font-size: 13px;
  color: #8b1a1a;
  text-align: center;
}
.battle-doll-placeholder {
  text-align: center;
  padding: 40px 8px;
  border: 1px dashed rgba(138, 107, 26, 0.4);
  background: rgba(255, 248, 220, 0.35);
}
.battle-compare-summary {
  margin: 4px 0;
  font-size: 12px;
}
.battle-compare-wrap {
  overflow: visible;
  max-height: none;
  margin-top: 6px;
}
.battle-compare-wrap .data-table {
  border-collapse: separate;
  border-spacing: 0;
}
.battle-compare-wrap .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #e8d4a8;
  box-shadow: 0 1px 0 rgba(139, 90, 40, 0.35);
}
.battle-compare-wrap .diff-good {
  color: #1a7a2e !important;
}
.battle-compare-wrap .diff-bad {
  color: #ba0000 !important;
}
.battle-compare-wrap .diff-zero {
  color: #5a4630 !important;
}
.battle-doll-with-elixirs {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
}
.battle-elixir-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 2px;
  width: 40px;
  box-sizing: border-box;
  padding: 0;
}
.battle-elixir-slot-wrap {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 0;
  width: 40px;
}
.battle-elixir-slot-wrap:hover,
.battle-elixir-slot-wrap:focus-within {
  z-index: 20;
}
.battle-elixir-link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.battle-elixir-link:hover {
  color: inherit;
  text-decoration: none;
}
.battle-elixir-slot {
  width: 100%;
  height: 100%;
  background-size: contain;
  cursor: pointer;
}
.battle-elixir-slot-wrap.is-empty .battle-elixir-slot {
  cursor: default;
  opacity: 0.55;
}
.battle-elixir-slot img.slot-item-img {
  width: 78%;
  height: 78%;
  max-width: 32px;
  max-height: 32px;
}
.battle-elixir-slot-wrap .item-alt {
  left: calc(100% + 8px);
  top: 0;
}

.battle-doll-col .paper-doll {
  display: inline-block;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  padding: 6px 4px 4px;
  box-sizing: border-box;
  text-align: left;
}
.battle-doll-col .battle-doll-with-elixirs .paper-doll {
  margin: 0;
}
/* Компактная сетка боя: нижний ряд — flex (лук | бижутерия | колчан) без наезда */
.battle-doll-col .doll-grid {
  grid-template-columns: 60px minmax(192px, 1fr) 60px;
  grid-template-rows: 60px 70px 70px 70px 60px;
  gap: 4px 8px;
  justify-items: center;
  align-items: center;
  min-height: 0;
  width: 340px;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.battle-doll-col .doll-grid > .doll-slot,
.battle-doll-col .doll-grid > .doll-slot-wrap {
  width: 60px;
  height: 60px;
}
.battle-doll-col .doll-grid > .doll-slot img.slot-item-img,
.battle-doll-col .doll-grid > .doll-slot-wrap .doll-slot img.slot-item-img {
  width: 50px;
  height: 50px;
}
.battle-doll-col .doll-slot .enchants {
  left: 4px;
  bottom: 4px;
}
.battle-doll-col .doll-bottom {
  gap: 8px;
  height: 60px;
  min-height: 60px;
  padding: 0;
  justify-content: space-between;
}
.battle-doll-col .doll-bottom > .cell-bow,
.battle-doll-col .doll-bottom > .cell-quiver {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
}
.battle-doll-col .doll-bottom > .cell-bow .doll-slot,
.battle-doll-col .doll-bottom > .cell-quiver .doll-slot {
  width: 60px;
  height: 60px;
  background-size: 60px 60px;
}
.battle-doll-col .doll-bottom > .cell-bow img.slot-item-img,
.battle-doll-col .doll-bottom > .cell-quiver img.slot-item-img {
  width: 50px;
  height: 50px;
}
.battle-doll-col .rings-row {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  justify-content: center;
  align-items: center;
  min-width: calc(60px * 0.75 * 4 + 12px);
  max-width: none;
  height: calc(60px * 0.75);
  overflow: visible;
}
.battle-doll-col .rings-row > .doll-slot-wrap {
  width: calc(60px * 0.75);
  height: calc(60px * 0.75);
  flex: 0 0 calc(60px * 0.75);
  min-width: calc(60px * 0.75);
  max-width: none;
}
.battle-doll-col .rings-row .cell-ring .doll-slot,
.battle-doll-col .rings-row .doll-slot.ring {
  width: calc(60px * 0.75);
  height: calc(60px * 0.75);
  background-size: calc(60px * 0.75) calc(60px * 0.75);
}
.battle-doll-col .rings-row .cell-ring .doll-slot img.slot-item-img,
.battle-doll-col .rings-row .doll-slot.ring img.slot-item-img {
  width: calc(50px * 0.75);
  height: calc(50px * 0.75);
}
.battle-doll-col .doll-center {
  width: 100%;
  min-height: 220px;
  height: 100%;
  justify-self: stretch;
}
.battle-doll-col .level-badge {
  width: 32px;
  height: 32px;
  font-size: 13px;
}
.battle-doll-col .set-label {
  font-size: 10px;
  max-width: 370px;
  margin-left: auto;
  margin-right: auto;
  white-space: normal;
  word-break: break-word;
}

.set-group-title {
  margin: 12px 0 4px;
  font-size: 13px;
  color: #8b1a1a;
  border-bottom: 1px solid #c9a227;
  padding-bottom: 2px;
}

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}

/* Обучение при первом входе */
body.onboarding-open {
  overflow: hidden;
}
.onboarding-overlay[hidden] {
  display: none !important;
}
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  background: rgba(42, 24, 16, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.onboarding-panel {
  --onboarding-h: 88vh;
  position: relative;
  width: 54vw;
  max-width: 1120px;
  height: var(--onboarding-h);
  max-height: var(--onboarding-h);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.onboarding-panel .panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 0;
  height: 100%;
  max-height: var(--onboarding-h);
  box-shadow: none;
}
.onboarding-panel .panel-frame {
  height: 100%;
  max-height: var(--onboarding-h);
}
.onboarding-panel .panel-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(var(--onboarding-h) - 44px);
  max-height: calc(var(--onboarding-h) - 44px);
  min-height: 0;
  overflow: hidden;
  padding: 20px 28px 10px;
  background: url("/static/chrome/onboarding-bg.png") repeat;
}
.onboarding-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--banner-red);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.onboarding-close:hover {
  color: #c00;
}
.onboarding-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-right: 4px;
}
.onboarding-pane:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.onboarding-copy {
  flex: 0 0 auto;
}
.onboarding-shot {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboarding-shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}
.onboarding-heading {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--banner-red);
}
.onboarding-body p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}
.onboarding-dont-show {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.onboarding-dont-show input {
  margin: 0;
  accent-color: var(--banner-red);
}
.onboarding-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 0 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  background: url("/static/chrome/onboarding-bg.png") repeat;
}
.onboarding-arrow {
  width: 36px;
  height: 36px;
  border: 1px solid #8a6b1a;
  background: #f3e6c8;
  color: var(--banner-red);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.onboarding-arrow:hover:not(:disabled) {
  background: #efe0b8;
}
.onboarding-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}
.onboarding-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.onboarding-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1px solid #8a6b1a;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.onboarding-dot.is-active {
  background: var(--banner-red);
  border-color: var(--banner-red);
}
@media (max-width: 900px) {
  .onboarding-panel {
    --onboarding-h: 92vh;
    width: 92vw;
  }
}

.scrape-groups {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
}
.scrape-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: 13px;
}
.scrape-group-label {
  font-weight: 700;
  color: #461c0b;
}
.scrape-group-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-muted);
}
.scrape-group-bar {
  margin-top: 4px;
  height: 10px;
  background: #efe4c8;
  border: 1px solid #8a7a5a;
  overflow: hidden;
}
.scrape-group-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #8a6b1a;
  transition: width 0.3s ease;
}
.scrape-group.is-running .scrape-group-bar-fill {
  background: #a05020;
}
.scrape-group.is-done .scrape-group-bar-fill {
  background: #3d6b2a;
}
.scrape-group-current {
  margin: 4px 0 0;
  font-size: 12px;
}
.scrape-refresh-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 12px;
}
.scrape-force-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #461c0b;
}

.battle-run-row {
  margin-top: 1rem;
}
.battle-progress[hidden] {
  display: none !important;
}
.user-rewards__progress-bar {
  position: relative;
  display: block;
  width: var(--battle-btn-w, 110px);
  height: 16px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border-radius: 8px;
  overflow: hidden;
  background: #c9a227;
  box-shadow:
    0 1px 1px rgba(70, 28, 11, 0.28),
    inset 0 1px 0 rgba(255, 248, 220, 0.7),
    inset 0 -1px 0 rgba(90, 55, 10, 0.35);
}
.user-rewards__progress-bar__bg,
.user-rewards__progress-bar__fill-mask,
.user-rewards__progress-bar__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
}
.user-rewards__progress-bar__bg {
  right: 0;
}
.user-rewards__progress-bar__bg-inner,
.user-rewards__progress-bar__fill-inner {
  height: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(184, 134, 43, 0.85);
  border-radius: 8px;
}
.user-rewards__progress-bar__bg-inner {
  background: linear-gradient(180deg, #c44a4a 0%, #9a1c1c 42%, #7a1212 100%);
  box-shadow: inset 0 1px 2px rgba(40, 0, 0, 0.35);
}
.user-rewards__progress-bar__fill-mask {
  width: 0;
  overflow: hidden;
}
.user-rewards__progress-bar__fill-inner {
  background: linear-gradient(180deg, #fff8e4 0%, #f4e6c0 48%, #e6d09a 100%);
  box-shadow:
    inset 0 1px 0 #fffdf6,
    inset 0 -1px 1px rgba(138, 107, 26, 0.28);
}
.user-rewards__progress-bar__pointer {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  margin-left: -6px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff4c8 0%, #e8c96a 38%, #c9a227 68%, #8a6b1a 100%);
  box-shadow:
    0 1px 1px rgba(70, 28, 11, 0.35),
    inset 0 1px 0 rgba(255, 248, 220, 0.8);
}
.user-rewards__progress-bar__pointer[hidden] {
  display: none;
}
.user-rewards__progress-bar__text {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  color: #f3e6c8;
  -webkit-text-stroke: 1px #000;
  paint-order: stroke fill;
  text-shadow:
    -1px 0 0 #000,
    1px 0 0 #000,
    0 -1px 0 #000,
    0 1px 0 #000;
  white-space: nowrap;
}
