/* =====================================================================
   CHESS COLLECTION — style.css
   Design system B: soft dark neutrals, gold/violet as accents.
   Mobile-first with a real desktop layout at >= 960px.
   ===================================================================== */

/* =====================================================================
   1. Tokens
   ===================================================================== */
:root {
  --bg:          #0e1015;
  --bg-soft:     #14171f;
  --surface:     #161922;
  --surface-2:   #1e222d;
  --surface-3:   #262b38;
  --border:      #252a37;
  --border-soft: #1d2029;

  --text:        #e8eaf0;
  --text-soft:   #b7bdcb;
  --muted:       #7e879b;
  --muted-2:     #5b6376;

  --gold:        #d4af37;
  --gold-soft:   #b8901f;
  --gold-bg:     rgba(212, 175, 55, 0.08);
  --gold-border: rgba(212, 175, 55, 0.32);
  --violet:      #a64dff;
  --violet-bg:   rgba(166, 77, 255, 0.10);
  --violet-border: rgba(166, 77, 255, 0.28);

  --ok:    #57d38c;
  --warn:  #f7c631;
  --bad:   #ff6b6b;
  --info:  #5b8def;
  --ok-bg:   rgba(87, 211, 140, 0.10);
  --bad-bg:  rgba(255, 107, 107, 0.10);
  --warn-bg: rgba(247, 198, 49, 0.10);

  --common:    #8b93a7;
  --epic:      #a64dff;
  --legendary: #d4af37;

  --bullet: #ff8c42;
  --blitz:  #57d38c;
  --rapid:  #5b8def;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.28);
  --sh-2: 0 4px 14px rgba(0, 0, 0, 0.35);
  --sh-3: 0 12px 32px rgba(0, 0, 0, 0.45);
  --sh-gold: 0 0 24px -6px rgba(212, 175, 55, 0.55);
  --sh-violet: 0 0 24px -6px rgba(166, 77, 255, 0.55);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --fast: 0.15s var(--ease);
  --med:  0.25s var(--ease);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 32px;

  --app-max: 520px;
  --sidebar-w: 220px;
  --rail-w: 280px;
  --topbar-h: 60px;

  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-top:    env(safe-area-inset-top, 0px);
}

/* =====================================================================
   2. Reset / base
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 50% -200px, rgba(212, 175, 55, 0.05), transparent 70%),
    radial-gradient(700px 500px at 100% 110%, rgba(166, 77, 255, 0.06), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

p { margin: 0 0 8px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font: inherit; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  margin: 6px 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color var(--fast), background var(--fast);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-border);
  background: var(--surface);
}
input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--gold); }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* =====================================================================
   3. Layout — mobile first
   ===================================================================== */
#shell { display: block; min-height: 100%; }

.sidebar, .rail { display: none; }

#app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding-bottom: calc(120px + var(--sa-bottom));
  position: relative;
}

main#screen { padding: 16px; }

.stack        { display: flex; flex-direction: column; gap: 14px; }
.stack--lg    { gap: 18px; }
.stack--sm    { gap: 8px; }

.row-between  { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-2        { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 2px; }
.section-head h3 { font-size: 15px; }

.section-title {
  margin: 22px 0 10px;
  font-size: 15px;
  font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.section-title .count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
}
.section-title .count.foil-badge {
  color: var(--gold);
  border-color: var(--gold-border);
  background: linear-gradient(135deg, rgba(212,175,55,.12), rgba(166,77,255,.06));
}

.sub      { color: var(--muted); font-size: 13px; }
.muted-sm { color: var(--muted); font-size: 11px; }
.text-bad  { color: var(--bad); }
.text-gold { color: var(--gold); }
.text-sm   { font-size: 12px; }
.bold      { font-weight: 700; }
.bold-lg   { font-weight: 800; font-size: 16px; }

.empty {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}

/* =====================================================================
   4. Topbar
   ===================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  padding-top: calc(12px + var(--sa-top));
  position: sticky; top: 0;
  background: rgba(14, 16, 21, 0.86);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
  z-index: 10;
}

.menu-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  border-radius: var(--r-md);
  padding: 7px 11px;
  cursor: pointer;
  transition: background var(--fast);
}
.menu-btn:hover { background: var(--surface-2); }
.menu-btn:active { transform: scale(0.96); }

.user {
  display: flex; gap: 10px; align-items: center;
  flex: 1; min-width: 0;
  cursor: pointer;
  border-radius: var(--r-md);
  padding: 4px;
  transition: background var(--fast);
}
.user:hover { background: var(--surface); }

.avatar {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
  font-size: 20px;
  color: var(--gold);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm  { width: 32px; height: 32px; font-size: 16px; border-radius: var(--r-sm); }

.nick {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who .sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who { min-width: 0; flex: 1; }

.wallet { display: flex; gap: 6px; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
  white-space: nowrap;
}
.chip:hover  { background: var(--surface-2); }
.chip:active { transform: scale(0.96); }
.chip-ico    { font-size: 13px; line-height: 1; }

.chip--gold {
  color: var(--gold);
  border-color: var(--gold-border);
  background: linear-gradient(135deg, rgba(212,175,55,.10), rgba(212,175,55,.02));
}
.chip--gold:hover { background: linear-gradient(135deg, rgba(212,175,55,.16), rgba(212,175,55,.05)); }

.chip--violet {
  color: var(--violet);
  border-color: var(--violet-border);
  background: linear-gradient(135deg, rgba(166,77,255,.10), rgba(166,77,255,.02));
}
.chip--violet:hover { background: linear-gradient(135deg, rgba(166,77,255,.16), rgba(166,77,255,.05)); }

.icon-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 15px;
  border-radius: var(--r-md);
  padding: 7px 9px;
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn--danger { color: var(--bad); }
.icon-btn--danger:hover { background: var(--bad-bg); }

/* =====================================================================
   5. Bottom tabbar
   ===================================================================== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: rgba(14, 16, 21, 0.94);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-top: 1px solid var(--border-soft);
  padding: 8px 4px calc(8px + var(--sa-bottom));
  z-index: 20;
}
.tabbar button {
  background: none; border: 0;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer;
  padding: 6px 0;
  border-radius: var(--r-md);
  transition: color var(--fast), background var(--fast);
}
.tabbar button:active { background: var(--surface); }
.tabbar .tab-ico { font-size: 21px; line-height: 1; }
.tabbar .tab-lbl { font-size: 9px; font-weight: 600; letter-spacing: 0.02em; }
.tabbar button.active { color: var(--gold); }
.tabbar button.active .tab-ico {
  transform: scale(1.12);
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.55));
}

/* =====================================================================
   6. Sidebar (desktop)
   ===================================================================== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  padding: 20px 14px;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--border-soft);
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 30;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 8px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 20px;
  color: #151515;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  box-shadow: var(--sh-gold);
}
.brand-name { font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-footer { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid var(--border-soft); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: none; border: 0;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  border-radius: var(--r-md);
  cursor: pointer;
  position: relative;
  transition: background var(--fast), color var(--fast);
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(212,175,55,.14), rgba(212,175,55,.02));
  color: var(--gold);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gold);
}
.nav-ico { font-size: 16px; width: 22px; text-align: center; }
.nav-lbl { flex: 1; }
.nav-item--muted { color: var(--muted); font-size: 12.5px; }
.nav-badge {
  font-size: 10px;
  font-weight: 800;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  display: none; /* <--- ИЗМЕНЕНО: скрыто по умолчанию */
  place-items: center;
}
/* Если в HTML добавлен класс .show (или убран атрибут hidden), показываем */
.nav-badge:not([hidden]) {
  display: grid;
}splay: grid; place-items: center;
}

