* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

body {
  background-image: url('assets/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: #2f2c25;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #e7dcda;
  cursor: none;
  overflow: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(231,220,218,0.15), transparent),
    radial-gradient(1px 1px at 40px 70px, rgba(231,220,218,0.1), transparent),
    radial-gradient(1px 1px at 50px 160px, rgba(231,220,218,0.15), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(231,220,218,0.1), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(231,220,218,0.15), transparent),
    radial-gradient(1px 1px at 160px 120px, rgba(231,220,218,0.1), transparent);
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 0;
}

.leaderboard{
  position: fixed;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  padding: 18px 18px 14px;
  z-index: 6;

  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 18px;

  box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.25);
  color: #333;
}

.lb-title{
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 14px;
  color: rgba(0,0,0,0.7);
  margin-bottom: 10px;
  text-align: center;
}

.lb-save{
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

#lbName{
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  outline: none;
  color: #333;
  font-weight: 700;
}

#lbName::placeholder{
  color: rgba(0,0,0,0.45);
  font-weight: 600;
}

#lbSaveBtn{
  width: 88px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 1px;
  color: #333;
  transition: all .2s ease;
  white-space: nowrap;
}

#lbSaveBtn:hover{
  background: rgba(255,255,255,0.4);
  transform: translateY(-1px);
}

#lbSaveBtn:disabled{
  opacity: 0.75;
  cursor: default;
  transform: none;
}

.lb-hint{
  text-align: center;
  font-size: 12px;
  color: rgba(0,0,0,0.55);
  margin-bottom: 12px;
  font-weight: 700;
}

.lb-list{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-row{
  display: grid;
  grid-template-columns: 46px 1fr 60px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}

.lb-rank{
  font-weight: 900;
  color: rgba(0,0,0,0.55);
}

.lb-name{
  font-weight: 900;
  color: rgba(0,0,0,0.75);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
}

.lb-score{
  text-align: right;
  font-weight: 900;
  color: rgba(0,0,0,0.75);
}

.lb-row.top1{
  background: linear-gradient(135deg, rgba(255,233,168,0.75), rgba(255,245,209,0.65));
  border-color: rgba(255,233,168,0.55);
}

.lb-row.you{
  border: 2px solid rgba(142,202,230,0.95);
  background: rgba(142,202,230,0.18);
}

.lb-rankline{
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: rgba(0,0,0,0.62);
  font-weight: 900;
  min-height: 16px;
}

@media (max-width: 1100px){
  .leaderboard{
    left: 14px;
    width: 260px;
  }
}
@media (max-width: 900px){
  .leaderboard{
    position: static;
    transform: none;
    width: min(420px, 92vw);
    margin: 12px auto 0;
  }
}

.game-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  position: relative;
  z-index: 1;
}

header {
  margin-bottom: 30px;
}

h1 {
  font-size: 3rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 10px rgba(0,0,0,0.3);
  margin-bottom: 20px;
  color: #ffffff;
  letter-spacing: 2px;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.stat {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.3);
  border: 1px solid rgba(255,255,255,0.3);
}

.stat .label {
  color: rgba(0,0,0,0.6);
  margin-right: 10px;
  font-weight: 500;
}

.stat span:last-child {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333333;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 600px;
  margin: 0 auto 30px;
  padding: 30px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.25);
}

.hole {
  width: 150px;
  height: 150px;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.6) 0%, rgba(50,50,50,0.4) 70%, rgba(100,100,100,0.2) 100%);
  border-radius: 50%;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 10px 25px rgba(0,0,0,0.5),
              inset 0 -5px 15px rgba(255,255,255,0.1),
              0 5px 15px rgba(0,0,0,0.2);
  border: 3px solid rgba(255,255,255,0.2);
}

.hole::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30%;
  background: linear-gradient(to top, rgba(100,100,100,0.5), transparent);
  border-radius: 0 0 50% 50%;
  pointer-events: none;
}

.creature {
  position: absolute;
  bottom: -130%;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 130px;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
  transition: bottom 0.15s ease-out;
  cursor: none;
  z-index: 1;
}

.creature.show { bottom: -5%; }

.creature.good { filter: drop-shadow(0 5px 15px rgba(231,220,218,0.5)); }
.creature.bad { filter: drop-shadow(0 5px 15px rgba(180,80,80,0.6)); }

.creature.hit {
  animation: hitEffect 0.3s ease-out forwards;
  transition: none;
}

.creature.bad-hit {
  animation: badHitEffect 0.5s ease-out forwards;
  transition: none;
}

@keyframes hitEffect {
  0% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.3) rotate(10deg); }
  100% { transform: translateX(-50%) scale(0); bottom: -100%; }
}

@keyframes badHitEffect {
  0% { transform: translateX(-50%) scale(1); }
  25% { transform: translateX(-50%) scale(1.2); }
  50% { transform: translateX(-50%) scale(1.2) rotate(-10deg); }
  75% { transform: translateX(-50%) scale(1.2) rotate(10deg); }
  100% { transform: translateX(-50%) scale(1); }
}

.controls { margin-bottom: 10px; }

#startBtn {
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #333333;
  border: none;
  padding: 15px 50px;
  font-size: 1.3rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3);
  border: 2px solid rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
}

#startBtn:hover {
  background: rgba(255,255,255,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
  border-color: rgba(255,255,255,0.6);
}

#startBtn.hidden { display: none; }

.message {
  font-size: 1.5rem;
  min-height: 50px;
  padding: 12px 30px;
  color: #333333;
  font-weight: bold;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.4);
  display: inline-block;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.message.visible { opacity: 1; transform: scale(1); }

.message.positive {
  color: #2e7d32;
  background: rgba(144,238,144,0.3);
  border-color: rgba(144,238,144,0.5);
  animation: popIn 0.3s ease-out;
}

.message.negative {
  color: #c62828;
  background: rgba(255,107,107,0.3);
  border-color: rgba(255,107,107,0.5);
  animation: shake 0.5s ease-out;
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-10px); }
  40%,80% { transform: translateX(10px); }
}

.hammer {
  position: fixed;
  width: 50px;
  height: 50px;
  pointer-events: none;
  z-index: 1000;
  background-image: url('assets/bonk.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: translate(-50%, -50%) rotate(-30deg);
  transition: transform 0.08s ease-out;
  filter: drop-shadow(3px 3px 8px rgba(0,0,0,0.7));
}

.hammer.hit {
  transform: translate(-50%, -50%) rotate(30deg) scale(1.1);
}

.screen-shake { animation: screenShake 0.3s ease-out; }

@keyframes screenShake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-5px,5px); }
  40% { transform: translate(5px,-5px); }
  60% { transform: translate(-5px,-5px); }
  80% { transform: translate(5px,5px); }
}

.points-popup {
  position: absolute;
  font-size: 1.5rem;
  font-weight: bold;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
  z-index: 100;
}

.points-popup.positive {
  color: #e7dcda;
  text-shadow: 0 0 10px rgba(231,220,218,0.8);
}

.points-popup.negative {
  color: #c87070;
  text-shadow: 0 0 10px rgba(200,112,112,0.8);
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-50px) scale(1.5); }
}

@media (max-width: 650px) {
  .hole { width: 100px; height: 100px; }
  .creature { width: 60px; height: 60px; font-size: 35px; }
  h1 { font-size: 2rem; }
  .game-board { gap: 10px; padding: 15px; }
  .stats { gap: 15px; }
  .stat { padding: 10px 20px; }
}
