/* ============================================
   AVENTURAS DO VOIKINHO — CSS
   Cores: #1C3A6E (azul escuro) | #04B3D6 (ciano)
   Fonte: Fredoka One (títulos) | Nunito (corpo)
   ============================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --blue-dark: #1C3A6E;
  --cyan: #04B3D6;
  --cyan-light: #5DD6F0;
  --sky-top: #4FC3F7;
  --sky-mid: #81D4FA;
  --sky-bot: #E1F5FE;
  --grass: #66BB6A;
  --grass-dark: #43A047;
  --white: #ffffff;
  --yellow: #FFD54F;
  --yellow-dark: #FFB300;
  --orange: #FF8C42;
  --shadow: rgba(28, 58, 110, 0.25);
  --font-title: 'Fredoka One', cursive;
  --font-body: 'Nunito', sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--blue-dark);
  font-family: var(--font-body);
}

/* ============================
   SCREENS
   ============================ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.screen.active {
  display: flex;
}

/* Start & Gameover share gradient bg */
#screen-start,
#screen-gameover {
  background: linear-gradient(180deg,
    var(--sky-top) 0%,
    var(--sky-mid) 40%,
    var(--sky-bot) 75%,
    var(--grass) 75%,
    var(--grass-dark) 100%
  );
}

/* Animated clouds on start/gameover screens */
#screen-start::before,
#screen-gameover::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120px 60px at 10% 20%, rgba(255,255,255,0.85) 0%, transparent 70%),
    radial-gradient(ellipse 90px 50px at 75% 15%, rgba(255,255,255,0.80) 0%, transparent 70%),
    radial-gradient(ellipse 150px 70px at 50% 10%, rgba(255,255,255,0.75) 0%, transparent 70%),
    radial-gradient(ellipse 80px 45px at 88% 30%, rgba(255,255,255,0.70) 0%, transparent 70%);
  pointer-events: none;
  animation: cloudDrift 12s linear infinite;
}

@keyframes cloudDrift {
  0%   { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
  100% { background-position: 5% 0%, 3% 0%, 4% 0%, 2% 0%; }
}

/* ============================
   SCREEN CONTENT
   ============================ */
.screen-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.5vh, 24px);
  padding: clamp(16px, 4vw, 40px);
  width: 100%;
  max-width: 600px;
}

/* ============================
   LOGO AREA / HERO
   ============================ */
.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.hero-char {
  width: clamp(120px, 22vw, 220px);
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.2));
  animation: bounceChar 1.2s ease-in-out infinite;
  transform-origin: bottom center;
}

@keyframes bounceChar {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-16px) rotate(2deg); }
}

.game-title {
  font-family: var(--font-title);
  font-size: clamp(2.8rem, 8vw, 5rem);
  color: var(--blue-dark);
  text-align: center;
  line-height: 1;
  -webkit-text-stroke: 2px rgba(255,255,255,0.5);
  filter: drop-shadow(0 3px 0 rgba(255,255,255,0.6));
}

.game-title span {
  color: var(--cyan);
  display: block;
  -webkit-text-stroke: 2px var(--blue-dark);
  filter: drop-shadow(0 3px 0 rgba(28,58,110,0.4));
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.3rem);
  font-weight: 700;
  color: var(--blue-dark);
  text-align: center;
  background: rgba(255,255,255,0.6);
  border-radius: 40px;
  padding: 6px 20px;
  backdrop-filter: blur(4px);
}

.best-score-display {
  font-family: var(--font-title);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--blue-dark);
  background: rgba(255,255,255,0.7);
  border: 2px solid rgba(28,58,110,0.15);
  border-radius: 40px;
  padding: 6px 24px;
  backdrop-filter: blur(4px);
}

/* ============================
   BUTTONS
   ============================ */
.btn-start {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--white);
  background: linear-gradient(135deg, var(--cyan) 0%, #0290B0 100%);
  border: none;
  border-radius: 60px;
  padding: clamp(14px, 2.5vh, 20px) clamp(36px, 8vw, 72px);
  cursor: pointer;
  box-shadow: 0 8px 0 #0270A0, 0 12px 20px rgba(4,179,214,0.4);
  transition: transform 0.1s, box-shadow 0.1s;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn-start::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: skewX(-20deg);
  animation: shimmer 2.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { left: -100%; }
  100% { left: 200%; }
}

.btn-start:hover, .btn-start:focus {
  transform: translateY(-3px);
  box-shadow: 0 10px 0 #0270A0, 0 16px 28px rgba(4,179,214,0.5);
  outline: none;
}

.btn-start:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #0270A0, 0 6px 12px rgba(4,179,214,0.3);
}

.btn-secondary {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 700;
  color: var(--blue-dark);
  background: rgba(255,255,255,0.6);
  border: 2px solid rgba(28,58,110,0.2);
  border-radius: 40px;
  padding: 10px 28px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s, transform 0.1s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.85);
  transform: translateY(-2px);
}

/* ============================
   HINT TEXT
   ============================ */
.hint-text {
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  font-weight: 600;
  color: rgba(28,58,110,0.7);
  text-align: center;
}

#hint-mobile { display: none; }