/* =====================================================================
   7. Rail (desktop)
   ===================================================================== */
.rail {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--rail-w);
  padding: 20px 16px;
  border-left: 1px solid var(--border-soft);
  background: var(--bg-soft);
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 14px;
  z-index: 20;
}
.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
}
.rail-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 10px; }
.rail-row   { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 6px 0; }
.rail-row + .rail-row { border-top: 1px solid var(--border-soft); }

/* =====================================================================
   8. Buttons
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #151515;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  transition: transform var(--fast), box-shadow var(--fast), filter var(--fast);
  box-shadow: 0 3px 10px -4px rgba(212, 175, 55, 0.4);
}
.btn:hover { filter: brightness(1.05); box-shadow: 0 6px 18px -4px rgba(212, 175, 55, 0.55); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.4; pointer-events: none; box-shadow: none; }

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-soft); }

.btn--muted { background: var(--surface-2); color: var(--muted); box-shadow: none; }

.btn--danger { color: var(--bad); border-color: rgba(255,107,107,.28); }
.btn--danger:hover { background: var(--bad-bg); }

.btn--sm { width: auto; padding: 7px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn--google { color: var(--text); }
.btn--google::before { content: '🔵'; margin-right: 6px; }

.action-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* =====================================================================
   9. Cards
   ===================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-1);
}
.card--center { text-align: center; padding: 24px; }
.card--accent {
  background: linear-gradient(160deg, rgba(212,175,55,.06), rgba(166,77,255,.04)), var(--surface);
  border-color: var(--gold-border);
}

.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.card-title-row { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.card-foot-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; gap: 10px;
}

.badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge--ok   { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(87,211,140,.32); }
.badge--warn { background: var(--warn-bg); color: var(--warn); border: 1px solid rgba(247,198,49,.32); }
.badge--bad  { background: var(--bad-bg); color: var(--bad); border: 1px solid rgba(255,107,107,.32); }

/* =====================================================================
   10. Home
   ===================================================================== */
.card--hero {
  background:
    radial-gradient(400px 200px at 100% 0%, rgba(212,175,55,.14), transparent 70%),
    radial-gradient(400px 200px at 0% 100%, rgba(166,77,255,.12), transparent 70%),
    linear-gradient(160deg, var(--surface-2), var(--surface));
  border-color: rgba(212, 175, 55, 0.20);
  padding: 18px;
}
.hero-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 10px;
}
.hero-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.hero-title { font-size: 22px; margin-top: 2px; letter-spacing: -0.02em; }
.hero-icon  { font-size: 36px; line-height: 1; filter: drop-shadow(0 4px 12px rgba(212,175,55,.45)); }

.streak-dots { display: flex; gap: 6px; margin: 12px 0; }
.streak-dots i {
  flex: 1; height: 6px; border-radius: 3px;
  background: var(--surface-3);
  transition: background var(--med), box-shadow var(--med);
}
.streak-dots i.on { background: linear-gradient(90deg, var(--gold), var(--gold-soft)); box-shadow: 0 0 8px rgba(212,175,55,.5); }

.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.meta-chip {
  font-size: 11px; font-weight: 700;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.meta-chip--gold { color: var(--gold); border-color: var(--gold-border); background: var(--gold-bg); }
.meta-chip--ok   { color: var(--ok); border-color: rgba(87,211,140,.35); background: var(--ok-bg); }

.club-pill {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 14px;
  margin-top: 12px;
  border: 1px solid var(--gold-border);
  border-radius: var(--r-md);
  background: linear-gradient(90deg, rgba(212,175,55,.10), rgba(212,175,55,.02));
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--fast), border-color var(--fast);
  text-align: left;
}
.club-pill:hover { background: linear-gradient(90deg, rgba(212,175,55,.16), rgba(212,175,55,.05)); }
.club-pill-arrow { margin-left: auto; color: var(--gold); font-size: 16px; }

