html, body { margin: 0; height: 100%; overflow: hidden; background: #bfdbf0; font-family: "Segoe UI", Arial, sans-serif; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas { display: block; }
.panel { position: fixed; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); pointer-events: none; }

/* ----- HUD ----- */
#hud { left: 16px; bottom: 16px; background: rgba(10,20,35,.55); backdrop-filter: blur(4px); padding: 12px 16px; border-radius: 12px; font: 600 15px monospace; line-height: 1.6; min-width: 210px; }
#hud .big { font-size: 26px; }
#bar { width: 100%; height: 8px; background: rgba(255,255,255,.25); border-radius: 4px; margin-top: 4px; }
#bar i { display: block; height: 100%; width: 0; background: #ffb400; border-radius: 4px; }
#help { right: 16px; top: 16px; background: rgba(10,20,35,.6); backdrop-filter: blur(4px); padding: 12px 16px; border-radius: 12px; font-size: 13px; line-height: 1.65; }
#help b { background: rgba(255,255,255,.2); padding: 1px 7px; border-radius: 4px; font-family: monospace; }
#title { left: 16px; top: 14px; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
#title small { display: block; font-weight: 400; font-size: 12px; opacity: .9; }
#msg { left: 0; right: 0; top: 14%; text-align: center; font-size: 32px; font-weight: 700; opacity: 0; transition: opacity .4s; padding: 0 12px; }
#hint { left: 0; right: 0; top: 24%; text-align: center; font-size: 19px; padding: 0 12px; }
#poi { left: 0; right: 0; top: 76px; text-align: center; font-size: 16px; opacity: .95; }
#mapbox { right: 16px; bottom: 16px; text-align: center; font-size: 12px; line-height: 1.5; }
#mm { display: block; width: 190px; height: 190px; }
#warn { left: 0; right: 0; bottom: 60px; text-align: center; font-size: 16px; color: #ffd27a; padding: 0 12px; }
#attrib { left: 0; right: 0; bottom: 3px; text-align: center; font-size: 10px; opacity: .7; text-shadow: 0 1px 2px #000; }
body.hg #hud, body.hg #mapbox, body.hg #hint, body.hg #poi, body.hg #warn, body.hg #help { display: none; }
#loading { position: fixed; inset: 0; background: linear-gradient(#1b4f8f, #7db4de); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; transition: opacity .6s; z-index: 30; text-align: center; padding: 0 20px; }
#loading small { font-size: 14px; opacity: .85; margin-top: 10px; max-width: 460px; }
#rotate { display: none; position: fixed; inset: 0; z-index: 40; background: rgba(6,16,32,.96); color: #fff; align-items: center; justify-content: center; text-align: center; font-size: 22px; line-height: 1.6; }

/* ----- Menú: elegir vehículo y destino ----- */
#hangar { position: fixed; inset: 0; display: none; flex-direction: column; justify-content: space-between; align-items: center; z-index: 20; color: #fff;
  background: linear-gradient(rgba(4,12,26,.55), rgba(4,12,26,0) 22%, rgba(4,12,26,0) 40%, rgba(4,12,26,.92) 78%); padding: 18px 16px 18px; box-sizing: border-box; }
