/* ============================================================
   TAK-TAK – style.css  (design moderne gaming)
   ============================================================ */

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

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

:root {
  --bg:          #0d0d14;
  --bg-card:     #16161f;
  --bg-card2:    #1c1c28;
  --border:      rgba(255,255,255,0.07);
  --primary:     #ff6a00;
  --primary-d:   #cc5000;
  --cyan:        #22d3ee;
  --coral:       #ff6b6b;
  --gold:        #fbbf24;
  --silver:      #94a3b8;
  --bronze:      #cd7f32;
  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --success:     #10b981;
  --font:        'Inter', sans-serif;
  --font-title:  'Rajdhani', sans-serif;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 8px 48px rgba(0,0,0,0.6);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ── Navbar ────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 28px 2px;
  height: calc(60px + env(safe-area-inset-top));
  background: rgba(13,13,20,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-logo {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 2px;
  user-select: none;
}

.navbar-logo span {
  color: var(--primary);
}

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

.gamepad-badge {
  display: none;
  font-size: 0.7rem;
  color: var(--success);
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 20px;
  padding: 4px 10px;
}
.gamepad-badge.visible { display: inline-block; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-d);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,106,0,0.4);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-outline:hover {
  background: var(--bg-card2);
  border-color: rgba(255,255,255,0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-card2);
}

.btn-danger {
  background: rgba(255,107,107,0.12);
  color: var(--coral);
  border: 1px solid rgba(255,107,107,0.25);
}
.btn-danger:hover {
  background: rgba(255,107,107,0.2);
}

.btn-sm { font-size: 0.8rem; padding: 6px 12px; }

/* ── Hero ──────────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 16px 20px;
  gap: 8px;
  text-align: center;
}

.hero-title {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 4px;
  line-height: 1;
}

.hero-title span {
  color: var(--primary);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: 0.5px;
}

/* ── Game Section ──────────────────────────────────────── */
.game-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 40px;
}

.game-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  position: relative;
}

/* ── Leaderboard ───────────────────────────────────────── */
.leaderboard-section {
  padding: 0 16px 56px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
}

.section-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
}

.leaderboard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leaderboard-list {
  list-style: none;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  animation: slideIn 0.3s ease forwards;
  opacity: 0;
  transform: translateY(8px);
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-item:hover { background: var(--bg-card2); }

/* Top 3 highlight */
.leaderboard-item.rank-1 { background: rgba(251,191,36,0.05); }
.leaderboard-item.rank-2 { background: rgba(148,163,184,0.04); }
.leaderboard-item.rank-3 { background: rgba(205,127,50,0.04); }

.lb-rank {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  width: 28px;
  text-align: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lb-rank.gold   { color: var(--gold); }
.lb-rank.silver { color: var(--silver); }
.lb-rank.bronze { color: var(--bronze); }

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.lb-info { flex: 1; min-width: 0; }

.lb-pseudo {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.lb-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 32px 0;
}

/* ── Prize Box ─────────────────────────────────────────── */
.prize-box {
  margin-top: 20px;
  background: linear-gradient(135deg, rgba(255,106,0,0.10) 0%, rgba(34,211,238,0.07) 100%);
  border: 2px solid rgba(255,106,0,0.6);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(255,106,0,0.25), inset 0 0 24px rgba(255,106,0,0.05);
  animation: prizePulse 2.5s ease-in-out infinite;
}

@keyframes prizePulse {
  0%, 100% { box-shadow: 0 0 18px rgba(255,106,0,0.25), inset 0 0 24px rgba(255,106,0,0.05); border-color: rgba(255,106,0,0.6); }
  50%       { box-shadow: 0 0 36px rgba(255,106,0,0.55), 0 0 60px rgba(255,106,0,0.18), inset 0 0 30px rgba(255,106,0,0.10); border-color: rgba(255,106,0,1); }
}

.prize-box::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,106,0,0.1), transparent 70%);
  pointer-events: none;
}

.prize-label-top {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
  display: block;
}

/* ── Prize Icon ─────────────────────────────────────────── */
.prize-icon-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 104px;
  height: 104px;
  margin: 14px auto 20px;
  border-radius: 28px;
  background: linear-gradient(145deg, #ff8040 0%, #cc2200 100%);
  box-shadow:
    0 8px 32px rgba(255,106,0,0.45),
    0 2px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.18);
  position: relative;
  overflow: hidden;
  animation: floatUp 3s ease-in-out infinite alternate;
}

/* glass shine */
.prize-icon-wrap::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, transparent 100%);
  border-radius: 28px 28px 50% 50%;
  pointer-events: none;
}

