:root {
  color-scheme: dark;
  --ink: #edf1e9;
  --muted: #9baca0;
  --line: #35483a;
  --green: #15261f;
  --accent: #d3ee87;
  --car: #ef654d;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--green);
  color: var(--ink);
  height: 100dvh;
  min-height: 610px;
  display: flex;
  flex-direction: column;
}
button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  font: inherit;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button {
  border: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
.topbar {
  height: 85px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1.2px;
}
.brand-mark {
  border: 1px solid #697b65;
  color: var(--accent);
  padding: 9px 6px;
  font-size: 20px;
  font-style: italic;
  letter-spacing: -2px;
  border-radius: 7px;
}
.brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  margin-top: 6px;
  color: var(--muted);
}
.connection {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
#connection-dot {
  width: 6px;
  height: 6px;
  background: #82917c;
  border-radius: 50%;
}
#connection-dot.online {
  background: var(--accent);
}
.quiet {
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  white-space: nowrap;
}
.quiet:hover:not(:disabled) {
  background: #ffffff08;
  border-color: #788774;
}
.small {
  font-size: 10px;
  padding: 6px 8px;
}
main {
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 22px 24px 18px;
  gap: 24px;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 7px 8px;
  overflow: auto;
  scrollbar-width: thin;
}
.eyebrow {
  display: block;
  font-size: 9px;
  letter-spacing: 1.6px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--muted);
}
h1 {
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -1.3px;
  margin: 12px 0;
}
h1 span {
  float: right;
  font-size: 25px;
  color: var(--accent);
}
.track-title p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 27px;
}
.room-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.room-heading b {
  font-size: 10px;
  color: var(--ink);
  letter-spacing: 1px;
}
.drivers-heading {
  display: flex;
  justify-content: space-between;
  margin-top: 21px;
  font-size: 11px;
  color: var(--muted);
}
.drivers {
  list-style: none;
  margin: 10px 0 15px;
  padding: 0;
  min-height: 52px;
}
.drivers li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 0;
  border-bottom: 1px solid #ffffff0d;
  font-size: 12px;
}
.driver-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}
.driver-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.driver-lap {
  font-size: 10px;
  color: var(--muted);
}
.drivers .empty-driver {
  color: var(--muted);
  font-size: 11px;
}
.primary {
  width: 100%;
  padding: 15px 16px;
  border-radius: 5px;
  background: var(--accent);
  color: #203322;
  font-weight: 750;
  font-size: 12px;
  text-align: left;
}
.primary span {
  float: right;
  font-size: 16px;
  line-height: 14px;
}
.primary:hover:not(:disabled) {
  background: #e0f9a6;
}
.race-actions p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  min-height: 29px;
  margin: 9px 0 20px;
}
.controls-card {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.controls-card p {
  font-size: 11px;
  color: var(--muted);
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 5px;
}
.controls-card p kbd:last-of-type {
  margin-right: 7px;
}
kbd {
  font-family: inherit;
  font-size: 9px;
  display: inline-block;
  padding: 3px 5px;
  border: 1px solid #5c6b57;
  color: #e4eadc;
  border-radius: 3px;
  line-height: 1;
  min-width: 18px;
  text-align: center;
}
.controls-card small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 16px;
}
.leave {
  margin-top: auto;
  align-self: flex-start;
  font-size: 10px;
}
.circuit {
  flex: 1;
  min-width: 0;
  min-height: 0;
  border: 1px solid #5b7054;
  border-radius: 9px;
  position: relative;
  background: #80916e;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}
.hud {
  position: absolute;
  z-index: 1;
  top: 22px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.hud .eyebrow {
  color: #e9efde;
  opacity: 0.8;
}
.hud strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px #0003;
}
.timing {
  text-align: right;
}
.timing strong {
  font-size: 23px;
}
.timing small {
  display: block;
  font-size: 9px;
  color: #e9efde;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.bottom-hud {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 19px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
}
.speed {
  width: 110px;
  flex-shrink: 0;
}
.speed strong {
  font-size: 31px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}
.speed span {
  font-size: 8px;
  margin-left: 5px;
  color: #e9efde;
}
.speed-meter {
  height: 3px;
  width: 100%;
  background: #f0f5e033;
  margin-top: 8px;
  overflow: hidden;
}
.speed-meter i {
  height: 100%;
  width: 0;
  display: block;
  background: var(--accent);
}
#hint {
  margin-left: auto;
  font-size: 10px;
  color: #eef3e8;
  text-shadow: 0 1px 2px #0004;
  text-align: right;
}
#reset {
  border-color: #edf1e966;
  background: #2435285c;
}
#reset kbd {
  margin-left: 6px;
}
.race-banner {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  text-align: center;
  color: white;
  font-size: 48px;
  font-weight: 750;
  letter-spacing: -2px;
  text-shadow: 0 3px 18px #12261780;
  z-index: 2;
  white-space: pre-line;
}
.race-banner small {
  display: block;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.5;
}
.join-shade {
  position: absolute;
  inset: 0;
  background: #15271fc9;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 4;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.join-shade[hidden] {
  display: none;
}
.join-card {
  background: #1a2e25;
  border: 1px solid #5a6c50;
  padding: 31px 34px;
  width: 346px;
  max-width: 100%;
  box-shadow: 0 25px 80px #0003;
  border-radius: 8px;
}
.join-card h2 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -1.5px;
  line-height: 1.15;
  margin: 10px 0 13px;
}
.join-card p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 22px;
}
.join-card label {
  display: block;
  font-size: 10px;
  color: #b9c6b8;
  margin: 13px 0 6px;
}
.join-card input {
  width: 100%;
  border: 1px solid #516149;
  background: #14271e;
  border-radius: 4px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.join-card input#room {
  text-transform: uppercase;
  letter-spacing: 2px;
}
.join-card .primary {
  margin-top: 21px;
}
.join-card small {
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}
.join-card #join-error {
  color: #f4b8a6;
  font-size: 11px;
  margin: 10px 0;
  min-height: 0;
}
footer {
  height: 30px;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
  color: #8a9b88;
  font-size: 8px;
  letter-spacing: 1.4px;
}
footer i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
}
footer b {
  margin: 0 8px;
  font-weight: 400;
}
.touch-controls {
  display: none;
  position: absolute;
  bottom: 18px;
  left: 14px;
  right: 14px;
  justify-content: space-between;
  z-index: 3;
  pointer-events: none;
}
.touch-controls > div {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}
.touch-controls button {
  pointer-events: auto;
  width: 53px;
  height: 56px;
  background: #172a26c9;
  border: 1px solid #ecf1e288;
  border-radius: 9px;
  color: white;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-size: 17px;
}
.touch-controls .touch-gas {
  height: 74px;
  background: #d3ee87e8;
  color: #23372a;
  font-size: 11px;
  font-weight: 800;
}
.touch-controls .touch-brake {
  font-size: 9px;
}
.touch-controls .touch-drift {
  width: 43px;
  height: 43px;
  font-size: 8px;
}
.touch-controls button.held {
  transform: translateY(2px);
  background: #ffffffaa;
  color: #213429;
}
@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .bottom-hud {
    bottom: 111px;
  }
  .controls-card {
    display: none;
  }
}
@media (max-width: 1000px) {
  .sidebar {
    width: 210px;
  }
  main {
    gap: 16px;
    padding: 16px;
  }
  .topbar {
    padding: 0 24px;
  }
  .track-title p {
    font-size: 11px;
  }
  h1 {
    font-size: 27px;
  }
}
@media (max-width: 760px) {
  body {
    min-height: 640px;
  }
  .topbar {
    height: 65px;
    padding: 0 15px;
    gap: 12px;
  }
  .brand {
    font-size: 12px;
    letter-spacing: 0.8px;
  }
  .brand small {
    font-size: 6px;
    letter-spacing: 1.5px;
  }
  .brand-mark {
    font-size: 17px;
    padding: 8px 5px;
  }
  .connection {
    font-size: 9px;
  }
  .topbar .quiet {
    font-size: 9px;
    padding: 8px;
  }
  main {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
  }
  .sidebar {
    width: 100%;
    padding: 0;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 12px;
    align-items: center;
  }
  .track-title {
    display: none;
  }
  .room-heading {
    border: 0;
    padding: 0;
    gap: 10px;
    justify-content: flex-start;
  }
  .drivers-heading {
    display: none;
  }
  .drivers {
    grid-column: 1/2;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 5px 0 0;
    min-height: 0;
  }
  .drivers li {
    border: 0;
    padding: 0;
    font-size: 9px;
    gap: 4px;
  }
  .driver-lap {
    display: none;
  }
  .driver-dot {
    width: 6px;
    height: 6px;
  }
  .race-actions {
    grid-column: 2;
    grid-row: 1/3;
  }
  .race-actions .primary {
    padding: 12px;
    font-size: 10px;
    min-width: 137px;
  }
  .race-actions .primary span {
    display: none;
  }
  .race-actions p {
    display: none;
  }
  .controls-card {
    display: none;
  }
  .leave {
    position: absolute;
    right: 20px;
    bottom: 1px;
    z-index: 5;
    padding: 0;
    border: 0;
    font-size: 7px;
  }
  .circuit {
    min-height: 0;
    flex: 1;
  }
  .hud {
    top: 14px;
    left: 16px;
    right: 16px;
  }
  .hud .eyebrow {
    font-size: 7px;
  }
  .hud strong {
    font-size: 14px;
  }
  .timing strong {
    font-size: 18px;
  }
  .bottom-hud {
    left: 17px;
    right: 17px;
    bottom: 106px;
    gap: 9px;
  }
  .speed {
    width: 75px;
  }
  .speed strong {
    font-size: 25px;
  }
  #hint {
    max-width: 130px;
    font-size: 8px;
  }
  #reset {
    font-size: 9px;
    padding: 7px;
  }
  #reset kbd {
    display: none;
  }
  .touch-controls {
    display: flex;
  }
  .join-card {
    padding: 25px;
    width: 310px;
  }
  .join-card h2 {
    font-size: 32px;
  }
  .join-shade {
    padding: 16px;
  }
  .race-banner {
    font-size: 38px;
  }
  footer {
    height: 25px;
    padding: 0 15px;
    font-size: 6px;
  }
  footer span:last-child {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }
}
.sidebar .leave {
  min-height: 36px;
}
.new-track {
  width: 100%;
  margin-top: 8px;
  text-align: left;
  min-height: 40px;
}
.new-track span {
  float: right;
}
@media (max-width: 760px) {
  .sidebar .leave {
    position: static;
    grid-column: 1/3;
    grid-row: 3;
    justify-self: end;
    align-self: center;
    min-height: 40px;
    min-width: 80px;
    padding: 10px;
    font-size: 10px;
    border: 1px solid var(--line);
    margin-top: 7px;
  }
  .sidebar .room-heading {
    min-height: 32px;
  }
  .sidebar .small {
    min-height: 32px;
  }
}
/* Optical centering compensates for the slanted letterforms without padding drift. */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0 2px 0 0;
  line-height: 1;
  letter-spacing: -1.2px;
  flex-shrink: 0;
}
.paint-picker {
  border: 0;
  padding: 0;
  margin: 15px 0 0;
  min-width: 0;
}
.paint-picker legend {
  font-size: 10px;
  color: #b9c6b8;
  margin-bottom: 9px;
}
#paint-presets {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.paint-swatch {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
}
.paint-swatch[aria-pressed="true"] {
  outline: 2px solid #edf1e9;
  outline-offset: 2px;
}
.paint-custom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.paint-custom label {
  margin: 0 0 0 auto;
}
.paint-custom input {
  padding: 2px;
  width: 38px;
  height: 30px;
  cursor: pointer;
}
#paint-auto[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
#rotate-hint {
  display: none;
}
.join-shade {
  overflow: auto;
}
.drivers li {
  padding: 8px 0;
}
@media (max-width: 760px) {
  .topbar {
    gap: 8px;
  }
  .brand {
    font-size: 10px;
    gap: 7px;
    letter-spacing: 0.5px;
  }
  .brand-mark {
    width: 34px;
    height: 36px;
    font-size: 18px;
  }
  .connection {
    margin-left: auto;
  }
  #connection {
    display: none;
  }
  .topbar .quiet {
    font-size: 9px;
    padding: 8px 6px;
    min-height: 36px;
  }
  #computers {
    white-space: normal;
    max-width: 112px;
  }
  .join-card {
    padding: 20px;
  }
  .join-card p {
    margin-bottom: 12px;
  }
  .paint-swatch {
    width: 25px;
    height: 25px;
    min-width: 25px;
  }
  #paint-presets {
    gap: 6px;
  }
}
@media (pointer: coarse), (max-width: 760px) {
  body {
    min-height: 420px;
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .touch-controls button {
    width: 64px;
    height: 64px;
  }
  .touch-controls .touch-gas {
    height: 78px;
    width: 68px;
  }
  .touch-controls .touch-drift {
    width: 44px;
    height: 44px;
  }
  .touch-controls {
    bottom: 12px;
    left: 12px;
    right: 12px;
  }
  body.race-active .sidebar {
    display: none;
  }
  body.race-active footer {
    display: none;
  }
  body.race-active .bottom-hud {
    bottom: 105px;
  }
  body.race-active #hint {
    display: none;
  }
  body.race-active .hud .eyebrow,
  body.race-active .timing small {
    display: none;
  }
  body.race-active .hud {
    top: 12px;
  }
}
@media (max-width: 760px) and (orientation: portrait) {
  #rotate-hint {
    display: block;
    position: absolute;
    bottom: 93px;
    left: 14px;
    font-size: 8px;
    color: #eef3e8;
    pointer-events: none;
  }
  .touch-controls button {
    width: 52px;
  }
  .touch-controls .touch-gas {
    width: 57px;
  }
  .touch-controls .touch-drift {
    width: 38px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  body {
    min-height: 300px;
  }
  .topbar {
    height: 48px;
    padding: 0 12px;
    gap: 10px;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }
  .brand {
    font-size: 12px;
  }
  .connection {
    font-size: 9px;
  }
  main {
    flex-direction: column;
    padding: 6px;
    gap: 6px;
  }
  .sidebar {
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow: auto;
    align-items: center;
  }
  .track-title,
  .drivers-heading,
  .controls-card,
  .drivers,
  .race-actions p {
    display: none;
  }
  .room-heading {
    padding: 0;
    border: 0;
    gap: 8px;
  }
  .race-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
  }
  .race-actions .primary,
  .new-track {
    width: auto;
    min-height: 36px;
    padding: 9px 12px;
    margin: 0;
    white-space: nowrap;
  }
  .race-actions .primary span {
    display: none;
  }
  .leave {
    margin: 0;
    min-height: 36px;
  }
  footer {
    display: none;
  }
  .hud {
    top: 12px;
    left: 14px;
    right: 14px;
  }
  .hud .eyebrow,
  .timing small,
  #hint {
    display: none;
  }
  .hud strong,
  .timing strong {
    font-size: 15px;
  }
  .bottom-hud {
    left: 45%;
    right: 14px;
    bottom: 12px;
    gap: 8px;
    justify-content: flex-end;
  }
  body.race-active .bottom-hud {
    bottom: 12px;
  }
  .speed {
    width: 55px;
  }
  .speed strong {
    font-size: 20px;
  }
  .speed span {
    font-size: 7px;
  }
  .speed-meter {
    display: none;
  }
  #reset {
    position: absolute;
    top: auto;
    bottom: 88px;
    right: 0;
    padding: 6px;
    font-size: 9px;
  }
  #reset kbd {
    display: none;
  }
  .join-shade {
    padding: 8px;
    align-items: flex-start;
  }
  .join-card {
    width: 530px;
    padding: 14px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }
  .join-card > .eyebrow,
  .join-card > h2,
  .join-card > p:not(#join-error),
  .join-card > small {
    display: none;
  }
  .join-card label[for="name"] {
    grid-column: 1;
    grid-row: 1;
  }
  .join-card input#name {
    grid-column: 1;
    grid-row: 2;
  }
  .join-card label[for="room"] {
    grid-column: 2;
    grid-row: 1;
  }
  .join-card input#room {
    grid-column: 2;
    grid-row: 2;
  }
  .paint-picker {
    grid-column: 1;
    grid-row: 3/5;
    margin-top: 10px;
  }
  .join-card .primary {
    grid-column: 2;
    grid-row: 3;
    margin-top: 20px;
    align-self: end;
  }
  #join-error {
    grid-column: 2;
    grid-row: 4;
  }
  .race-banner {
    font-size: 30px;
  }
  .race-banner small {
    font-size: 11px;
  }
}
/* Eight drivers must not squeeze the race controls underneath the roster. */
.sidebar > * {
  flex-shrink: 0;
}
@media (pointer: coarse), (max-width: 760px) {
  body.race-active .sidebar {
    display: contents;
  }
  body.race-active .sidebar > :not(.leave) {
    display: none;
  }
  body.race-active .sidebar .leave {
    position: absolute;
    left: 24px;
    right: auto;
    bottom: 113px;
    z-index: 3;
    margin: 0;
    min-height: 36px;
    min-width: 65px;
    background: #172a26c9;
    padding: 8px;
    font-size: 9px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .bottom-hud {
    left: calc(50% - 30px);
    right: auto;
    bottom: 18px;
    justify-content: flex-start;
    width: 60px;
  }
  body.race-active .bottom-hud {
    bottom: 18px;
  }
  #reset {
    left: 0;
    right: auto;
    bottom: 88px;
  }
  body.race-active .sidebar .leave {
    left: calc(50% - 30px);
    bottom: 65px;
    min-height: 30px;
  }
}
.driver-dot {
  border: 1px solid #edf1e980;
}
@media (pointer: coarse), (max-width: 760px) {
  body.race-active .sidebar .leave {
    min-height: 40px;
    min-width: 68px;
  }
}
.race-clock {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  padding: 7px 10px;
  border-radius: 5px;
  background: #15261fd9;
  color: #edf1e9;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.race-clock.closing {
  color: var(--accent);
  border: 1px solid #d3ee8780;
}
.race-clock[hidden] {
  display: none;
}
@media (max-width: 760px), (max-height: 500px) {
  .race-clock {
    top: 29px;
    font-size: 10px;
    padding: 5px 8px;
  }
}
.practice-button {
  width: 100%;
  margin-top: 9px;
  min-height: 40px;
}
@media (max-height: 500px) and (orientation: landscape) {
  .join-card .practice-button {
    grid-column: 2;
    grid-row: 4;
    align-self: start;
    margin-top: 8px;
  }
  #join-error {
    grid-row: 5;
  }
}
html[data-mode="solo"] #room,
html[data-mode="solo"] label[for="room"],
html[data-mode="solo"] #copy {
  display: none;
}
