@import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300;400;700&family=Roboto:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0b21;
  --bg-card:    rgba(255,255,255,.04);
  --bg-hover:   rgba(255,255,255,.07);
  --line:       rgba(255,255,255,.09);
  --line-soft:  rgba(255,255,255,.05);

  --w:          #ffffff;
  --w70:        rgba(255,255,255,.70);
  --w40:        rgba(255,255,255,.40);
  --w20:        rgba(255,255,255,.20);
  --w10:        rgba(255,255,255,.10);
  --w05:        rgba(255,255,255,.05);

  --red:        #ff4d4d;
  --green:      #4dff91;
  --yellow:     #ffc84d;

  --accent:     #E07B2A;
  --accent-dim: rgba(224,123,42,.12);

  --f-display:  'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  --f-body:     'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
  --f-mono:     'JetBrains Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: #171717;
  color: var(--w);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('https://shop-front-ru-cdn.lesta.ru/assets/lesta-ps-bg.de23f314.jpg') no-repeat center top / cover;
}

.hidden { display: none !important; }
.mono   { font-family: var(--f-mono); }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--w20); border-radius: 2px; }

/* ── Header ─────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 59px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  background: #232323;
  box-shadow: 0 -1px rgba(255,255,255,.10) inset, 0 1px 0 rgba(0,0,0,.4);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header__logo-icon { height: 24px; width: auto; }

.header__product-logo {
  height: 28px;
  width: auto;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
  object-fit: contain;
}

.header__logo-main {
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.header__logo-sub { display: none; }

.header__search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  background: var(--w05);
  border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}

.search-box:focus-within {
  border-color: var(--w40);
  background: var(--w10);
}

.search-box__icon { width: 15px; height: 15px; color: var(--w40); flex-shrink: 0; }

.search-box__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--w);
  font-family: var(--f-body);
  font-size: 13px;
}

.search-box__input::placeholder { color: var(--w40); }

.search-box__clear {
  background: none;
  border: none;
  color: var(--w40);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  transition: color .15s;
  line-height: 1;
}
.search-box__clear:hover { color: var(--w); }

/* ── Dropdown ───────────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #0f0d28;
  border: 1px solid var(--line);
  z-index: 200;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background .1s;
}

.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--bg-hover); }

.dropdown-item__nick { font-size: 13px; font-weight: 500; }
.dropdown-item__id   { font-family: var(--f-mono); font-size: 11px; color: var(--w40); }

/* ── Badge ──────────────────────────────────────────────── */
.badge {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .08em;
  padding: 3px 8px;
  border: 1px solid var(--line);
  color: var(--w40);
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
a.badge:hover { color: var(--w70); border-color: var(--w20); }

/* ── Main ───────────────────────────────────────────────── */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 32px 64px;
}

/* ── Empty state ────────────────────────────────────────── */
.view--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 100px;
  gap: 10px;
  text-align: center;
}

.empty__icon svg { width: 60px; height: 60px; opacity: .2; }

.empty__title {
  font-family: var(--f-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: .04em;
  margin-top: 8px;
}

.empty__sub { color: var(--w40); font-size: 13px; max-width: 380px; }

.empty__tips {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.tip { display: flex; align-items: center; gap: 14px; font-size: 12px; }

.tip__key {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--w70);
  border: 1px solid var(--line);
  padding: 2px 10px;
  min-width: 60px;
  text-align: center;
}

.tip__val { color: var(--w40); }

/* ── Loading ────────────────────────────────────────────── */
.view--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 120px;
  gap: 14px;
  color: var(--w40);
  font-size: 13px;
}

/* ── Error ──────────────────────────────────────────────── */
.view--error {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 100px;
  gap: 12px;
}

.error__icon   { font-size: 28px; color: var(--red); opacity: .7; }
.error__message { color: var(--w70); font-size: 13px; }

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--w10);
  border-top-color: var(--w70);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.spinner--sm { width: 16px; height: 16px; border-width: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
  border: none;
}

.btn--outline {
  background: none;
  border: 1px solid var(--line);
  color: var(--w70);
}
.btn--outline:hover { border-color: var(--w40); color: var(--w); background: var(--w05); }

/* ── Profile panel ───────────────────────────────────────── */
.profile-panel {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: rgba(0,0,0,.5);
  margin-bottom: 16px;
}

.profile-hero {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

/* Identity */
.profile-id {
  flex: 1;
  padding: 24px 28px;
  min-width: 0;
}

.profile-id__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.player-nick {
  font-family: var(--f-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--w);
  margin-bottom: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-id__rows {
  border-top: 1px solid var(--line);
}

.profile-id__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
  gap: 12px;
}
.profile-id__row:last-child { border-bottom: none; }

.profile-id__key { font-size: 11px; color: var(--w40); white-space: nowrap; flex-shrink: 0; }
.profile-id__val { font-family: var(--f-mono); font-size: 12px; color: var(--w70); text-align: right; overflow: hidden; text-overflow: ellipsis; }

/* Clan */
.profile-clan-section {
  width: 220px;
  flex-shrink: 0;
  padding: 24px 28px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.profile-clan-section__label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--w40);
  margin-bottom: 14px;
}

.profile-clan { display: flex; flex-direction: column; flex: 1; }

.clan-tag {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1;
  display: block;
  margin-bottom: 4px;
}

.clan-name { font-size: 13px; color: var(--w70); display: block; margin-bottom: 10px; }

.clan-role,
.clan-joined,
.clan-members {
  display: block;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--w40);
  line-height: 1.8;
}

