/* Coastline — game-only styles on top of /assets/3d/kit.css (the house look). */

.minimap {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 150px;
  height: 150px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(10, 14, 30, 0.85), 0 6px 20px rgba(0, 0, 0, 0.35);
}
.speedo {
  position: absolute;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: 170px;
  height: 170px;
}

.drift-meter {
  position: absolute;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-family: var(--display);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), 0 4px 14px rgba(0, 0, 0, 0.45);
}
.dm-label { font-size: 16px; letter-spacing: 0.3em; color: #fff; }
.dm-num { font-size: 44px; line-height: 1; color: var(--accent); }
.dm-mult { font-size: 20px; color: #ff8a3d; }

#hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 12px;
  background: rgba(10, 14, 30, 0.62);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  transition: opacity 1s;
}
#hint b { color: #fff; }
#hint.fade { opacity: 0; }
body.touch #hint { display: none; }

.swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 8px 12px; border-radius: 999px; background: rgba(10, 14, 30, 0.55); }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.25); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 0 3px var(--accent), inset 0 -4px 0 rgba(0, 0, 0, 0.2); }

/* Garage: the car stays visible (left / top), the card sits beside it. */
#garage { justify-content: flex-end; align-items: flex-end; padding: 18px; flex-direction: row; gap: 0; }
.garage-head { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.garage-head h2 { font-family: var(--display); font-weight: 400; font-size: clamp(32px, 6vw, 48px); text-shadow: 0 4px 0 var(--accent-deep), 0 8px 20px rgba(0, 0, 0, 0.4); }
.garage-head p { font-weight: 900; font-size: 18px; color: var(--pc, #fff); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.garage-card { width: min(380px, 94vw); margin: 0 2vw 2vh 0; text-align: left; }
.g-nav { display: flex; align-items: center; gap: 10px; }
.g-nav .round-btn { width: 52px; height: 52px; padding: 0; justify-content: center; font-size: 20px; flex: none; }
.g-names { flex: 1; text-align: center; }
.g-name { font-family: var(--display); font-size: 30px; line-height: 1.05; color: var(--accent); }
.g-count { font-size: 12px; font-weight: 900; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.55); }
.g-blurb { margin: 10px 0 8px; font-size: 15px; color: rgba(255, 255, 255, 0.85); text-align: center; min-height: 2.6em; }
.g-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; margin: 4px 0 10px; }
.g-stats span { font-size: 13px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.g-bar { display: flex; gap: 4px; }
.g-bar i { flex: 1; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); }
.g-bar i.on { background: linear-gradient(90deg, var(--accent), #ff9a1f); box-shadow: 0 0 8px rgba(255, 190, 40, 0.35); }
.g-badge { text-align: center; font-weight: 900; font-size: 15px; margin-bottom: 10px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.garage-card .swatches { margin: 0 auto 12px; gap: 7px; padding: 8px 10px; flex-wrap: nowrap; background: rgba(255, 255, 255, 0.05); }
.garage-card .swatch { width: 30px; height: 30px; flex: none; }
@media (max-width: 700px), (orientation: portrait) {
  #garage { justify-content: center; padding: 10px; }
  .garage-card { margin: 0 auto; padding: 14px 16px; }
  .g-blurb { min-height: 0; margin: 6px 0; font-size: 14px; }
  .garage-head { top: 64px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #garage { padding: 8px 8px 8px 8px; }
  .garage-card { width: 320px; max-height: calc(100vh - 72px); overflow-y: auto; padding: 8px 12px; margin: 0; }
  .g-blurb, .g-count { display: none; }
  .g-nav .round-btn { width: 42px; height: 42px; }
  .g-name { font-size: 24px; }
  .g-stats { gap: 3px 10px; margin: 4px 0 6px; }
  .g-bar i { height: 9px; }
  .g-badge { margin-bottom: 6px; padding: 3px 8px; font-size: 13px; }
  .garage-card .swatches { margin-bottom: 8px; padding: 5px 8px; }
  .garage-card .swatch { width: 24px; height: 24px; }
  .garage-card .btns { flex-direction: row; gap: 8px; }
  .garage-card .big-btn { height: 46px; font-size: 20px; flex: 2; white-space: nowrap; }
  .garage-card .chip-btn { flex: 1; white-space: nowrap; }
  .garage-head { left: 33%; top: 12px; }
  .garage-head h2 { font-size: 28px; }
}

/* Map select: three big cards over a live fly-over of the chosen map. */
#maps { justify-content: flex-end; align-items: center; padding: 18px; }
.maps-card { width: min(720px, 96vw); }
.map-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.map-card { position: relative; padding: 14px 10px 12px; border-radius: 18px; border: 3px solid transparent; background: linear-gradient(160deg, var(--mc1), var(--mc2)); text-align: center; color: #fff; box-shadow: inset 0 -40px 40px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.map-card:hover { transform: translateY(-2px); }
.map-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 210, 31, 0.35), inset 0 -40px 40px rgba(0, 0, 0, 0.25); }
.map-card .em { display: block; font-size: 40px; line-height: 1.1; }
.map-card b { display: block; font-family: var(--display); font-weight: 400; font-size: 21px; margin-top: 2px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.map-card small { display: block; font-size: 12.5px; font-weight: 800; line-height: 1.3; margin-top: 4px; color: rgba(255, 255, 255, 0.92); }
.map-card .tro { position: absolute; top: 6px; right: 8px; font-size: 18px; }
@media (max-width: 600px) {
  .map-grid { grid-template-columns: 1fr; gap: 8px; }
  .map-card { display: grid; grid-template-columns: 52px 1fr; align-items: center; text-align: left; padding: 10px 12px; gap: 0 8px; }
  .map-card .em { grid-row: span 2; font-size: 34px; }
  .map-card b { font-size: 19px; margin: 0; }
  .map-card small { margin: 0; font-size: 12px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #maps { padding: 8px; }
  .maps-card { padding: 10px 12px; }
  .map-card { padding: 8px 6px; }
  .map-card .em { font-size: 28px; }
  .map-card b { font-size: 17px; }
  .map-card small { display: none; }
  .maps-card .btns { flex-direction: row; gap: 8px; }
  .maps-card .big-btn { height: 48px; font-size: 22px; flex: 2; white-space: nowrap; }
  .maps-card .chip-btn { flex: 1; white-space: nowrap; }
}

/* Race vs free drive HUD bits. */
body:not(.racing) .race-only, body.racing .free-only { display: none !important; }
.hud-pill b small { font-size: 0.55em; color: rgba(255, 255, 255, 0.6); margin-left: 2px; }
#scoreboard { top: 74px; right: 14px; width: 170px; }
#scoreboard .sb-row b { width: 16px; text-align: center; color: #fff; }
.mode-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.mode-row .chip-btn { flex: 1; justify-content: center; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 16px 0 8px; }
.podium div { width: 30%; border-radius: 14px 14px 0 0; background: rgba(255, 255, 255, 0.1); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 8px 4px; font-weight: 900; font-size: 14px; }
.podium div b { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1; }
.podium div small { font-size: 11px; color: rgba(255, 255, 255, 0.6); }
.podium .p1 { height: 132px; background: linear-gradient(180deg, rgba(255, 204, 31, 0.5), rgba(255, 204, 31, 0.1)); }
.podium .p2 { height: 106px; background: linear-gradient(180deg, rgba(200, 210, 225, 0.4), rgba(200, 210, 225, 0.08)); }
.podium .p3 { height: 84px; background: linear-gradient(180deg, rgba(205, 127, 50, 0.45), rgba(205, 127, 50, 0.08)); }
.res-next { color: var(--accent) !important; font-weight: 900; }
.new-best { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: linear-gradient(135deg, #d13dd1, #7a4fff); font-size: 13px; color: #fff; }
@media (max-width: 760px) { #scoreboard { width: 140px; transform: scale(0.85); transform-origin: top right; } }
/* Phones/tablets: the position pill says it all; the full list would cover the controls. */
body.touch #scoreboard { display: none !important; }

/* Per-player HUD halves. One player: p0 covers the screen. Two: left/right. */
.ph { position: absolute; inset: 0; pointer-events: none; }
.ph.p1, .ph-name, .split-only { display: none; }
.ph-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: stretch; }
body.split .ph.p0 { right: 50%; }
body.split .ph.p1 { display: block; left: 50%; }
body.split .split-only { display: flex; }
body.split .solo-only, body.split #scoreboard, body.split #hint { display: none !important; }
body.split .ph-top { top: 74px; }
body.split .hud-top { top: 14px; }
body.split .ph-name { display: block; position: absolute; top: 150px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 999px; background: rgba(10, 14, 30, 0.55); font-weight: 900; font-size: 13px; white-space: nowrap; transition: opacity 1s; }
body.split .ph-name.fade { opacity: 0; }
body.split .minimap { width: 120px; height: 120px; }
body.split .speedo { width: 136px; height: 136px; }
body.split .hud-pill b { font-size: 24px; }
body.split .hud-pill.big b { font-size: 30px; }
body[data-screen="play"].split::after { content: ""; position: fixed; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: #0a0c18; z-index: 19; pointer-events: none; }
body.touch #btn-2p { display: none; } /* split-screen needs two players on one keyboard */

/* Phones: the HUD shrinks and moves out of the thumbs' way. */
@media (max-width: 760px), (max-height: 500px) {
  .minimap { width: 104px; height: 104px; }
  .speedo { width: 124px; height: 124px; }
}
body.touch .minimap { top: 74px; bottom: auto; left: calc(14px + env(safe-area-inset-left)); }
body.touch .speedo { top: 64px; bottom: auto; right: calc(8px + env(safe-area-inset-right)); }
@media (max-width: 520px) and (orientation: portrait) {
  .hud-top { top: 70px; }
  .drift-meter { top: 160px; }
  .ph-top { top: 70px; }
  body.touch .minimap { top: 170px; }
  body.touch .speedo { top: 164px; }
}
