/* =========================
   MANIFA FONT FACE
========================= */
@font-face {
  font-family: 'Manifa';
  src: url('../fonts/Manifa/ManifaPro2_2.224-Thin.otf') format('opentype');
  font-weight: 100;
  font-display: swap;
}
@font-face {
  font-family: 'Manifa';
  src: url('../fonts/Manifa/ManifaPro2_2.224-Light.otf') format('opentype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Manifa';
  src: url('../fonts/Manifa/ManifaPro2_2.224-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Manifa';
  src: url('../fonts/Manifa/ManifaPro2_2.224-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Manifa';
  src: url('../fonts/Manifa/ManifaPro2_2.224-Hefty.otf') format('opentype');
  font-weight: 800;
  font-display: swap;
}

/* =========================
   GOOGLE FONTS
========================= */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Rajdhani:wght@600;700&display=swap');

/* =========================
   CSS VARIABLES & THEMING
========================= */
:root {
  --primary: #0072ff;
  --primary-dark: #0052c2;
  --primary-light: #00c6ff;
  --dark-bg: #020617;
  --card-bg: rgba(9, 21, 45, 0.42);
  --accent: #00f2fe;
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --border-radius: 24px;
  --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --font-family: 'Outfit', 'Manifa', -apple-system, BlinkMacSystemFont, sans-serif;
  --header-font: 'Rajdhani', 'Manifa', sans-serif;
}

/* =========================
   GLOBAL RESET & BASE
========================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
}

body {
  background-color: var(--dark-bg);
  color: var(--text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

/* Concentric Waves & Dots SVG Overlay */
body::before {
  content: "";
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 900' preserveAspectRatio='none'><defs><pattern id='dots' width='30' height='30' patternUnits='userSpaceOnUse'><circle cx='15' cy='15' r='1.2' fill='%2300f2fe' opacity='0.12'/></pattern><linearGradient id='grad' x1='0%25' y1='100%25' x2='100%25' y2='0%25'><stop offset='0%25' stop-color='%2300f2fe' stop-opacity='0.25'/><stop offset='50%25' stop-color='%230072ff' stop-opacity='0.12'/><stop offset='100%25' stop-color='%230056cc' stop-opacity='0'/></linearGradient><radialGradient id='dots-fade' cx='95%25' cy='95%25' r='45%25'><stop offset='0%25' stop-color='white' stop-opacity='1'/><stop offset='100%25' stop-color='white' stop-opacity='0'/></radialGradient><mask id='dots-mask'><rect width='100%25' height='100%25' fill='url(%23dots-fade)'/></mask></defs><rect width='100%25' height='100%25' fill='url(%23dots)' mask='url(%23dots-mask)'/><g stroke='url(%23grad)' fill='none' stroke-width='1.0'><path d='M -100 800 C 400 500, 1000 1000, 1540 750'/><path d='M -100 780 C 400 480, 1000 980, 1540 730'/><path d='M -100 760 C 400 460, 1000 960, 1540 710'/><path d='M -100 740 C 400 440, 1000 940, 1540 690'/><path d='M -100 720 C 400 420, 1000 920, 1540 670'/><path d='M -100 700 C 400 400, 1000 900, 1540 650'/><path d='M -100 680 C 400 380, 1000 880, 1540 630'/><path d='M -100 660 C 400 360, 1000 860, 1540 610'/><path d='M -100 640 C 400 340, 1000 840, 1540 590'/><path d='M -100 620 C 400 320, 1000 820, 1540 570'/><path d='M -100 600 C 400 300, 1000 800, 1540 550'/><path d='M -100 580 C 400 280, 1000 780, 1540 530'/><path d='M -100 560 C 400 260, 1000 760, 1540 510'/><path d='M -100 540 C 400 240, 1000 740, 1540 490'/><path d='M -100 520 C 400 220, 1000 720, 1540 470'/></g></svg>"),
    linear-gradient(135deg, #070e1e 0%, #020617 100%);
  background-size: 100% 100%;
  background-attachment: fixed;
  z-index: -3;
  pointer-events: none;
}

/* =========================
   BACKGROUND GLOWING BLOBS
========================= */
.bg-blob {
  position: fixed;
  width: clamp(350px, 45vw, 650px);
  height: clamp(350px, 45vw, 650px);
  border-radius: 50%;
  z-index: -2;
  filter: blur(140px);
  opacity: 0.16;
  pointer-events: none;
  animation: drift 25s infinite alternate ease-in-out;
}

.blob-1 {
  background: var(--accent);
  bottom: -10%;
  left: -10%;
}

.blob-2 {
  background: var(--primary);
  top: -10%;
  right: -10%;
  animation-delay: -6s;
}

.blob-3 {
  background: #7c3aed;
  top: 35%;
  left: 15%;
  animation-delay: -12s;
}

/* =========================
   SCREEN LAYOUT
========================= */
.screen {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* =========================
   TOP BAR / HEADER
========================= */
.top-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  z-index: 10;
}

.center-logo {
  flex: 1;
  display: flex;
  justify-content: center;
  animation: fadeIn 1s ease-out;
}

/* Logo Text Styling */
.logo-text {
  font-family: var(--header-font);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.5rem);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 5px;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: var(--transition);
}

.logo-text:hover {
  transform: scale(1.04) rotate(-0.5deg);
  filter: drop-shadow(0 4px 15px rgba(0, 114, 255, 0.65));
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =========================
   MAIN CONTENT AREA
========================= */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  width: 100%;
}

.content.center-content {
  justify-content: center;
  align-items: center;
}

/* =========================
   SLOGAN
========================= */
.slogan {
  font-family: var(--header-font);
  font-size: clamp(1.875rem, 4.5vw, 3rem);
  margin-bottom: clamp(1.5rem, 3.5vw, 2.5rem);
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  text-align: center;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.slogan-span {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =========================
   GLASS PANELS (CARDS)
========================= */
.register-card, .question-box, .leaderboard-section, .result-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.16);
  border-left-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 650px;
  animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  padding: clamp(1.5rem, 4.5vw, 3.5rem);
}

.register-card {
  text-align: center;
}

.register-card h1 {
  font-family: var(--header-font);
  font-size: clamp(1.875rem, 5.5vw, 3rem);
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.register-card p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-weight: 300;
}

.register-card form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  align-items: center;
}

/* Form Inputs */
.register-card input {
  width: 100%;
  max-width: 480px;
  padding: 1.1rem 1.5rem;
  font-size: 1.1rem;
  border-radius: var(--border-radius);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  background: rgba(2, 7, 19, 0.7);
  color: var(--text-primary);
  text-align: center;
  transition: var(--transition);
  font-family: inherit;
}

.register-card input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(2, 7, 19, 0.9);
  box-shadow: 0 0 0 4px rgba(0, 242, 254, 0.2);
}

.register-card input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* =========================
   BUTTONS
========================= */
.submit-btn, .restart-btn, .register-card button {
  padding: 1.1rem 2.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: var(--border-radius);
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 0 6px 20px rgba(0, 114, 255, 0.35);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  position: relative;
  overflow: hidden;
  z-index: 1;
  min-width: clamp(180px, 45vw, 280px);
}

.submit-btn::before, .restart-btn::before, .register-card button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
  z-index: -1;
}

