:root {
  --tg-bg: var(--tg-theme-bg-color, #0f172a);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
html, body { background: #020617; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body { padding-bottom: var(--safe-bottom); }
.screen { animation: fadeIn .18s ease-out; padding-bottom: 84px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { background: linear-gradient(160deg, #0f172a, #1e293b); border: 1px solid rgba(148,163,184,.12); border-radius: 18px; }
.card-hover:active { transform: scale(.985); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border-radius: 14px; padding: .8rem 1.1rem; font-weight: 600; transition: transform .1s, opacity .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, #22c55e, #16a34a); color: #062a12; box-shadow: 0 8px 24px -8px rgba(34,197,94,.55); }
.btn-secondary { background: #1e293b; color: #e2e8f0; border: 1px solid rgba(148,163,184,.18); }
.btn-ghost { background: transparent; color: #94a3b8; }
.btn-danger { background: #7f1d1d; color: #fecaca; }

/* chips */
.chip { border-radius: 999px; padding: .4rem .85rem; font-size: .8rem; font-weight: 600; background: #1e293b; color: #cbd5e1; border: 1px solid rgba(148,163,184,.15); white-space: nowrap; }
.chip.active { background: #22c55e; color: #052e16; border-color: transparent; }

/* inputs */
.input { width: 100%; background: #0b1220; border: 1px solid rgba(148,163,184,.2); border-radius: 12px; padding: .75rem .9rem; color: #f1f5f9; outline: none; }
.input:focus { border-color: #22c55e; }
select.input { appearance: none; }
input[type=range] { width: 100%; accent-color: #22c55e; height: 6px; }
input[type=datetime-local].input { color-scheme: dark; }

/* bottom nav */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(2,6,23,.92); backdrop-filter: blur(12px); border-top: 1px solid rgba(148,163,184,.12); display: grid; grid-template-columns: repeat(4,1fr); padding: .4rem 0 calc(.4rem + var(--safe-bottom)); z-index: 30; }
.bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .65rem; color: #64748b; padding: .3rem; }
.bottom-nav button i { font-size: 1.15rem; }
.bottom-nav button.active { color: #22c55e; }

/* header */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(2,6,23,.85); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(148,163,184,.08); }

/* toast */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #1e293b; color: #f1f5f9; padding: .65rem 1rem; border-radius: 12px; font-size: .85rem; border: 1px solid rgba(148,163,184,.2); z-index: 60; box-shadow: 0 10px 30px -10px rgba(0,0,0,.6); max-width: 90vw; }
.toast.err { background: #7f1d1d; color: #fecaca; }

/* player avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg,#334155,#1e293b); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #cbd5e1; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* rating badge */
.rating-badge { display: inline-flex; align-items: center; gap: 3px; background: #0b1220; border: 1px solid rgba(245,158,11,.4); color: #fbbf24; border-radius: 8px; padding: 2px 7px; font-size: .75rem; font-weight: 700; }

.pos-GK { background: #f59e0b; color: #1c1917; }
.pos-DEF { background: #3b82f6; color: #eff6ff; }
.pos-MID { background: #22c55e; color: #052e16; }
.pos-FWD { background: #ef4444; color: #fef2f2; }
.pos-tag { border-radius: 6px; padding: 1px 6px; font-size: .65rem; font-weight: 800; letter-spacing: .03em; }

/* FIFA card */
.fifa-card { position: relative; border-radius: 22px; padding: 1.25rem; background: linear-gradient(160deg, #b45309 0%, #f59e0b 35%, #fbbf24 55%, #d97706 100%); color: #1c1917; overflow: hidden; box-shadow: 0 20px 50px -20px rgba(245,158,11,.6); }
.fifa-card.silver { background: linear-gradient(160deg, #475569, #cbd5e1 40%, #e2e8f0 60%, #64748b); }
.fifa-card.bronze { background: linear-gradient(160deg, #78350f, #b45309 40%, #d97706 60%, #92400e); color: #fff7ed; }
.fifa-card::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 80% 10%, rgba(255,255,255,.35), transparent 40%); pointer-events: none; }
.fifa-ovr { font-size: 3rem; font-weight: 900; line-height: 1; }
.fifa-stat { display: flex; justify-content: space-between; font-weight: 700; font-size: .85rem; border-bottom: 1px solid rgba(0,0,0,.12); padding: 2px 0; }

/* pitch */
.pitch-wrap { position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: 16px; overflow: hidden; border: 2px solid rgba(255,255,255,.15); background: #15803d; }
.pitch-wrap.horizontal { aspect-ratio: 3 / 2; }
.pitch-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pitch-player { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: grab; transition: transform .15s, left .3s, top .3s; z-index: 2; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.pitch-player .dot { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 4px 12px rgba(0,0,0,.35); overflow: hidden; }
.pitch-player .dot img { width: 100%; height: 100%; object-fit: cover; }
.pitch-player .lbl { font-size: .6rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); padding: 1px 6px; border-radius: 6px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pitch-player.team-A .dot { background: #2563eb; color: #fff; }
.pitch-player.team-B .dot { background: #dc2626; color: #fff; }
.pitch-player.selected { transform: translate(-50%, -50%) scale(1.18); z-index: 5; }
.pitch-player.selected .dot { border-color: #fbbf24; box-shadow: 0 0 0 4px rgba(251,191,36,.45); }
.pitch-player .cap { position: absolute; top: -4px; right: -6px; background: #fbbf24; color: #1c1917; border-radius: 50%; width: 14px; height: 14px; font-size: .55rem; font-weight: 900; display: flex; align-items: center; justify-content: center; }
/* P2 drag&drop: sudralayotgan futbolchi */
.pitch-player.dragging { z-index: 10; transition: none; cursor: grabbing; }
.pitch-player.dragging .dot { border-color: #fbbf24; box-shadow: 0 0 0 4px rgba(251,191,36,.45); }
.stat-input { width: 52px; background: #0b1220; border: 1px solid rgba(148,163,184,.2); border-radius: 10px; padding: .4rem .2rem; color: #f1f5f9; outline: none; text-align: center; font-weight: 800; }
.stat-input:focus { border-color: #22c55e; }

.streak-dot { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: .65rem; font-weight: 800; }
.streak-W { background: #16a34a; color: #fff; } .streak-L { background: #dc2626; color: #fff; } .streak-D { background: #64748b; color: #fff; }

.skeleton { background: linear-gradient(90deg,#1e293b 25%,#334155 50%,#1e293b 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.hide-scroll::-webkit-scrollbar { display: none; }
.hide-scroll { scrollbar-width: none; }
