@font-face {
  font-family: 'LilitaOneCustom';
  src: url('assets/LilitaOne-Regular.ttf') format('truetype');
  font-display: swap;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, #163a45 0%, #08171d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'LilitaOneCustom', 'Trebuchet MS', sans-serif;
}

#game-wrapper {
  position: relative;
  width: 100vw;
  max-width: 177.78vh;
  aspect-ratio: 16 / 9;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 209, 102, 0.15);
  overflow: hidden;
  border-radius: 6px;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* HUD alinhada com a barra inferior do canvas (68px em 720) */
#hud-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 9.444%;
  padding: 0 2.6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5%;
  pointer-events: none;
}

#hud-overlay button {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.1s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

#hud-overlay button:hover:not(:disabled) {
  filter: brightness(1.12);
}

#hud-overlay button:active:not(:disabled) {
  transform: scale(0.94);
}

#hud-overlay button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hud-icon-btn {
  width: 4.4%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: linear-gradient(180deg, #ff5b5b, #b51c1c);
  color: #fff;
  font-size: clamp(15px, 1.9vw, 27px);
  box-shadow: 0 3px 0 #6e0e0e, inset 0 2px 0 rgba(255,255,255,0.3);
}

.hud-box {
  height: 78%;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #d9e7ec);
  border: 2px solid #c63636;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1.4%;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255,255,255,0.6);
}

.credits-box {
  min-width: 17%;
  background: linear-gradient(180deg, #6fe3ff, #1186c7);
  border-color: #ffffff;
  color: #fff;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.4);
}

.bet-box {
  flex-direction: row;
  min-width: 18%;
  justify-content: space-between;
  padding: 0 0.8%;
}

.bet-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
}

.step-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(180deg, #f04040, #b01e1e);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 2px 0 #6e0e0e, inset 0 1px 0 rgba(255,255,255,0.3);
}

.win-box {
  min-width: 17%;
  color: #18323c;
}

.hud-box strong {
  font-size: clamp(14px, 1.9vw, 28px);
  letter-spacing: 0.5px;
}

.hud-label {
  font-size: clamp(9px, 0.9vw, 13px);
  opacity: 0.85;
  letter-spacing: 1px;
}

.hud-speed-btn {
  width: 4.6%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff0a0, #d97706);
  border: 2px solid #fff;
  color: #2b1500;
  font-weight: bold;
  font-size: clamp(11px, 1.2vw, 17px);
  box-shadow: 0 3px 0 #8a4805, inset 0 2px 0 rgba(255,255,255,0.5);
}

.modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.hidden { display: none; }

.modal-card {
  background: linear-gradient(180deg, #1a3a46, #0f2831);
  color: #fff;
  border: 3px solid #e63946;
  border-radius: 18px;
  padding: 26px 34px;
  min-width: 340px;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), inset 0 2px 0 rgba(255,255,255,0.08);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions button {
  padding: 11px 16px;
  border-radius: 9px;
  border: none;
  font-family: inherit;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
  box-shadow: 0 3px 0 rgba(0,0,0,0.4);
}

.modal-actions button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }

.modal-actions button.primary {
  background: linear-gradient(180deg, #2a9d8f, #14675f);
  color: #fff;
}

.finish-extras-btn {
  position: absolute;
  right: 7.5%;
  bottom: 11%;
  z-index: 5;
  padding: clamp(7px, 1vw, 13px) clamp(10px, 1.5vw, 20px);
  border: 2px solid #fff2c6;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(180deg, #2a9d8f, #14675f);
  box-shadow: 0 4px 0 #0b403b, 0 5px 12px rgba(0,0,0,.4);
  font: inherit;
  font-size: clamp(9px, 1vw, 14px);
  letter-spacing: .5px;
  cursor: pointer;
}
.finish-extras-btn[hidden] { display: none; }
.finish-extras-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #0b403b; }

@media (max-aspect-ratio: 4/3) {
  #game-wrapper { width: 100vw; max-width: 100vw; border-radius: 0; }
}
