/* === Font Faces === */
@font-face {
  font-family: 'League Gothic';
  src: url('assets/fonts/LeagueGothic-VF.ttf') format('truetype-variations');
  font-weight: 400 900;
  font-stretch: 50% 100%;
}
@font-face {
  font-family: 'Agency FB';
  src: url('assets/fonts/AGENCYB%20(1).TTF') format('truetype');
  font-weight: 700;
}
@font-face {
  font-family: 'Agency FB';
  src: url('assets/fonts/UFONTS.COM_AGENCYFB-BLACK.TTF') format('truetype');
  font-weight: 900;
}

/* === Palette ===
   --blue:   #1C42CD
   --black:  #1A1A1A
   --gold:   #FFBB58
   --peach:  #FFD690
*/

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: #1A1A1A;
  color: #ffffff;
  font-family: 'Agency FB', 'Segoe UI', sans-serif;
}

/* === Background === */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url('assets/bg.png') center center / cover no-repeat;
}
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 10, 0.78) 0%,
    rgba(10, 10, 10, 0.9) 40%,
    rgba(10, 10, 10, 0.96) 100%
  );
}

/* === Main Container — left panel + right table === */
.container {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  padding: 28px 36px;
  max-width: 1700px;
  margin: 0 auto;
}

/* === Side Panel === */
.side-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 22px;
  background: linear-gradient(
    180deg,
    rgba(28, 66, 205, 0.18) 0%,
    rgba(26, 26, 26, 0.92) 100%
  );
  border: 1px solid rgba(255, 187, 88, 0.35);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  min-height: 0;
  overflow: hidden;
}

.logo-hotdrop {
  height: 180px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

.side-title {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
}
.side-title-1 {
  font-size: 1.8rem;
  letter-spacing: 4px;
  color: #ffffff;
}
.side-title-2 {
  font-size: 2.6rem;
  letter-spacing: 6px;
  color: #FFBB58;
  margin-top: 4px;
}

.side-divider {
  width: 70%;
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 187, 88, 0.55) 50%,
    transparent 100%
  );
  flex-shrink: 0;
}

/* === Region Box (Country Leaderboard) === */
.region-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
}

/* Section heading with side rules */
.region-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.region-heading-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 187, 88, 0.55) 100%
  );
}
.region-heading-line:last-child {
  background: linear-gradient(
    90deg,
    rgba(255, 187, 88, 0.55) 0%,
    transparent 100%
  );
}
.region-heading-text {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.05rem;
  letter-spacing: 5px;
  color: #FFBB58;
  text-transform: uppercase;
}

/* Hero leader card */
.region-leader {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 14px 18px;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at top, rgba(255, 187, 88, 0.28) 0%, transparent 65%),
    linear-gradient(180deg, rgba(28, 66, 205, 0.22) 0%, rgba(26, 26, 26, 0.92) 100%);
  border: 1px solid rgba(255, 187, 88, 0.55);
  box-shadow:
    0 0 22px rgba(255, 187, 88, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.region-leader::before,
.region-leader::after {
  content: "";
  position: absolute;
  top: -40%;
  width: 60%;
  height: 180%;
  background: linear-gradient(
    115deg,
    transparent 40%,
    rgba(255, 187, 88, 0.08) 50%,
    transparent 60%
  );
  pointer-events: none;
}
.region-leader::before { left: -30%; transform: rotate(8deg); }
.region-leader::after  { right: -30%; transform: rotate(-8deg); }

.region-leader-rank {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  color: #FFBB58;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: 0 0 14px rgba(255, 187, 88, 0.5);
  position: relative;
  z-index: 1;
}
.region-leader-name {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 0.95;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  position: relative;
  z-index: 1;
}
.region-leader-points {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  position: relative;
  z-index: 1;
}
.region-leader-points .rl-points {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 2.4rem;
  color: #FFD690;
  line-height: 1;
  text-shadow: 0 0 18px rgba(255, 214, 144, 0.45);
}
.region-leader-points .rl-label {
  font-family: 'League Gothic', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
}

/* Card-style rows for 2nd / 3rd */
.region-rest {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
}
.region-rest .region-row {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr 80px;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
  overflow: hidden;
  isolation: isolate;
}
.region-rest .region-rank {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--tier-text);
  text-shadow: 0 0 10px var(--tier-glow);
  position: relative;
  z-index: 2;
}
.region-rest .region-row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--tier-edge) 0%, transparent 60%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

