/* =============================================
   RANKING SINUCA ITAPIRANGA — STYLES
   Dark luxury + neon green aesthetic
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;600;700&family=Rajdhani:wght@400;500;600;700&family=Bebas+Neue&display=swap');

/* ─── RESET & ROOT ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-deep:      #07070f;
  --bg-card:      #0e0e1c;
  --bg-card2:     #12121e;
  --neon:         #00ff88;
  --neon-dim:     #00cc6a;
  --neon-glow:    0 0 20px #00ff8866, 0 0 40px #00ff8833;
  --gold:         #ffd700;
  --gold-glow:    0 0 16px #ffd70077;
  --silver:       #c0c8d8;
  --bronze:       #cd7f32;
  --accent:       #6366f1;
  --text-main:    #e8eaf6;
  --text-dim:     #8892aa;
  --border:       rgba(255,255,255,0.06);
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'Oswald', sans-serif;
  --font-ui:      'Rajdhani', sans-serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
}

/* ─── LAYOUT ───────────────────────────────── */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ─── RANKING SIDE (LEFT 48%) ──────────────── */
#ranking-side {
  width: 48%;
  min-width: 340px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #0b0b18 0%, #07070f 60%);
  border-right: 1px solid rgba(0,255,136,0.15);
  position: relative;
  overflow: hidden;
}

/* Background grid pattern */
#ranking-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,255,136,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,136,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* ─── HEADER ───────────────────────────────── */
#ranking-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(0,255,136,0.2);
  background: linear-gradient(90deg, rgba(0,255,136,0.05) 0%, transparent 100%);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

#header-icon {
  font-size: clamp(2rem, 5vw, 3.5rem);
  filter: drop-shadow(0 0 12px rgba(0,255,136,0.5));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

#header-text h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 3rem);
  letter-spacing: 4px;
  color: var(--neon);
  text-shadow: var(--neon-glow);
  line-height: 1;
}

#header-text h2 {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.8rem);
  letter-spacing: 8px;
  color: var(--text-dim);
  line-height: 1;
}

#header-live {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-ui);
  font-size: clamp(0.7rem, 1.5vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--neon);
  border: 1px solid var(--neon);
  border-radius: 4px;
  padding: 4px 10px;
  text-shadow: var(--neon-glow);
  box-shadow: 0 0 12px rgba(0,255,136,0.15);
  flex-shrink: 0;
}

.live-dot {
  width: 8px; height: 8px;
  background: var(--neon);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--neon);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ─── COLUMN LABELS ────────────────────────── */
#ranking-labels {
  display: grid;
  grid-template-columns: 52px 1fr 60px 90px;
  padding: 8px 20px;
  font-family: var(--font-ui);
  font-size: clamp(0.6rem, 1.3vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#ranking-labels span { padding: 0 4px; }
.lbl-wins, .lbl-pts { text-align: center; }

/* ─── TOP 3 ────────────────────────────────── */
#top3 {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.player-row {
  display: grid;
  grid-template-columns: 52px 1fr 60px 90px;
  align-items: center;
  padding: 0 20px;
  min-height: clamp(52px, 8vh, 82px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
  animation: rowIn 0.5s ease both;
  position: relative;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Rank 1 */
.player-row.rank-1 {
  background: linear-gradient(90deg, rgba(255,215,0,0.12) 0%, rgba(255,215,0,0.04) 60%, transparent 100%);
  border-bottom-color: rgba(255,215,0,0.2);
  min-height: clamp(64px, 10vh, 100px);
}
.player-row.rank-1::after {
  content: '👑 REI DA SINUCA';
  position: absolute;
  top: 4px; right: 12px;
  font-family: var(--font-ui);
  font-size: clamp(0.5rem, 1vw, 0.65rem);
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: var(--gold-glow);
  animation: crownPulse 2s ease-in-out infinite;
}
@keyframes crownPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.player-row.rank-2 {
  background: linear-gradient(90deg, rgba(192,200,216,0.08) 0%, transparent 70%);
}
.player-row.rank-3 {
  background: linear-gradient(90deg, rgba(205,127,50,0.08) 0%, transparent 70%);
}

/* Position badge */
.player-pos {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  text-align: center;
  line-height: 1;
}

.rank-1 .player-pos { color: var(--gold); text-shadow: var(--gold-glow); }
.rank-2 .player-pos { color: var(--silver); }
.rank-3 .player-pos { color: var(--bronze); }
.rank-other .player-pos { color: var(--text-dim); font-size: clamp(1rem, 2vw, 1.5rem); }

/* Avatar + Name */
.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.player-avatar {
  width: clamp(32px, 4.5vw, 52px);
  height: clamp(32px, 4.5vw, 52px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.8vw, 1.4rem);
  color: #000;
  font-weight: bold;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
}

.rank-1 .player-avatar {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(255,215,0,0.4);
  width: clamp(40px, 5.5vw, 64px);
  height: clamp(40px, 5.5vw, 64px);
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
}

.player-name {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.2vw, 1.6rem);
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-1 .player-name {
  font-size: clamp(1.2rem, 2.6vw, 2rem);
  color: var(--gold);
  text-shadow: var(--gold-glow);
}

.player-wins {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.9rem);
  text-align: center;
  color: var(--neon);
}

.rank-1 .player-wins { color: var(--gold); text-shadow: var(--gold-glow); }

.player-pts {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  text-align: center;
  color: var(--neon);
  text-shadow: 0 0 10px rgba(0,255,136,0.4);
}

.rank-1 .player-pts {
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  color: var(--gold);
  text-shadow: var(--gold-glow);
}

/* ─── DIVIDER ───────────────────────────────── */
#ranking-divider {
  flex-shrink: 0;
  text-align: center;
  padding: 5px 0;
  font-family: var(--font-ui);
  font-size: clamp(0.55rem, 1.1vw, 0.7rem);
  letter-spacing: 3px;
  color: var(--text-dim);
  background: rgba(0,255,136,0.04);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

/* ─── SCROLL AREA ───────────────────────────── */
#ranking-scroll-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
}

