* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.ranking-box {
  margin-top: 14px;
  padding: 12px 16px;
  width: min(100%, 390px);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  color: #fff;
}

.ranking-box h3 {
  margin: 0 0 10px;
  color: #ff8a00;
  font-size: 1.05rem;
}

#rankingList {
  line-height: 1.8;
  color: #e5e7eb;
  font-size: 1rem;
  white-space: nowrap;
}

#rankingList .rank-line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: #0b1220;
  color: #fff;
  touch-action: manipulation;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.game-wrapper {
  width: min(100vw, 1000px);
  height: min(100vh, 620px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
}

.brand {
  display: flex;
  align-items: center;
  max-height: 50px;
}

.score-box {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: bold;
}

.score-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 50;

  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  padding: 6px 10px;
  border-radius: 10px;

  font-size: 13px;
  color: #fff;
  text-align: right;
}

.game {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  border-radius: 24px;
  overflow: hidden;
  background:
  linear-gradient(rgba(10,15,30,0.42), rgba(10,15,30,0.58)),
  url("img/bg.png") center/cover no-repeat;
  border: 2px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  user-select: none;
}

.bg-decor {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.glow {
  position: absolute;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.22;
}

.glow-1 {
  width: 140px;
  height: 140px;
  background: #ff8a00;
  left: 6%;
  top: 10%;
}

.glow-2 {
  width: 120px;
  height: 120px;
  background: #3b82f6;
  right: 10%;
  top: 16%;
}

.glow-3 {
  width: 180px;
  height: 180px;
  background: #f97316;
  right: 18%;
  bottom: 20%;
}

.ground {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 100px;
  background: linear-gradient(to top, #2b2f38, #494f59);
  border-top: 3px solid rgba(255,255,255,0.08);
  z-index: 1;
}

.ground-line {
  position: absolute;
  left: 0;
  bottom: 72px;
  width: 100%;
  height: 6px;
  z-index: 2;
  opacity: 0.6;
  background: repeating-linear-gradient(
    to right,
    rgba(255,255,255,0.22) 0 26px,
    transparent 26px 54px
  );
}

.iphone {
  position: absolute;
  left: 70px;
  width: 110px;
  height: auto;
  z-index: 5;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

.obstacles-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
}

.obstacle {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  object-fit: contain;
}

.game-over::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("img/caido.png") no-repeat left 70px bottom 90px;
  background-size: 120px auto;
  opacity: 0.22;
  filter: blur(0.5px);
  pointer-events: none;
}

.start-screen,
.game-over {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(6, 10, 20, 0.48);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.touch-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  z-index: 5;
  background: transparent;
  touch-action: manipulation;
}

.start-screen h1,
.game-over h2 {
  color: #ff8a00;
  margin-bottom: 14px;
}

.start-screen p,
.game-over p {
  max-width: 520px;
  line-height: 1.5;
  margin-bottom: 10px;
  color: #e5e7eb;
}

button {
  margin-top: 12px;
  padding: 14px 22px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff8a00, #ff5f1f);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(255, 122, 0, 0.28);
}

button:active {
  transform: scale(0.98);
}

.hidden {
  display: none !important;
}

.hint {
  text-align: center;
  margin-top: 10px;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.72);
}

.crash-effect {
  animation: flashCrash 400ms ease-in-out 1;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-box,
.icon-btn,
.pause-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  color: #e5e7eb;
  font-weight: bold;
  box-shadow: none;
  margin-top: 0;
}

.icon-btn,
.pause-btn {
  padding: 10px 14px;
}

.icon-btn {
  min-width: 46px;
  font-size: 1rem;
}

.icon-btn:hover,
.pause-btn:hover {
  background: rgba(255,255,255,0.14);
}

.pause-overlay,
.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 18, 0.82);
  backdrop-filter: blur(6px);
  text-align: center;
  padding: 24px;
}

.pause-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.countdown-overlay {
  display: none;
  align-items: center;
  justify-content: center;
}

.pause-overlay:not(.hidden),
.countdown-overlay:not(.hidden) {
  display: flex;
}