.card--ratings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 6px;
}
.rating-cell {
  text-align: center;
  padding: 10px 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
}
.rating-cell::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
}
.rating-cell--bullet::before { background: var(--bullet); }
.rating-cell--blitz::before  { background: var(--blitz); }
.rating-cell--rapid::before  { background: var(--rapid); }
.rating-label {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.rating-value { font-size: 19px; font-weight: 800; margin-top: 2px; letter-spacing: -0.02em; }
.rating-cell--bullet .rating-value { color: var(--bullet); }
.rating-cell--blitz .rating-value  { color: var(--blitz);  }
.rating-cell--rapid .rating-value  { color: var(--rapid);  }

.boxes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.box-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-align: center;
  cursor: pointer;
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
  overflow: hidden;
}
.box-card::before {
  content: '';
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 40%;
  background: radial-gradient(120% 100% at 50% 0%, rgba(212,175,55,.10), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--med);
}
.box-card:hover::before { opacity: 1; }
.box-card:hover { border-color: var(--gold-border); }
.box-card:active { transform: scale(0.98); }
.box-card--locked { opacity: 0.78; }

.box-emoji { display: grid; place-items: center; height: 66px; margin-bottom: 6px; }
.box-emoji .svg-box { width: 60px; height: 60px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.4)); }

