/* ================================
   RUNNER BITCOINZ — STYLE.CSS
   Dark Neon Racing — Mobile First
   ================================ */

*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:root {
  --gold: #f7931a;
  --gold-dim: #b86010;
  --cyan: #00f5ff;
  --green: #00ff88;
  --red: #ff4466;
  --bg: #0a0a0f;
  --card: #12121c;
  --card2: #1a1a28;
  --text: #e8e8f0;
  --dim: #555;
  --font: 'Courier New', monospace;
}

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font);
}

/* ── WRAPPER RESPONSIVE ── */
#wrap {
  position: relative;
  /* On calcule la taille pour tenir dans l'écran en gardant le ratio */
  width: min(420px, 100vw, calc(100vh * 420 / 620));
  height: min(620px, calc(100vw * 620 / 420), 100vh);
}

#gc {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px solid #00f5ff18;
}

#ui {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ── LAYERS / ÉCRANS ── */
.layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 14, 0.93);
  pointer-events: all;
  overflow-y: auto;
  padding: 16px;
}

.hidden { display: none !important; }

/* ── TYPO ── */
.gtitle {
  font-size: clamp(24px, 8vw, 38px);
  font-weight: 900;
  color: var(--cyan);
  letter-spacing: 6px;
  text-shadow: 0 0 30px #00f5ff80;
  margin-bottom: 4px;
}
.gtitle.red   { color: var(--red);   text-shadow: 0 0 20px #ff446660; }
.gtitle.green { color: var(--green); text-shadow: 0 0 20px #00ff8860; }

.gsub {
  font-size: clamp(9px, 2.5vw, 12px);
  color: var(--gold);
  letter-spacing: 5px;
  margin-bottom: 6px;
}

.gbal {
  font-size: clamp(13px, 4vw, 18px);
  color: var(--gold);
  letter-spacing: 3px;
  margin-bottom: 20px;
}

.sec-title {
  font-size: clamp(12px, 3.5vw, 16px);
  color: var(--cyan);
  letter-spacing: 4px;
  margin-bottom: 12px;
}

/* ── BOUTONS ── */
.btn {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #1a0800;
  font-family: var(--font);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 900;
  letter-spacing: 3px;
  border: none;
  padding: clamp(10px, 2.5vw, 13px) clamp(20px, 6vw, 36px);
  border-radius: 5px;
  cursor: pointer;
  margin: 4px;
  transition: transform .15s, box-shadow .15s;
  pointer-events: all;
  min-width: 160px;
}
.btn:active { transform: scale(0.96); }

.btn2 {
  background: transparent;
  color: var(--cyan);
  border: 1.5px solid var(--cyan);
  border-radius: 5px;
  font-family: var(--font);
  font-size: clamp(10px, 2.5vw, 11px);
  letter-spacing: 2px;
  padding: clamp(8px, 2vw, 9px) clamp(16px, 4vw, 22px);
  cursor: pointer;
  margin: 4px;
  transition: background .15s;
  pointer-events: all;
  min-width: 120px;
}
.btn2:active { background: #00f5ff22; }

/* ── HUD jeu ── */
.hud {
  position: absolute;
  top: 6px; left: 8px;
  font-size: clamp(9px, 2.5vw, 11px);
  color: #ddd;
  line-height: 1.9;
  text-shadow: 0 1px 4px #000;
  pointer-events: none;
  z-index: 10;
}

.hud2 {
  position: absolute;
  bottom: 78px; /* au-dessus des contrôles mobiles */
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(8px, 2vw, 10px);
  color: var(--dim);
  letter-spacing: 1px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

/* Sur desktop, hud2 reste en bas normal */
@media (hover: hover) {
  .hud2 { bottom: 6px; }
}

/* ── TOAST ── */
#msg {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(11px, 3vw, 13px);
  padding: 8px 18px;
  border-radius: 5px;
  background: var(--card);
  border: 1px solid #f7931a44;
  color: var(--gold);
  display: none;
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
}

/* ── BOUTIQUE ── */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  width: min(360px, 90%);
  margin: 6px 0;
}

.scard {
  background: var(--card);
  border: 1px solid #ffffff0f;
  border-radius: 7px;
  padding: clamp(8px, 2vw, 12px);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, transform .18s;
  pointer-events: all;
}
.scard:active { transform: scale(0.97); }
.scard.owned    { border-color: #00ff8833; }
.scard.equipped { border-color: var(--gold); box-shadow: 0 0 14px #f7931a44; }

.scard-emoji { font-size: clamp(20px, 5vw, 26px); }
.scard-name  { font-size: clamp(9px, 2.2vw, 10px); color: #ccc; margin: 2px 0; }
.scard-mult  { font-size: clamp(8px, 2vw, 9px);  color: var(--gold); }
.scard-status{ font-size: clamp(8px, 2vw, 9px);  color: #888; margin-top: 3px; }

.rbadge {
  font-size: clamp(7px, 1.8vw, 9px);
  padding: 2px 7px;
  border-radius: 10px;
  display: inline-block;
  margin: 2px 0;
}
.commune  { background: #33333388; color: #aaa; }
.rare     { background: #003388aa; color: #88aaff; }
.epic     { background: #550088aa; color: #cc88ff; }
.legendary{ background: #f7931a22; color: var(--gold); }

.pow-label {
  font-size: clamp(9px, 2.2vw, 10px);
  color: var(--dim);
  letter-spacing: 2px;
  margin: 10px 0 6px;
}

.prow {
  display: flex;
  gap: 7px;
  margin: 4px 0;
  width: min(360px, 90%);
}

.pcrd {
  background: var(--card);
  border: 1px solid #ffffff0f;
  border-radius: 6px;
  padding: clamp(8px, 2vw, 10px) clamp(10px, 2.5vw, 14px);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s;
  flex: 1;
  pointer-events: all;
}
.pcrd:active { border-color: var(--cyan); }
.pcrd-icon  { font-size: clamp(16px, 4vw, 20px); }
.pcrd-name  { font-size: clamp(8px, 2vw, 9px);  color: #aaa; margin-top: 3px; }
.pcrd-price { font-size: clamp(8px, 2vw, 9px);  color: var(--gold); }
.pcrd-stock { font-size: clamp(8px, 2vw, 9px);  color: var(--dim); }

.shop-msg {
  font-size: clamp(9px, 2.2vw, 10px);
  height: 14px;
  margin: 4px 0;
}

/* ── QUÊTES ── */
.qrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 11px;
  margin: 3px 0;
  background: var(--card);
  border-radius: 5px;
  border: 1px solid #ffffff08;
  font-size: clamp(9px, 2.2vw, 10px);
  color: #666;
  width: min(360px, 90%);
}
.qrow.done { color: var(--green); border-color: #00ff8820; }
.qrew { color: var(--gold); }

/* ── TUTORIEL ── */
.tuto-text {
  font-size: clamp(10px, 2.5vw, 11px);
  color: #666;
  text-align: center;
  line-height: 2.1;
  margin-bottom: 16px;
  width: min(320px, 90%);
}

/* ── CAMPAGNE ── */
#cc {
  display: block;
  width: 100%;
  height: calc(100% - 70px);
  cursor: pointer;
}

.camp-ui {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  background: rgba(8, 8, 14, 0.9);
  padding: 8px 12px;
  pointer-events: all;
}

.camp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.camp-label { font-size: clamp(8px, 2vw, 10px);  color: var(--dim); letter-spacing: 2px; }
.camp-val   { font-size: clamp(11px, 2.8vw, 13px); color: #fff; }
.camp-val.cyan { color: var(--cyan); }

/* ── GAME OVER / VICTOIRE ── */
.go-score {
  font-size: clamp(16px, 5vw, 20px);
  color: var(--gold);
  letter-spacing: 2px;
  margin: 10px 0;
}
.go-sub {
  font-size: clamp(9px, 2.5vw, 11px);
  color: var(--dim);
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.vic-earn {
  font-size: clamp(12px, 3.5vw, 14px);
  color: var(--gold);
  margin: 10px 0;
}

/* ── CONTRÔLES MOBILES ── */
.mobile-controls {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(8, 8, 14, 0.85);
  border-top: 1px solid #ffffff0a;
  pointer-events: all;
  z-index: 20;
  gap: 6px;
}

/* On cache les contrôles mobiles sur desktop (souris disponible) */
@media (hover: hover) and (pointer: fine) {
  .mobile-controls { display: none !important; }
  .hud2 { bottom: 6px; }
}

.ctrl-left, .ctrl-right {
  display: flex;
  align-items: center;
}

.ctrl-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.ctrl-btn {
  width: clamp(56px, 14vw, 70px);
  height: clamp(50px, 12vw, 58px);
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: #fff;
  font-size: clamp(18px, 5vw, 24px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
  pointer-events: all;
}
.ctrl-btn:active, .ctrl-btn.pressed {
  background: rgba(0, 245, 255, 0.18);
  border-color: var(--cyan);
}

.drift-btn {
  width: clamp(80px, 20vw, 100px);
  height: clamp(30px, 8vw, 36px);
  font-size: clamp(9px, 2.5vw, 11px);
  letter-spacing: 2px;
  background: rgba(255, 100, 30, 0.15);
  border-color: rgba(255, 100, 30, 0.4);
  color: #ff9944;
}
.drift-btn:active, .drift-btn.pressed {
  background: rgba(255, 100, 30, 0.35);
  border-color: #ff9944;
}

.ctrl-powers {
  display: flex;
  gap: 5px;
}

.ctrl-pow {
  width: clamp(26px, 7vw, 32px);
  height: clamp(26px, 7vw, 32px);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  font-size: clamp(12px, 3.5vw, 16px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}
.ctrl-pow:active { background: rgba(247,147,26,0.25); border-color: var(--gold); }
