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

body {
  display: flex;
  justify-content: center;
  font-family: "Roboto", sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

.everything {
  text-align: center;
  padding: 20px;
  max-width: 1100px;
  width: 100%;
}

h1 {
  font-size: 48px;
  font-weight: 900;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 18px;
  color: #aaa;
  margin-bottom: 12px;
}

kbd {
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 13px;
  font-family: inherit;
}

/* Canvas Overlays (start screen & game over) */
.canvas-wrapper {
  position: relative;
  width: 800px;
  height: 500px;
}

.canvas-overlay {
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: rgba(10, 10, 26, 0.88);
  z-index: 10;
  pointer-events: auto;
}

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

.overlay-instruction {
  font-size: 17px;
  color: #00d2ff;
  font-weight: 500;
}

.overlay-controls {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: #aaa;
}

.mode-description {
  font-size: 12px;
  color: #888;
}

.gameover-title {
  font-size: 28px;
  color: #ff4757;
  margin-bottom: 4px;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mode-btn {
  padding: 8px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid #3a7bd5;
  border-radius: 8px;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  border-color: transparent;
}

.mode-btn:hover:not(.active) {
  color: #fff;
  border-color: #00d2ff;
}

#button {
  width: 220px;
  height: 55px;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

#button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 210, 255, 0.4);
}

/* Game Layout */
.gameandinfo {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: flex-start;
}

.canvas-wrapper {
  position: relative;
}

canvas {
  border: 3px solid #3a7bd5;
  border-radius: 8px;
  background-color: #0a0a1a;
  display: block;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 140px;
}

.info-box {
  background: #16213e;
  border: 1px solid #3a7bd5;
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
}

.info-box h3 {
  font-size: 13px;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.info-value {
  font-size: 28px;
  font-weight: 700;
  color: #00d2ff;
}

.separator {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.stat {
  background: #1a1a2e;
  border-radius: 10px;
  padding: 14px;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #00d2ff;
}

#new-record {
  font-size: 22px;
  font-weight: 700;
  color: #ffd700;
  margin: 12px 0;
}

#new-record.hidden {
  display: none;
}

#restart-btn {
  margin-top: 16px;
  padding: 12px 30px;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s;
}

#restart-btn:hover {
  transform: scale(1.05);
}

/* Touch Controls */
.touch-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 20px;
}

.touch-controls.hidden {
  display: none;
}

.touch-side {
  display: flex;
  gap: 10px;
}

.touch-btn {
  width: 64px;
  height: 64px;
  font-size: 24px;
  background: #16213e;
  border: 2px solid #3a7bd5;
  border-radius: 12px;
  color: #00d2ff;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.touch-btn:active {
  background: #3a7bd5;
  color: #fff;
}

/* Submit Score */
.submit-score {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

#player-name {
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  background: #1a1a2e;
  border: 2px solid #3a7bd5;
  border-radius: 8px;
  color: #fff;
  width: 160px;
  outline: none;
}

#player-name:focus {
  border-color: #00d2ff;
}

#submit-score-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s;
}

#submit-score-btn:hover {
  transform: scale(1.05);
}

#submit-score-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#score-submitted {
  color: #2ed573;
  font-weight: 600;
  margin-top: 8px;
}

#score-submitted.hidden {
  display: none;
}

/* Leaderboard Section */
.leaderboard-section {
  max-width: 800px;
  margin: 40px auto 0;
  padding: 32px 40px;
  background: #16213e;
  border-radius: 16px;
  border: 1px solid #253555;
  text-align: center;
}

.leaderboard-section h2 {
  font-size: 28px;
  color: #00d2ff;
  margin-bottom: 16px;
}

.lb-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.lb-tab {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 2px solid #3a7bd5;
  border-radius: 8px;
  background: transparent;
  color: #aaa;
  cursor: pointer;
  transition: all 0.15s;
}

.lb-tab.active {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  border-color: transparent;
}

.lb-tab:hover:not(.active) {
  color: #fff;
  border-color: #00d2ff;
}

.lb-panel.hidden {
  display: none;
}

.lb-header {
  display: grid;
  grid-template-columns: 50px 1fr 80px 80px;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.lb-list {
  list-style: none;
  padding: 0;
}

.lb-row {
  display: grid;
  grid-template-columns: 50px 1fr 80px 80px;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  align-items: center;
  transition: background 0.15s;
}

.lb-row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.lb-row:hover {
  background: rgba(0, 210, 255, 0.08);
}

.lb-rank {
  font-size: 18px;
  font-weight: 700;
  color: #888;
}

.lb-name {
  font-size: 16px;
  font-weight: 600;
  color: #eee;
  text-align: left;
}

.lb-time {
  font-size: 16px;
  font-weight: 700;
  color: #00d2ff;
}

.lb-accuracy {
  font-size: 14px;
  color: #aaa;
}

.lb-empty {
  padding: 24px;
  color: #666;
  font-size: 14px;
}

/* SEO Content Section */
.seo-content {
  text-align: left;
  max-width: 800px;
  margin: 60px auto 0;
  padding: 40px;
  background: #16213e;
  border-radius: 16px;
  border: 1px solid #253555;
}

.seo-content h2 {
  font-size: 24px;
  color: #00d2ff;
  margin-top: 28px;
  margin-bottom: 12px;
}

.seo-content h2:first-child {
  margin-top: 0;
}

.seo-content p {
  font-size: 16px;
  line-height: 1.7;
  color: #bbb;
  margin-bottom: 12px;
}

.seo-content ul {
  padding-left: 24px;
  margin-bottom: 12px;
}

.seo-content li {
  font-size: 16px;
  line-height: 1.7;
  color: #bbb;
  margin-bottom: 6px;
}

/* CTA Section */
.cta-section {
  max-width: 800px;
  margin: 40px auto 0;
  padding: 36px 40px;
  background: linear-gradient(135deg, #1e3a5f, #16213e);
  border-radius: 16px;
  border: 1px solid #3a7bd5;
}

.cta-section h2 {
  font-size: 24px;
  color: #fff;
  margin-bottom: 8px;
}

.cta-section p {
  font-size: 16px;
  color: #aaa;
  margin-bottom: 20px;
}

.cta-btn {
  display: inline-block;
  padding: 14px 32px;
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.cta-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 210, 255, 0.4);
}

/* Ad containers */
.ad-container {
  max-width: 800px;
  margin: 30px auto;
  min-height: 90px;
  text-align: center;
}

/* Footer */
footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid #253555;
}

footer p {
  font-size: 13px;
  color: #666;
}

/* Responsive */
@media (max-width: 900px) {
  .gameandinfo {
    flex-direction: column;
    align-items: center;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    min-width: auto;
    gap: 8px;
  }

  .info-box {
    min-width: 100px;
    padding: 8px 12px;
  }

  .info-value {
    font-size: 22px;
  }
}

@media (max-width: 600px) {
  h1 {
    font-size: 32px;
  }

  .subtitle {
    font-size: 14px;
  }

  .seo-content,
  .cta-section {
    padding: 24px 20px;
    margin-left: 10px;
    margin-right: 10px;
  }

  .seo-content h2,
  .cta-section h2 {
    font-size: 20px;
  }

  .seo-content p,
  .seo-content li,
  .cta-section p {
    font-size: 14px;
  }

  .instructions-box {
    padding: 24px 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .touch-controls {
    justify-content: center;
  }

  .touch-btn {
    width: 56px;
    height: 56px;
    font-size: 20px;
  }
}
