/* ═══════════════════════════════════════════════════════════════
   Ruban Softwares — Game Player Shell
   ═══════════════════════════════════════════════════════════════ */

/* Full-screen game shell */
.game-shell {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  z-index: 9999;
}

/* ─── HUD Header ──────────────────────────────────────────────── */
.game-hud {
  height: 52px;
  background: rgba(13,17,23,.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
}
.hud-back {
  display: flex; align-items: center; gap: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: rgba(255,255,255,.5);
  cursor: pointer;
  transition: color .2s;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}
.hud-back:hover { color: #fff; background: rgba(255,255,255,.06); }
.hud-sep { width: 1px; height: 20px; background: rgba(255,255,255,.08); }
.hud-game-icon { font-size: 1.2rem; }
.hud-game-title {
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
}
.hud-difficulty {
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.diff-easy   { background: rgba(74,222,128,.15); color: #4ade80; }
.diff-medium { background: rgba(230,152,41,.15); color: #e69829; }
.diff-hard   { background: rgba(248,113,113,.15); color: #f87171; }

.hud-spacer { flex: 1; }

/* Live score display */
.hud-score-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 4px 14px;
}
.hud-metric { text-align: center; }
.hud-metric-val {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hud-metric-lbl {
  font-size: .6rem;
  color: rgba(255,255,255,.4);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.hud-metric-val.score-highlight { color: var(--rs-primary, #e69829); }

/* HUD controls */
.hud-ctrl {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.5);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .85rem;
  transition: all .2s;
}
.hud-ctrl:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ─── Game Canvas Area ────────────────────────────────────────── */
.game-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.game-canvas-wrap canvas,
.game-canvas-wrap #game3d {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
#game3d {
  width: 100% !important;
  height: 100% !important;
}

/* ─── Difficulty Selection (pre-game) ────────────────────────── */
.pre-game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.pre-game-box {
  text-align: center;
  max-width: 420px;
  padding: 0 20px;
}
.pre-game-icon { font-size: 5rem; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.pre-game-title {
  font-size: 1.9rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -.02em;
}
.pre-game-desc { color: rgba(255,255,255,.6); font-size: .9rem; margin-bottom: 28px; }
.pre-diff-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 10px;
}
.pre-diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.pre-diff-btn {
  padding: 12px 8px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.6);
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.pre-diff-btn:hover { border-color: rgba(255,255,255,.25); color: #fff; }
.pre-diff-btn.selected { border-color: #e69829; background: rgba(230,152,41,.12); color: #e69829; }
.pre-diff-btn .diff-icon { font-size: 1.4rem; margin-bottom: 4px; }
.pre-diff-btn .diff-name { font-size: .8rem; font-weight: 700; }
.pre-diff-btn .diff-hint { font-size: .67rem; opacity: .7; }
.pre-start-btn {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e69829, #cb7c11);
  color: #000;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .02em;
  font-family: inherit;
}
.pre-start-btn:hover {
  box-shadow: 0 6px 20px rgba(230,152,41,.4);
  transform: translateY(-2px);
}
.pre-controls {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  text-align: left;
}
.pre-controls-title {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  margin-bottom: 8px;
}
.pre-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: .78rem;
  color: rgba(255,255,255,.5);
}
.key-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  font-size: .68rem;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  font-family: monospace;
}

/* ─── Pause Overlay ───────────────────────────────────────────── */
.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  flex-direction: column;
  gap: 16px;
}
.pause-overlay.active { display: flex; }
.pause-title {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: .05em;
}
.pause-subtitle { color: rgba(255,255,255,.5); font-size: .9rem; }
.pause-actions { display: flex; gap: 12px; margin-top: 8px; }
.pause-btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}
.pause-btn-primary {
  background: linear-gradient(135deg, #e69829, #cb7c11);
  color: #000;
}
.pause-btn-ghost {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
}
.pause-btn:hover { transform: translateY(-1px); }

/* ─── Game Over Overlay ───────────────────────────────────────── */
.gameover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 45;
}
.gameover-overlay.active { display: flex; }
.gameover-box {
  text-align: center;
  padding: 40px 50px;
  background: rgba(26,29,39,.9);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  max-width: 380px;
  width: 90%;
  animation: score-pop .5s ease forwards;
}
.gameover-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 20px;
}
.gameover-score-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  margin-bottom: 6px;
}
.gameover-score {
  font-size: 3.5rem;
  font-weight: 900;
  color: #e69829;
  line-height: 1;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  animation: score-pop .6s .2s ease both;
}
.gameover-rank {
  font-size: .88rem;
  color: rgba(255,255,255,.5);
  margin-bottom: 20px;
}
.gameover-rank strong { color: #fff; }
.gameover-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 20px;
}
.go-stat-val { font-size: 1.1rem; font-weight: 800; color: #fff; }
.go-stat-lbl { font-size: .65rem; color: rgba(255,255,255,.4); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.gameover-new-record {
  font-size: .78rem;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.2);
  border-radius: 20px;
  padding: 4px 14px;
  display: inline-block;
  margin-bottom: 14px;
}
.gameover-actions { display: flex; flex-direction: column; gap: 8px; }
.gameover-btn {
  width: 100%;
  padding: 11px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  text-decoration: none;
  display: block;
  text-align: center;
}
.gameover-btn-primary {
  background: linear-gradient(135deg, #e69829, #cb7c11);
  color: #000;
}
.gameover-btn-secondary {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.7);
}
.gameover-btn:hover { transform: translateY(-1px); }

/* ─── Mobile D-Pad ────────────────────────────────────────────── */
.mobile-dpad {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: .85;
}
@media (max-width: 768px) and (pointer: coarse) { .mobile-dpad { display: flex; } }
/* Push canvas area up so D-pad doesn't overlap gameplay */
@media (max-width: 768px) and (pointer: coarse) {
  .game-canvas-wrap { padding-bottom: 130px; }
}
.dpad-row { display: flex; gap: 4px; }
.dpad-btn {
  width: 50px; height: 50px;
  border-radius: 10px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.dpad-btn:active { background: rgba(230,152,41,.4); }

/* ─── Achievement Toast ───────────────────────────────────────── */
.achievement-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9000;
  background: linear-gradient(135deg, rgba(26,29,39,.95), rgba(13,17,23,.95));
  border: 1px solid rgba(230,152,41,.3);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  max-width: 300px;
  transform: translateX(120%);
  transition: transform .4s cubic-bezier(.34,1.56,.64,1);
}
.achievement-toast.show { transform: translateX(0); }
.toast-icon { font-size: 2rem; }
.toast-body .toast-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #e69829;
  margin-bottom: 2px;
}
.toast-body .toast-name { font-size: .9rem; font-weight: 800; color: #fff; }
.toast-body .toast-xp   { font-size: .73rem; color: rgba(255,255,255,.5); }

/* ─── Confetti ────────────────────────────────────────────────── */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px; height: 8px;
  border-radius: 2px;
  animation: confetti-fall 3s ease-in forwards;
}

/* ─── Floating score popup ────────────────────────────────────── */
.score-popup {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 900;
  color: #e69829;
  pointer-events: none;
  animation: score-float 1s ease forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  z-index: 30;
}
@keyframes score-float {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-60px) scale(.8); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes score-pop {
  0%   { transform: scale(.5); opacity: 0; }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
