/* =====================================================
   TEJO GAME — Modal, HUD & Responsive
   ===================================================== */

/* ── Modal Backdrop ── */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  visibility: hidden;
  transition: background 0.3s ease, visibility 0.3s ease;
}

.game-modal.is-open {
  background: rgba(0, 0, 0, 0.92);
  visibility: visible;
}

/* ── Modal Container ── */
.game-modal__container {
  position: relative;
  width: 90vw;
  max-width: 500px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.game-modal.is-open .game-modal__container {
  transform: scale(1);
  opacity: 1;
}

/* ── Close Button ── */
.game-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #fbfbf8;
  font-size: 28px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 10;
}

.game-modal__close:hover {
  opacity: 1;
}

/* ── HUD (Score Bar) ── */
.game-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #111;
  border: 1px solid #222;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-family: 'Montserrat', sans-serif;
  color: #fbfbf8;
  font-size: 13px;
  gap: 8px;
}

.game-hud__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.game-hud__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.game-hud__value {
  font-weight: 700;
  font-size: 18px;
  color: #febd25;
}

.game-hud__value--round {
  color: #fbfbf8;
}

/* ── Canvas Wrapper ── */
.game-canvas-wrap {
  flex: 1;
  min-height: 0;
  max-height: 700px;
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #222;
  border-top: none;
  border-bottom: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-canvas-wrap canvas {
  display: block;
  /* Override JS inline styles to make canvas responsive */
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 400 / 700;
}

/* ── Bottom Bar (Action / Messages) ── */
.game-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  background: #111;
  border: 1px solid #222;
  border-top: none;
  border-radius: 0 0 8px 8px;
  gap: 8px;
}

.game-action-btn {
  width: 100%;
  padding: 14px 24px;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #050505;
  background: #febd25;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.game-action-btn:hover {
  background: #e5a91e;
}

.game-action-btn:active {
  transform: scale(0.97);
}

.game-action-btn--secondary {
  background: transparent;
  color: #febd25;
  border: 1px solid #febd25;
}

.game-action-btn--secondary:hover {
  background: rgba(254, 189, 37, 0.1);
}

.game-action-btn--share {
  background: #25d366;
  color: #fff;
}

.game-action-btn--share:hover {
  background: #20bd5a;
}

.game-message {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: rgba(251, 251, 248, 0.5);
  text-align: center;
}

.game-buttons-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.game-buttons-row .game-action-btn {
  flex: 1;
}

/* ── Hero Button ── */
.btn--game {
  background: transparent;
  color: #febd25;
  border: 2px solid #febd25;
  padding: 12px 28px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.1s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn--game:hover {
  background: #febd25;
  color: #050505;
}

.btn--game:active {
  transform: scale(0.97);
}

/* ── Screen Shake ── */
@keyframes game-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-4px, 2px); }
  20% { transform: translate(3px, -3px); }
  30% { transform: translate(-2px, 4px); }
  40% { transform: translate(4px, -1px); }
  50% { transform: translate(-3px, 3px); }
  60% { transform: translate(2px, -4px); }
  70% { transform: translate(-4px, 1px); }
  80% { transform: translate(3px, 3px); }
  90% { transform: translate(-1px, -2px); }
}

.game-canvas-wrap--shake {
  animation: game-shake 0.4s ease-out;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .game-modal__container {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  .game-hud {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .game-bottom {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 14px 16px;
  }

  .game-canvas-wrap {
    border-left: none;
    border-right: none;
  }

  .game-action-btn {
    padding: 16px 24px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .game-hud {
    padding: 8px 12px;
    font-size: 12px;
  }

  .game-hud__value {
    font-size: 16px;
  }

  .game-action-btn {
    padding: 14px 20px;
    font-size: 14px;
  }
}