.box-card .box-name {
  color: #f2f4f8;
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.box-card:hover .box-name { color: #ffffff; }
.box-card--locked .box-name { color: #c8cfdd; }

.box-cost-line { font-size: 12px; color: var(--gold); margin-top: 4px; font-weight: 700; }
.box-lock {
  position: absolute; top: 10px; right: 10px;
  font-size: 13px; opacity: 0.9;
}

.unlock-progress { margin-top: 8px; }
.unlock-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.unlock-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  transition: width var(--med);
  border-radius: 3px;
}
.unlock-bar--foil > span { background: linear-gradient(90deg, var(--gold), var(--violet)); }
.unlock-text { font-size: 10.5px; color: var(--muted); margin-top: 6px; }

.box-card .unlock-text { color: #9aa3b6; font-weight: 600; }

/* =====================================================================
   11. Profile
   ===================================================================== */
.card--profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
}
.profile-avatar {
  width: 56px; height: 56px;
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar--placeholder {
  display: grid; place-items: center;
  font-size: 28px; color: var(--gold);
}
.profile-head-text { min-width: 0; flex: 1; }
.profile-name {
  font-size: 18px;
  letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.profile-keys {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 800;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  background: var(--gold-bg);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  white-space: nowrap;
}
.profile-keys b { font-size: 14px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 8px;
  text-align: center;
  transition: transform var(--fast), border-color var(--fast);
}
.stat-card:hover { border-color: var(--border-soft); }
.stat-ico   { font-size: 20px; margin-bottom: 4px; }
.stat-val   { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.stat-lbl   { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 2px; font-weight: 700; }

.action-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
  box-shadow: var(--sh-1);
}
.action-card:hover { border-color: var(--border-soft); background: var(--surface-2); }
.action-card:active { transform: scale(0.99); }

.action-card--club {
  background:
    radial-gradient(300px 120px at 0% 0%, rgba(212,175,55,.16), transparent 60%),
    linear-gradient(135deg, var(--surface-2), var(--surface));
  border-color: var(--gold-border);
  box-shadow: var(--sh-gold);
}
.action-card--club:hover { filter: brightness(1.04); }
.action-card--club .action-card-title { color: var(--gold); }

.action-card--club-empty { border-style: dashed; border-color: var(--border); }

.action-card-ico {
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.action-card-ico--gold {
  background: linear-gradient(135deg, rgba(212,175,55,.18), rgba(212,175,55,.05));
  border-color: var(--gold-border);
}
.action-card-body { flex: 1; min-width: 0; }
.action-card-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 800; margin-bottom: 2px;
}
.action-card-title { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-card-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.action-card-arrow { font-size: 20px; color: var(--muted); margin-left: auto; padding-left: 6px; }


.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px; /* Уменьшили отступ между кнопками */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0; /* Убираем лишние отступы */
}

.quick-tile {
  display: flex;
  align-items: center;
  gap: 6px; /* Уменьшили отступ между иконкой и текстом */
  padding: 8px 6px; /* Сделали кнопки более компактными */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform var(--fast), border-color var(--fast), background var(--fast);
  width: 100%;
  min-width: 0; /* КРИТИЧЕСКИ ВАЖНО: запрещает элементу быть шире своей колонки */
  box-sizing: border-box;
  overflow: hidden; /* Прячем всё, что не влезает */
}

.quick-tile:hover { border-color: var(--gold-border); background: var(--surface-2); }
.quick-tile:active { transform: scale(0.98); }

.quick-ico {
  width: 28px; /* Уменьшили иконку */
  height: 28px;
  border-radius: var(--r-sm);
  display: grid; 
  place-items: center;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.quick-body { 
  min-width: 0; 
  flex: 1; 
}

.quick-title { 
  font-weight: 800; 
  font-size: 11px; /* Уменьшили шрифт заголовка */
  display: flex; 
  align-items: center; 
  gap: 4px; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
}

.quick-sub { 
  font-size: 9.5px; /* Уменьшили шрифт подписи */
  color: var(--muted); 
  margin-top: 1px; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
}

.quick-badge {
  font-size: 9px; 
  font-weight: 800;
  background: var(--bad); 
  color: #fff;
  border-radius: var(--r-pill);
  padding: 0 5px;
  min-width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.cc-nick {
  font-weight: 800;
  font-size: 15px;
  color: var(--gold);
  letter-spacing: -0.01em;
}

.prog-row { margin-top: 12px; }
.prog-row:first-child { margin-top: 0; }
.prog-top {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted);
  margin-bottom: 4px;
}
.prog-count { font-weight: 700; color: var(--text-soft); }

.profile-row { display: flex; align-items: center; gap: 14px; }
.profile-row h3 { font-size: 17px; letter-spacing: -0.02em; }

/* =====================================================================
   12. Collection
   ===================================================================== */
.mat-head { margin: 16px 0 4px; color: var(--text-soft); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }

.fig-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.fig-cell {
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  position: relative;
  border: 1px solid var(--border);
  transition: border-color var(--fast);
}
.fig-cell:not(.dim):hover { border-color: var(--gold-border); }
.fig-cell.dim { opacity: 0.28; }
.fig-cell .cnt {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 9px; color: var(--muted); font-weight: 700;
}
.img-fig { width: 28px; height: 28px; object-fit: contain; }
.fig-cell .img-fig { width: 26px; height: 26px; }

/* =====================================================================
   13. Card item
   ===================================================================== */
.card-item {
  position: relative;
  display: flex; gap: 12px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: transform var(--fast), border-color var(--fast);
}
.card-item:hover { transform: translateY(-2px); }
.card-img {
  width: 80px; height: 110px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
  display: grid; place-items: center;
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.card-title { font-weight: 700; font-size: 14px; line-height: 1.25; margin-bottom: 4px; }
.card-meta  { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.card-count {
  position: absolute; top: 8px; right: 8px;
  font-size: 11px; font-weight: 800;
  color: var(--gold);
  background: rgba(14, 16, 21, 0.9);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  z-index: 2;
}
.card-item.rarity-common    { border-color: #333a48; }
.card-item.rarity-epic      { border-color: var(--violet-border); background: linear-gradient(160deg, #221a3a, var(--surface)); }
.card-item.rarity-legendary { border-color: var(--gold-border); background: linear-gradient(160deg, #2c2510, #1a1606); box-shadow: 0 0 24px -12px rgba(212,175,55,.6); }
.card-item.foil::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.16) 45%, transparent 60%);
  animation: shine 3.2s linear infinite;
}
.card-item.card-glow { box-shadow: 0 0 0 2px currentColor inset, 0 0 28px -8px currentColor; }
.card-item.rarity-common.card-glow    { color: var(--common); }
.card-item.rarity-epic.card-glow      { color: var(--epic); }
.card-item.rarity-legendary.card-glow { color: var(--legendary); }

/* =====================================================================
   14. Market
   ===================================================================== */
.market-lot {
  display: flex; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 10px;
  align-items: center;
  transition: border-color var(--fast);
}
.market-lot:hover { border-color: var(--border-soft); }
.market-lot .card-img { width: 56px; height: 76px; }
.market-info { flex: 1; min-width: 0; }
.market-price { font-weight: 800; color: var(--violet); font-size: 15px; margin-top: 4px; }
.market-seller { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* =====================================================================
   15. Club
   ===================================================================== */
.club-header {
  background:
    radial-gradient(400px 160px at 100% 0%, rgba(212,175,55,.10), transparent 70%),
    linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 18px;
}
.club-name { font-size: 20px; font-weight: 800; color: var(--gold); letter-spacing: -0.02em; }
.club-desc { font-size: 13px; color: var(--text-soft); margin-top: 6px; line-height: 1.5; }
.club-social { margin-top: 10px; font-size: 12px; }
.club-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.club-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 8px;
  text-align: center;
}
.club-stat .lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.club-stat .val { font-size: 16px; font-weight: 800; margin-top: 3px; letter-spacing: -0.01em; }

.club-avg-block {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.club-avg-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center;
}

.club-member {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 6px;
  transition: border-color var(--fast), background var(--fast);
}
.club-member:hover { border-color: var(--border-soft); background: var(--surface-2); }
.club-member-info { flex: 1; min-width: 0; }
.club-member-name {
  font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.owner-badge {
  font-size: 9px; font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-border);
}
.row-me { border-color: var(--gold-border) !important; background: linear-gradient(160deg, rgba(212,175,55,.08), transparent); }
.rank { width: 30px; text-align: center; font-weight: 800; color: var(--muted); font-size: 13px; }
.top-rating { font-weight: 800; color: var(--gold); font-size: 16px; padding-left: 6px; }

.post-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 8px;
}
.post-item .body { font-size: 13px; line-height: 1.5; margin-top: 6px; word-wrap: break-word; }
.post-item .meta { font-size: 11px; color: var(--muted); }

.post-item--unread {
  border-color: var(--gold-border);
  background: linear-gradient(160deg, rgba(212,175,55,.06), transparent), var(--surface);
}
.notif-title {
  font-weight: 800;
  font-size: 14px;
  margin-top: 4px;
  color: var(--text);
}

/* =====================================================================
   16. Gift rewards
   ===================================================================== */
.gift-rewards { font-weight: 800; color: var(--gold); margin-top: 6px; font-size: 13px; }

/* =====================================================================
   17. Achievements
   ===================================================================== */
.ach-item {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  margin-bottom: 8px;
  transition: border-color var(--fast), transform var(--fast);
}
.ach-item:hover { border-color: var(--border-soft); }
.ach-item.unlocked {
  border-color: var(--gold-border);
  background: linear-gradient(160deg, rgba(212,175,55,.10), rgba(212,175,55,.02)), var(--surface);
  box-shadow: var(--sh-gold);
}
.ach-icon {
  width: 52px; height: 52px;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 26px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.ach-item.unlocked .ach-icon {
  background: linear-gradient(135deg, rgba(212,175,55,.22), rgba(212,175,55,.06));
  border-color: var(--gold-border);
}
.ach-body { flex: 1; min-width: 0; }
.ach-name { font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.ach-desc { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* =====================================================================
   18. Modals (ИСПРАВЛЕНО ДЛЯ МОБИЛЬНЫХ)
   ===================================================================== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.2s var(--ease);
}
.modal.hidden { display: none; }
.modal-body {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px;
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--sh-3);
  animation: popIn 0.24s var(--ease);
  box-sizing: border-box;
}

.reward { text-align: center; }
.reward .big { display: grid; place-items: center; min-height: 70px; }
.reward .big svg, .reward .big img { width: 90px; height: 90px; filter: drop-shadow(0 0 20px rgba(212,175,55,.65)); }
.reward .title { font-size: 18px; font-weight: 800; color: var(--gold); margin-top: 8px; letter-spacing: -0.01em; }
.reward .sub   { color: var(--muted); font-size: 13px; margin-top: 4px; }

.summary-list { max-height: 50vh; overflow-y: auto; margin: 12px 0; }
.summary-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  margin-bottom: 6px;
}
.summary-ico { width: 40px; display: grid; place-items: center; flex-shrink: 0; }
.summary-body { flex: 1; min-width: 0; }
.summary-title { font-weight: 700; font-size: 13px; }
.summary-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }

.checks { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-top: 10px; }
.check-row {
  display: flex; gap: 8px; align-items: center;
  font-size: 13px;
  background: var(--surface-2);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.check-row.ok { border-color: rgba(87,211,140,.35); background: var(--ok-bg); }
.check-icon { font-size: 14px; }

.verify-code-box {
  margin: 16px 0;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--bg-soft);
  border: 1px dashed var(--gold-border);
  text-align: center;
}
.verify-code-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.verify-code { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: var(--gold); cursor: pointer; }
.verify-code-hint { font-size: 10px; color: var(--muted); margin-top: 6px; }
.verify-timer { text-align: center; margin-top: 12px; font-size: 12px; color: var(--muted); }
.verify-status { text-align: center; margin-top: 8px; font-size: 12px; min-height: 16px; }

.opening {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: grid; place-items: center;
  z-index: 50;
}
.chest { width: 140px; height: 140px; animation: shake 0.14s infinite; }
.chest .svg-box { width: 100%; height: 100%; filter: drop-shadow(0 0 20px rgba(212,175,55,.55)); }

/* =====================================================================
   19. Toasts
   ===================================================================== */
#toasts {
  position: fixed;
  top: calc(var(--topbar-h) + 12px + var(--sa-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px);
  max-width: 420px;
  pointer-events: none;
}
.toast {
  background: rgba(22, 25, 34, 0.98);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  color: var(--text);
  font-size: 13.5px;
  display: flex; gap: 10px; align-items: center;
  animation: toastIn 0.24s var(--ease);
  pointer-events: auto;
  box-shadow: var(--sh-2);
}
.toast.ok   { border-color: rgba(87,211,140,.35); background: rgba(19,40,29,.98); }
.toast.err  { border-color: rgba(255,107,107,.35); background: rgba(42,22,22,.98); }
.toast.info { border-color: var(--violet-border); background: rgba(27,22,42,.98); }
.toast .toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.out { animation: toastOut 0.22s var(--ease) forwards; }

/* =====================================================================
   20. Sidemenu
   ===================================================================== */
.sidemenu { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.sidemenu.hidden { display: none; }
.sidemenu-panel {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  overflow-y: auto;
  animation: slideIn 0.22s var(--ease);
}
.sidemenu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.sm-close { background: none; border: 0; color: var(--text); font-size: 18px; cursor: pointer; padding: 6px 10px; border-radius: var(--r-sm); }
.sm-close:hover { background: var(--surface-2); }
.sm-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text);
  padding: 11px 12px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background var(--fast);
}
.sm-item:hover { background: var(--surface-2); }

/* =====================================================================
   21. Legend animation
   ===================================================================== */
.legend-overlay {
  position: fixed; inset: 0;
  z-index: 70;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(30,20,60,.92), rgba(0,0,0,.96));
  animation: fadeIn 0.35s var(--ease);
}
.legend-core {
  width: 180px; height: 180px;
  border-radius: 50%;
  position: relative;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, #fff7d6 0%, var(--gold) 35%, var(--violet) 70%, transparent 100%);
  box-shadow:
    0 0 60px 20px rgba(212,175,55,.65),
    0 0 120px 40px rgba(166,77,255,.5),
    0 0 200px 60px rgba(255,255,255,.22);
  animation: legendPulse 1.5s ease-in-out infinite;
}
.legend-core::before,
.legend-core::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.legend-core::before {
  inset: -40px;
  border: 2px solid rgba(212,175,55,.5);
  animation: legendRing 1.6s ease-out infinite;
}
.legend-core::after {
  inset: -80px;
  border: 1px solid rgba(166,77,255,.4);
  animation: legendRing 1.6s 0.4s ease-out infinite;
}
.legend-icon {
  font-size: 96px; line-height: 1;
  text-shadow: 0 0 30px rgba(255,255,255,.9), 0 0 60px rgba(212,175,55,.9);
  animation: legendIconPop 0.9s var(--ease);
}
.legend-text {
  position: absolute;
  bottom: -80px; left: 50%;
  transform: translateX(-50%);
  font-size: 20px; font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(212,175,55,.9), 0 0 32px rgba(166,77,255,.7);
  animation: legendTextGlow 1s ease-in-out infinite alternate;
  white-space: nowrap;
}
.legend-flash {
  position: fixed; inset: 0;
  z-index: 71;
  background: radial-gradient(circle at 50% 50%, #fff 0%, var(--gold) 25%, rgba(166,77,255,.6) 55%, transparent 80%);
  animation: legendFlash 0.5s ease-out forwards;
  pointer-events: none;
}

/* =====================================================================
   22. Games list
   ===================================================================== */
.games-page { padding: 4px; }
.back-btn {
  display: inline-block;
  padding: 7px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  transition: background var(--fast);
}
.back-btn:hover { background: var(--surface-2); }

.game-item {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.game-item:hover { border-color: var(--gold-border); background: linear-gradient(160deg, rgba(212,175,55,.06), transparent); }
.game-item:active { transform: scale(0.99); }
.game-item .icon { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }
.game-item .info { flex: 1; min-width: 0; }
.game-item .title { font-weight: 700; font-size: 13.5px; }
.game-item .sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.game-item-arrow  { color: var(--gold); font-size: 20px; padding-left: 6px; }

/* =====================================================================
   23. Analysis page
   ===================================================================== */
.analysis-page { padding: 4px; padding-bottom: 40px; }
.analysis-wrap { display: flex; flex-direction: column; gap: 10px; }

.analysis-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 2px;
}

.eval-box {
  font-weight: 800;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 16px;
  min-width: 74px;
  text-align: center;
  letter-spacing: -0.01em;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.eval-box.positive { color: var(--ok); border-color: rgba(87,211,140,.35); }
.eval-box.negative { color: var(--bad); border-color: rgba(255,107,107,.35); }
.eval-box.neutral  { color: var(--muted); }
.eval-box.mate {
  background: linear-gradient(135deg, #5b1f9e, var(--violet));
  color: #fff;
  border-color: var(--violet);
}

.eval-bar-wrap {
  height: 8px;
  border-radius: 4px;
  background: #232735;
  overflow: hidden;
  display: flex;
  flex-direction: row-reverse;
  margin: 6px 0;
}
.eval-bar-white { background: #f0f0f0; height: 100%; transition: width 0.35s var(--ease); }
.eval-bar-black { background: #3a3f4d; height: 100%; transition: width 0.35s var(--ease); flex: 1; }
.eval-bar-wrap.flipped { flex-direction: row; }

.analysis-mode { font-size: 11px; color: var(--muted); text-align: center; min-height: 16px; }
.analysis-status { font-size: 12px; color: var(--muted); text-align: center; min-height: 16px; margin-top: 4px; }

.analysis-board-outer { position: relative; width: 100%; max-width: 100%; margin: 0 auto; }

.analysis-board {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 2px solid rgba(212, 175, 55, 0.28);
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  background: #1a1d24;
  user-select: none;
  touch-action: none;
  box-shadow: var(--sh-2);
}

.analysis-square {
  display: grid; place-items: center;
  position: relative;
  cursor: pointer;
  transition: filter 0.18s;
}
.analysis-square.light { background: #e6d7b5; }
.analysis-square.dark  { background: #a27847; }
.analysis-square:hover { filter: brightness(1.05); }

.analysis-square img,
.analysis-square .ab-piece {
  width: 88%; height: 88%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
}

.analysis-square.last-move::before { content: ''; position: absolute; inset: 0; background: rgba(255, 220, 60, 0.42); z-index: 1; }
.analysis-square.selected::before { content: ''; position: absolute; inset: 0; background: rgba(80, 200, 255, 0.55); z-index: 1; }
.analysis-square.hint-empty::after {
  content: ''; position: absolute; inset: 8%; border-radius: 50%;
  border: 4px solid rgba(30,30,30,.4); background: transparent; z-index: 3; pointer-events: none;
}
.analysis-square.hint-capture::after {
  content: ''; position: absolute; inset: 6%; border-radius: 50%;
  border: 4px solid rgba(230, 60, 60, .65); background: transparent; z-index: 3; pointer-events: none;
}
.analysis-square.in-check::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle, rgba(255,60,60,.9) 0%, rgba(255,60,60,.3) 45%, transparent 75%);
  z-index: 1;
}
.analysis-square.drag-over { box-shadow: inset 0 0 0 3px rgba(87, 211, 140, .8); }
.analysis-square[draggable="true"] { cursor: grab; }
.analysis-square[draggable="true"]:active { cursor: grabbing; }

.analysis-square .move-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  color: #fff;
  z-index: 8;
  box-shadow: 0 1px 3px rgba(0,0,0,.6);
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex; align-items: center; justify-content: center;
}
.analysis-square .move-badge.brilliant  { background: #26c2ff; }
.analysis-square .move-badge.great      { background: #5b8def; }
.analysis-square .move-badge.best       { background: #57d38c; }
.analysis-square .move-badge.excellent  { background: #95bb4a; }
.analysis-square .move-badge.good       { background: #8fa86a; }
.analysis-square .move-badge.book       { background: #a88865; }
.analysis-square .move-badge.inaccuracy { background: #f7c631; color: #151515; }
.analysis-square .move-badge.mistake    { background: #ff8c42; }
.analysis-square .move-badge.blunder    { background: #fa4b4b; }
.analysis-square .move-badge.miss       { background: #b71c1c; }
.analysis-square .move-badge.forced     { background: #6c757d; }
.analysis-square .move-badge.normal     { background: #4a5266; }
.analysis-square .move-badge .eval-cp { font-size: 9px; margin-left: 2px; opacity: .85; font-weight: 600; }

.analysis-square.move-brilliant::before,
.analysis-square.move-great::before,
.analysis-square.move-best::before,
.analysis-square.move-excellent::before,
.analysis-square.move-inaccuracy::before,
.analysis-square.move-mistake::before,
.analysis-square.move-blunder::before,
.analysis-square.move-miss::before {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
}
.analysis-square.move-brilliant::before  { background: rgba(38, 194, 255, .32); }
.analysis-square.move-great::before      { background: rgba(91, 141, 239, .30); }
.analysis-square.move-best::before       { background: rgba(87, 211, 140, .26); }
.analysis-square.move-excellent::before  { background: rgba(149, 187, 74, .20); }
.analysis-square.move-inaccuracy::before { background: rgba(247, 198, 49, .28); }
.analysis-square.move-mistake::before    { background: rgba(255, 140, 66, .30); }
.analysis-square.move-blunder::before    { background: rgba(250, 75, 75, .36); }
.analysis-square.move-miss::before       { background: rgba(183, 28, 28, .42); }

.analysis-board.in-sandbox { filter: brightness(.86) saturate(.85); }
.analysis-board.in-sandbox .analysis-square img { filter: brightness(.85) saturate(.85) drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.analysis-board, .analysis-board .analysis-square img { transition: filter var(--med); }

.analysis-board svg.arrows { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.analysis-controls {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.analysis-controls button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.analysis-controls button:hover  { background: var(--surface); border-color: var(--border-soft); }
.analysis-controls button:active { transform: scale(0.96); }
.analysis-controls button.icon-btn { padding: 8px 11px; }
.analysis-controls button.danger  { color: var(--bad); }
.analysis-controls button#ab-hint.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #151515;
  border-color: var(--gold);
}
.analysis-nav-count {
  font-size: 13px;
  color: var(--muted);
  padding: 0 8px;
  min-width: 70px;
  text-align: center;
  font-weight: 700;
}

/* Moves list */
.moves-list {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 6px;
  max-height: 240px;
  overflow-y: auto;
  font-family: ui-monospace, 'SF Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
}

.moves-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 6px 4px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 10px;
  color: var(--muted);
}
.mv-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.mv-legend-item .mv-badge {
  position: static;
  transform: none;
  width: 14px; height: 14px;
  line-height: 14px;
  font-size: 8px;
  border-radius: 7px;
}
.mv-legend-lbl { font-size: 10px; color: var(--muted); }

.moves-row {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 3px;
  padding: 1px 2px;
  border-radius: 6px;
}
.moves-row:hover { background: rgba(255,255,255,.03); }
.moves-num { color: var(--muted); font-weight: 700; }

.moves-san {
  cursor: pointer;
  padding: 1px 6px 1px 22px;
  border-radius: var(--r-sm);
  position: relative;
  transition: background var(--fast);
}
.moves-san--w { color: #f0f2f6; }
.moves-san--b { color: #b9c0d0; }
.moves-san:hover { background: rgba(212,175,55,.15); }
.moves-san.current {
  background: rgba(212, 175, 55, 0.28);
  color: #fff;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--gold);
}
.moves-san.current .mv-badge { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4); }

.moves-san .mv-badge {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.moves-san .mv-badge.brilliant  { background: #26c2ff; }
.moves-san .mv-badge.great      { background: #5b8def; }
.moves-san .mv-badge.best       { background: #57d38c; }
.moves-san .mv-badge.excellent  { background: #95bb4a; }
.moves-san .mv-badge.good       { background: #8fa86a; }
.moves-san .mv-badge.book       { background: #a88865; }
.moves-san .mv-badge.inaccuracy { background: #f7c631; color: #151515; }
.moves-san .mv-badge.mistake    { background: #ff8c42; }
.moves-san .mv-badge.blunder    { background: #fa4b4b; }
.moves-san .mv-badge.miss       { background: #b71c1c; }
.moves-san .mv-badge.forced     { background: #6c757d; }

.moves-san.brilliant  { border-left: 3px solid #26c2ff; }
.moves-san.great      { border-left: 3px solid #5b8def; }
.moves-san.best       { border-left: 3px solid #57d38c; }
.moves-san.excellent  { border-left: 3px solid #95bb4a; }
.moves-san.good       { border-left: 3px solid #8fa86a; }
.moves-san.inaccuracy { border-left: 3px solid #f7c631; }
.moves-san.mistake    { border-left: 3px solid #ff8c42; }
.moves-san.blunder    { border-left: 3px solid #fa4b4b; }
.moves-san.miss       { border-left: 3px solid #b71c1c; }
.moves-san.forced     { border-left: 3px solid #6c757d; }

.play-indicator {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 800;
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid rgba(87,211,140,.35);
}
.play-indicator.thinking {
  background: var(--gold-bg);
  color: var(--gold);
  border-color: var(--gold-border);
}

.ab-drag-ghost, .ab-flying-piece {
  position: fixed;
  width: 60px; height: 60px;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%) scale(1.1);
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.5));
  transition: none;
}
.ab-drag-ghost img, .ab-flying-piece img { width: 100%; height: 100%; object-fit: contain; }
.ab-flying-piece {
  transform-origin: center;
  transition: transform 0.22s var(--ease);
  will-change: transform;
  z-index: 9999;
}

.promo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: var(--r-md);
}
.promo-picker {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 12px;
  display: flex;
  gap: 8px;
  box-shadow: var(--sh-3);
}
.promo-picker button {
  width: 60px; height: 60px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all var(--fast);
}
.promo-picker button:hover { background: var(--gold); transform: scale(1.08); }
.promo-picker img { width: 44px; height: 44px; object-fit: contain; }

/* =====================================================================
   24. Auth screen
   ===================================================================== */
.auth-card { max-width: 400px; margin: 40px auto; padding: 24px; }
.auth-card .btn { margin-top: 8px; }
.auth-card .btn:first-of-type { margin-top: 12px; }
.auth-card h2 { margin-bottom: 12px; }
.auth-consent { margin: 12px 0; font-size: 12.5px; color: var(--muted); }
.checkbox { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 6px 0; }
.checkbox input { width: auto; }
.checkbox a { color: var(--gold); }

/* =====================================================================
   25. Keyframes
   ===================================================================== */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn   { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes shake {
  0%   { transform: translate(0, 0) rotate(0); }
  25%  { transform: translate(-6px, 2px) rotate(-3deg); }
  50%  { transform: translate(4px, -3px) rotate(3deg); }
  75%  { transform: translate(-3px, -2px) rotate(-2deg); }
  100% { transform: translate(0, 0) rotate(0); }
}
@keyframes shine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes legendPulse { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.12); filter: brightness(1.35); } }
@keyframes legendRing { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes legendIconPop { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 60% { transform: scale(1.25) rotate(8deg); opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes legendTextGlow { from { opacity: .7; text-shadow: 0 0 12px rgba(212,175,55,.7); } to { opacity: 1; text-shadow: 0 0 24px rgba(212,175,55,1), 0 0 48px rgba(166,77,255,.9); } }
@keyframes legendFlash { 0% { opacity: 0; transform: scale(.2); } 40% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.6); } }

/* =====================================================================
   26. Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card-item.foil::after { display: none; }
}

/* =====================================================================
   27. Desktop layout (>= 960px)
   ===================================================================== */
@media (min-width: 960px) {
  body { font-size: 15px; }

  #shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
    min-height: 100vh;
    max-width: 1440px;
    margin: 0 auto;
  }

  .sidebar { display: flex; position: sticky; top: 0; height: 100vh; }
  .rail    { display: flex; position: sticky; top: 0; height: 100vh; }

  #app {
    max-width: 100%;
    margin: 0;
    padding-bottom: 24px;
    min-height: 100vh;
    border-left: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
  }

  main#screen {
    padding: 24px 32px;
    max-width: 780px;
    margin: 0 auto;
  }

  .tabbar { display: none; }
  .topbar { position: sticky; top: 0; padding: 14px 32px; padding-top: 14px; }
  .menu-btn { display: none; }

  .boxes-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-row   { grid-template-columns: repeat(3, 1fr); }
  .fig-grid   { grid-template-columns: repeat(12, 1fr); }

  .analysis-board-outer { max-width: 620px; }
  .analysis-controls    { gap: 8px; }
}

@media (min-width: 1200px) {
  .rail { display: flex; }
}

@media (min-width: 960px) and (max-width: 1199px) {
  #shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .rail { display: none; }
}

/* =====================================================================
   28. Print
   ===================================================================== */
@media print {
  .topbar, .tabbar, .sidebar, .rail, .sidemenu, #toasts, #fx { display: none !important; }
  body { background: #fff; color: #000; }
}

/* =====================================================================
   29. Card tiles (grid view)
   ===================================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.card-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: transform var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.card-tile:hover {
  transform: translateY(-2px);
  border-color: var(--gold-border);
  box-shadow: 0 8px 20px -6px rgba(0,0,0,.5);
}
.card-tile:active { transform: translateY(0) scale(0.98); }

.card-tile.rarity-common    { border-color: #333a48; }
.card-tile.rarity-epic      { border-color: var(--violet-border); background: linear-gradient(160deg, #221a3a, var(--surface)); }
.card-tile.rarity-legendary { border-color: var(--gold-border); background: linear-gradient(160deg, #2c2510, #1a1606); box-shadow: 0 0 20px -12px rgba(212,175,55,.6); }

.card-tile.foil::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.18) 45%, transparent 60%);
  animation: shine 3.2s linear infinite;
}

.tile-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
  border: 1px solid var(--border);
  margin-bottom: 6px;
}
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tile-body { min-width: 0; }
.tile-title {
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.tile-count {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(14, 16, 21, 0.9);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-sm);
  padding: 2px 5px;
  z-index: 2;
}

@media (min-width: 960px) {
  .cards-grid { grid-template-columns: repeat(5, 1fr); }
}

/* =====================================================================
   30. Fullscreen card viewer
   ===================================================================== */
.card-viewer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.viewer-img {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--border);
  background: linear-gradient(135deg, var(--surface-3), var(--surface));
}
.card-viewer.rarity-common .viewer-img    { border-color: #333a48; }
.card-viewer.rarity-epic .viewer-img      { border-color: var(--violet-border); box-shadow: var(--sh-violet); }
.card-viewer.rarity-legendary .viewer-img { border-color: var(--gold-border); box-shadow: var(--sh-gold); }
.viewer-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.viewer-info { text-align: center; }
.viewer-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.viewer-rarity {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.rarity-text-common    { color: var(--common); }
.rarity-text-epic      { color: var(--epic); }
.rarity-text-legendary { color: var(--legendary); }

.viewer-body {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
  margin-top: 8px;
}
.viewer-count {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* =====================================================================
   31. Figure collection progress bars
   ===================================================================== */
.collection-block { margin-top: 12px; }
.collection-block:first-of-type { margin-top: 0; }

.collection-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.collection-progress-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.collection-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 8px;
}
.collection-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  transition: width var(--med);
}

.collection-bonus {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  line-height: 1.4;
}

/* =====================================================================
   32. Daily reward preview + cooldown timer
   ===================================================================== */
.daily-preview {
  display: flex;
  gap: 10px;
  margin: 12px 0 6px;
}
.daily-preview-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.daily-preview-ico { font-size: 20px; line-height: 1; }
.daily-preview-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gold);
}
.daily-preview-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.daily-cooldown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 0;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.daily-cooldown-lbl {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.daily-cooldown-timer {
  font-family: ui-monospace, 'SF Mono', 'Courier New', monospace;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* =====================================================================
   33. Segmented control (Top-100 rating switch)
   ===================================================================== */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.seg-btn {
  flex: 1;
  padding: 8px 6px;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.seg-btn:hover { background: var(--surface-2); color: var(--text); }
.seg-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #151515;
  box-shadow: 0 2px 8px -3px rgba(212, 175, 55, 0.55);
}

/* =====================================================================
   34. Victory rows (profile → defeated players)
   ===================================================================== */
.victory-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
}
.victory-row:hover { border-color: var(--gold-border); background: var(--surface-3); }
.victory-row:active { transform: scale(0.99); }
.victory-row--in-app { border-color: rgba(212, 175, 55, 0.22); }
.victory-ico {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 18px;
  flex-shrink: 0;
}
.victory-body { flex: 1; min-width: 0; }
.victory-nick {
  font-weight: 800;
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.victory-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  margin-left: 4px;
  border-radius: var(--r-pill);
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.victory-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.victory-arrow { font-size: 18px; color: var(--muted); padding-left: 4px; }

/* =====================================================================
   35. Foil exchange button inside card viewer
   ===================================================================== */
.card-viewer #do-foil {
  margin-top: 10px;
  background: linear-gradient(135deg, rgba(212,175,55,.16), rgba(166,77,255,.12));
  border: 1px solid var(--gold-border);
  color: var(--gold);
}
.card-viewer #do-foil:hover { filter: brightness(1.1); }