/* 2nd — peach/light gold tier */
.region-rest .region-row:first-child {
  --tier-edge: rgba(255, 214, 144, 0.85);
  --tier-glow: rgba(255, 214, 144, 0.18);
  --tier-text: #FFD690;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(255, 214, 144, 0.22) 0%, transparent 55%),
    linear-gradient(95deg, rgba(255, 214, 144, 0.08) 0%, rgba(26, 26, 26, 0.7) 70%);
  box-shadow: 0 0 16px var(--tier-glow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* 3rd — cool silver / steel tier */
.region-rest .region-row:last-child {
  --tier-edge: rgba(200, 215, 235, 0.85);
  --tier-glow: rgba(180, 200, 225, 0.22);
  --tier-text: #D8DEE9;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(200, 215, 235, 0.22) 0%, transparent 55%),
    linear-gradient(95deg, rgba(180, 200, 225, 0.08) 0%, rgba(26, 26, 26, 0.7) 70%);
  box-shadow: 0 0 14px var(--tier-glow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.region-rest .region-name {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 3px;
  color: #ffffff;
  text-transform: uppercase;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
  z-index: 2;
}
.region-rest .region-points {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.55rem;
  color: var(--tier-text);
  line-height: 1;
  text-shadow: 0 0 10px var(--tier-glow);
  text-align: right;
  position: relative;
  z-index: 2;
}

/* === Live Indicator === */
.live-indicator {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border: 1px solid rgba(28, 66, 205, 0.6);
  background: rgba(28, 66, 205, 0.15);
  border-radius: 999px;
  flex-shrink: 0;
}
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FFBB58;
  box-shadow: 0 0 8px rgba(255, 187, 88, 0.9);
  animation: live-pulse 1.4s ease-in-out infinite;
}
.live-text {
  font-family: 'League Gothic', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* === App / Right Side === */
#app {
  display: flex;
  min-height: 0;
  width: 100%;
}

/* === Leaderboard === */
.leaderboard {
  background: linear-gradient(
    180deg,
    rgba(26, 26, 26, 0.85) 0%,
    rgba(10, 10, 10, 0.94) 100%
  );
  border: 1px solid rgba(255, 187, 88, 0.4);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  flex: 1;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Grid columns: rank | team | s1-skor | s1-wwcd | f-skor | f-sira | toplam */
.group-header,
.col-header,
.row {
  display: grid;
  grid-template-columns: 80px 1.6fr 1fr 1fr 1fr 1fr 1.1fr;
  align-items: center;
}

/* Group header (1. AŞAMA + ŞOV MAÇI labels) */
.group-header {
  padding: 14px 0 10px;
  background: rgba(28, 66, 205, 0.25);
  border-bottom: 1px solid rgba(28, 66, 205, 0.45);
  flex-shrink: 0;
  min-height: 52px;
}
.gh-spacer {
  grid-column: span 2;
}
.gh-spacer.end {
  grid-column: span 1;
}
.gh-group {
  grid-column: span 2;
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 4px;
  color: #ffffff;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0.85;
  height: 100%;
  padding-top: 4px;
}

/* Column header */
.col-header {
  padding: 12px 0;
  background: rgba(26, 26, 26, 0.7);
  border-bottom: 2px solid rgba(255, 187, 88, 0.5);
  flex-shrink: 0;
}
.col-header .cell {
  font-family: 'League Gothic', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 3px;
  color: #ffffff;
  text-transform: uppercase;
  text-align: center;
}

/* Rows list */
.rows-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.row {
  flex: 1;
  padding: 0;
  border-bottom: 1px solid rgba(28, 66, 205, 0.28);
  transition: background 0.2s ease;
}
.row:last-child {
  border-bottom: none;
}
.row:hover {
  background: rgba(255, 187, 88, 0.06);
}

/* Top-3 row accents */
.row.top-1 {
  background: linear-gradient(
    90deg,
    rgba(255, 187, 88, 0.18) 0%,
    rgba(255, 187, 88, 0.04) 60%,
    transparent 100%
  );
}
.row.top-2 {
  background: linear-gradient(
    90deg,
    rgba(255, 214, 144, 0.12) 0%,
    transparent 80%
  );
}
.row.top-3 {
  background: linear-gradient(
    90deg,
    rgba(28, 66, 205, 0.18) 0%,
    transparent 80%
  );
}

/* Cell base */
.cell {
  font-family: 'Agency FB', sans-serif;
  font-weight: 900;
  font-size: 1.25rem;
  color: #ffffff;
  text-align: center;
  padding: 0 8px;
}

/* Rank cell */
.cell.rank {
  font-family: 'Agency FB', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: #ffffff;
  text-align: center;
  letter-spacing: 1px;
}
.row.top-1 .cell.rank { color: #FFBB58; }
.row.top-2 .cell.rank { color: #FFD690; }
.row.top-3 .cell.rank { color: #ffffff; }

/* Team cell */
.cell.team {
  text-align: left;
  padding-left: 18px;
  font-size: 1.3rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
}
.team-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 187, 88, 0.55);
  background: rgba(26, 26, 26, 0.65);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  display: inline-block;
}
.team-logo img {
  position: absolute;
  top: 0;
  left: 50%;
  width: 160%;
  height: auto;
  transform: translateX(-50%);
  display: block;
}
.row.top-1 .team-logo {
  border-color: #FFBB58;
  box-shadow: 0 0 14px rgba(255, 187, 88, 0.45);
}

/* Per-team logo tweaks */
.team-logo.logo-TEAM-ROSE img { transform: translateX(-46%); }
.team-logo.logo-KNGL img { transform: translateX(-54%); }
.team-logo.logo-BURUNLEY-ESPOR img { transform: translateX(-48%); }
.team-logo.logo-BARISG img { transform: translateX(-53%); }

/* Multi-member logos (GIRL POWER) */
.team-logo-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.team-logo.team-logo-small {
  width: 38px;
  height: 38px;
  border-width: 1.5px;
}
.team-logo.team-logo-small img {
  width: 115%;
}
.team-logo-group.logo-GIRL-POWER .team-logo-small:nth-child(1) img {
  transform: translateX(-40%);
}
.team-logo-placeholder {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
}
.team-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Total cell */
.cell.total {
  color: #FFD690;
  font-size: 1.5rem;
}
.row.top-1 .cell.total { color: #FFBB58; }

/* Vertical dividers between groups */
.col-header .cell:nth-child(4),
.row .cell:nth-child(4),
.col-header .cell:nth-child(6),
.row .cell:nth-child(6) {
  border-right: 3px solid rgba(28, 66, 205, 0.65);
}
.group-header .gh-group:not(:last-of-type) {
  border-right: 3px solid rgba(28, 66, 205, 0.65);
}

/* === Loading / Error === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: 'Agency FB', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #ffffff;
}
.error {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: #ff7a7a;
  font-family: 'Agency FB', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 2px;
  text-align: center;
}

/* === Responsive === */
@media (max-width: 1100px) {
  .container {
    grid-template-columns: 260px 1fr;
    gap: 16px;
    padding: 20px;
  }
  .logo-hotdrop { height: 140px; }
  .region-leader-name { font-size: 1.7rem; letter-spacing: 3px; }
  .region-leader-points .rl-points { font-size: 2.2rem; }
  .region-rest .region-name { font-size: 1.2rem; letter-spacing: 2px; }
  .region-rest .region-points { font-size: 1.3rem; }
}

@media (max-width: 900px) {
  html, body { overflow: auto; }
  .container {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    padding: 16px;
  }
  .side-panel { padding: 18px; }
  .group-header, .col-header, .row {
    grid-template-columns: 56px 1.2fr 0.8fr 0.8fr 0.8fr 0.8fr 0.9fr;
  }
  .cell { font-size: 0.95rem; }
  .cell.rank { font-size: 1.4rem; }
  .cell.team { font-size: 1rem; padding-left: 10px; }
  .gh-group { font-size: 1.1rem; }
  .col-header .cell { font-size: 0.75rem; letter-spacing: 1.5px; }
  .row { min-height: 44px; }
}
