:root {
  --bg: #08111f;
  --bg-soft: #0f1c2f;
  --card: rgba(255, 255, 255, 0.9);
  --card-dark: rgba(10, 18, 32, 0.78);
  --text: #101828;
  --muted: #667085;
  --white: #ffffff;
  --primary: #f43f5e;
  --primary-2: #f59e0b;
  --green: #16a34a;
  --blue: #2563eb;
  --line: rgba(148, 163, 184, 0.35);
  --shadow: 0 24px 80px rgba(2, 6, 23, 0.22);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(244, 63, 94, 0.26), transparent 34rem),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.20), transparent 30rem),
    linear-gradient(180deg, #08111f 0%, #0d1728 36%, #f6f8fb 36%, #eef2f7 100%);
  min-height: 100vh;
}

button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
img { max-width: 100%; display: block; }

.app-shell { min-height: 100vh; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.hero {
  color: var(--white);
  padding: 34px 0 54px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -120px;
  top: 20px;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0));
  pointer-events: none;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 42px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 30px rgba(244, 63, 94, 0.35);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffe4e6;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(38px, 6vw, 78px);
  line-height: 0.92;
  letter-spacing: -0.065em;
}
.hero p {
  margin: 0;
  max-width: 690px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.72;
  font-size: 17px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }

.hero-card {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 32px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.hero-card-inner {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 22px;
}
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat-mini {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 14px;
}
.stat-mini strong { display: block; font-size: 24px; letter-spacing: -0.04em; }
.stat-mini span { color: var(--muted); font-size: 12px; font-weight: 700; }

.main { margin-top: -34px; padding-bottom: 56px; position: relative; z-index: 2; }
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.10);
  overflow: hidden;
}
.card.pad { padding: 22px; }
.card-header {
  padding: 20px 22px;
  border-bottom: 1px solid #e8edf5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.card-header h2, .card-header h3, .section-title { margin: 0; letter-spacing: -0.035em; }
.section-title { font-size: 24px; }
.subtle { color: var(--muted); font-size: 14px; line-height: 1.55; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.16);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(17,24,39,0.20); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #fb7185); }
.btn.light { background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.20); color: #fff; }
.btn.ghost { background: #f1f5f9; color: #0f172a; box-shadow: none; }
.btn.small { min-height: 36px; padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.48; cursor: not-allowed; transform: none; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; background: #f1f5f9; padding: 6px; border-radius: 999px; }
.auth-tabs button { flex: 1; border-radius: 999px; padding: 10px 12px; font-weight: 800; color: var(--muted); background: transparent; }
.auth-tabs button.active { background: #fff; color: #0f172a; box-shadow: 0 8px 20px rgba(15,23,42,0.08); }
.form-grid { display: grid; gap: 12px; }
.field label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 6px; color: #334155; }
.input {
  width: 100%;
  border: 1px solid #d7deea;
  background: #fff;
  border-radius: 16px;
  min-height: 48px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { border-color: rgba(244,63,94,0.72); box-shadow: 0 0 0 4px rgba(244,63,94,0.10); }
.error-box, .success-box, .notice-box {
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.error-box { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.success-box { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.notice-box { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

.user-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.user-kpi {
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.72);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 15px 40px rgba(15,23,42,0.08);
}
.user-kpi span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 6px; }
.user-kpi strong { font-size: 28px; letter-spacing: -0.04em; }

.rounds {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 18px;
  scrollbar-width: thin;
}
.round-pill {
  white-space: nowrap;
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-weight: 800;
}
.round-pill.active { background: #111827; color: #fff; border-color: #111827; }

.match-list { display: grid; gap: 14px; padding: 18px; }
.match-card {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 22px;
  padding: 16px;
  display: grid;
  gap: 14px;
}
.match-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.match-date { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.match-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}
.match-status.live { background: #fff7ed; color: #c2410c; }
.match-status.finished { background: #ecfdf5; color: #047857; }
.match-status.locked { background: #fff1f2; color: #be123c; }
.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team.away { justify-content: flex-end; text-align: right; }
.team-name { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag {
  width: 40px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  flex: 0 0 auto;
}
.flag.placeholder { display: grid; place-items: center; font-size: 18px; }
.vs { color: #94a3b8; font-weight: 900; font-size: 12px; }
.prediction-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: #f8fafc;
  border-radius: 18px;
  padding: 12px;
}
.score-input {
  width: 68px;
  text-align: center;
  border: 1px solid #d7deea;
  border-radius: 14px;
  height: 44px;
  font-size: 18px;
  font-weight: 900;
}
.real-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-weight: 900;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 8px 12px;
}
.points-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 900;
}

.ranking { padding: 12px; }
.rank-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid #edf2f7;
}
.rank-row:last-child { border-bottom: 0; }
.rank-pos {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  font-weight: 900;
}
.rank-row:first-child .rank-pos { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #111827; }
.rank-name { min-width: 0; }
.rank-name strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rank-name span { color: var(--muted); font-size: 12px; }
.rank-points { font-weight: 900; font-size: 18px; }
.empty-state { padding: 34px 22px; text-align: center; color: var(--muted); }
.empty-state strong { color: #0f172a; display:block; font-size: 18px; margin-bottom: 6px; }

.admin-box { margin-top: 18px; display: grid; gap: 10px; }
.footer-note { text-align: center; color: #64748b; padding: 28px 0 0; font-size: 13px; }
.loading { display: grid; place-items: center; min-height: 220px; color: #fff; font-weight: 800; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.18); border-top-color: #fff;
  animation: spin 0.9s linear infinite; margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .hero-grid, .grid { grid-template-columns: 1fr; }
  .hero-card { order: -1; }
  .user-strip { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container { width: min(100% - 22px, 1180px); }
  .topbar { align-items: flex-start; flex-direction: column; margin-bottom: 28px; }
  .hero { padding-top: 24px; }
  .stats-row { grid-template-columns: 1fr; }
  .card-header { align-items: flex-start; flex-direction: column; }
  .teams { grid-template-columns: 1fr; gap: 8px; }
  .team.away { justify-content: flex-start; text-align: left; flex-direction: row-reverse; }
  .vs { display: none; }
  .prediction-row { grid-template-columns: 1fr 1fr; }
  .prediction-row .btn { grid-column: 1 / -1; }
}