.no-clan { color: var(--w40); font-size: 12px; }

/* ── Stats readout ───────────────────────────────────────── */
.stats-readout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.stats-readout__cell {
  padding: 18px 24px;
  border-right: 1px solid var(--line);
  transition: background .15s;
}
.stats-readout__cell:last-child { border-right: none; }
.stats-readout__cell:hover { background: var(--bg-hover); }

.stat-value {
  font-family: var(--f-mono);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: var(--w);
  margin-bottom: 6px;
}

.stat-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--w40);
}

.wr--high { color: var(--green); }
.wr--mid  { color: var(--yellow); }
.wr--low  { color: var(--red); }

/* ── Flags bar ──────────────────────────────────────────── */
.flags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  border-left: 2px solid currentColor;
}

.flag--warn { color: var(--yellow); background: rgba(255,200,77,.06); }
.flag--info { color: var(--w40);    background: var(--w05); }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--w40);
  font-family: var(--f-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover { color: var(--w70); }
.tab-btn.active { color: var(--w); border-bottom-color: var(--w); }

.tab-btn__icon { width: 16px; height: 16px; opacity: .6; }
.tab-btn.active .tab-btn__icon { opacity: 1; }

.tab-count {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--w40);
  padding: 1px 5px;
  border: 1px solid var(--line);
}

/* ── Tab panel ──────────────────────────────────────────── */
.tab-panel { padding: 24px 0; }

/* ── Panel toolbar ──────────────────────────────────────── */
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.filter-input {
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--w);
  font-family: var(--f-body);
  font-size: 13px;
  padding: 6px 0;
  width: 220px;
  outline: none;
  transition: border-color .15s;
}
.filter-input::placeholder { color: var(--w40); }
.filter-input:focus { border-bottom-color: var(--w40); }

.toolbar-right { display: flex; align-items: center; gap: 16px; }

.sort-select {
  background: none;
  border: 1px solid var(--line);
  color: var(--w70);
  font-family: var(--f-body);
  font-size: 12px;
  padding: 5px 28px 5px 10px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,.3)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.sort-select option { background: #0f0d28; }

.tanks-total {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--w40);
  white-space: nowrap;
}

/* ── Loading / empty ────────────────────────────────────── */
.panel-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--w40);
  font-size: 12px;
  padding: 24px 0;
}

.panel-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--w20);
  font-size: 13px;
}

/* ── Tank table ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.tanks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tanks-table th {
  padding: 8px 12px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--w40);
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.th-center { text-align: center; }
.th-right  { text-align: right; }
.th-sort   { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort:hover { color: var(--w70, #aaa); }
.th-sort--active { color: var(--w, #fff); }
.sort-ico  { font-size: 9px; opacity: .6; }

.tanks-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.tanks-table tbody tr:hover td { background: var(--bg-hover); }
.tanks-table tbody tr:last-child td { border-bottom: none; }

.tank-name  { font-weight: 500; color: var(--w); }
.nation-flag { vertical-align: middle; margin-right: 6px; border-radius: 1px; position: relative; top: -1px; }
.tank-type  { font-family: var(--f-mono); font-size: 10px; color: var(--w40); display: block; margin-top: 2px; }
.td-tier    { text-align: center; font-family: var(--f-mono); font-size: 11px; color: var(--w40); }
.td-num     { text-align: right; font-family: var(--f-mono); font-size: 12px; color: var(--w70); }
.td-wr      { text-align: right; font-family: var(--f-mono); font-size: 12px; font-weight: 500; }

/* ── Achievements ───────────────────────────────────────── */
.ach-content { display: flex; flex-direction: column; gap: 28px; }

.ach-section-title {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--w40);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.ach-list { display: flex; flex-direction: column; }

.ach-row {
  display: flex;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .1s;
  position: relative;
}
.ach-row:last-child { border-bottom: none; }
.ach-row--tip { cursor: help; }
.ach-row--tip:hover { background: var(--bg-hover); border-radius: 4px; }

.ach-name {
  flex: 1;
  font-size: 13px;
  color: var(--w70);
  transition: color .1s;
}
.ach-row--tip:hover .ach-name { color: var(--w); }

.ach-badge {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--w);
  background: var(--w10);
  padding: 2px 8px;
  border-radius: 3px;
  margin-left: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ach-badge--degree {
  color: #ffc84d;
  background: rgba(255,200,77,.12);
}
.ach-badge--series {
  color: #7eb8ff;
  background: rgba(126,184,255,.10);
}

.ach-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 300px;
  background: #131224;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255,255,255,.75);
  z-index: 60;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.6);
  transition: opacity .15s;
  white-space: pre-line;
}
.ach-row:hover .ach-tip {
  visibility: visible;
  opacity: 1;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .profile-hero { flex-direction: column; }
  .profile-clan-section { width: auto; border-left: none; border-top: 1px solid var(--line); }
  .stats-readout { grid-template-columns: repeat(2, 1fr); }
  .stats-readout__cell:nth-child(2) { border-right: none; }
  .stats-readout__cell:nth-child(3),
  .stats-readout__cell:nth-child(4) { border-top: 1px solid var(--line); }
  .stats-readout__cell:nth-child(4) { border-right: none; }
  .player-nick { font-size: 30px; }
  .main  { padding: 20px 16px 48px; }
  .header { padding: 0 16px; gap: 12px; }
  .header__search-wrap { max-width: none; }
}

@media (max-width: 640px) {
  .panel-toolbar { flex-direction: column; align-items: flex-start; }
  .filter-input  { width: 100%; }
}