.submit-btn:hover::before, .restart-btn:hover::before, .register-card button:hover::before {
  left: 100%;
}

.submit-btn:hover, .restart-btn:hover, .register-card button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 114, 255, 0.55);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

.submit-btn:active, .restart-btn:active, .register-card button:active {
  transform: translateY(-1px);
}

/* =========================
   QUESTION BOX & QUIZ SCREEN
========================= */
.question-box {
  max-width: 850px;
  margin-bottom: 2rem;
  text-align: center;
}

.question-box h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 850px;
  margin: 0 auto;
}

#questionCounter {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Interactive Answer Button */
.answer-btn {
  display: flex;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(8, 20, 42, 0.45);
  border-radius: var(--border-radius);
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-left: 4px solid transparent;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 500;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
  text-decoration: none;
}

.answer-btn input {
  width: 22px;
  height: 22px;
  margin-right: 1.25rem;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.answer-btn:hover {
  background: rgba(8, 20, 42, 0.75);
  border-color: rgba(255, 255, 255, 0.15);
  border-left-color: var(--accent);
  transform: translateX(8px);
  box-shadow: 0 5px 20px rgba(0, 242, 254, 0.15);
}

/* Correct & Incorrect States for Answers */
.answer-btn.correct {
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: rgba(34, 197, 94, 0.4) !important;
  border-left: 5px solid #22c55e !important;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.25) !important;
  color: #4ade80 !important;
  animation: correct-bounce 0.5s ease;
}

.answer-btn.incorrect {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  border-left: 5px solid #ef4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25) !important;
  color: #f87171 !important;
  animation: wrong-shake 0.5s ease;
}

@keyframes correct-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* =========================
   LEADERBOARD & RESULTS
========================= */
.leaderboard-section {
  max-width: 900px;
  margin-top: 3rem;
}

.leaderboard-header {
  text-align: center;
  margin-bottom: 2rem;
}

.leaderboard-header h2 {
  font-family: var(--header-font);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.leaderboard-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
}

/* High-tech Player Card */
.player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: rgba(2, 7, 19, 0.45);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: var(--transition);
  min-height: 220px;
}

