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

:root {
  --primary: #667eea;
  --secondary: #764ba2;
  --accent: #f093fb;
  --success: #4facfe;
  --error: #ff6b6b;
  --warning: #ffd93d;
  --dark-bg: #121212;
  --card-bg: #1e1e1e;
  --text-light: #ffffff;
  --text-muted: #b0b0b0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --border-radius: 12px;
  --transition: all 0.3s ease;
  /* Original Kahoot colors */
  --kahoot-red: #e84e67;
  --kahoot-blue: #0092d1;
  --kahoot-yellow: #ffd740;
  --kahoot-green: #00bd68;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #864cbf;
  color: var(--text-light);
  overflow-x: hidden;
  line-height: 1.6;
}

.layout {
  display: flex;
  width: 100%;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  box-sizing: border-box;
  overflow: hidden;
}

.leaderboard {
  flex: 0 0 300px;
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(10px);
  padding: 2.5rem 2rem;
  color: var(--text-light);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: flex-basis 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: flex-basis;
}

.leaderboard.collapsed {
  flex: 0 0 70px;
  padding: 1rem 0.5rem;
}

.leaderboard.collapsed .leaderboard-content {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease 0.1s, visibility 0.2s ease 0.1s;
}

.leaderboard:not(.collapsed) .leaderboard-content {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.leaderboard.collapsed .leaderboard-header {
  position: relative;
  margin-bottom: 0;
  height: 100%;
}

.leaderboard.collapsed h3 {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 1.1rem;
  margin: 0;
  white-space: nowrap;
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(180deg);
}


.leaderboard.collapsed .leaderboard-toggle {
  top: 50%;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  font-size: 1rem;
  padding: 0.6rem 0.8rem;
  width: 44px;
  height: 44px;
}

/* Desktop-only collapsed styles */
@media (min-width: 769px) {
  /* Removed game container adjustments since we use transform instead */
}

.leaderboard h3 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.leaderboard-toggle {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-light);
  border-radius: 50%;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 40px;
  height: 40px;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.leaderboard-toggle:active {
  transform: scale(0.95);
}

.leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard li {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 500;
}

.leaderboard li:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.leaderboard li:first-child {
  background: rgba(138, 76, 191, 0.2);
  border: 1px solid rgba(138, 76, 191, 0.3);
  color: #ffffff;
  font-weight: 600;
}

.game-container.kahoot-style {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(10px);
  overflow: hidden;
  position: relative;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-right: none;
  margin-left: 0.5rem;
}

/* Header with timer circle and skip button */
.kahoot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  background: rgba(136, 76, 191, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#timer-circle {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  animation: pulse 2s infinite;
  border: 2px solid rgba(136, 76, 191, 0.2);
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); }
  50% { transform: scale(1.03); box-shadow: 0 6px 25px rgba(136, 76, 191, 0.2); }
  100% { transform: scale(1); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); }
}

#timer-circle span {
  font-size: 1.4rem;
  font-weight: 700;
  color: #864cbf;
  font-variant-numeric: tabular-nums;
}

#skip {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: var(--text-light);
  padding: 0.8rem 1.8rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

