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

html, body {
  min-height: 100%;
  background: #1a1a1a;
  color: #f5f5f5;
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
}

#page-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
  padding: 20px;
}

.game-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  width: 480px;
  max-width: 100%;
}

#game-container {
  position: relative;
  width: 480px;
  height: 720px;
  flex: 0 0 auto;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.disclaimer-note {
  font-size: 11px;
  color: #777;
  text-align: center;
  line-height: 1.4;
}

#info-panel {
  width: 340px;
  max-width: 100%;
  flex: 0 0 auto;
  background: #232323;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 22px;
  font-size: 14px;
  line-height: 1.55;
  color: #d8d8d8;
}

#info-panel h2 {
  font-size: 17px;
  color: #ffd54a;
  margin-bottom: 16px;
  line-height: 1.4;
}

#info-panel h2 .subtle {
  display: block;
  font-size: 12px;
  font-weight: normal;
  color: #999;
  margin-top: 4px;
}

#info-panel .lead {
  color: #d8d8d8;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #3a3a3a;
}

#info-panel section {
  margin-bottom: 16px;
}

#info-panel h3 {
  font-size: 13px;
  color: #7fd3ff;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

#info-panel p {
  margin-bottom: 6px;
}

#info-panel ul {
  padding-left: 18px;
  margin-bottom: 6px;
}

#info-panel li {
  margin-bottom: 4px;
}

#info-panel .subtle {
  color: #999;
  font-size: 12px;
}

#info-panel a {
  color: #ffd54a;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 213, 74, 0.4);
}

#info-panel a:hover {
  border-bottom-color: #ffd54a;
}

#info-panel .disclaimer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #3a3a3a;
  font-size: 12px;
  font-style: italic;
  color: #999;
}

canvas {
  display: block;
  background: #3a3a3a;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 14px;
  text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

#hud-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#score {
  font-size: 20px;
  font-weight: bold;
}

#speed {
  font-size: 14px;
  font-weight: bold;
  color: #cfe;
  transition: color 0.2s ease;
}

#speed.reduced {
  color: #ff5a5a;
  animation: speed-pulse 0.6s infinite alternate;
}

#speed.police {
  color: #5ab0ff;
  animation: speed-pulse 0.4s infinite alternate;
}

#speed.rising {
  color: #7dffa0;
  animation: speed-pulse 0.5s infinite alternate;
}

@keyframes speed-pulse {
  from { opacity: 1; }
  to { opacity: 0.55; }
}

#event-status {
  font-size: 12px;
  font-weight: bold;
  color: #5ab0ff;
  min-height: 14px;
}

#powerup-status {
  font-size: 13px;
  font-weight: bold;
  color: #ffd54a;
  min-height: 16px;
}

#lives {
  display: flex;
  gap: 6px;
  font-size: 22px;
  font-weight: bold;
}

#mute-btn {
  position: absolute;
  top: 48px;
  right: 14px;
  z-index: 5;
  margin-top: 0;
  padding: 6px 9px;
  font-size: 15px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.45);
  color: #f5f5f5;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#mute-btn:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: none;
}

#mute-btn:active {
  transform: scale(0.94);
}

#banner {
  position: absolute;
  top: 90px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  color: #ffd54a;
  text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

#banner.show {
  opacity: 1;
}

#flavor-text {
  position: absolute;
  bottom: 40px;
  left: 20px;
  right: 20px;
  text-align: center;
  font-size: 15px;
  font-style: italic;
  color: #ffe0e0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#flavor-text.show {
  opacity: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: 26px 30px;
  overflow-y: auto;
}

.overlay.hidden {
  display: none;
}

.overlay h1 {
  font-size: 36px;
  color: #ffd54a;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #000;
}

.overlay h2 {
  font-size: 18px;
  color: #7fd3ff;
  margin-top: 6px;
  font-weight: normal;
}

.tagline {
  margin-top: 18px;
  font-size: 14px;
  color: #ccc;
}

.instructions {
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: #aaa;
}

.gameover-line {
  margin-top: 16px;
  font-size: 14px;
  color: #ccc;
  max-width: 360px;
}

.final-score {
  margin-top: 16px;
  font-size: 20px;
  font-weight: bold;
  color: #ffd54a;
}

.fine-line {
  margin-top: 6px;
  font-size: 15px;
  font-weight: bold;
  color: #ff8a8a;
}

.high-score {
  margin-top: 6px;
  font-size: 13px;
  color: #7fd3ff;
}

button {
  margin-top: 26px;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: bold;
  background: #ffd54a;
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

button:hover {
  background: #ffe08a;
  transform: scale(1.04);
}

button:active {
  transform: scale(0.98);
}

#route-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  margin-top: 20px;
}

.route-btn {
  margin-top: 0;
  width: 100%;
  padding: 12px 16px;
  background: #262626;
  color: #f5f5f5;
  border: 1px solid #444;
  border-radius: 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: normal;
}

.route-btn:hover {
  background: #303030;
  border-color: #ffd54a;
  transform: none;
}

.route-btn:active {
  transform: none;
}

.route-name {
  font-size: 15px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-diff {
  font-size: 10px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.diff-easy { background: #2e6b3e; color: #d4ffe0; }
.diff-medium { background: #8a6d1f; color: #ffedb3; }
.diff-hard { background: #7a1f1f; color: #ffd0d0; }

.route-desc {
  font-size: 12px;
  color: #aaa;
}

.route-best {
  font-size: 11px;
  color: #7fd3ff;
  min-height: 14px;
}

#score-entry {
  margin-top: 16px;
  width: 100%;
  max-width: 320px;
}

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

.score-entry-label {
  font-size: 12px;
  color: #ffd54a;
  margin-bottom: 6px;
}

.score-entry-row {
  display: flex;
  gap: 8px;
}

#name-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #f5f5f5;
  font-size: 14px;
}

#save-score-btn {
  margin-top: 0;
  padding: 8px 14px;
  font-size: 13px;
}

#leaderboard-list {
  margin-top: 16px;
  width: 100%;
  max-width: 320px;
  text-align: left;
  list-style: decimal inside;
  font-size: 13px;
  color: #ccc;
}

#leaderboard-list li {
  padding: 4px 2px;
  border-bottom: 1px solid #2e2e2e;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

#leaderboard-list li.me {
  color: #ffd54a;
  font-weight: bold;
}