.prize-emoji {
  font-size: 3.2rem;
  display: block;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
}

.prize-month {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 6px;
  display: block;
  font-weight: 600;
}

.prize-description {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ── Footer ────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-link { cursor: pointer; color: var(--text-muted); transition: color .2s; }
.footer-link:hover { color: var(--text); }

/* ── SEO description block ─────────────────────────────── */
.seo-description {
  max-width: 640px;
  margin: 24px auto 0;
  padding: 20px 24px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
}
.seo-description h2 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--primary);
  letter-spacing: 1px;
  margin: 0 0 6px;
  text-transform: uppercase;
}
.seo-description p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 16px;
}
.seo-description p:last-child { margin-bottom: 0; }

/* ── Modals ────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 16px;
}
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-card2); color: var(--text); }

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,106,0,0.15);
}
.form-input.invalid { border-color: var(--coral); }

.password-wrapper { position: relative; }
.password-wrapper .form-input { padding-right: 42px; }

.toggle-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.toggle-eye:hover { color: var(--text); }

.form-error {
  font-size: 0.78rem;
  color: var(--coral);
  margin-top: 4px;
  display: none;
}
.form-error.visible { display: block; }

.form-submit {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  font-size: 0.9rem;
  justify-content: center;
}

.form-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.form-link span {
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}
.form-link span:hover { text-decoration: underline; }

.form-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── CGU Checkbox ──────────────────────────────────────── */
.cgu-group { margin-top: 4px; }

.cgu-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.cgu-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.cgu-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}
.cgu-link:hover { color: #ff9040; }

/* ── Modal large (CGU) ─────────────────────────────────── */
.modal-box-lg {
  max-width: 580px;
}

.cgu-content {
  max-height: 380px;
  overflow-y: auto;
  padding-right: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.cgu-date {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 16px;
  font-style: italic;
}

.cgu-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 6px;
}

.cgu-content p { margin-bottom: 8px; }

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
  line-height: 1.5;
}
.alert.visible { display: block; }
.alert-error   { background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.3); color: var(--coral); }
.alert-success { background: rgba(16,185,129,0.1);  border: 1px solid rgba(16,185,129,0.3);  color: var(--success); }

/* ── User Info Navbar ──────────────────────────────────── */
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

/* ── Bannière de bienvenue ─────────────────────────────── */
#welcome-banner {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: 0 4px 32px rgba(255,106,0,0.25);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
  animation: bannerIn 0.3s ease;
}

#welcome-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Animations ────────────────────────────────────────── */
@keyframes slideIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatUp {
  from { transform: translateY(0); }
  to   { transform: translateY(-8px); }
}

@keyframes modalIn {
  from { transform: scale(0.95) translateY(-10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes bounceIn {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

/* ── History Section ───────────────────────────────────── */
.history-section {
  margin-top: 2.5rem;
}

.history-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.history-tab {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: capitalize;
}

.history-tab:hover {
  border-color: var(--primary);
  color: var(--text);
}

.history-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.history-winner {
  opacity: 1 !important;
  border: 2px solid rgba(251,191,36,0.85) !important;
  background: linear-gradient(90deg, rgba(251,191,36,0.10) 0%, rgba(255,106,0,0.06) 100%) !important;
  animation: winnerPulse 2.5s ease-in-out infinite !important;
}

@keyframes winnerPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(251,191,36,0.25), inset 0 0 16px rgba(251,191,36,0.06); }
  50%       { box-shadow: 0 0 42px rgba(251,191,36,0.55), 0 0 64px rgba(251,191,36,0.18), inset 0 0 24px rgba(251,191,36,0.12); }
}
}

.lb-winner-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  margin-top: 2px;
  text-transform: uppercase;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .navbar { padding: 0 16px; }
  .navbar-logo { font-size: 1.3rem; }
  .btn { font-size: 0.8rem; padding: 7px 12px; }
  .hero { padding: 24px 12px 16px; }
  .leaderboard-section { padding: 0 12px 40px; }
  .modal-box { padding: 24px 18px; }
  .prize-box { padding: 20px 16px; }
}

/* Paysage mobile : tout tenir sans scroller */
@media (pointer: coarse) and (orientation: landscape) {
  .navbar {
    height: 44px;
    padding: 0 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .navbar-logo { font-size: 1.1rem; }
  .btn-sm { font-size: 0.72rem; padding: 4px 8px; }
  .hero {
    padding: 4px 12px 0;
    gap: 2px;
  }
  .hero-subtitle { display: none; }
  .game-section { padding: 4px 8px 0; }
}
