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

:root {
  --bg-primary: #0a0b0e;
  --bg-secondary: #101218;
  --bg-card: #151821;
  --border-color: #212635;
  
  --accent-cyan: #00f0ff;
  --accent-purple: #9d4edd;
  --accent-green: #00ff66;
  --accent-red: #ff4655; /* Valorant Red */
  --accent-orange: #ff9d00;
  
  --text-main: #f0f2f5;
  --text-muted: #7c8394;
  
  --font-title: 'Space Grotesk', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent-red);
  border-radius: 2px;
  position: relative;
  transform: rotate(45deg);
}

.logo-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background-color: var(--accent-red);
  border-radius: 1px;
}

.logo-text {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 2px;
  color: #fff;
  text-transform: uppercase;
}

.headphone-notice-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-orange);
  border: 1px solid rgba(255, 157, 0, 0.2);
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  background: rgba(255, 157, 0, 0.03);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.5rem;
  position: relative;
}

/* Modern flat panel container */
.container {
  width: 100%;
  max-width: 1000px;
  min-height: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: var(--shadow-card);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Screen Transitions */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 2.5rem 3rem;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* Home Screen */
#screen-home {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-area {
  margin-bottom: 2.5rem;
  max-width: 680px;
}

.hero-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 2.2rem;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  color: #fff;
}

.hero-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 2.5rem auto;
}

.feature-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 4px;
  text-align: center; /* Center-aligned entire content */
  transition: all 0.25s ease;
  overflow: hidden;
}

.feature-card:hover {
  background: #181c25;
  border-color: var(--accent-red);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.overall-evaluation-card {
  grid-column: 1 / -1;
  background: rgba(157, 78, 221, 0.08) !important;
  border-color: rgba(157, 78, 221, 0.3) !important;
}

.overall-evaluation-card:hover {
  border-color: rgba(157, 78, 221, 0.6) !important;
  background: rgba(157, 78, 221, 0.12) !important;
}

.overall-evaluation-card .feature-title {
  color: #e2c2ff !important; /* High contrast lavender title */
}

.overall-evaluation-card .feature-desc {
  color: #d1d5db !important; /* High contrast bright gray description */
}

.feature-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: center; /* Centered title and number span */
  align-items: center;
  gap: 0.5rem;
}

.feature-title span {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.feature-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.feature-card-hint {
  font-size: 0.7rem;
  color: var(--accent-red);
  margin-top: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 420px;
}

/* Flat solid esports buttons */
.btn {
  background: var(--accent-red);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.85rem 2.2rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  background: #ff5c69;
  box-shadow: 0 4px 12px rgba(255, 70, 85, 0.35);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--text-muted);
  box-shadow: none;
}

/* Standby Overlays */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 17, 0.97);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 5;
  text-align: center;
  padding: 2rem;
}

.overlay-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.overlay-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Gameplay Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.game-title-area {
  flex: 1;
}

.game-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  text-transform: uppercase;
}

.game-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.game-progress {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--accent-red);
  border: 1px solid rgba(255, 70, 85, 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: 2px;
  background: rgba(255, 70, 85, 0.03);
  font-weight: 600;
  letter-spacing: 1px;
}

/* Game Areas */
.game-area {
  flex: 1;
  background: #08090c;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  position: relative;
  cursor: crosshair;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Sound Test Layout (Compass) */
.audio-test-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.85rem;
  padding: 1rem;
  max-width: 540px;
  margin: 0 auto;
}

.audio-listening-indicator {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
}

.audio-listening-indicator.playing {
  animation: audio-pulse 0.6s ease-out;
  border-color: var(--accent-red);
  background: rgba(255, 70, 85, 0.04);
}

.audio-icon {
  width: 28px;
  height: 28px;
  fill: var(--text-muted);
}

.audio-listening-indicator.playing .audio-icon {
  fill: var(--accent-red);
}

@keyframes audio-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 70, 85, 0.4);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(255, 70, 85, 0);
  }
}

.compass-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  width: 260px;
  margin-top: 0.5rem;
}

.compass-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-main);
  padding: 0.8rem 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.compass-btn:hover {
  border-color: var(--accent-red);
  background: rgba(255, 70, 85, 0.03);
  color: #fff;
}