#hgHead { text-align: center; text-shadow: 0 2px 10px rgba(0,0,0,.7); }
.brand { font-size: 46px; font-weight: 800; letter-spacing: 12px; text-indent: 12px; background: linear-gradient(#fff, #ffd56b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.sub { font-size: 15px; letter-spacing: 3px; text-transform: uppercase; opacity: .9; margin-top: 2px; }
#hgFact { max-width: 620px; text-align: center; font-size: 13px; line-height: 1.45; background: rgba(6,16,32,.55); padding: 8px 14px; border-radius: 10px; margin: 10px auto 0; border: 1px solid rgba(255,255,255,.15); }
#hgBottom { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
#hgBar { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
#hgTabs { display: flex; gap: 6px; }
.tab { font: 600 14px "Segoe UI", Arial; color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); border-radius: 18px; padding: 6px 16px; cursor: pointer; }
.tab.on { background: #ffc93c; color: #1a1a1a; border-color: #ffc93c; }
#hgGo { font: 800 16px "Segoe UI", Arial; color: #1a1a1a; background: linear-gradient(#ffd56b, #ffb400); border: 0; border-radius: 22px; padding: 9px 26px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
#hgGo:active { transform: scale(.97); }
#cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 1300px; }
.card { box-sizing: border-box; width: 214px; background: linear-gradient(160deg, rgba(255,255,255,.14), rgba(255,255,255,.05)); border: 1px solid rgba(255,255,255,.22); border-radius: 16px; padding: 10px 12px 12px; cursor: pointer; transition: transform .15s, border-color .15s, background .15s; backdrop-filter: blur(6px); position: relative; }
.card:hover, .card.sel { transform: translateY(-8px); border-color: #ffc93c; background: linear-gradient(160deg, rgba(255,201,60,.30), rgba(255,255,255,.08)); box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px rgba(255,201,60,.4); }
.card img { width: 100%; height: 84px; object-fit: contain; display: block; }
.card h3 { margin: 0 0 2px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: #2f9c5a; font-weight: 700; white-space: nowrap; }
.t1 { background: #b8951f; } .t2 { background: #d9782b; } .t3 { background: #c8282d; } .t4 { background: #8a4fc0; }
.card .vmax { font-size: 21px; font-weight: 800; color: #ffd56b; line-height: 1.1; }
.card .vmax small { font-size: 12px; font-weight: 600; opacity: .85; color: #fff; }
.card p { font-size: 10.5px; opacity: .88; min-height: 28px; margin: 2px 0 4px; line-height: 1.3; }
.row { display: flex; align-items: center; font-size: 10px; gap: 6px; margin-top: 2px; opacity: .95; }
.row span { width: 62px; }
.bar { flex: 1; height: 5px; background: rgba(255,255,255,.2); border-radius: 3px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb400, #ff6a3d); border-radius: 3px; }
.num { position: absolute; top: 8px; left: 10px; font-size: 11px; font-weight: 800; background: rgba(0,0,0,.45); border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
#destRow { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; align-items: center; max-width: 1100px; font-size: 13px; }
#destRow .lbl { opacity: .85; margin-right: 4px; }
.chip { padding: 3px 10px; font-size: 12px; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); cursor: pointer; transition: .15s; }
.chip:hover { background: rgba(255,255,255,.25); }
.chip.on { background: #ffb400; color: #1a1a1a; font-weight: 700; border-color: #ffb400; }
.chip.lock { opacity: .45; cursor: not-allowed; }
#hgKeys { font-size: 12px; opacity: .8; letter-spacing: .5px; }

/* ----- Controles táctiles ----- */
#touch { position: fixed; inset: 0; z-index: 5; display: none; pointer-events: none; }
#touch > *, #touch button { pointer-events: auto; touch-action: none; }
#touch button { font: 700 12px "Segoe UI", Arial; color: #fff; background: rgba(15,30,50,.55); border: 2px solid rgba(255,255,255,.4); border-radius: 50%; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); cursor: pointer; padding: 0; }
#touch button.on, #touch button:active { background: rgba(255,180,0,.75); }
#tStick { position: absolute; left: calc(20px + env(safe-area-inset-left)); bottom: 22px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35); }
#tKnob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 2px 8px rgba(0,0,0,.4); pointer-events: none; }
#tThr { position: absolute; right: calc(22px + env(safe-area-inset-right)); bottom: 24px; width: 64px; height: 190px; border-radius: 32px; background: rgba(255,255,255,.14); border: 2px solid rgba(255,255,255,.35); }
#tThrFill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#ffb400, #ff6a3d); opacity: .65; border-radius: 0 0 30px 30px; pointer-events: none; }
#tThrHandle { position: absolute; left: 4px; right: 4px; height: 28px; bottom: -14px; border-radius: 14px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.5); pointer-events: none; }
#tThr span { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-size: 10px; color: #fff; font-weight: 700; pointer-events: none; text-shadow: 0 1px 2px #000; }
#tBrake, #tHand { position: absolute; right: calc(106px + env(safe-area-inset-right)); bottom: 26px; width: 66px; height: 66px; line-height: 1.15; }
#tPedals { position: absolute; right: calc(22px + env(safe-area-inset-right)); bottom: 24px; display: flex; flex-direction: column; gap: 14px; }
#tPedals button { width: 76px; height: 76px; border-radius: 22px; font-size: 24px; line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#tPedals small { font-size: 10px; margin-top: 2px; }
#tGas { background: rgba(47,156,90,.6) !important; }
#tStrafe { position: absolute; right: calc(86px + env(safe-area-inset-right)); bottom: 100px; display: flex; gap: 10px; }
#tStrafe button { width: 58px; height: 58px; font-size: 20px; }
#tBtns { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
#tBtns button { width: 42px; height: 42px; font-size: 19px; }

/* ----- Pantallas pequeñas y móviles ----- */
body.touch #help, body.touch #hgKeys { display: none; }
body.touch #hud { left: calc(8px + env(safe-area-inset-left)); bottom: auto; top: 46px; padding: 6px 10px; font-size: 12px; min-width: 150px; line-height: 1.4; border-radius: 10px; }
body.touch #hud .big { font-size: 18px; }
body.touch #title { left: calc(10px + env(safe-area-inset-left)); top: 6px; font-size: 14px; }
body.touch #title small { font-size: 10px; }
body.touch #mapbox { right: calc(8px + env(safe-area-inset-right)); bottom: auto; top: 8px; font-size: 10px; }
body.touch #mm { width: 104px; height: 104px; }
body.touch #poi { top: 56px; font-size: 13px; }
body.touch #msg { font-size: 20px; top: 12%; }
body.touch #hint { font-size: 14px; top: 20%; }
body.touch #warn { bottom: 20px; font-size: 12px; }
body.touch #attrib { font-size: 8px; bottom: 1px; }
@media (max-height: 620px), (max-width: 900px) {
  #hangar { padding: 8px; justify-content: flex-end; gap: 6px; background: linear-gradient(rgba(4,12,26,0) 22%, rgba(4,12,26,.92) 58%); }
  #hgHead { position: absolute; top: 8px; left: 0; right: 0; }
  .brand { font-size: 24px; letter-spacing: 6px; text-indent: 6px; }
  .sub { font-size: 11px; letter-spacing: 2px; } #hgFact { display: none; }
  #hgBar { gap: 8px; } .tab { padding: 4px 12px; font-size: 12px; } #hgGo { padding: 7px 20px; font-size: 14px; }
  #cards { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; max-width: 100%; padding: 6px 4px 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #cards::-webkit-scrollbar { display: none; }
  .card { flex: 0 0 150px; width: 150px; padding: 6px 8px 8px; border-radius: 12px; }
  .card:hover, .card.sel { transform: translateY(-3px); }
  .card img { height: 54px; } .card p, .num { display: none; } .card h3 { font-size: 12px; } .card .vmax { font-size: 16px; }
  .row { font-size: 9px; margin-top: 1px; } .row span { width: 52px; }
  #destRow { max-height: 52px; overflow-y: auto; font-size: 11px; } .chip { padding: 2px 8px; font-size: 11px; }
}
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }
@media (max-width: 720px) { body.touch #tBtns { gap: 5px; } body.touch #tBtns button { width: 36px; height: 36px; font-size: 16px; } }
@media (max-height: 420px) { #tStick { width: 124px; height: 124px; bottom: 12px; } #tThr { height: 140px; bottom: 14px; } #tKnob { width: 54px; height: 54px; margin: -27px 0 0 -27px; } body.touch #hud { top: 40px; } }