.player-card:hover {
  background: rgba(2, 7, 19, 0.75);
  border-color: var(--accent);
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(0, 242, 254, 0.25);
}

/* Medal Ranks */
.medal {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  border-radius: 50%;
  background: rgba(8, 20, 42, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition);
}

.player-card:hover .medal {
  transform: scale(1.1);
  border-color: var(--accent);
}

.medal.gold {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border-color: #fbbf24;
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.medal.silver {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  border-color: #cbd5e1;
  box-shadow: 0 0 15px rgba(203, 213, 225, 0.4);
}

.medal.bronze {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
  border-color: #ed8936;
  box-shadow: 0 0 15px rgba(237, 137, 54, 0.4);
}

.rank-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.card-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0.75rem 0;
  text-align: center;
  word-break: break-all;
}

.card-score {
  text-align: center;
}

.score-value {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* =========================
   RESULTS BOARD
========================= */
.result-card {
  border: 1px solid rgba(0, 242, 254, 0.18);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 650px;
  animation: scaleIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  padding: clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.finish-title {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 500;
  color: var(--text-secondary);
}

.score-display {
  font-family: var(--header-font);
  font-size: clamp(4rem, 10vw, 6rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(0, 242, 254, 0.35);
  animation: pulse 2s ease-in-out infinite;
  line-height: 1;
  margin: 0.5rem 0;
}

.score-caption {
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.leaderboard-container {
  width: 100%;
}

.board-title {
  font-family: var(--header-font);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.board-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

/* High-tech Row Item */
.player-row-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(2, 7, 19, 0.45);
  padding: 1rem 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
  gap: 1rem;
}

.player-row-item:hover {
  background: rgba(8, 20, 42, 0.75);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 242, 254, 0.15);
}

.row-rank {
  width: 45px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.rank-badge {
  font-weight: 700;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rank-badge.gold {
  filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.6));
}

.rank-badge.silver {
  filter: drop-shadow(0 0 5px rgba(203, 213, 225, 0.6));
}

.rank-badge.bronze {
  filter: drop-shadow(0 0 5px rgba(237, 137, 54, 0.6));
}

.rank-badge.standard {
  color: var(--accent);
}

.row-name {
  flex: 1;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-score {
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}

.pts-val {
  color: var(--primary-light);
  font-size: 1.3rem;
}

.pts-lbl {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.restart-wrapper {
  margin-top: 1rem;
  width: 100%;
}

/* =========================
   RESPONSIVE OVERRIDES
========================= */
@media (max-width: 768px) {
  .lb-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .player-row {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .lb-grid {
    grid-template-columns: 1fr;
  }
  .top-bar {
    padding: 1rem;
  }
}