* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 20px;
}

:root {
  --bg: #f8f9fa;
  --text: #212529;
  --card: #ffffff;
  --border: #dee2e6;
  --primary: #4361ee;
  --correct: #51cf66;
  --incorrect: #ff6b6b;
  --shadow: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #e9ecef;
  --card: #1e1e1e;
  --border: #333;
  --shadow: rgba(0,0,0,0.3);
}

.container {
  width: 100%;
  max-width: 1000px;
  background: var(--card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

/* Social Icons - Right Side Column */
.social-icons {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 100;
}

.social-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 1.3rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--shadow);
  text-decoration: none;
}

.social-icon:hover {
  transform: scale(1.15) translateX(-5px);
  box-shadow: 0 6px 20px var(--shadow);
}

.social-icon.linkedin:hover { 
  background: #0077b5; 
  color: white; 
  border-color: #0077b5; 
}

.social-icon.instagram:hover { 
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); 
  color: white; 
  border-color: #bc1888; 
}

.social-icon.snapchat:hover { 
  background: #FFFC00; 
  color: #000; 
  border-color: #FFFC00; 
}

.social-icon.whatsapp:hover { 
  background: #25D366; 
  color: white; 
  border-color: #25D366; 
}

.social-icon.email:hover { 
  background: #EA4335; 
  color: white; 
  border-color: #EA4335; 
}

.social-icon.github:hover { 
  background: #333; 
  color: white; 
  border-color: #333; 
}

/* User Profile Display */
.user-profile {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  padding: 8px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  margin-bottom: 0rem;
  box-shadow: 0 2px 8px var(--shadow);
  width: fit-content;
  
}

.user-profile.active {
  display: flex;
}

.user-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.user-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

/* Modern Single Row Header - Like Image */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1), rgba(63, 55, 201, 0.05));
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 2px solid var(--border);
  gap: 1rem;
}

h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #3f37c9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

#time-select {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  min-width: 75px;
  box-shadow: 0 2px 4px var(--shadow);
}

#time-select:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow);
}

#sound-toggle, #theme-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 2px 4px var(--shadow);
}

#sound-toggle:hover, #theme-toggle:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--shadow);
}

.icon {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.stats {
  display: flex;
  justify-content: space-around;
  background: var(--bg);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.stat {
  text-align: center;
  font-weight: 600;
}

.label {
  display: block;
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 4px;
}

.stat span:not(.label) {
  font-size: 1.5rem;
  color: var(--primary);
}

.typing-area {
  position: relative;
}

#sample-text {
  background: var(--bg);
  padding: 1.5rem;
  border-radius: 12px;
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
  user-select: none;
  border: 1px solid var(--border);
  min-height: 120px;
  color: var(--text);
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
}

#sample-text span {
  transition: all 0.1s;
}

.correct { 
  color: var(--correct) !important; 
}

.incorrect { 
  color: var(--incorrect) !important; 
  background: rgba(255,107,107,0.2); 
}

.current {
  background: var(--primary) !important;
  color: white !important;
  border-radius: 3px;
  padding: 0 2px;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#input-text {
  width: 100%;
  height: 120px;
  padding: 1rem;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid var(--border);
  border-radius: 12px;
  resize: none;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border 0.3s;
}

#input-text:focus {
  border-color: var(--primary);
}

#reset-btn {
  margin-top: 1rem;
  padding: 0.7rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

#reset-btn:hover {
  background: #3f37c9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: #666;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

/* Shafiq Ansari ke naam ka color change karne ke liye */
footer strong {
  color: var(--primary); /* Yahan aap koi bhi color code daal sakte hain jaise #ff6b6b ya blue */
  font-weight: 700;
  transition: color 0.3s ease;
}

/* Hover effect agar aap chahen */
footer strong:hover {
  color: #3f37c9;
}

/* Leaderboard link style */
.leaderboard-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 5px;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; 
  top: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--card);
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 30px var(--shadow);
  border: 1px solid var(--border);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), #3f37c9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.8rem;
}

.result-stats p {
  margin: 12px 0;
  font-size: 1.1rem;
}

.modal-content button {
  margin: 10px 8px;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.modal-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

#close-modal, #close-leaderboard { 
  background: #6c757d; 
  color: white; 
}

#save-score, #start-test-btn { 
  background: var(--primary); 
  color: white; 
}

#clear-leaderboard { 
  background: #dc3545; 
  color: white; 
}

#leaderboard-list {
  text-align: left;
  max-height: 300px;
  overflow-y: auto;
  margin: 1rem 0;
  padding: 0 1rem;
}

#leaderboard-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  list-style-position: inside;
}

#confetti-canvas {
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Welcome Modal Form Styles */
.form-group {
  margin: 20px 0;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  transition: border 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.gender-options {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 10px;
}

.gender-option {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  background: var(--bg);
  font-weight: 600;
}

.gender-option:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.gender-option.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.gender-option i {
  display: block;
  font-size: 2rem;
  margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .social-icons {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
  }
  
  .social-icon {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
  }
  
  .social-icon:hover {
    transform: scale(1.15);
  }
  
  .container {
    margin-top: 20px;
  }
  
  header {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    padding: 15px;
  }
  
  h1 {
    font-size: 1.4rem;
    width: 100%;
    margin-bottom: 10px;
  }
  
  .controls {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .stats { 
    flex-direction: column; 
    align-items: center; 
  }
  
  .modal-content {
    padding: 1.5rem;
  }
  
  footer p {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .text { display: none; }
  
  #sound-toggle, #theme-toggle { 
    padding: 8px 10px; 
    width: 42px;
    height: 42px;
    justify-content: center;
    border-radius: 8px;
  }
  
  #time-select {
    padding: 8px 10px;
    font-size: 0.85rem;
    min-width: 65px;
  }
  
  .controls {
    gap: 8px;
  }
  
  h1 {
    font-size: 1.3rem;
  }
  
  header {
    padding: 12px;
  }
}