.compass-btn:disabled {
  cursor: default;
  opacity: 0.7;
}

#compass-btn-center {
  background: transparent;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: default;
  height: 100%; /* Symmetrical vertical centering of center dot */
}

.compass-center-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.audio-play-btn {
  margin-top: 0.5rem;
}

.audio-action-area {
  min-height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Results Screen */
.results-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  width: 100%;
}

/* Practice result centered styling */
.results-grid.practice-results {
  grid-template-columns: 1fr !important;
  max-width: 500px;
  margin: 0 auto;
}

.results-grid.practice-results .results-stats-panel {
  width: 100%;
  align-items: center;
  text-align: center;
}

.results-grid.practice-results .practice-result-card {
  width: 100%;
  align-items: center;
}

/* Center the restart actions button in practice results */
.results-grid.practice-results .results-actions {
  justify-content: center !important;
}

.results-chart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0c0e13;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1.5rem;
}

.chart-canvas {
  width: 100%;
  max-width: 340px;
  height: auto;
  aspect-ratio: 1;
}

.results-stats-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
}

.score-rank-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.score-rank-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-red);
}

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

.total-score-value {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin: 0.2rem 0;
}

.rank-badge {
  display: none !important;
  display: inline-block;
  padding: 0.35rem 1.25rem;
  border-radius: 4px;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1.5px solid var(--accent-red);
  color: var(--accent-red);
  background: rgba(255, 70, 85, 0.03);
}

/* Rank themes (clean flat border and color, no heavy shadows) */
.rank-radiant {
  border-color: var(--accent-purple) !important;
  color: var(--accent-purple) !important;
  background: rgba(157, 78, 221, 0.03) !important;
}

.rank-diamond {
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
  background: rgba(0, 240, 255, 0.03) !important;
}

.rank-gold {
  border-color: var(--accent-orange) !important;
  color: var(--accent-orange) !important;
  background: rgba(255, 157, 0, 0.03) !important;
}

.rank-silver {
  border-color: #cbd5e1 !important;
  color: #cbd5e1 !important;
  background: rgba(203, 213, 225, 0.03) !important;
}

.rank-bronze {
  border-color: #cd7f32 !important;
  color: #cd7f32 !important;
  background: rgba(205, 127, 50, 0.03) !important;
}

/* Practice mode single test result display */
.practice-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2.2rem 1.5rem;
  text-align: center;
  position: relative;
}

.practice-result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-red);
}

/* Score Breakdown List (Flat & Clean) */
.stats-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
  padding: 0.7rem 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.stat-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.stat-score-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  justify-content: flex-end;
}

.stat-bar-outer {
  width: 100px;
  height: 5px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 1px;
  overflow: hidden;
}

.stat-bar-inner {
  height: 100%;
  background-color: var(--accent-red);
  border-radius: 1px;
  width: 0%;
  transition: width 1s cubic-bezier(0.1, 0.8, 0.2, 1);
}

#stat-sound-bar {
  background-color: var(--accent-purple) !important;
}

.stat-score {
  font-family: monospace;
  font-weight: 700;
  color: #fff;
  width: 60px;
  text-align: right;
  font-size: 0.85rem;
}

/* Details list at the bottom of result screen */
.results-details-panel {
  background: rgba(12, 14, 20, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  width: 100%;
}

.details-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  letter-spacing: 0.5px;
}

#details-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

#details-list strong {
  font-family: monospace;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  width: 100%;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header {
    padding: 1rem 1.5rem;
  }
  
  main {
    padding: 1.5rem 1rem;
  }
  
  .screen {
    padding: 1.5rem 1.5rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .overall-evaluation-card {
    grid-column: auto !important;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .results-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .hero-title {
    font-size: 1.8rem;
  }
}

/* Side Skyscraper Ads */
.side-ad {
  position: fixed;
  top: 120px;
  width: 160px;
  height: 600px;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

.left-side-ad {
  left: 20px;
}

.right-side-ad {
  right: 20px;
}

/* Hide side ads on screens narrower than 1400px to avoid overlapping content */
@media (max-width: 1400px) {
  .side-ad {
    display: none !important;
  }
}
