:root { font-family: system-ui, Arial; }

/* גובה דינמי במובייל (דפדפנים חדשים), עם fallback ל-vh */
body {
  margin: 0;
  background: #0b1020;
  color: #e8eeff;

  min-height: 100vh;
  min-height: 100dvh;

  display: flex;
  flex-direction: column;
}

.top {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.top h1 { margin: 0 0 6px; font-size: 20px; }
.sub { margin: 0; opacity: .8; font-size: 14px; }

/* העיקר: תופס את כל השטח הפנוי וממרכז אנכית */
.wrap {
  flex: 1;
  width: 100%;
  padding: 14px 16px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 10px;
  min-height: 0; /* חשוב לפלקס כדי שלא "יידחף" */
}

/* Canvas */
#game {
  background: radial-gradient(800px 520px at 50% 40%, #111b3a 0%, #070b18 55%, #050713 100%);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 14px 40px rgba(0,0,0,.35);

  width: min(900px, calc(100vw - 32px));
  aspect-ratio: 900 / 520;
  height: auto;
  display: block;
  margin: 0 auto;

  touch-action: none;
}

/* HUD */
.hud {
  display: flex;
  gap: 20px;
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.hud div {
  display: flex;
  align-items: center;
  gap: 5px;
}

#level {
  color: #ffcc00; /* צבע זהב לשלב */
  font-weight: bold;
}

#hint {
  font-family: Arial, sans-serif;
  font-size: 18px;
  color: #ffff00;
  text-align: center;
  min-height: 25px;
}
.mobile-controls {
  display: none;
  margin-top: 12px;
  width: 100%;
  max-width: 420px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}

.mobile-controls {
  position: fixed;
  bottom: 80px; /* עכשיו נמוך מדי */
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  z-index: 9999;
  pointer-events: auto; 
}
/* ברירת מחדל – הכפתורים מוסתרים */
.mobile-controls {
  display: none;
}

/* רק למסכים עד 768px (טלפון/טאבלט קטן) */
@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
    position: fixed;
    bottom: 80px; /* כפי שתיקנת */
    left: 0;
    right: 0;
    justify-content: space-around;
    z-index: 9999;
    pointer-events: auto;
  }

  .mobile-controls button {
    font-size: 22px;
    padding: 16px 20px;
    border-radius: 14px;
    border: none;
    background: rgba(30,40,80,0.9);
    color: white;
    touch-action: none;   /* קריטי למגע */
  }
}



