// Chweya Drift — compiled in the browser by less.js 2.x

@font: 'Saira Condensed', 'Arial Narrow', sans-serif;
@body-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
@ink: #ffffff;
@muted: #aab4bf;
@accent: #e6007e;
@cyan: #38c5ef;
@gold: #f5c542;
@night: #070a0e;
@glass: rgba(10, 14, 20, 0.55);

.glass() {
  background: @glass;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.skewed-bg(@color; @deg: -14deg) {
  position: relative;
  z-index: 0;
  &:before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: @color;
    transform: skewX(@deg);
    z-index: -1;
  }
}
.shadow-text() { text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55); }

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: @ink;
  font-family: @font;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
[ng-cloak] { display: none !important; }
#scene { position: fixed; top: 0; left: 0; width: 100vw !important; height: 100vh !important; display: block; }
#touch { position: fixed; top: 0; right: 0; bottom: 0; left: 0; touch-action: none; }
#ui { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
button { font-family: @font; cursor: pointer; pointer-events: auto; color: inherit; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  margin: 0 3px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: @font;
  font-weight: 700;
  font-size: 0.9em;
  text-align: center;
  &:first-child { margin-left: 0; }
}

// round icon buttons (pause, sound)
.icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  .glass();
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  svg { width: 20px; height: 20px; fill: #fff; stroke: #fff; stroke-width: 0; }
  &:hover { background: rgba(255, 255, 255, 0.16); }
}
.icon.sound {
  position: absolute;
  top: 18px;
  right: 18px;
  svg { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
}

// ---------- in-race HUD ----------
@me: #8b3dff;
.panel-dark() {
  background: rgba(8, 11, 16, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.hud {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s;
  &.on { opacity: 1; visibility: visible; }

  .big {
    .shadow-text();
    small { display: block; font-size: 15px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #e8edf2; }
    b { font-size: 54px; font-weight: 700; line-height: 0.95; }
    i { font-style: normal; font-size: 30px; color: @muted; }
  }

  // standings, top left
  .board { position: absolute; top: 16px; left: 18px; width: 230px; }
  .standings {
    list-style: none;
    margin: 10px 0 0;
    padding: 4px 0;
    .panel-dark();
    li {
      display: flex;
      align-items: center;
      gap: 8px;
      height: 22px;
      padding: 0 10px;
      font-size: 15px;
      font-weight: 600;
      .p { width: 18px; color: @muted; text-align: right; }
      .n { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
      .g { color: @muted; font-size: 13px; font-variant-numeric: tabular-nums; }
      &.me { background: @me; .p, .g { color: #fff; } }
    }
  }

  // rear-view mirror, top centre
  .mirror-wrap {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    height: 92px;
    padding: 5px;
    border-radius: 18px;
    background: linear-gradient(180deg, #2a2f36, #0d1014);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    #mirror { width: 100%; height: 100%; border-radius: 13px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
  }

  // skill score, under the mirror
  .skill {
    position: absolute;
    top: 116px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    .shadow-text();
    .chain { font-size: 34px; font-weight: 800; color: @gold; i { font-style: normal; font-size: 24px; color: #fff; } }
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-top: 2px;
      padding: 3px 4px 3px 10px;
      .panel-dark();
      border-radius: 4px;
      font-size: 17px;
      font-weight: 700;
      letter-spacing: 1px;
      color: @gold;
      .star { color: @gold; }
      b { padding: 1px 8px; border-radius: 3px; background: @me; color: #fff; }
      &.lost { color: #ff6b75; .star { color: #ff6b75; } }
    }
  }

  // timing + objectives, top right
  .pause { position: absolute; top: 18px; right: 70px; }
  .right { position: absolute; top: 70px; right: 18px; width: 250px; text-align: right; }
  .times {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
    .panel-dark();
    font-size: 16px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    td { padding: 3px 12px; text-align: left; }
    td + td { text-align: right; }
    .best td { color: #c9a6ff; }
    .best td:first-child { background: @me; color: #fff; }
  }
  .objectives {
    margin-top: 12px;
    padding: 8px 12px 10px;
    text-align: left;
    .panel-dark();
    h6 { margin: 0 0 6px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: @muted; }
    ul { list-style: none; margin: 0; padding: 0; }
    li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 15px; font-weight: 600; }
    .l { flex: 1; }
    em { font-style: normal; color: @muted; font-size: 13px; }
    .mark { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.7); flex: none; }
    li.done { .mark { border-color: @me; background: @me; } .l { color: #d8c4ff; } }
    li.failed { opacity: 0.55; .mark { border-color: #ff4b57; } .l { text-decoration: line-through; } }
  }
  .score {
    margin-top: 10px;
    .shadow-text();
    small { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: @muted; margin-right: 8px; }
    b { font-size: 26px; font-weight: 700; color: @gold; }
  }

  // minimap, bottom left
  .map {
    position: absolute;
    left: 20px;
    bottom: 18px;
    text-align: center;
    p {
      margin: 6px 0 0;
      font-size: 20px;
      font-weight: 700;
      .shadow-text();
      svg { width: 16px; height: 16px; fill: @cyan; vertical-align: -2px; margin-right: 4px; }
    }
  }
  .minimap {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    #minimap { width: 100%; height: 100%; }
  }

  // nitro, bottom centre
  .nitrobar {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    text-align: center;
    .segs { display: flex; gap: 5px; }
    i {
      display: block;
      width: 22px;
      height: 12px;
      transform: skewX(-18deg);
      background: rgba(255, 255, 255, 0.16);
      &.on { background: #3d8bff; box-shadow: 0 0 10px fade(#3d8bff, 70%); }
    }
    p { margin: 8px 0 0; font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; .shadow-text(); }
  }
  .nitro {
    display: none;
    position: absolute;
    right: 24px;
    bottom: 230px;
    width: 64px;
    height: 64px;
    padding: 0;
    border-radius: 50%;
    border: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    align-items: center;
    justify-content: center;
    touch-action: none;
    .charge { position: absolute; left: 0; right: 0; bottom: 0; background: fade(#3d8bff, 88%); }
    svg { position: relative; width: 34px; height: 34px; fill: #fff; }
  }
  .speedo {
    position: absolute;
    right: 14px;
    bottom: 8px;
    width: 230px;
    height: 230px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
    #speedo { width: 100%; height: 100%; }
  }
}
@media (hover: none) and (pointer: coarse) {
  .hud .nitro { display: flex; }
  .hud .nitrobar p kbd { display: none; }
}

// ---------- banner ----------
.banner {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  .plate {
    .skewed-bg(fade(#11161d, 82%); -16deg);
    padding: 0 56px 4px;
    font-size: 84px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: 3px;
    line-height: 1.05;
    white-space: nowrap;
  }
  .slash {
    position: relative;
    width: 64px;
    height: 80px;
    &:before, &:after {
      content: '';
      position: absolute;
      left: 12px;
      width: 42px;
      height: 14px;
      transform: skewX(-40deg);
    }
    &:before { top: 12px; background: @accent; }
    &:after { bottom: 12px; background: #fff; }
    &.r:before { background: #fff; }
    &.r:after { background: @accent; }
  }
}

// ---------- buttons ----------
.cta, .ghost {
  border: 0;
  background: none;
  font-size: 26px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 44px 12px;
  transition: transform 0.15s;
  &:hover { transform: translateY(-2px); }
}
.cta { .skewed-bg(@accent); }
.ghost { .skewed-bg(rgba(255, 255, 255, 0.14)); }

// ---------- main menu ----------
.menu {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: auto;
  background: linear-gradient(90deg, fade(@night, 88%) 0%, fade(@night, 55%) 34%, fade(@night, 0%) 62%);

  .menu-main {
    position: absolute;
    left: 6vw;
    top: 50%;
    transform: translateY(-50%);
    width: 420px;
    max-width: ~"calc(100vw - 32px)";
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .kicker { color: @cyan; letter-spacing: 3px; text-transform: uppercase; font-weight: 700; font-size: 14px; }
  h1 {
    margin: -14px 0 0;
    font-size: 92px;
    line-height: 0.9;
    font-weight: 800;
    font-style: italic;
    span { color: @accent; }
  }
  .garage { .glass(); border-radius: 14px; padding: 16px 18px; }
  .car-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    .arrow {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 1px solid rgba(255, 255, 255, 0.2);
      background: rgba(255, 255, 255, 0.06);
      font-size: 30px;
      line-height: 1;
      padding: 0 0 4px;
      &:hover { background: rgba(255, 255, 255, 0.16); }
    }
    .car-name {
      text-align: center;
      small { display: block; color: @muted; font-size: 13px; letter-spacing: 2px; }
      b { font-size: 28px; font-weight: 700; }
    }
  }
  .paints {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    span { margin-left: 4px; color: @muted; font-size: 16px; font-weight: 600; }
  }
  .swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 -5px 8px rgba(0, 0, 0, 0.35), inset 0 4px 8px rgba(255, 255, 255, 0.25);
    &.on { border-color: #fff; transform: scale(1.12); }
  }
  .weather {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    button {
      flex: 1;
      padding: 6px 0;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.15);
      background: rgba(255, 255, 255, 0.05);
      font-size: 15px;
      font-weight: 700;
      letter-spacing: 1px;
      text-transform: uppercase;
      &.on { background: @accent; border-color: @accent; }
    }
  }
  .cta { align-self: flex-start; font-size: 30px; padding: 12px 64px 14px; }
  .best { margin: -8px 0 0; color: @gold; font-size: 17px; font-weight: 700; letter-spacing: 1px; }

  .controls-line {
    position: absolute;
    left: 6vw;
    bottom: 22px;
    margin: 0;
    color: @muted;
    font-size: 15px;
    font-weight: 600;
    .touch-only { display: none; }
  }
  .about-toggle {
    position: absolute;
    right: 72px;
    top: 22px;
    padding: 8px 16px;
    border-radius: 20px;
    .glass();
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .about {
    position: absolute;
    right: 18px;
    top: 72px;
    bottom: 18px;
    width: 380px;
    max-width: ~"calc(100vw - 36px)";
    overflow-y: auto;
    padding: 20px 22px;
    border-radius: 14px;
    .glass();
    background: fade(@night, 82%);
    h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: 3px; text-transform: uppercase; color: @muted; }
    .sub { font-family: @body-font; color: @muted; font-size: 13px; margin: 0 0 12px; }
    ol { list-style: none; padding: 0; margin: 0; }
    li { display: flex; gap: 12px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
    .n { color: @accent; font-weight: 800; font-size: 18px; width: 16px; }
    b { font-size: 18px; font-weight: 700; margin-right: 8px; }
    i { font-style: normal; color: @cyan; font-size: 13px; font-weight: 600; }
    p { margin: 2px 0 0; font-family: @body-font; font-size: 12px; color: @muted; line-height: 1.45; }
    .credits { margin-top: 14px; font-size: 11.5px; }
  }
}
@media (hover: none) and (pointer: coarse) {
  .menu .controls-line .touch-only { display: inline; }
}

// ---------- loading ----------
.loading {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #18202c 0%, @night 70%);
  h1 { margin: 0 0 22px; font-size: 72px; font-style: italic; font-weight: 800; span { color: @accent; } }
  .bar { width: ~"min(380px, 78vw)"; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.12); i { display: block; height: 100%; background: @accent; transition: width 0.2s; } }
  p { margin: 12px 0 0; font-size: 15px; font-weight: 600; letter-spacing: 3px; color: @muted; text-transform: uppercase; }
}

// ---------- pause / results ----------
.overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: fade(@night, 55%);
  overflow-y: auto;
}
.card {
  .glass();
  background: fade(#0e131a, 90%);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 28px 26px;
  text-align: center;
  &.small { max-width: 340px; }
  small { color: @cyan; letter-spacing: 4px; text-transform: uppercase; font-weight: 700; }
  h2 { margin: 2px 0 12px; font-size: 80px; line-height: 1; font-style: italic; font-weight: 800; span { font-size: 32px; color: @muted; } }
  .stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 10px;
    span { display: block; color: @muted; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }
    b { font-size: 26px; }
  }
  .obj-results {
    list-style: none;
    margin: 6px auto 4px;
    padding: 0;
    display: inline-block;
    text-align: left;
    li { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; padding: 2px 0; }
    .mark { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.6); }
    li.done .mark { background: #8b3dff; border-color: #8b3dff; }
    li.failed { opacity: 0.55; .mark { border-color: #ff4b57; } }
  }
  .splits { color: @muted; font-size: 15px; margin: 2px 0 6px; font-variant-numeric: tabular-nums; i { font-style: normal; } }
  .pb { color: @gold; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; margin: 4px 0 8px; }
  table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; font-size: 17px; }
  td { padding: 3px 8px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
  .pos { width: 34px; color: @muted; font-weight: 700; }
  .t, .gap { text-align: right; font-variant-numeric: tabular-nums; }
  .gap { color: @muted; width: 80px; }
  tr.me td { background: fade(@accent, 26%); font-weight: 700; }
  .actions { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
}

// ---------- small screens ----------
@media (max-width: 900px), (max-height: 560px) {
  .icon { width: 36px; height: 36px; svg { width: 17px; height: 17px; } }
  .icon.sound { top: 10px; right: 10px; }
  .hud {
    .big b { font-size: 34px; } .big i { font-size: 18px; } .big small { font-size: 11px; }
    .board { top: 8px; left: 10px; width: 150px; }
    .standings { display: none; }
    .mirror-wrap { width: 200px; height: 58px; top: 6px; }
    .skill { top: 70px; .chain { font-size: 24px; } .badge { font-size: 13px; } }
    .pause { top: 10px; right: 54px; }
    .right { top: 52px; right: 10px; width: 160px; .times { font-size: 12px; } .objectives { display: none; } .score b { font-size: 18px; } }
    .map { left: 10px; bottom: 10px; p { font-size: 14px; } }
    .minimap { width: 100px; height: 100px; }
    .nitrobar { bottom: 12px; i { width: 12px; height: 9px; } }
    .nitro { width: 54px; height: 54px; bottom: 160px; right: 14px; svg { width: 28px; height: 28px; } }
    .speedo { width: 150px; height: 150px; right: 4px; bottom: 4px; }
  }
  .banner { .plate { font-size: 46px; padding: 0 30px 3px; } .slash { width: 38px; height: 50px; &:before, &:after { width: 24px; height: 9px; left: 6px; } } }
  .menu {
    background: linear-gradient(180deg, fade(@night, 30%) 0%, fade(@night, 85%) 55%);
    .menu-main { left: 16px; right: 16px; top: auto; bottom: 48px; transform: none; width: auto; gap: 14px; }
    h1 { font-size: 58px; }
    .cta { font-size: 24px; padding: 10px 48px 12px; }
    .controls-line { left: 16px; bottom: 14px; font-size: 12px; }
    .about-toggle { right: 56px; top: 10px; }
    .about { top: 56px; right: 10px; bottom: 10px; }
  }
  .card h2 { font-size: 58px; }
  .card table { font-size: 14px; }
}
