@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&family=Russo+One&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0A0A0F;
  --bg-elevated: #14121C;
  --bg-elevated-2: #1C1926;
  --border: #2A2635;
  --text: #F5F3F7;
  --text-muted: #A39FB0;
  --gold: #F4B93E;
  --gold-soft: #FFD97A;
  --orange: #FF6A2B;
  --purple: #7C4DFF;
  --silver: #C7CDD6;
  --bronze: #C97C3D;
  --success: #34D399;
  --danger: #F14747;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 8px 30px rgba(124, 77, 255, 0.12);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font-display: 'Russo One', 'Chakra Petch', sans-serif;
  --font-head: 'Chakra Petch', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(124, 77, 255, 0.15), transparent),
              radial-gradient(900px 500px at 100% 0%, rgba(255, 106, 43, 0.08), transparent),
              var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

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

button, input, select {
  font-family: inherit;
  font-size: 1rem;
}

::selection { background: var(--gold); color: #14121C; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- layout ---------- */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  color: var(--text);
}

.brand-name span { color: var(--gold); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.hero {
  text-align: center;
  padding: 48px 20px 24px;
}

.hero img.hero-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  object-fit: cover;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  margin: 0 0 8px;
  letter-spacing: 1px;
}

.hero h1 span { color: var(--gold); }

.hero p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- season selector ---------- */

.season-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px auto 8px;
}

.season-bar select {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 44px;
}

.toggle-group {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}

.toggle-group button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  min-height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.4px;
}

.toggle-group button.active {
  background: var(--gold);
  color: #14121C;
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0 8px;
  margin-bottom: 8px;
  scrollbar-width: thin;
}

.tabs button {
  flex: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 18px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: border-color 200ms, color 200ms, background 200ms;
}

.tabs button:hover { border-color: var(--purple); color: var(--text); }

.tabs button.active {
  background: linear-gradient(135deg, var(--orange), var(--gold));
  color: #14121C;
  border-color: transparent;
}

/* ---------- podium ---------- */

.podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 12px;
  margin: 28px 0 20px;
}

.podium-slot {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 10px 16px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-card);
}

.podium-slot.first { order: 2; padding-top: 28px; transform: translateY(-10px); }
.podium-slot.second { order: 1; }
.podium-slot.third { order: 3; }

.podium-slot .rank-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.9rem;
  margin: 0 auto 8px;
  color: #14121C;
}

.podium-slot.first .rank-badge { background: var(--gold); width: 38px; height: 38px; font-size: 1.1rem; }
.podium-slot.second .rank-badge { background: var(--silver); }
.podium-slot.third .rank-badge { background: var(--bronze); }

.podium-slot .avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 10px;
  border: 3px solid var(--border);
  background: var(--bg-elevated-2);
}

.podium-slot.first .avatar { width: 84px; height: 84px; border-color: var(--gold); }
.podium-slot.second .avatar { border-color: var(--silver); }
.podium-slot.third .avatar { border-color: var(--bronze); }

.podium-slot .name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.podium-slot .team {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.podium-slot .score {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.3rem;
}

.podium-slot.second .score { color: var(--silver); }
.podium-slot.third .score { color: var(--bronze); }

/* ---------- ranking list ---------- */

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 40px;
}

.rank-row {
  display: grid;
  grid-template-columns: 32px 40px 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.rank-row .pos {
  font-family: var(--font-display);
  color: var(--text-muted);
  text-align: center;
}

.rank-row .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated-2);
  border: 2px solid var(--border);
}

.rank-row .who .name { font-weight: 600; }
.rank-row .who .team { color: var(--text-muted); font-size: 0.82rem; }

.rank-row .stat {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.15rem;
  text-align: right;
  min-width: 48px;
}

.rank-row .bar-track {
  width: 100%;
  height: 4px;
  background: var(--bg-elevated-2);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}

.rank-row .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--gold));
  border-radius: 4px;
}

/* ---------- team standings table ---------- */

.standings {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 40px;
}

.standings th, .standings td {
  padding: 12px 14px;
  text-align: left;
}

.standings thead th {
  font-family: var(--font-head);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.standings tbody tr:not(:last-child) { border-bottom: 1px solid var(--border); }
.standings tbody tr:hover { background: var(--bg-elevated-2); }

.standings .team-cell { display: flex; align-items: center; gap: 10px; }
.standings .team-cell img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.standings td.points { font-family: var(--font-display); color: var(--gold); }

@media (max-width: 700px) {
  .standings thead { display: none; }
  .standings, .standings tbody, .standings tr, .standings td { display: block; width: 100%; }
  .standings tr { padding: 12px 14px; }
  .standings td { padding: 4px 0; border: none !important; }
  .standings td::before {
    content: attr(data-label);
    display: inline-block;
    width: 110px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
  }
}

/* ---------- empty / loading ---------- */

.empty-state, .loading-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-head);
  letter-spacing: 0.3px;
  transition: transform 150ms, border-color 150ms, background 150ms;
  text-decoration: none;
}

.btn:hover { border-color: var(--purple); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--gold));
  color: #14121C;
  border-color: transparent;
}

.btn-danger { color: var(--danger); border-color: rgba(241, 71, 71, 0.4); }
.btn-danger:hover { background: rgba(241, 71, 71, 0.1); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- forms ---------- */

.field { margin-bottom: 16px; text-align: left; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--purple);
}
.field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.field .error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; }

.photo-input {
  display: flex;
  align-items: center;
  gap: 12px;
}
.photo-input .preview {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
}

/* ---------- footer ---------- */

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 30px 20px 50px;
}

.site-footer a { color: var(--orange); text-decoration: none; }
