* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9fb7c9;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #f4f1e8;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  outline: none;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

#brand {
  position: absolute;
  top: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#brand strong { font-size: 20px; letter-spacing: 0.04em; }
#brand span { font-size: 12px; opacity: 0.85; }

#fps {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font: 12px ui-monospace, monospace;
  opacity: 0.8;
}

#help {
  position: absolute;
  left: 14px;
  bottom: 12px;
  max-width: min(640px, calc(100vw - 28px));
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  background: rgba(20, 24, 28, 0.55);
  border-radius: 6px;
}
#help.hidden { display: none; }

#hint {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
}

#vehicle-info {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: 220px;
  text-align: center;
}
#vehicle-info[hidden] { display: none; }
#vehicle-name { font-size: 13px; opacity: 0.85; }
#vehicle-speed { font: 700 28px ui-monospace, monospace; }
.bar {
  height: 6px;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 3px;
  overflow: hidden;
}
#vehicle-health { height: 100%; width: 100%; background: #e8e2cf; transition: width 0.15s; }
#vehicle-health.low { background: #e05a3a; }

#toasts {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.toast {
  padding: 3px 10px;
  font-size: 14px;
  font-weight: 700;
  color: #ffd75e;
  background: rgba(20, 24, 28, 0.55);
  border-radius: 4px;
  animation: toast 2.2s ease-out forwards;
}
@keyframes toast {
  0% { opacity: 0; transform: translateY(-6px) scale(1.1); }
  10% { opacity: 1; transform: none; }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

#start {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 18, 22, 0.55);
  cursor: pointer;
}
#start.hidden { display: none; }
#start .card {
  max-width: 440px;
  padding: 24px 28px;
  text-align: center;
  background: rgba(20, 24, 28, 0.85);
  border-radius: 10px;
}
#start h1 { margin: 0 0 8px; font-size: 40px; letter-spacing: 0.05em; }
#start p { margin: 8px 0; line-height: 1.45; }
#start .small { font-size: 13px; opacity: 0.75; }
#start-status { font-weight: 700; color: #ffd75e; }

#debug {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 270px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 10px 12px;
  font-size: 13px;
  background: rgba(20, 24, 28, 0.78);
  border-radius: 8px;
  text-shadow: none;
}
#debug.hidden { display: none; }
#debug header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
#debug header span {
  padding: 0 6px;
  font: 11px ui-monospace, monospace;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 3px;
}
#debug .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#debug select, #debug button {
  font: inherit;
  color: #f4f1e8;
  background: #2b3036;
  border: 1px solid #4a525a;
  border-radius: 4px;
  padding: 3px 6px;
}
#debug select { flex: 1; }
#debug .slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  margin-bottom: 8px;
}
#debug .slider output {
  font: 12px ui-monospace, monospace;
  color: #ffd75e;
}
#debug .slider input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #ffd75e;
}
#debug .buttons { display: flex; flex-wrap: wrap; gap: 6px; }
#debug button { cursor: pointer; }
#debug button:hover { background: #3a4048; }
#debug .note { margin: 8px 0 0; font-size: 11px; opacity: 0.7; }

@media (max-width: 640px) {
  #help { font-size: 11px; }
  #brand strong { font-size: 16px; }
  #debug { width: calc(100vw - 24px); top: auto; bottom: 12px; max-height: 50vh; }
}
