/* Authentic Golf Championship Theme - Responsive & Broadcast Polish */
:root {
  --golf-green-dark: #0f2e1b;
  --golf-green-mid: #1b4332;
  --golf-green-light: #2d6a4f;
  --golf-fairway: #40916c;
  --golf-gold: #d4af37;
  --golf-gold-hover: #f3c64c;
  --golf-cream: #fdfbf7;
  --text-dark: #1e293b;
  --text-light: #f8fafc;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
  background-color: #0b1f13;
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 8px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* App Container */
.game-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #143522;
  border: 2px solid #235338;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 100%;
  max-width: 620px;
}

/* Header & HUD */
.golf-header {
  width: 100%;
  background: linear-gradient(180deg, #102e1c 0%, #0d2617 100%);
  border-bottom: 2px solid var(--golf-gold);
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.course-branding {
  display: flex;
  align-items: center;
  gap: 8px;
}

.club-crest {
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.course-title h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--golf-gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.course-title span {
  font-size: 11px;
  color: #a7d7b5;
}

.hole-hud {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.hud-pill {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 6px;
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 54px;
}

.hud-pill .label {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hud-pill .value {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.hud-pill.highlight .value {
  color: var(--golf-gold);
}

/* Wind Widget */
.wind-pill {
  min-width: 64px;
}

.wind-val-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wind-compass-arrow {
  display: inline-block;
  color: var(--golf-gold);
  font-size: 13px;
  font-weight: 800;
  transition: transform 0.4s ease-out;
}

.header-controls {
  display: flex;
  gap: 6px;
}

.nav-btn {
  background: #1b4332;
  border: 1px solid #377d5b;
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: #2d6a4f;
  border-color: var(--golf-gold);
  transform: translateY(-1px);
}

/* Canvas Area - Fluid & Responsive */
.canvas-container {
  position: relative;
  width: 100%;
  height: clamp(480px, 64vh, 660px);
  background-color: #1e3f1a;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

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

/* Information Floating Overlay */
.info-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(10, 25, 15, 0.82);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  display: flex;
  gap: 10px;
  color: #e2e8f0;
  pointer-events: none;
  z-index: 5;
}

.info-overlay strong {
  color: var(--golf-gold);
}

.record-badge {
  color: #a7d7b5;
  border-left: 1px solid rgba(212, 175, 55, 0.3);
  padding-left: 8px;
}

/* Camera Toolbar */
.cam-toolbar {
  position: absolute;
  bottom: 12px;
  left: 10px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.cam-btn {
  background: rgba(15, 38, 24, 0.82);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: #ffffff;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
}

.cam-btn.zoom {
  font-size: 14px;
  font-weight: 800;
  padding: 3px 9px;
}

.cam-btn:hover {
  background: rgba(45, 106, 79, 0.9);
  border-color: var(--golf-gold);
  transform: translateY(-1px);
}

/* Bottom Controls */
.golf-footer {
  width: 100%;
  background: linear-gradient(180deg, #102e1c 0%, #0d2617 100%);
  border-top: 2px solid #235338;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Club Selector */
.club-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.club-btn {
  background: #183e29;
  border: 1.5px solid #2c6343;
  color: #e2e8f0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s ease;
  min-width: 64px;
}

.club-btn span.key {
  font-size: 9px;
  color: #8fb99e;
}

.club-btn:hover {
  background: #235639;
  border-color: #55a278;
}

.club-btn.active {
  background: linear-gradient(180deg, #2b6c49 0%, #1c4b32 100%);
  border-color: var(--golf-gold);
  color: var(--golf-gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

/* Power Bar & Swing Button */
.swing-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
  min-width: 220px;
}

.power-meter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 120px;
}

.power-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #a7d7b5;
  font-weight: 600;
}

.power-track {
  width: 100%;
  height: 14px;
  background: #09170e;
  border-radius: 7px;
  border: 1px solid #28573b;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.power-fill {
  height: 100%;
  width: 65%;
  background: linear-gradient(90deg, #22c55e 0%, #eab308 70%, #ef4444 100%);
  border-radius: 6px;
  transition: width 0.05s ease-out;
  pointer-events: none;
}

.shoot-btn {
  background: linear-gradient(180deg, #d4af37 0%, #b89327 100%);
  border: 1px solid #f3c64c;
  color: #0d2617;
  font-size: 13px;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}

.shoot-btn:hover {
  background: linear-gradient(180deg, #f3c64c 0%, #d4af37 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(212, 175, 55, 0.4);
}

.shoot-btn:active {
  transform: translateY(0);
}

.instructions-hint {
  font-size: 11px;
  color: #7fad8f;
  text-align: center;
}

.instructions-hint kbd {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
  font-size: 10px;
  color: #ffffff;
}

/* Modals & Overlays */
.overlay-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 28, 17, 0.96);
  border: 2px solid var(--golf-gold);
  border-radius: 12px;
  padding: 22px 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-banner h2 {
  font-size: 26px;
  color: var(--golf-gold);
  letter-spacing: 1px;
}

.overlay-banner p {
  font-size: 14px;
  color: #e2e8f0;
}

.hazard-alert {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(185, 28, 28, 0.92);
  border: 2px solid #f87171;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  animation: bounceAlert 0.4s ease;
}

/* Scorecard Modal */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: #0d2617;
  border: 2px solid var(--golf-gold);
  border-radius: 10px;
  padding: 18px;
  width: 92%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #235338;
  padding-bottom: 8px;
}

.modal-header h3 {
  color: var(--golf-gold);
  font-size: 17px;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}

.scorecard-table th {
  background: #143823;
  color: #a7d7b5;
  padding: 6px 8px;
  text-align: center;
  border: 1px solid #235338;
}

.scorecard-table td {
  padding: 5px 8px;
  text-align: center;
  border: 1px solid #235338;
  color: #e2e8f0;
}

.scorecard-table td:nth-child(2) {
  text-align: left;
}

.score-cell.ace {
  background: #fbbf24;
  color: #000;
  font-weight: 800;
}

.score-cell.eagle {
  background: #10b981;
  color: #000;
  font-weight: 800;
}

.score-cell.birdie {
  background: #34d399;
  color: #000;
  font-weight: 700;
}

.score-cell.par {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.score-cell.bogey {
  background: #f87171;
  color: #000;
  font-weight: 700;
}

.score-cell.double-bogey {
  background: #ef4444;
  color: #fff;
  font-weight: 800;
}

.scorecard-total-row {
  font-weight: 700;
  color: var(--golf-gold);
  font-size: 14px;
  margin-bottom: 12px;
  text-align: right;
}

.hidden {
  display: none !important;
}

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes bounceAlert {
  0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* =========================================================
   Virtual Aim Joystick (touch-only)
   ========================================================= */
.vjoy-wrapper {
  position: absolute;
  bottom: 18px;
  right: 14px;
  z-index: 20;
  pointer-events: auto;
}

.vjoy-base {
  position: relative;
  width: 100px;
  height: 100px;
  pointer-events: auto;
  touch-action: none;
}

.vjoy-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(15, 46, 28, 0.55);
  border: 2px solid rgba(212, 175, 55, 0.55);
  backdrop-filter: blur(4px);
}

.vjoy-knob {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #f3c64c, #d4af37 60%, #8a6f1e);
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  transition: box-shadow 0.1s ease;
}

.vjoy-knob:active {
  cursor: grabbing;
  box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.25), 0 3px 10px rgba(0,0,0,0.5);
}

.vjoy-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: rgba(212, 175, 55, 0.8);
  letter-spacing: 1px;
  pointer-events: none;
}

/* =========================================================
   Two-finger pan hint
   ========================================================= */
.pan-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 28, 17, 0.88);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 30;
  animation: fadeOutHint 2.8s ease forwards;
}

@keyframes fadeOutHint {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* =========================================================
   Mobile Responsiveness
   ========================================================= */
@media (max-width: 580px) {
  body {
    padding: 0;
  }
  .game-wrapper {
    border-radius: 0;
    border: none;
    height: 100vh;
  }
  .golf-header {
    padding: 6px 10px;
  }
  .course-title h1 {
    font-size: 13px;
  }
  .hud-pill {
    min-width: 44px;
    padding: 3px 5px;
  }
  .hud-pill .value {
    font-size: 11px;
  }
  .hud-pill .label {
    font-size: 8px;
  }
  .canvas-container {
    height: 54vh;
  }

  /* Larger club buttons on mobile */
  .club-btn {
    min-width: 68px;
    padding: 8px 7px;
    font-size: 12px;
    min-height: 48px;
  }

  /* Taller power bar — easier to hit with thumb */
  .power-track {
    height: 22px;
    border-radius: 11px;
  }
  .power-fill {
    border-radius: 10px;
  }
  .power-meter-wrapper {
    width: 110px;
  }

  /* Bigger SWING button */
  .shoot-btn {
    padding: 12px 20px;
    font-size: 14px;
    min-height: 48px;
    min-width: 120px;
    border-radius: 10px;
  }

  .instructions-hint {
    font-size: 9.5px;
  }

  /* Show virtual joystick on touch screens */
  .vjoy-wrapper {
    display: block !important;
  }
}

/* Show virtual joystick on all screens up to 768px */
@media (max-width: 768px) {
  .vjoy-wrapper {
    display: block !important;
  }
}

/* Hide joystick entirely on desktop non-touch / pointer:fine devices */
@media (pointer: fine) and (min-width: 769px) {
  .vjoy-wrapper {
    display: none !important;
  }
}

/* =========================================================
   Visual Quick Onboarding (CrazyGames Quality Standard)
   ========================================================= */
.onboarding-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 18, 10, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 16px;
  animation: popIn 0.25s ease-out;
}

.onboarding-card {
  background: linear-gradient(180deg, #102e1c 0%, #0a1f13 100%);
  border: 2px solid var(--golf-gold);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  padding: 18px 20px;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.onboarding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.onboarding-badge {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--golf-gold);
  color: var(--golf-gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 6px;
}

.onboarding-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.onboarding-close-btn:hover {
  color: #ffffff;
}

.onboarding-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.onboarding-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
}

.onboarding-item .item-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.onboarding-item .item-info strong {
  font-size: 12px;
  color: var(--golf-gold);
  display: block;
}

.onboarding-item .item-info p {
  font-size: 11px;
  color: #cbd5e1;
  margin: 0;
}

.desk-key {
  color: #86efac;
  font-weight: 600;
  font-family: monospace;
}

.onboarding-start-btn {
  background: linear-gradient(180deg, #d4af37 0%, #b89327 100%);
  border: 1px solid #f3c64c;
  color: #0d2617;
  font-size: 13px;
  font-weight: 800;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}

.onboarding-start-btn:hover {
  background: linear-gradient(180deg, #f3c64c 0%, #d4af37 100%);
  transform: translateY(-1px);
}