.pause-overlay h2 {
  color: #ffffff;
  font-size: 2rem;
  margin: 0;
}

#countdownNumber {
  font-size: 5rem;
  font-weight: 900;
  color: #ff8a00;
  text-shadow: 0 10px 30px rgba(255,138,0,0.28);
}

.shield-item {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255, 200, 0, 0.45));
  animation: shieldFloatPulse 1.8s ease-in-out infinite;
}

@keyframes shieldFloatPulse {
  0% {
    transform: translateY(0) scale(1) rotate(0deg);
    filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.35));
  }
  25% {
    transform: translateY(-4px) scale(1.04) rotate(-2deg);
    filter: drop-shadow(0 0 12px rgba(255, 220, 80, 0.45));
  }
  50% {
    transform: translateY(-8px) scale(1.08) rotate(0deg);
    filter: drop-shadow(0 0 18px rgba(255, 230, 120, 0.65));
  }
  75% {
    transform: translateY(-4px) scale(1.04) rotate(2deg);
    filter: drop-shadow(0 0 12px rgba(255, 220, 80, 0.45));
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.35));
  }
}

.shield-visual {
  position: absolute;
  width: 96px;
  height: 96px;
  z-index: 6;
  pointer-events: none;
  border-radius: 999px;

  /* base */
  border: 2px solid rgba(120, 220, 255, 0.7);

  /* glow forte */
  box-shadow:
    0 0 18px rgba(120, 220, 255, 0.6),
    0 0 32px rgba(120, 220, 255, 0.35),
    inset 0 0 18px rgba(120, 220, 255, 0.25);

  /* gradiente mágico */
  background: radial-gradient(circle,
    rgba(120,220,255,0.18) 0%,
    rgba(120,220,255,0.06) 40%,
    rgba(120,220,255,0.02) 70%,
    transparent 100%
  );

  animation: shieldPulse 1.6s ease-in-out infinite;
}

@keyframes shieldPulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}

@keyframes flashCrash {
  0%   { filter: brightness(1); }
  20%  { filter: brightness(1.8); }
  40%  { filter: brightness(0.8); }
  60%  { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

.shield-visual::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;

  background: conic-gradient(
    from 0deg,
    rgba(120,220,255,0.0),
    rgba(120,220,255,0.5),
    rgba(120,220,255,0.0)
  );

  filter: blur(6px);
  animation: shieldRotate 2.8s linear infinite;
}

@keyframes shieldRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.shield-hit {
  animation: shieldImpact 0.3s ease-out;
}

@keyframes shieldImpact {
  0% {
    transform: scale(1.4);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 768px) {

  .hud-right {
    gap: 6px;
  }

  .game-wrapper {
    width: 100vw;
    height: 100dvh;
    padding-top: calc(env(safe-area-inset-top, 10px) + 29px);
    padding-right: 8px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
    padding-left: 8px;
    justify-content: flex-start;
  }
  
  .hud {
    margin-bottom: 12px;
    padding-top: 2px;
  }

  .game {
    min-height: 0;
    height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 120px);
    border-radius: 18px;
  }
  
  .hint {
    margin-top: 10px;
    padding-bottom: 4px;
  }

  .iphone {
    left: 34px;
    width: 92px;
  }

  .score-box {
    font-size: 0.95rem;
    padding: 8px 12px;
  }

  .start-screen h1,
  .game-over h2 {
    font-size: 1.5rem;
  }

  .ground {
    height: 96px;
  }

  .ground-line {
    bottom: 68px;
  }
  .brand img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
  }

  .gameover-phone {
    position: absolute;
    bottom: 110px;
    left: 60px;
    width: 90px;
    opacity: 0.35;
    transform: rotate(-18deg);
    filter: blur(1px);
  }

  .icon-btn,
  .pause-btn {
    margin-top: 0;
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: none;
  }

  .icon-btn {
    min-width: 46px;
    padding: 10px 12px;
    font-size: 1.05rem;
  }

  .icon-btn:hover,
  .pause-btn:hover {
    background: rgba(255,255,255,0.14);
  }
}