:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --card: #ffffff;
  --card-soft: #f8fafc;
  --text: #0f172a;
  --text-soft: #475569;
  --line: #dbe2ea;
  --primary: #16a34a;
  --primary-dark: #0f7a36;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background: #ffffff;
}

body.public-body {
  background: #ffffff;
}

body.admin-body {
  background: #ffffff;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.site-header {
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 8px 18px rgba(15,23,42,.2);
}

.public-body .site-header {
  background: #390;
}

.admin-body .site-header {
  background: #000;
}

.site-header-inner {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  flex-wrap: wrap;
}

.brand {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
}

.brand:hover { text-decoration: none; }

.brand-sub {
  font-size: .9rem;
  opacity: .75;
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  font-weight: 600;
}

.nav a:hover {
  background: rgba(255,255,255,.16);
  text-decoration: none;
}

.admin-pill {
  background: #16a34a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.main-area { padding: 28px 0 48px; }

.hero {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.3fr .9fr;
  align-items: stretch;
  margin-bottom: 24px;
}

.card, .panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(219,226,234,.8);
}

.card { padding: 22px; }
.panel { padding: 18px; }
.card-soft { background: var(--card-soft); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }

.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi strong {
  font-size: 2rem;
  line-height: 1;
}

.kpi span { color: var(--text-soft); }

.page-title {
  margin: 0 0 18px;
  font-size: 2rem;
}

.page-subtitle {
  margin: 0 0 20px;
  color: var(--text-soft);
}

.section-title {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: .88rem;
  font-weight: 700;
}

.hero .badge { margin-bottom: 14px; }

.badge.gray { background: #e2e8f0; color: #334155; }
.badge.orange { background: #ffedd5; color: #9a3412; }
.badge.red { background: #fee2e2; color: #991b1b; }

.match-score {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 12px 0;
}

.match-scoreline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

.match-scoreline strong {
  font-size: 2rem;
  line-height: 1;
  white-space: nowrap;
}

.match-meta {
  color: var(--text-soft);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: .95rem;
}

.match-meta-main { margin-bottom: 4px; }

.match-submeta {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: .86rem;
}

.ranking-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  flex-wrap: wrap;
}

.ranking-filter label {
  margin: 0;
  font-size: .9rem;
}

.ranking-filter select {
  width: auto;
  min-width: 220px;
  padding: 10px 12px;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  text-align: left;
  color: var(--text-soft);
  font-size: .9rem;
}

tr:hover td { background: #fbfdfc; }

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0,1fr));
}

.form-grid-3 {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0,1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-weight: 700;
  font-size: .94rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

button:hover, .btn:hover {
  text-decoration: none;
  background: #14803d;
}

.btn-secondary { background: #0f172a; }
.btn-secondary:hover { background: #1e293b; }

.btn-light {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-light:hover { background: #cbd5e1; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #b45309; }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.flash {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-weight: 700;
}

.flash-success {
  background: #dcfce7;
  color: #166534;
}

.flash-error {
  background: #fee2e2;
  color: #991b1b;
}

.login-card {
  width: min(460px, 100%);
  margin: 50px auto 0;
}

.stat-list { display: grid; gap: 12px; }

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.player-card {
  display: grid;
  gap: 12px;
  grid-template-columns: 90px 1fr;
  align-items: center;
}

.player-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.muted { color: var(--text-soft); }

.empty {
  padding: 24px;
  text-align: center;
  color: var(--text-soft);
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
}

.site-footer {
  padding: 18px 0 36px;
  color: var(--text-soft);
}

code.inline {
  padding: 2px 6px;
  background: #e2e8f0;
  border-radius: 8px;
}

@media (max-width: 860px) {
  .hero, .grid-3, .grid-2, .form-grid, .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .site-header-inner {
    align-items: flex-start;
  }

  .match-score {
    font-size: 2rem;
  }

  .match-scoreline {
    flex-direction: column;
    align-items: flex-start;
  }
}