/* Faceit-Beta — Telegram Mini App
   Минимализм: тёмно-серый + красный акцент.
   Шрифт: Inter (с табличными цифрами для статы).
*/

:root {
  /* Surfaces */
  --bg-0: #0e0e10;          /* deepest */
  --bg-1: #141416;          /* page bg */
  --bg-2: #1a1a1d;          /* card bg */
  --bg-3: #232327;          /* card hover / inset */
  --bg-4: #2c2c30;          /* divider strong */

  /* Lines */
  --line-1: rgba(255,255,255,0.06);
  --line-2: rgba(255,255,255,0.10);

  /* Text */
  --text-1: #f4f4f5;        /* primary */
  --text-2: #b8b8be;        /* secondary */
  --text-3: #76767e;        /* tertiary */
  --text-4: #56565c;        /* muted */

  /* Accent — deep red */
  --red-1: #ff3a3a;
  --red-2: #e02424;         /* main */
  --red-3: #b91818;
  --red-4: #7a0e0e;
  --red-glow: 0 0 0 1px rgba(224,36,36,0.3), 0 8px 24px rgba(224,36,36,0.18);

  /* Status */
  --green: #2ecc71;
  --gold: #d6a93a;
  --blue: #3a8bff;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Type */
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #0a0a0c;
  font-family: var(--font);
  color: var(--text-1);
  font-feature-settings: "ss01","cv11";
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ───────────── App shell ───────────── */

.app-stage {
  min-height: 100vh;
  background: var(--bg-1);
}

.phone {
  width: 100%;
  min-height: 100vh;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
}

/* App body — scroll area */
.app-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-1);
  scrollbar-width: thin;
  scrollbar-color: var(--bg-4) transparent;
  position: relative;
}
.app-body::-webkit-scrollbar { width: 6px; }
.app-body::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }

.native-back {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg-1) 92%, transparent);
  border-bottom: 1px solid var(--line-1);
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  backdrop-filter: blur(12px);
}

.native-back button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5b9eff;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 16px;
  cursor: pointer;
}

.state-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  color: var(--text-2);
  text-align: center;
  font-size: 14px;
}

.state-screen img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

/* Bottom tab nav */
.tabbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-0);
  border-top: 1px solid var(--line-1);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 16px));
  gap: 4px;
}
.tabbar button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 120ms ease;
  cursor: pointer;
}
.tabbar button .tab-ico {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tabbar button.active {
  color: var(--red-1);
}
.tabbar button:active .tab-ico {
  transform: scale(0.92);
}

/* ───────────── Generic ───────────── */

.row { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tabnum { font-variant-numeric: tabular-nums; }

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 16px;
  margin: 20px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .more {
  color: var(--red-1);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
}

.divider {
  height: 1px;
  background: var(--line-1);
}

/* Skeleton placeholder image (striped) */
.placeholder-img {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,0.04) 0 6px,
      rgba(255,255,255,0.01) 6px 12px
    ),
    var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Pills, chips, badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--line-1);
}
.chip.red {
  background: rgba(224,36,36,0.12);
  color: var(--red-1);
  border-color: rgba(224,36,36,0.25);
}
.chip.green {
  background: rgba(46,204,113,0.12);
  color: var(--green);
  border-color: rgba(46,204,113,0.22);
}
.chip.gold {
  background: rgba(214,169,58,0.12);
  color: var(--gold);
  border-color: rgba(214,169,58,0.22);
}
.chip.dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  display: block;
}

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 80ms ease, background 120ms ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--red-2);
  color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 6px 14px -6px rgba(224,36,36,0.6);
}
.btn-primary:hover { background: var(--red-1); }
.btn-secondary {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--line-2);
}
.btn-secondary:hover { background: var(--bg-4); }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line-2);
}

/* Banner / avatar */
.banner {
  height: 138px;
  width: 100%;
  position: relative;
  background:
    radial-gradient(circle at 80% 100%, rgba(40,40,46,0.6), transparent 60%),
    radial-gradient(circle at 20% 30%, rgba(60,60,68,0.4), transparent 50%),
    linear-gradient(135deg, #16161a 0%, #0e0e10 60%, #0a0a0c 100%);
  overflow: hidden;
}
.banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255,255,255,0.02) 0 1px,
      transparent 1px 80px
    );
}