#skip:hover {
  background: linear-gradient(135deg, #3a9bd1, #00d9e7);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.score-display {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Question text */
.kahoot-question {
  flex: 0 0 auto;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  padding: 3rem 2rem;
  background: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(10px);
  margin: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* Feedback */
.feedback {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1.2rem;
  margin: 0 1.5rem 1rem;
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback.correct {
  background: rgba(79, 172, 254, 0.2);
  color: #ffffff;
  border: 1px solid rgba(79, 172, 254, 0.3);
  box-shadow: 0 4px 20px rgba(79, 172, 254, 0.2);
}

.feedback.wrong {
  background: rgba(255, 107, 107, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 107, 107, 0.3);
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.2);
}

/* Full-bleed 2x2 answer grid */
.kahoot-grid {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  padding: 1.5rem;
}

.option-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 600;
  color: var(--text-light);
  border: none;
  cursor: pointer;
  position: relative;
  padding: 1.8rem;
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1rem;
  min-height: 80px;
}

.option-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.option-btn:active {
  transform: translateY(0);
  transition: all 0.1s ease;
}

.option-btn.red {
  background: linear-gradient(135deg, #e84e67, #ff6b6b);
}

.option-btn.blue {
  background: linear-gradient(135deg, #0092d1, #4facfe);
}

.option-btn.yellow {
  background: linear-gradient(135deg, #ffd740, #ffeb3b);
}

.option-btn.green {
  background: linear-gradient(135deg, #00bd68, #4caf50);
}

.option-btn .text {
  font-size: 1.1rem;
  line-height: 1.4;
  flex: 1;
}

/* Shapes */
.option-btn .shape {
  display: inline-block;
  margin-right: 1rem;
  flex-shrink: 0;
}

.shape.triangle {
  width: 0;
  height: 0;
  border-left: 0.5rem solid transparent;
  border-right: 0.5rem solid transparent;
  border-bottom: 0.8rem solid var(--text-light);
}

.shape.diamond {
  width: 1rem;
  height: 1rem;
  transform: rotate(45deg);
  background: var(--text-light);
}

.shape.circle {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--text-light);
}

.shape.square {
  width: 1rem;
  height: 1rem;
  background: var(--text-light);
}

/* Progress bar at bottom */
footer {
  flex: 0 0 3.5rem;
  padding: 0 1.5rem 1.5rem;
  position: relative;
}

.progress-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#progress {
  width: 100%;
  height: 100%;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
}

#progress::-webkit-progress-value {
  background: linear-gradient(90deg, #864cbf, #a855f7);
  border-radius: var(--border-radius);
  box-shadow: 0 0 10px rgba(136, 76, 191, 0.5);
}

#progress::-moz-progress-bar {
  background: linear-gradient(90deg, #864cbf, #a855f7);
  border-radius: var(--border-radius);
  box-shadow: 0 0 10px rgba(136, 76, 191, 0.5);
}

#progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-light);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 1;
}

/* Site Footer */
.site-footer {
  background: rgba(136, 76, 191, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem 2rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 3rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-name {
  margin: 0 0 1.5rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: #ffffff;
  opacity: 0.9;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 20px rgba(136, 76, 191, 0.3);
}

.social-icon {
  width: 22px;
  height: 22px;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .layout {
    flex-direction: column;
    min-height: 100vh;
    padding: 0 0.5rem;
  }

  .leaderboard {
    order: 2; /* Appear after game container */
    flex: 0 0 auto;
    width: 100%;
    max-height: 200px;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 0;
  }

  .leaderboard-header {
    margin-bottom: 1.5rem;
  }

  .leaderboard h3 {
    font-size: 1.3rem;
    margin: 0;
  }

  .leaderboard-toggle {
    display: none; /* Hide toggle on mobile */
  }

  .leaderboard li {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
  }

  .game-container.kahoot-style {
    order: 1; /* Appear first on mobile */
    flex: 1;
    min-height: 0;
    border-radius: var(--border-radius);
    margin-left: 0;
    margin-top: 0;
  }

  /* Header adjustments for mobile */
  .kahoot-header {
    padding: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
  }

  #timer-circle {
    width: 4rem;
    height: 4rem;
    order: 1;
  }

  #timer-circle span {
    font-size: 1.3rem;
  }

  .score-display {
    order: 2;
    font-size: 1.1rem;
    padding: 0.4rem 0.8rem;
  }

  #skip {
    order: 3;
    padding: 0.7rem 1.4rem;
    font-size: 0.9rem;
  }

  /* Question text mobile */
  .kahoot-question {
    font-size: 1.7rem;
    padding: 2rem 1.5rem;
    margin: 1rem 0.5rem;
  }

  /* Feedback mobile */
  .feedback {
    font-size: 1rem;
    padding: 1rem;
    margin: 0 0.5rem 1rem;
  }

  /* Button grid adjustments */
  .kahoot-grid {
    gap: 1rem;
    padding: 1rem;
  }

  .option-btn {
    padding: 1.5rem;
    min-height: 70px;
    font-size: 0.95rem;
  }

  .option-btn .shape {
    margin-right: 0.8rem;
    flex-shrink: 0;
  }

  .option-btn .text {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  /* Progress bar mobile */
  footer {
    padding: 0 1rem 1.5rem;
  }

  .progress-container {
    height: 2.5rem;
  }

  #progress-text {
    font-size: 1rem;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .kahoot-question {
    font-size: 1.4rem;
    padding: 1rem;
  }

  .option-btn {
    padding: 1rem;
    min-height: 55px;
  }

  .option-btn .text {
    font-size: 0.9rem;
  }

  .kahoot-header {
    padding: 0.8rem;
  }

  #timer-circle {
    width: 3rem;
    height: 3rem;
  }

  #timer-circle span {
    font-size: 1.1rem;
  }

  .leaderboard {
    padding: 0.8rem;
    max-height: 150px;
  }

  /* Footer mobile */
  .site-footer {
    padding: 1rem;
    margin-top: 1rem;
  }

  .footer-name {
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    color: #ffffff;
  }

  .social-links {
    gap: 1rem;
  }

  .social-link {
    width: 36px;
    height: 36px;
  }

  .social-icon {
    width: 18px;
    height: 18px;
  }

  /* Extra small footer adjustments */
  .site-footer {
    padding: 0.8rem;
  }

  .social-links {
    gap: 0.8rem;
  }
}

/* Home link styling */
.home-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s ease;
  z-index: 10;
}

.home-link:hover {
  color: white;
  transform: scale(1.1);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
}

.modal-content h2 {
  color: var(--text-light);
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  text-align: center;
}

.modal-content p {
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
  text-align: center;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #864cbf;
  box-shadow: 0 0 0 2px rgba(134, 76, 191, 0.2);
}

.form-group input::placeholder {
  color: var(--text-secondary);
}

.form-options {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-primary, .btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.btn-primary {
  background: linear-gradient(135deg, #864cbf, #a855f7);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(134, 76, 191, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Mobile responsiveness for modal */
@media (max-width: 480px) {
  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .form-options {
    flex-direction: column;
  }
  
  .btn-primary, .btn-secondary {
    width: 100%;
  }
}
