@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --card-bg: rgba(30, 41, 59, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  
  --color-hunter: #ff4a6b;
  --color-runner: #38bdf8;
  --color-bonus: #fbbf24;
  --color-success: #10b981;
  --color-danger: #ef4444;
  
  --shadow-hunter: 0 0 20px rgba(255, 74, 107, 0.8), 0 0 40px rgba(255, 74, 107, 0.4);
  --shadow-runner: 0 0 20px rgba(56, 189, 248, 0.8), 0 0 40px rgba(56, 189, 248, 0.4);
  --shadow-bonus: 0 0 20px rgba(251, 191, 36, 0.8), 0 0 40px rgba(251, 191, 36, 0.4);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(255, 74, 107, 0.08) 0, transparent 50%),
    radial-gradient(at 50% 100%, rgba(251, 191, 36, 0.05) 0, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

#game-container {
  width: 100%;
  max-width: 800px;
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

/* Header & Controls */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.game-title {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-title span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-runner);
  background: rgba(56, 189, 248, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  text-shadow: none;
  -webkit-text-fill-color: var(--color-runner);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  transition: transform 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2px;
}

#stat-score {
  color: var(--color-bonus);
}

#stat-accuracy {
  color: var(--color-success);
}

#stat-time {
  color: var(--color-runner);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Chase Track */
.track-wrapper {
  margin-bottom: 40px;
  position: relative;
}

.track-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.track-container {
  height: 24px;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  position: relative;
  display: flex;
  align-items: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  overflow: visible;
}

.track-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 5% 100%;
  border-radius: 12px;
  pointer-events: none;
}

.track-node {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  transition: left 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.hunter-node {
  background: radial-gradient(circle, #ff6b8b 30%, var(--color-hunter) 90%);
  box-shadow: var(--shadow-hunter);
}

.hunter-node::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  filter: blur(1px);
}

.runner-node {
  background: radial-gradient(circle, #60a5fa 30%, var(--color-runner) 90%);
  box-shadow: var(--shadow-runner);
}

.runner-node::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  filter: blur(1px);
}

.meta-node {
  position: absolute;
  right: 0;
  width: 36px;
  height: 36px;
  background: rgba(251, 191, 36, 0.1);
  border: 2px dashed var(--color-bonus);
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.2);
  animation: pulse-gold 2s infinite;
  z-index: 5;
}

.meta-icon {
  font-size: 1.1rem;
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 5px rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.05);
  }
  50% {
    box-shadow: var(--shadow-bonus);
    border-color: var(--color-bonus);
    background: rgba(251, 191, 36, 0.25);
  }
  100% {
    box-shadow: 0 0 5px rgba(251, 191, 36, 0.3);
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(251, 191, 36, 0.05);
  }
}

/* Question Area */
.question-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.2);
}

.question-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 15px;
}

.question-text {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 5px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
  letter-spacing: -0.02em;
}

.question-subtext {
  font-size: 0.95rem;
  color: var(--color-runner);
  font-weight: 500;
}

/* Answer Buttons Container */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 600px) {
  .answers-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .answers-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .answers-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .answers-grid.grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.answer-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 24px;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 60px;
}

.answer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.1);
  transform: translateY(-2px);
}

.answer-btn:active {
  transform: translateY(0);
}

/* Feedback states */
.answer-btn.correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: var(--color-success) !important;
  color: #a7f3d0 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4) !important;
  transform: scale(1.02);
}

.answer-btn.incorrect {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--color-danger) !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4) !important;
  transform: scale(0.98);
}

/* Game Over Screen */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay-screen.active {
  opacity: 1;
  pointer-events: all;
}

.screen-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 10px;
  text-align: center;
  background: linear-gradient(135deg, #f43f5e, #fda4af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.screen-subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 24px;
  text-align: center;
}

.summary-table {
  width: 100%;
  max-width: 400px;
  border-collapse: collapse;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.summary-value {
  font-weight: 700;
}

.summary-value.highlight {
  color: var(--color-bonus);
}

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 16px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Modal styling */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #111827;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 450px;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: 24px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group:last-child {
  margin-bottom: 0;
}

.setting-label-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.setting-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.setting-value-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-runner);
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: 8px;
}

.setting-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.setting-input:focus {
  border-color: var(--color-runner);
}

select.setting-input {
  cursor: pointer;
}

.setting-input option {
  background-color: #111827;
  color: var(--text-primary);
}

#btn-settings {
  position: relative;
  z-index: 150;
}

.setting-help {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Utility Animations */
.pulse-green {
  animation: flash-green-anim 0.3s ease;
}

.pulse-red {
  animation: flash-red-anim 0.3s ease;
}

@keyframes flash-green-anim {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  100% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
}

@keyframes flash-red-anim {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  100% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
}
