/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #2ecc71;
  --dark-green: #1a7a43;
  --sand: #e8c87a;
  --sky: #87CEEB;
  --white: #fff;
  --ui-bg: rgba(10,20,10,0.82);
  --radius: 18px;
  --font-display: 'Georgia', serif;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0d1f0d;
  font-family: 'Trebuchet MS', sans-serif;
  color: #fff;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
}

/* ===================== SCREENS ===================== */
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.screen.active {
  display: flex; opacity: 1; pointer-events: all;
}

/* ===================== MENU SCREEN ===================== */
#screen-menu {
  background: linear-gradient(160deg, #0a2a0a 0%, #1a4a1a 50%, #0a1a2a 100%);
  position: relative; overflow: hidden;
}
.menu-bg {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(46,204,113,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(52,152,219,0.12) 0%, transparent 50%);
}
.menu-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  padding: 40px 20px;
}
.logo {
  font-size: clamp(52px, 12vw, 96px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  text-align: center;
}
.logo-mini {
  color: #a8e6bf;
  font-size: 0.45em;
  display: block;
  letter-spacing: 8px;
  font-weight: 400;
}
.logo-golf {
  color: #2ecc71;
  text-shadow: 0 0 40px rgba(46,204,113,0.5);
  display: block;
}
.logo-3d {
  color: #f39c12;
  font-size: 0.35em;
  display: block;
  letter-spacing: 12px;
}
.tagline {
  color: rgba(255,255,255,0.55);
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Floating decorative balls */
.floating-balls { position: absolute; inset: 0; pointer-events: none; }
.fb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0%, rgba(46,204,113,0.8) 30%, #1a7a43 100%);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: floatBall linear infinite;
}
.fb1 { width: 60px; height: 60px; left: 8%; top: 15%; animation-duration: 8s; opacity: 0.6; }
.fb2 { width: 40px; height: 40px; right: 12%; top: 25%; animation-duration: 11s; animation-delay: -3s; opacity: 0.5; }
.fb3 { width: 80px; height: 80px; right: 5%; bottom: 20%; animation-duration: 14s; animation-delay: -6s; opacity: 0.4; }
@keyframes floatBall {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(180deg); }
}

/* ===================== BUTTONS ===================== */
.btn-primary {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(46,204,113,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 200px;
  touch-action: manipulation;
}
.btn-primary:active { transform: scale(0.96); box-shadow: 0 2px 8px rgba(46,204,113,0.3); }

.btn-secondary {
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  padding: 13px 36px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 160px;
  touch-action: manipulation;
}
.btn-secondary:active { background: rgba(255,255,255,0.08); }

.btn-back {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 15px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-hud-back {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  z-index: 20;
  touch-action: manipulation;
}
.btn-hud-cam {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 18px;
  cursor: pointer;
  z-index: 20;
  touch-action: manipulation;
}

/* ===================== COURSE SELECT ===================== */
#screen-course {
  background: linear-gradient(160deg, #0a2a0a 0%, #1a3a1a 100%);
  padding: 20px;
  gap: 0;
  justify-content: flex-start;
}
.course-header {
  display: flex; align-items: center; gap: 16px;
  width: 100%; padding: 16px 0 24px;
}
.course-header h2 { font-size: 22px; font-weight: 700; }
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 600px;
}
.world-card {
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  touch-action: manipulation;
}
.world-card:active, .world-card:hover { background: rgba(46,204,113,0.15); border-color: rgba(46,204,113,0.5); transform: scale(1.03); }
.world-icon { font-size: 42px; }
.world-name { font-size: 18px; font-weight: 700; }
.world-holes { font-size: 12px; color: rgba(255,255,255,0.5); letter-spacing: 1px; }
.world-diff { font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 700; letter-spacing: 1px; }
.easy { background: rgba(46,204,113,0.25); color: #2ecc71; }
.medium { background: rgba(241,196,15,0.25); color: #f1c40f; }
.hard { background: rgba(52,152,219,0.25); color: #3498db; }
.expert { background: rgba(231,76,60,0.25); color: #e74c3c; }

/* ===================== HOW TO PLAY ===================== */
#screen-how {
  background: linear-gradient(160deg, #0a2a0a 0%, #1a3a1a 100%);
  padding: 20px;
  justify-content: flex-start;
  gap: 0;
}
.how-content { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 480px; padding-top: 10px; }
.how-step { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,0.06); border-radius: var(--radius); padding: 18px 20px; }
.how-icon { font-size: 30px; flex-shrink: 0; }
.how-text { font-size: 15px; line-height: 1.5; color: rgba(255,255,255,0.85); }

/* ===================== GAME SCREEN ===================== */
#screen-game { background: #000; }
#gameCanvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; touch-action: none; }

/* ===================== HUD ===================== */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 56px 16px 16px;
  pointer-events: none;
  z-index: 10;
}
#hud-left, #hud-right {
  background: var(--ui-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 12px 18px;
  text-align: center;
  min-width: 70px;
  backdrop-filter: blur(10px);
}
.hud-label { font-size: 10px; letter-spacing: 2px; color: rgba(255,255,255,0.45); text-transform: uppercase; }
.hud-value { font-size: 28px; font-weight: 900; color: #2ecc71; line-height: 1; }
#hud-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hud-world {
  background: var(--ui-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.8);
  backdrop-filter: blur(10px);
}
.power-bar-wrap {
  background: var(--ui-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  backdrop-filter: blur(10px);
  min-width: 120px;
  opacity: 0; transition: opacity 0.2s;
}
.power-bar-wrap.visible { opacity: 1; }
.power-bar-track {
  width: 100px; height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px; overflow: hidden;
}
.power-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #2ecc71, #f39c12, #e74c3c);
  border-radius: 4px;
  transition: width 0.05s;
}
.power-label { font-size: 9px; letter-spacing: 2px; color: rgba(255,255,255,0.45); }

/* ===================== MESSAGES ===================== */
#message-overlay, #scorecard-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 30;
  backdrop-filter: blur(4px);
}
#message-overlay.hidden, #scorecard-overlay.hidden { display: none; }
#message-box, #scorecard {
  background: linear-gradient(135deg, rgba(10,30,10,0.98), rgba(20,40,20,0.98));
  border: 1.5px solid rgba(46,204,113,0.4);
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  max-width: 320px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#message-emoji { font-size: 52px; }
#message-title { font-size: 28px; font-weight: 900; color: #2ecc71; }
#message-sub { font-size: 14px; color: rgba(255,255,255,0.6); }
#scorecard h2 { font-size: 26px; }
#scorecard-rows { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.sc-row {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.06); border-radius: 10px; padding: 10px 14px;
  font-size: 14px;
}
.sc-hole { color: rgba(255,255,255,0.5); font-size: 12px; }
.sc-score { font-weight: 700; font-size: 18px; }
.sc-score.under { color: #2ecc71; }
.sc-score.over { color: #e74c3c; }
.sc-score.par { color: #f39c12; }
#scorecard-total { font-size: 20px; font-weight: 900; border-top: 1px solid rgba(255,255,255,0.15); padding-top: 14px; width: 100%; text-align: center; }