/* Profile avatar */
.avatar {
  --avatar-size: 96px;
  --ring-color: #2ecc71;
  --ring-glow: rgba(46,204,113,0.32);
  width: var(--avatar-size);
  height: var(--avatar-size);
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid var(--ring-color);
  background: linear-gradient(135deg, rgba(224,36,36,0.25), #17171a 72%);
  box-shadow:
    0 0 0 5px rgba(0,0,0,0.35),
    0 10px 26px rgba(0,0,0,0.5),
    0 0 18px var(--ring-glow);
  overflow: hidden;
}
.avatar.premium {
  --ring-color: #a855f7;
  --ring-glow: rgba(138,61,255,0.38);
}
.avatar::before {
  content: none;
}
.avatar > * {
  position: relative;
  z-index: 1;
  font-size: 38px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: 0;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
.avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.avatar-wrap .online-dot {
  position: absolute;
  bottom: -2px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--green);
  border-radius: 50%;
  border: 3px solid var(--bg-1);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5), 0 2px 8px rgba(46,204,113,0.45);
  z-index: 5;
}

.avatar.online::after { display: none; }

/* Stats grid */
.stats-grid {
  display: grid;
  gap: 1px;
  background: var(--line-1);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line-1);
}
.stat-cell {
  background: var(--bg-2);
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-cell .v {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-cell .v.red { color: var(--red-1); }
.stat-cell .v.green { color: var(--green); }
.stat-cell .l {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Match card */
.match {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  align-items: center;
  cursor: pointer;
  transition: border-color 120ms ease, transform 80ms ease;
}
.match:hover { border-color: var(--line-2); }
.match:active { transform: scale(0.995); }
.match .map-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}
.match.win  .map-thumb { box-shadow: inset 3px 0 0 var(--green); }
.match.loss .map-thumb { box-shadow: inset 3px 0 0 var(--red-1); }

.match-card {
  overflow: hidden;
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  background: var(--bg-2);
}

.match-map {
  min-height: 116px;
  padding: 14px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line-1);
}

.match-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-1);
}

.match-meta > div {
  min-width: 0;
  padding: 10px 8px;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.match-meta .l {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.match-meta .v {
  color: var(--text-1);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Reviews bar */
.review-bar {
  height: 8px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}
.review-bar .pos { background: var(--green); }
.review-bar .neg { background: var(--red-2); }

/* Premium / shop */
.shop-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line-1);
  background: var(--bg-2);
}

.premium-card {
  padding: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(224,36,36,0.4), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(122,14,14,0.6), transparent 60%),
    linear-gradient(135deg, #2a0808 0%, #150404 100%);
  border: 1px solid rgba(224,36,36,0.3);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
}
.premium-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 4px);
  pointer-events: none;
}

/* Plan tiles */
.plan {
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  padding: 14px;
  cursor: pointer;
  transition: all 120ms ease;
  position: relative;
}
.plan.selected {
  border-color: var(--red-2);
  background: linear-gradient(180deg, rgba(224,36,36,0.08), rgba(224,36,36,0.02));
  box-shadow: 0 0 0 1px var(--red-2) inset;
}
.plan .badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--red-2);
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

/* Inputs */
.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  color: var(--text-1);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border 120ms ease;
}
.input:focus { border-color: var(--red-2); }
.input::placeholder { color: var(--text-4); }

/* Filter pills row (matches) */
.filter-row {
  display: flex;
  gap: 6px;
  padding: 10px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-row .fp {
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 120ms ease;
}
.filter-row .fp.active {
  background: var(--red-2);
  border-color: var(--red-2);
  color: white;
}

/* Keyframes */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.tab-enter { animation: fadeIn 220ms ease; }

/* Modal sheet */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  animation: fadeIn 200ms ease;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
}
.sheet {
  width: 100%;
  background: var(--bg-1);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--line-2);
  padding: 8px 0 24px;
  animation: slideUp 280ms cubic-bezier(0.2, 0.9, 0.3, 1.05);
  max-height: 85%;
  overflow-y: auto;
}
.sheet .grabber {
  width: 36px;
  height: 4px;
  background: var(--bg-4);
  border-radius: 999px;
  margin: 6px auto 12px;
}

/* Verified / Premium glyphs */
.verified {
  color: var(--blue);
  flex-shrink: 0;
}
.premium-prefix {
  color: var(--gold);
  font-weight: 600;
}
.banned {
  color: var(--red-1);
  flex-shrink: 0;
}
