/* MEGA MINI DRIVE — autosjatekok.net edition (ad-free) */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* autosjatekok.net branding on the loading + title screens.
   Rendered as a background-image (an SVG in an <img> collapses to 0x0 inside
   a flex column in Chrome); aspect-ratio gives the height. */
.brand-logo { display: block; width: 176px; max-width: 78%; aspect-ratio: 462 / 211;
  background: url('../brand/logo.png') center / contain no-repeat;
  flex: 0 0 auto; } /* flex:none so the flex column can't squash the height to 0 */
#loading .brand-logo { margin-top: 18px; opacity: 0.92; }
.brand-credit { display: block; margin-top: 10px; opacity: 0.9; transition: opacity .2s, transform .1s; }
.brand-credit .brand-logo { margin: 0 auto; }
.brand-credit:hover { opacity: 1; transform: translateY(-1px); }
html, body { width: 100%; height: 100%; overflow: hidden; background: #182033; }
body { font-family: 'Segoe UI', 'Arial Black', system-ui, sans-serif; touch-action: none;
  -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
  -webkit-touch-callout: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(8,10,20,0.38) 100%); }
.hidden { display: none !important; }

/* ---------- logo ---------- */
.logo { font-weight: 900; letter-spacing: 0.04em; line-height: 0.98; text-align: center; }
.logo .mega { display: block; font-size: 52px; color: #ffcf3a; text-shadow: 0 4px 0 #b8860b, 0 8px 18px rgba(0,0,0,.45); }
.logo .mini { display: block; font-size: 40px; color: #3ef3ff; text-shadow: 0 3px 0 #0e7d8a, 0 6px 14px rgba(0,0,0,.4); }
.logo .drive { display: none; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; background: linear-gradient(#182033, #0d1220); display: flex; flex-direction: column; gap: 26px; align-items: center; justify-content: center; z-index: 60; transition: opacity .4s; }
#loading.off { opacity: 0; pointer-events: none; }
.load-bar { width: 220px; height: 10px; border-radius: 6px; background: #0a0e18; overflow: hidden; }
#load-fill { width: 30%; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ffcf3a, #3ef3ff); animation: loadslide 1s infinite alternate ease-in-out; }
@keyframes loadslide { from { margin-left: 0; width: 30%; } to { margin-left: 70%; width: 30%; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; transition: opacity .25s; }
#hud.dim { opacity: 0; }
/* safe-area insets keep the HUD clear of notches / rounded corners */
#topbar { position: absolute; display: flex; align-items: center; gap: 12px;
  top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); }
#lv-label { color: #fff; font-weight: 800; font-size: 17px; text-shadow: 0 2px 4px rgba(0,0,0,.6); background: rgba(10,16,28,.55); padding: 7px 14px; border-radius: 12px; }
#timer-box { color: #ffcf3a; font-weight: 900; font-size: 20px; text-shadow: 0 2px 4px rgba(0,0,0,.6); background: rgba(10,16,28,.55); padding: 6px 14px; border-radius: 12px; min-width: 86px; text-align: center; }
#bolt-box { display: flex; gap: 4px; background: rgba(10,16,28,.55); padding: 6px 10px; border-radius: 12px; }
.boltdot { font-size: 18px; filter: grayscale(1) opacity(.45); transition: filter .2s, transform .2s; }
.boltdot.got { filter: none; transform: scale(1.15); }
#btn-pause, #btn-help { pointer-events: auto; font-size: 22px; width: 46px; height: 46px; border-radius: 14px; border: none; background: rgba(10,16,28,.6); color: #fff; cursor: pointer; }
#btn-help { margin-left: auto; font-weight: 900; color: #3ef3ff; }
#btn-help.attn { animation: helppulse 0.9s infinite; border: 2px solid #3ef3ff; }
@keyframes helppulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(62,243,255,0); } 50% { transform: scale(1.14); box-shadow: 0 0 20px rgba(62,243,255,.85); } }
.help-card { max-width: 470px; }
#help-body { color: #eaf2ff; font-size: 16px; line-height: 1.5; text-align: center; margin: 2px 0 4px; }
#help-controls { color: #9fb4d8; font-size: 13px; font-weight: 700; text-align: center; }
#hint { position: absolute; left: 50%; bottom: 21%; transform: translateX(-50%); max-width: 86%; background: rgba(12,18,32,.82); border: 2px solid #3ef3ff; color: #eaf8ff; font-size: 17px; font-weight: 700; padding: 11px 20px; border-radius: 16px; text-align: center; animation: hintpop .3s ease-out; }
@keyframes hintpop { from { transform: translateX(-50%) scale(.7); opacity: 0; } }
#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); background: rgba(12,18,32,.85); color: #ffe9a0; font-weight: 800; padding: 12px 22px; border-radius: 14px; font-size: 18px; }
#toast-skip { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); pointer-events: auto; background: linear-gradient(#8a5cf5, #6a3de0); border: none; color: #fff; font-weight: 800; font-size: 15px; padding: 10px 18px; border-radius: 14px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4); }

/* ---------- touch controls ---------- */
#touch-left, #touch-right { position: absolute; display: none; gap: 14px; align-items: flex-end;
  bottom: max(16px, env(safe-area-inset-bottom)); }
#touch-left { left: max(16px, env(safe-area-inset-left)); }
#touch-right { right: max(16px, env(safe-area-inset-right)); flex-direction: row; }
body.touch #touch-left, body.touch #touch-right { display: flex; }
@media (pointer: coarse) { #touch-left, #touch-right { display: flex; } }
#touch-left button, #t-brake { pointer-events: auto; width: 76px; height: 76px; border-radius: 22px; border: none; font-size: 30px; color: #fff; background: rgba(20,28,48,.65); box-shadow: 0 3px 0 rgba(0,0,0,.35); }
#touch-left button:active, #t-brake:active { background: rgba(62,243,255,.5); }
#morph-btn { pointer-events: auto; width: 96px; height: 96px; border-radius: 50%; border: 4px solid #ffcf3a; background: radial-gradient(circle at 34% 30%, #ffe084, #f0a71b); color: #4a2c00; font-weight: 900; font-size: 19px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 5px 0 #a06a00, 0 8px 20px rgba(0,0,0,.4); transition: transform .1s; }
#morph-btn.mini { border-color: #3ef3ff; background: radial-gradient(circle at 34% 30%, #b8fbff, #17b8d9); color: #003a44; box-shadow: 0 5px 0 #0a7080, 0 8px 20px rgba(0,0,0,.4); }
#morph-btn:active { transform: scale(.93); }
#morph-btn.deny { animation: deny .3s; }
@keyframes deny { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
#morph-btn small { font-size: 10px; font-weight: 700; opacity: .7; }
/* the on-screen MORPH button only exists on touch — don't advertise SPACE there */
@media (pointer: coarse) { #morph-key { display: none; } }

#fade { position: fixed; inset: 0; background: #06080f; opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 30; }
#fade.on { opacity: 1; }

/* ---------- panels ---------- */
.panel { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 40; background: rgba(6,10,20,.45); backdrop-filter: blur(3px); }
.card { background: linear-gradient(160deg, #1e2a45, #131b30); border: 2px solid rgba(120,160,255,.25); border-radius: 26px; padding: 26px 34px; display: flex; flex-direction: column; gap: 12px; align-items: center; box-shadow: 0 18px 60px rgba(0,0,0,.5); max-width: 92vw; max-height: 92vh; overflow-y: auto; }
.card h2 { color: #fff; font-size: 26px; letter-spacing: .06em; }
.tagline { color: #9fb4d8; font-weight: 700; font-size: 14px; margin-top: -4px; }
button.big { background: linear-gradient(#ffd95c, #f2a81d); color: #4a2c00; font-size: 24px; font-weight: 900; border: none; border-radius: 18px; padding: 14px 60px; cursor: pointer; box-shadow: 0 5px 0 #a06a00; transition: transform .08s; letter-spacing: .05em; }
button.big:hover { transform: scale(1.04); }
button.big:active { transform: scale(.96); }
button.mid { background: rgba(62,243,255,.12); border: 2px solid #3ef3ff; color: #b8fbff; font-size: 16px; font-weight: 800; border-radius: 14px; padding: 10px 34px; cursor: pointer; }
button.mid:hover { background: rgba(62,243,255,.25); }
.row { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.mini-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #dfe8f5; border-radius: 12px; padding: 8px 14px; font-size: 15px; font-weight: 700; cursor: pointer; }
.mini-btn.wide { font-size: 12px; }

.skins-box { width: 100%; background: rgba(8,12,24,.5); border-radius: 16px; padding: 10px 14px; }
.skins-head { display: flex; justify-content: space-between; color: #9fb4d8; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.skins-head.sub { margin-top: 12px; }
#trail-row, #topper-row { display: flex; gap: 8px; justify-content: center; }
#trail-row .skin, #topper-row .skin { display: flex; align-items: center; justify-content: center; font-size: 19px; background: rgba(255,255,255,.08); }
#skin-row { display: flex; gap: 8px; justify-content: center; }
.skin { width: 40px; height: 40px; border-radius: 12px; border: 3px solid rgba(255,255,255,.25); cursor: pointer; font-size: 15px; }
.skin.sel { border-color: #ffcf3a; box-shadow: 0 0 10px rgba(255,207,58,.7); }
.skin.locked { filter: saturate(.35) brightness(.6); cursor: default; }

.cmp-name { color: #9fb4d8; font-weight: 800; }
.cmp-line { color: #dfe8f5; font-size: 15px; font-weight: 700; }
#stars { display: flex; gap: 10px; font-size: 44px; height: 56px; }
.star { color: #3a4260; animation: starpop .4s both; }
.star.lit { color: #ffcf3a; text-shadow: 0 0 18px rgba(255,207,58,.8); }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.3); } to { transform: scale(1); } }

.levels-card { min-width: 320px; }
#lv-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; }
.lv-world { grid-column: 1 / -1; color: #9fb4d8; font-size: 12px; font-weight: 900; letter-spacing: .2em; margin-top: 6px; }
.lv-cell { background: rgba(62,243,255,.1); border: 2px solid rgba(62,243,255,.4); border-radius: 12px; color: #fff; padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; font-size: 15px; }
.lv-cell:hover { background: rgba(62,243,255,.25); }
.lv-cell.locked { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.04); cursor: default; }
.lv-stars { font-size: 10px; color: #ffcf3a; }
.lv-bolts { font-size: 9px; color: #ffd9a0; min-height: 11px; }

/* short screens (landscape phones): compact the title card so it fits without
   scrolling — smaller logo, tighter reward rows, no tagline */
@media (max-height: 600px) {
  .logo .mega { font-size: 38px; } .logo .mini { font-size: 21px; } .logo .drive { font-size: 15px; }
  .card { padding: 12px 20px; gap: 7px; }
  .tagline { display: none; }
  button.big { font-size: 18px; padding: 9px 40px; }
  button.mid { font-size: 14px; padding: 7px 26px; }
  .skins-box { padding: 7px 10px; }
  .skins-head { font-size: 11px; margin-bottom: 5px; } .skins-head.sub { margin-top: 6px; }
  .skin { width: 34px; height: 34px; border-width: 2px; }
  #trail-row .skin, #topper-row .skin { font-size: 16px; }
  #stars { font-size: 32px; height: 40px; }
  .brand-logo { width: 150px; } #loading .brand-logo { margin-top: 10px; }
  .brand-credit { margin-top: 5px; }
}
/* tiny screens: squeeze further */
@media (max-height: 430px) {
  .logo .mega { font-size: 28px; } .logo .mini { font-size: 16px; }
  .card { padding: 8px 16px; gap: 4px; }
  button.big { font-size: 15px; padding: 7px 30px; }
  button.mid { padding: 5px 20px; }
  .skin { width: 28px; height: 28px; }
  #trail-row .skin, #topper-row .skin { font-size: 13px; }
  .skins-head.sub { margin-top: 4px; }
  .brand-logo { width: 128px; }
}
/* narrow screens: shrink HUD + make the level grid fit */
@media (max-width: 480px) {
  #lv-label { font-size: 13px; padding: 6px 9px; }
  #timer-box { font-size: 16px; min-width: 68px; }
  .levels-card { min-width: 0; }
  #lv-grid { gap: 5px; }
  .lv-cell { padding: 5px 1px; font-size: 13px; }
  .skin { width: 32px; height: 32px; }
  #skin-row, #trail-row, #topper-row { gap: 6px; }
}