#ranking-rest {
  position: absolute;
  width: 100%;
  top: 0;
}

/* Rest players smaller */
.player-row.rank-other {
  min-height: clamp(36px, 5.5vh, 56px);
  background: transparent;
}

.player-row.rank-other:hover {
  background: rgba(255,255,255,0.03);
}

/* ─── NOTICE BAR ────────────────────────────── */
#notice-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: linear-gradient(90deg, rgba(255,180,0,0.15) 0%, rgba(255,180,0,0.05) 100%);
  border-top: 1px solid rgba(255,180,0,0.3);
  position: relative;
  z-index: 2;
  animation: noticeIn 0.5s ease;
}

@keyframes noticeIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

#notice-icon { font-size: clamp(1rem, 2vw, 1.4rem); animation: float 2s infinite; }

#notice-text {
  font-family: var(--font-body);
  font-size: clamp(0.8rem, 1.8vw, 1.2rem);
  font-weight: 500;
  color: #ffd060;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── PROMO SIDE (RIGHT 52%) ────────────────── */
#promo-side {
  flex: 1;
  height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
}

#promo-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#promo-slides {
  width: 100%;
  height: 100%;
  position: relative;
}

.promo-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  will-change: transform, opacity;
  user-select: none;
}

.promo-slide.active {
  opacity: 1;
  z-index: 1;
}

/* Cursor de arrastar para indicar swipe no desktop */
#promo-slides {
  cursor: grab;
}
#promo-slides:active {
  cursor: grabbing;
}

.promo-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #000;
}

/* Ken burns suave SEM escala para não cortar */
.promo-slide.active img {
  animation: kenBurnsSafe 15s ease-in-out infinite alternate;
}

@keyframes kenBurnsSafe {
  from { transform: translateY(0px); }
  to   { transform: translateY(-6px); }
}

/* Overlay gradient on promo for visual depth */
.promo-slide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(0,0,0,0.15) 0%,
    transparent 50%,
    rgba(0,0,0,0.1) 100%
  );
  pointer-events: none;
}

/* Corner decoration */
#promo-side::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle at top left, rgba(0,255,136,0.12) 0%, transparent 70%);
  z-index: 3;
  pointer-events: none;
}

/* Promo dots */
#promo-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.promo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 0.3s;
  cursor: pointer;
}

.promo-dot.active {
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
  width: 24px;
  border-radius: 4px;
}

/* Progress bar */
#promo-progress-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,0.1);
  z-index: 10;
}

#promo-progress-fill {
  height: 100%;
  background: var(--neon);
  box-shadow: 0 0 8px var(--neon);
  width: 0%;
  transition: none;
}

#promo-progress-fill.animating {
  transition: width 15s linear;
  width: 100%;
}

/* Empty promo state */
#promo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0e1a14 0%, #07070f 70%);
  gap: 16px;
  z-index: 5;
}

.promo-empty-icon {
  font-size: 6rem;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(0,255,136,0.4));
}

#promo-empty p {
  font-family: var(--font-display);
  font-size: 2.5rem;
  letter-spacing: 6px;
  color: var(--neon);
  text-shadow: var(--neon-glow);
}

#promo-empty .promo-sub {
  font-family: var(--font-ui);
  font-size: 1rem;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-align: center;
}

/* ─── PWA INSTALL ───────────────────────────── */
#pwa-install-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 20px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
  transition: all 0.2s;
}

#pwa-install-btn:hover {
  background: #818cf8;
  transform: translateY(-2px);
}

/* ─── UPDATE FLASH ──────────────────────────── */
.score-update-flash {
  animation: flash 0.6s ease;
}

@keyframes flash {
  0%, 100% { background: inherit; }
  50% { background: rgba(0,255,136,0.15) !important; }
}

/* ─── UTILITY ───────────────────────────────── */
.hidden { display: none !important; }

/* ─── RESPONSIVE — PHONE ────────────────────── */
@media (max-width: 768px) {
  html, body { overflow-y: auto; }
  #app { flex-direction: column; height: auto; min-height: 100vh; }
  #ranking-side { width: 100%; height: auto; border-right: none; border-bottom: 1px solid rgba(0,255,136,0.2); }
  #promo-side { width: 100%; height: 55vw; min-height: 200px; }
  #ranking-scroll-container { height: auto; max-height: 50vh; overflow-y: auto; position: relative; mask-image: none; }
  #ranking-rest { position: relative; }
  body { overflow: auto; }
}

/* ─── RESPONSIVE — TABLET ───────────────────── */
@media (min-width: 769px) and (max-width: 1100px) {
  #ranking-side { width: 50%; }
}