* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #153e38;
  color: #f7f7eb;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  color: inherit;
  touch-action: manipulation;
}
button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
#app {
  position: relative;
  height: 100%;
  min-height: 350px;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
}
header {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  background: linear-gradient(#102f38b0, transparent);
  pointer-events: none;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 1px 6px #15383e;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  margin-top: 4px;
  color: #e6f0d4;
}
.mark {
  display: grid;
  place-items: center;
  background: #e8ff87;
  color: #1d4342;
  font-size: 35px;
  font-style: italic;
  width: 43px;
  height: 43px;
  border-radius: 13px;
}
.circuit {
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: 700;
  display: flex;
  gap: 10px;
  align-items: center;
}
.circuit i {
  width: 6px;
  height: 6px;
  background: #dff783;
  border-radius: 50%;
}
.circuit span {
  padding: 7px 10px;
  border: 1px solid #ffffff50;
  border-radius: 6px;
  font-size: 10px;
}
#leaderboard {
  position: absolute;
  top: 112px;
  left: 27px;
  width: 197px;
  background: #122e38e8;
  border: 1px solid #ffffff18;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px #193e3320;
}
.board-title {
  display: flex;
  justify-content: space-between;
  padding: 15px 13px;
  font-size: 10px;
  letter-spacing: 1.6px;
  color: #a9c4c6;
  border-bottom: 1px solid #ffffff13;
}
.board-title span {
  font-size: 8px;
  color: #d9f58d;
}
.driver-row {
  width: 100%;
  display: flex;
  gap: 9px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  background: transparent;
  font-size: 12px;
  border-bottom: 1px solid #ffffff09;
}
.driver-row:hover {
  background: #ffffff10;
}
.driver-row.selected {
  background: #ffffff15;
}
.driver-row .rank {
  color: #a4bfc2;
  font-size: 10px;
  width: 11px;
}
.driver-row i {
  width: 4px;
  height: 21px;
  border-radius: 3px;
}
.driver-row strong {
  font-size: 12px;
  font-weight: 600;
}
.driver-row small {
  display: block;
  font-size: 8px;
  color: #9cb5b5;
  margin-top: 2px;
}
.driver-row .gap {
  margin-left: auto;
  color: #bbcdca;
  font:
    10px ui-monospace,
    monospace;
}
#telemetry {
  position: absolute;
  left: 28px;
  bottom: 111px;
  width: 260px;
  padding: 19px 21px;
  background: #112f38ed;
  border: 1px solid #ffffff20;
  border-radius: 15px;
  box-shadow: 0 10px 30px #153c3420;
}
.eyebrow {
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 1.8px;
  color: #d7ecaf;
}
.eyebrow span {
  color: #86a6ae;
  letter-spacing: 0.6px;
  float: right;
}
.driver-name {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 6px 0 13px;
}
.numbers {
  display: flex;
  justify-content: space-between;
}
.numbers strong {
  font-size: 28px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.numbers strong span {
  font-size: 12px;
  color: #88a9b0;
  margin-left: 2px;
}
.numbers small {
  display: block;
  color: #9cb9bc;
  font-size: 8px;
  letter-spacing: 1.5px;
  margin-top: 4px;
}
#behavior {
  font-size: 10px;
  margin-top: 17px;
  padding-top: 11px;
  border-top: 1px solid #ffffff18;
  color: #d9f497;
}
#behavior:before {
  content: "●";
  font-size: 7px;
  margin-right: 7px;
}
footer {
  position: absolute;
  bottom: 28px;
  left: 28px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
footer button {
  background: #122f38eb;
  padding: 13px 17px;
  border: 1px solid #ffffff20;
  border-radius: 10px;
  font-size: 14px;
  min-height: 44px;
}
.view-controls,
.race-controls {
  display: flex;
  gap: 6px;
}
.view-controls button {
  font-size: 18px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.view-controls span {
  font-size: 11px;
}
.view-controls .active {
  background: #e4f6b5;
  color: #264344;
}
button:disabled {
  opacity: 0.5;
}
.footnote {
  position: absolute;
  bottom: 8px;
  right: 30px;
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: #ecf3dd90;
}
#welcome {
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  background: #102f37ed;
  backdrop-filter: blur(9px);
  border: 1px solid #ffffff25;
  border-radius: 22px;
  padding: 38px 42px;
  width: 440px;
  box-shadow: 0 20px 90px #0e36294a;
}
h1 {
  font-size: 53px;
  line-height: 1.03;
  letter-spacing: -2.5px;
  margin: 18px 0;
  color: #faf8e9;
}
#welcome p {
  font-size: 13px;
  line-height: 1.8;
  color: #abc3c3;
}
.primary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #e7faab;
  color: #183a3c;
  padding: 17px 20px;
  width: 100%;
  border-radius: 10px;
  font-weight: 750;
  font-size: 13px;
  margin-top: 25px;
}
.primary span {
  font-size: 20px;
}
.hint {
  font-size: 10px;
  color: #99b5b8;
  text-align: center;
  margin-top: 16px;
}
#race-state {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 52px;
  font-weight: 900;
  color: #f9ffd4;
  text-shadow: 0 3px 20px #173d38;
  background: #183a3b80;
  border-radius: 14px;
  padding: 0 20px;
  pointer-events: none;
}
#race-state:empty {
  display: none;
}
#debug-panel {
  position: absolute;
  top: 100px;
  right: 24px;
  background: #112c35ed;
  color: #d9f1b5;
  padding: 16px;
  font-size: 10px;
  line-height: 1.7;
  border-radius: 12px;
  max-width: 270px;
  pointer-events: none;
}
#results {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #102e37f5;
  border: 1px solid #ffffff30;
  padding: 25px;
  border-radius: 20px;
  width: 340px;
  max-height: 76%;
  overflow: auto;
}
#results h2 {
  font-size: 28px;
  margin: 5px 0 15px;
}
#results p {
  font-size: 11px;
  color: #b9ced0;
}
#results ol {
  padding-left: 25px;
  font-size: 13px;
}
#results li {
  padding: 6px;
}
#results li span {
  float: right;
  color: #cfe6a3;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  header {
    padding: 17px;
  }
  .brand {
    font-size: 14px;
    gap: 9px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1.2px;
  }
  .mark {
    width: 35px;
    height: 35px;
    font-size: 28px;
  }
  .circuit {
    font-size: 8px;
    letter-spacing: 0.8px;
  }
  .circuit span {
    display: none;
  }
  #leaderboard {
    left: 13px;
    top: 86px;
    width: 129px;
    border-radius: 11px;
  }
  .board-title {
    padding: 10px;
    font-size: 8px;
    letter-spacing: 0.9px;
  }
  .board-title span {
    font-size: 7px;
  }
  .driver-row {
    padding: 7px 9px;
    gap: 6px;
  }
  .driver-row i {
    height: 17px;
    width: 3px;
  }
  .driver-row strong {
    font-size: 10px;
  }
  .driver-row small {
    display: none;
  }
  .driver-row .gap {
    font-size: 8px;
  }
  .driver-row .rank {
    width: 8px;
    font-size: 8px;
  }
  #telemetry {
    bottom: 91px;
    left: 13px;
    width: 210px;
    padding: 14px 16px;
  }
  .driver-name {
    font-size: 22px;
    margin-bottom: 9px;
  }
  .numbers strong {
    font-size: 24px;
  }
  .numbers small {
    font-size: 7px;
  }
  #behavior {
    margin-top: 11px;
    padding-top: 9px;
    font-size: 9px;
  }
  .eyebrow {
    font-size: 8px;
    letter-spacing: 1.1px;
  }
  footer {
    bottom: 25px;
    left: 13px;
    right: 13px;
  }
  .view-controls span {
    display: none;
  }
  footer button {
    padding: 10px 15px;
  }
  #welcome {
    width: min(350px, calc(100% - 30px));
    left: 50%;
    padding: 29px;
    z-index: 5;
  }
  h1 {
    font-size: 45px;
  }
  #welcome p {
    font-size: 12px;
  }
  #welcome .eyebrow {
    font-size: 7px;
  }
  #race-state {
    top: 87px;
    left: 70%;
    font-size: 38px;
  }
  #debug-panel {
    top: 85px;
    right: 12px;
    font-size: 8px;
    padding: 10px;
    max-width: 210px;
  }
  .footnote {
    right: 14px;
    font-size: 6px;
  }
}
@media (max-height: 550px) {
  #leaderboard {
    top: 80px;
    width: 132px;
  }
  .driver-row {
    padding: 4px 9px;
  }
  .driver-row small {
    display: none;
  }
  .board-title {
    padding: 9px;
  }
  #telemetry {
    bottom: 87px;
    left: auto;
    right: 20px;
    width: 200px;
    padding: 13px;
  }
  .driver-name {
    font-size: 21px;
    margin: 3px 0;
  }
  .numbers strong {
    font-size: 23px;
  }
  #behavior {
    margin-top: 8px;
    padding-top: 7px;
  }
  #welcome {
    padding: 22px 30px;
    width: 380px;
  }
  h1 {
    font-size: 35px;
    margin: 10px 0;
  }
  #welcome p {
    margin: 6px 0;
  }
  .primary {
    margin-top: 15px;
    padding: 12px;
  }
  header {
    padding: 15px 22px;
  }
}