@media (pointer: coarse) {
  #hint-desktop { display: none; }
  #hint-mobile  { display: block; }
}

/* ============================
   HUD (in-game)
   ============================ */
#screen-game {
  background: var(--sky-top);
  flex-direction: column;
  justify-content: flex-start;
  padding: 0;
}

.hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(8px, 2vw, 16px) clamp(16px, 4vw, 32px);
  background: var(--blue-dark);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 20;
  flex-shrink: 0;
}

.hud-score, .hud-best {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: clamp(0.55rem, 1.5vw, 0.75rem);
  font-weight: 700;
  color: var(--cyan-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-value {
  font-family: var(--font-title);
  font-size: clamp(1.3rem, 4vw, 2rem);
  color: var(--white);
  min-width: 60px;
  text-align: center;
  transition: transform 0.1s;
}

.hud-value.pop {
  animation: scorePop 0.2s ease-out;
}

@keyframes scorePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); color: var(--yellow); }
  100% { transform: scale(1); }
}

.voike-brand {
  font-family: var(--font-title);
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  color: var(--cyan);
  letter-spacing: 0.04em;
}

/* ============================
   CANVAS
   ============================ */
.canvas-wrap {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

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

.tap-hint {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(28,58,110,0.75);
  color: var(--white);
  font-family: var(--font-title);
  font-size: clamp(1rem, 3vw, 1.3rem);
  padding: 8px 24px;
  border-radius: 40px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  display: none;
}

@media (pointer: coarse) {
  .tap-hint { display: block; }
}

/* ============================
   GAME OVER SCREEN
   ============================ */
.gameover-content {
  gap: clamp(10px, 2vh, 18px);
}

.gameover-bird {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gameover-char {
  width: clamp(100px, 18vw, 180px);
  filter:
    drop-shadow(0 12px 24px rgba(0,0,0,0.2))
    hue-rotate(0deg);
  animation: tiltCrash 0.5s ease-out forwards;
}

@keyframes tiltCrash {
  0%   { transform: rotate(0deg) scale(1); }
  30%  { transform: rotate(-20deg) scale(0.9); }
  60%  { transform: rotate(15deg) scale(1.05); }
  100% { transform: rotate(-8deg) scale(1); }
}

.stars-anim {
  font-size: clamp(1.4rem, 4vw, 2rem);
  animation: starsBounce 0.6s ease-out forwards;
  opacity: 0;
  animation-delay: 0.3s;
}

@keyframes starsBounce {
  0%   { opacity: 0; transform: scale(0) translateY(-10px); }
  60%  { opacity: 1; transform: scale(1.3) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.gameover-title {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 7vw, 4rem);
  color: var(--blue-dark);
  -webkit-text-stroke: 2px rgba(255,255,255,0.5);
  filter: drop-shadow(0 3px 0 rgba(255,255,255,0.5));
}

.gameover-msg {
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 700;
  color: var(--blue-dark);
  text-align: center;
  background: rgba(255,255,255,0.6);
  border-radius: 40px;
  padding: 6px 20px;
  backdrop-filter: blur(4px);
}

/* ============================
   SCORE CARDS
   ============================ */
.score-cards {
  display: flex;
  gap: 16px;
}

.score-card {
  background: rgba(255,255,255,0.65);
  border: 2px solid rgba(28,58,110,0.1);
  border-radius: 20px;
  padding: clamp(10px, 2vw, 18px) clamp(20px, 4vw, 40px);
  text-align: center;
  backdrop-filter: blur(6px);
  flex: 1;
}

.score-card.highlight {
  background: linear-gradient(135deg, rgba(4,179,214,0.2), rgba(28,58,110,0.15));
  border-color: var(--cyan);
}

.score-card-label {
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  font-weight: 700;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.score-card-value {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--blue-dark);
}

/* ============================
   NEW RECORD BADGE
   ============================ */
.new-record-badge {
  font-family: var(--font-title);
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--white);
  background: linear-gradient(135deg, var(--yellow) 0%, var(--orange) 100%);
  border-radius: 40px;
  padding: 8px 24px;
  box-shadow: 0 4px 0 var(--yellow-dark), 0 8px 16px rgba(255,176,0,0.4);
  display: none;
  animation: badgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.new-record-badge.show {
  display: block;
}

@keyframes badgePop {
  0%   { transform: scale(0) rotate(-10deg); }
  70%  { transform: scale(1.15) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ============================
   RESPONSIVE ADJUSTMENTS
   ============================ */
@media (max-width: 480px) {
  .score-cards {
    flex-direction: column;
    width: 100%;
    max-width: 280px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .hero-char { width: 100px; }
  .game-title { font-size: 2.2rem; }
  .screen-content { gap: 8px; padding: 12px; }
  .gameover-char { width: 80px; }
}

/* ============================
   FLASH EFFECT (collision)
   ============================ */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,60,60,0.4);
  pointer-events: none;
  opacity: 0;
  z-index: 999;
  animation: flashIn 0.35s ease-out forwards;
}

@keyframes flashIn {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================
   SCROLLBAR HIDE
   ============================ */
::-webkit-scrollbar { display: none; }
