html, body { margin: 0; height: 100%; overflow: hidden; background: #314d79; }
canvas { display: block; width: 100vw; height: 100vh; }
#game3d { position: fixed; inset: 0; display: none; }
#game.minimap {
  position: fixed; right: 16px; bottom: 16px; width: 320px; height: 180px;
  border: 2px solid rgba(255, 255, 255, 0.85); border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.hud {
  position: fixed; color: #fff; font: 28px/1.4 Arial, Helvetica, sans-serif;
  text-shadow: 1.5px 1.5px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  pointer-events: none; user-select: none;
}
#hudLeft { top: 20px; left: 20px; }
#hudRight { top: 20px; right: 20px; text-align: right; }
#hint { bottom: 12px; left: 20px; font-size: 14px; opacity: 0.8; }
#diffText { font-size: 18px; opacity: 0.9; }
.panel {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font: 32px/1.4 Arial, Helvetica, sans-serif; text-align: center;
}
.panel.show { display: flex; }
#standings { white-space: pre; margin-bottom: 40px; }
.panel button {
  width: 200px; height: 60px; border: 0; background: rgb(255, 217, 26);
  color: #000; font: 28px Arial, Helvetica, sans-serif; cursor: pointer;
}
.panel button:hover { filter: brightness(1.1); }
#startPanel h1 { margin: 0 0 8px; font-size: 56px; color: rgb(255, 217, 26); }
#diffButtons { display: flex; gap: 16px; margin: 24px 0 16px; flex-wrap: wrap; justify-content: center; }
#diffButtons button { background: #eee; }
#diffButtons button.selected { background: rgb(255, 217, 26); outline: 3px solid #fff; }
#diffButtons small { display: block; font-size: 14px; opacity: 0.7; }
.panelHint { font-size: 16px; opacity: 0.8; }

/* ML car training mode */
#trainBtn { width: auto; padding: 0 24px; margin-bottom: 12px; font-size: 22px; background: rgb(160, 80, 220); color: #fff; }
#trainBtn:disabled { opacity: 0.4; cursor: default; }
#trainBtn small { display: block; font-size: 13px; opacity: 0.8; }
#brainInfo { margin-bottom: 12px; }
#trainPanel {
  position: fixed; top: 16px; right: 16px; width: 290px; padding: 14px 16px; display: none;
  background: rgba(0, 0, 0, 0.72); border: 2px solid rgb(160, 80, 220); border-radius: 10px;
  color: #fff; font: 15px/1.5 Arial, Helvetica, sans-serif;
}
body.training #trainPanel { display: block; }
body.training #hudLeft, body.training #hudRight { display: none; }
.trainTitle { font-size: 20px; font-weight: bold; color: rgb(200, 150, 255); margin-bottom: 6px; }
#trainStats { white-space: pre; font-family: "Courier New", monospace; font-size: 14px; margin-bottom: 8px; }
.trainRow { margin: 6px 0; }
#trainPanel button {
  font: 14px Arial, Helvetica, sans-serif; padding: 4px 8px; margin: 2px 2px 2px 0; cursor: pointer;
  border: 0; border-radius: 4px; background: #eee; color: #000;
}
#trainPanel button.selected { background: rgb(160, 80, 220); color: #fff; }
#brainStatus { font-size: 13px; opacity: 0.85; min-height: 1.5em; }

/* City Shift */
.modeLabel { font-size: 18px; opacity: 0.9; margin-top: 8px; }
#cityButtons { display: flex; gap: 16px; margin: 12px 0 20px; flex-wrap: wrap; justify-content: center; }
#cityButtons button { background: #3dff8a; }
#cityButtons small, .shiftButtons small { display: block; font-size: 14px; opacity: 0.7; }
#cityHud, #cityStatus, #toasts { display: none; }
body.city #cityHud, body.city #cityStatus, body.city #toasts { display: block; }
body.city #hudLeft, body.city #hudRight { display: none; }
#cityHud { top: 16px; left: 16px; font-size: 18px; }
#cityClock { font-size: 30px; }
#cityClock small { font-size: 15px; opacity: 0.85; }
#cityTable .row { display: flex; gap: 10px; align-items: center; }
#cityTable .row.me { font-weight: bold; }
#cityTable .nm { width: 110px; }
#cityTable .pf { width: 80px; text-align: right; }
#cityTable .tr { font-size: 14px; opacity: 0.8; }
.sw { display: inline-block; width: 14px; height: 14px; border: 1px solid #000; margin-right: 6px; vertical-align: -1px; }
#cityStatus { top: 16px; left: 50%; transform: translateX(-50%); font-size: 20px; text-align: center; white-space: nowrap; }
#cityStatus .green { color: #3dff8a; }
#cityStatus .pink { color: #ff7fe4; }
#cityStatus .bar { letter-spacing: -2px; color: #3dff8a; }
#toasts { top: 52px; left: 50%; transform: translateX(-50%); font-size: 16px; text-align: center; }
.toast { background: rgba(0, 0, 0, 0.55); border-left: 4px solid; padding: 3px 10px; margin-top: 4px; text-shadow: none; }
#shiftResults h2 { margin: 0 0 16px; color: rgb(255, 217, 26); }
#shiftResults table { border-collapse: collapse; font-size: 18px; margin: 0 auto 10px; }
#shiftResults th, #shiftResults td { padding: 4px 12px; text-align: right; }
#shiftResults th { font-size: 14px; opacity: 0.75; }
#shiftResults td:nth-child(2) { text-align: left; }
#shiftResults tr.me { color: rgb(255, 217, 26); font-weight: bold; }
.shiftButtons { display: flex; gap: 16px; margin-top: 18px; }
@media (max-width: 700px) {
  #cityStatus { font-size: 15px; top: auto; bottom: 40px; white-space: normal; width: 90vw; }
  #shiftResults table { font-size: 13px; }
  #shiftResults th, #shiftResults td { padding: 3px 5px; }
}
