/* Basic reset */
* { box-sizing: border-box; }
html, body { 
  height: 100%; 
  margin: 0;
  padding: 0;
}
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0b2239; /* deep blue */
  color: #fff;
  /* Prevent text selection and zoom on mobile */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* Mobile full screen body */
@media (max-width: 767px), (max-height: 767px) {
  html, body {
    height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
  }
}

#game-root {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Prevent overscroll on mobile */
  overscroll-behavior: none;
}

/* Mobile full-screen adjustments - FORCE FULL SCREEN */
@media (max-width: 767px), (max-height: 767px) {
  #game-root {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: #0b2239 !important;
  }
}

canvas#game {
  /* Better touch handling */
  touch-action: none;
  background: #1a4d7a; /* river tint; actual river drawn in canvas */
  /* Default desktop sizing */
  width: min(100vw, 560px);
  height: calc(min(100vw, 560px) * (800/480));
  max-height: 95vh;
  border-radius: 16px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

/* Mobile: fill entire screen */
@media (max-width: 767px) {
  canvas#game {
    position: absolute !important;
    top: 60px !important; /* Space for HUD */
    left: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 60px) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 1 !important;
  }
  
  @supports (height: 100dvh) {
    canvas#game {
      height: calc(100dvh - 60px) !important;
    }
  }
}

#hud {
  width: 100%;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

/* Mobile full-screen HUD */
@media (max-width: 767px) {
  #hud {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    z-index: 100 !important;
    background: transparent !important;
  }
}

/* Mobile HUD adjustments */
@media (max-width: 767px) {
  #hud {
    top: 4px;
    width: 90%;
    max-width: none;
  }
}

#hud.visible {
  opacity: 1;
  visibility: visible;
}

.hud-bar {
  background-color: rgb(39, 39, 39);
  border-radius: 30px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
}

/* Mobile HUD bar adjustments */
@media (max-width: 767px) {
  .hud-bar {
    padding: 10px 16px !important;
    gap: 16px !important;
    border-radius: 0 !important;
    width: 100vw !important;
    justify-content: space-between !important;
    margin: 0 !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
  }
  
  .hud-item {
    font-size: 13px;
    gap: 4px;
  }
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.hud-label {
  opacity: 0.8;
}

.hud-value {
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* Mobile responsive HUD */
@media (max-width: 768px) {
  .hud-bar {
    padding: 8px 12px;
    gap: 12px;
  }
  
  .hud-item {
    font-size: 12px;
    gap: 4px;
  }
  
  .hud-value {
    min-width: 30px;
  }
  
  .toggleSwitch {
    width: 32px;
    height: 32px;
  }
  
  .speaker svg, .mute-speaker svg {
    width: 14px;
  }
}

.hud-value {
  color: white;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.hud-label {
  color: rgba(255, 255, 255, 0.7);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 8px;
  font-weight: 400;
  line-height: 1;
  margin-top: 2px;
}

.shield-item .shield-indicator {
  font-size: 20px;
  line-height: 1;
}

.music-item {
  background: none !important;
}

.music-item .toggleSwitch {
  margin: 0;
}

.music-item .hud-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
}

#hud button {
  pointer-events: auto; /* Enable clicks for buttons inside HUD */
}

#hud input[type="checkbox"] {
  pointer-events: auto; /* Enable clicks for checkboxes inside HUD */
}

#hud label {
  pointer-events: auto; /* Enable clicks for labels inside HUD */
}

/* Override any pointer-events blocking for music controls */
#checkboxInput, .toggleSwitch {
  pointer-events: auto !important;
  z-index: 9999 !important;
}

/* Music control container */
#music-control {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: auto;
}

.cal { 
  font-size: 12px; 
  opacity: 0.9; 
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
}

.shield-indicator {
  margin-left: 8px !important;
  font-size: 16px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  animation: shield-pulse 2s infinite;
}

@keyframes shield-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.1); opacity: 1; }
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 14px;
  opacity: 0.8;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Duck Surfers animated loader */
.loader {
  max-width: fit-content;
  color: rgb(242, 255, 240);
  font-size: 50px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  position: relative;
  font-style: italic;
  font-weight: 600;
  margin-bottom: 20px;
}
.loader span {
  animation: cut 2s 2; /* 2 cycles, then stop */
  animation-fill-mode: forwards; /* Keep final state */
  transition: 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.loader:hover {
  color: #fcffdf;
}
.loader::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background-color: #ff828291;
  top: 0px;
  filter: blur(10px);
  animation: scan 2s 1, scanWithDisappear 2s 1 2s; /* First cycle normal, second cycle with disappear */
  animation-fill-mode: forwards; /* Keep final state */
  left: 0;
  z-index: 0;
  transition: 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.loader::before {
  position: absolute;
  content: "";
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background-color: #ff8282;
  top: 0px;
  animation: scan 2s 1, scanWithDisappear 2s 1 2s; /* First cycle normal, second cycle with disappear */
  animation-fill-mode: forwards; /* Keep final state */
  left: 0;
  z-index: 1;
  filter: opacity(0.9);
  transition: 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes scan {
  0% {
    top: 0px;
  }
  25% {
    top: 54px;
  }
  50% {
    top: 0px;
  }
  75% {
    top: 54px;
  }
  100% {
    top: 0px;
  }
}

@keyframes scanWithDisappear {
  0% {
    top: 0px;
    width: 100%;
    left: 0;
    opacity: 1;
  }
  25% {
    top: 54px;
    width: 100%;
    left: 0;
    opacity: 1;
  }
  50% {
    top: 0px;
    width: 100%;
    left: 0;
    opacity: 1;
  }
  75% {
    top: 54px;
    width: 100%;
    left: 0;
    opacity: 1;
  }
  85% {
    top: 0px;
    width: 100%;
    left: 0;
    opacity: 1;
  }
  95% {
    top: 0px;
    width: 10%;
    left: 45%;
    opacity: 0.5;
  }
  100% {
    top: 0px;
    width: 0%;
    left: 50%;
    opacity: 0;
  }
}

/* Music toggle switch */
#checkboxInput {
  display: none;
}

.toggleSwitch {
  display: inline-block;
  cursor: pointer;
  margin-left: 15px;
  width: 30px;
  height: 30px;
  position: relative;
  pointer-events: auto;
}

.speaker,
.mute-speaker {
  width: 100%;
  height: 100%;
  transition: opacity 0.3s ease;
}

.speaker svg,
.mute-speaker svg {
  width: 100%;
  height: 100%;
}

/* Show speaker by default (unmuted) */
.speaker {
  opacity: 1;
}

.mute-speaker {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

/* When checked (muted), show mute icon */
#checkboxInput:checked + .toggleSwitch .speaker {
  opacity: 0;
}

#checkboxInput:checked + .toggleSwitch .mute-speaker {
  opacity: 1;
}

.toggleSwitch:hover {
  transform: scale(1.1);
  transition: transform 0.2s;
}

#hud button,
#hud label {
  pointer-events: auto; /* Enable clicks for buttons and labels inside HUD */
}

@keyframes cut {
  0% {
    clip-path: inset(0 0 0 0);
  }
  25% {
    clip-path: inset(100% 0 0 0);
  }
  50% {
    clip-path: inset(0 0 100% 0);
  }
  75% {
    clip-path: inset(0 0 0 0);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.4);
}
.overlay.hidden { display: none; }

#leaderboard-overlay .outer-box {
  position: relative;
  overflow: hidden;
}

/* Mobile overlay adjustments */
@media (max-width: 767px) {
  .overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1000 !important;
  }
}

/* Generic hidden utility */
.hidden { display: none !important; }

/* 3D Neomorphic Card/Outer Box */
.card {
  width: min(92vw, 520px);
  background: #f0f0f0;
  padding: 20px 20px 16px;
}

.outer-box {
  position: relative;
  background: #f0f0f0;
  border: 4px solid #000;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  transform-style: preserve-3d;
  transform: rotateX(2deg) rotateY(-2deg);
  perspective: 1000px;
  box-shadow: 20px 20px 0 -5px #e9b50b, 20px 20px 0 0 #000;
  z-index: 1;
}

.outer-box > * {
  position: relative;
  z-index: 2;
}

.outer-box::before {
  content: "DUCK SURFERS";
  position: absolute;
  top: -15px;
  left: 30px;
  background: #e9b50b;
  color: #000;
  font-weight: bold;
  padding: 5px 15px;
  font-size: 14px;
  transform: translateZ(50px);
  z-index: 4;
  border: 2px solid #000;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.shadow__outer {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  bottom: 0;
  z-index: -1;
  transform: translateZ(-50px);
  background: linear-gradient(
    45deg,
    rgba(233, 181, 11, 0.3) 0%,
    rgba(233, 181, 11, 0.1) 100%
  );
  filter: blur(25px);
}

.outer-box h2 {
  color: #000;
  font-size: 28px;
  margin: 0 0 20px 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 3px 3px 0 rgba(233, 181, 11, 0.3);
}

.outer-box p {
  color: #333;
  font-size: 16px;
  line-height: 1.6;
  margin: 12px 0;
  text-align: center;
}

.outer-box strong {
  color: #000;
  font-weight: 700;
}

.outer-box .controls {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  color: #333;
}

.outer-box .controls li {
  padding: 8px 0;
  text-align: center;
  font-size: 14px;
}

/* From Uiverse.io by vinodjangid07 */ 
/* The switch - the box around the speaker*/
.toggleSwitch {
  width: 40px;
  height: 40px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  cursor: pointer;
  transition-duration: .3s;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

/* Hide default HTML checkbox */
#checkboxInput {
  display: none;
}

.bell {
  width: 18px;
}

.bell path {
  fill: white;
}

.speaker {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition-duration: .3s;
}

.speaker svg {
  width: 18px;
}

.mute-speaker {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  z-index: 3;
  transition-duration: .3s;
}

.mute-speaker svg {
  width: 18px;
}

#checkboxInput:checked + .toggleSwitch .speaker {
  opacity: 0;
  transition-duration: .3s;
}

#checkboxInput:checked + .toggleSwitch .mute-speaker {
  opacity: 1;
  transition-duration: .3s;
}

#checkboxInput:active + .toggleSwitch {
  transform: scale(0.7);
}

#checkboxInput:hover + .toggleSwitch {
  background-color: rgb(61, 61, 61);
}
.card h1, .card h2 { margin: 0 0 8px; }
.card p { margin: 0 0 12px; opacity: 0.9; }
.fine { opacity: 0.6; }

.controls {
  margin: 8px 0 16px;
  padding-left: 18px;
}
.controls li { margin: 6px 0; }

button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: #17b890;
  color: #0b2239;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #0b8c70;
}
button:hover { 
  filter: brightness(1.05);
  transform: translateZ(0);
}
button:active { transform: translateY(1px); box-shadow: 0 1px 0 #0b8c70; }
button.secondary { background: #8aa7c4; box-shadow: 0 2px 0 #69839e; }
button.primary { background: #ffd166; box-shadow: 0 2px 0 #e6b34d; color: #0b2239; }

/* 3D Neomorphic Buttons */
.btn-3d {
  appearance: none;
  border: 3px solid #000;
  background: #17b890;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 14px 28px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
  transition: all 150ms cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
  transform: translateZ(0);
  box-shadow: 6px 6px 0 #000;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  display: inline-block;
  margin: 10px auto;
  will-change: transform;
  backface-visibility: hidden;
}

.btn-3d:hover {
  transform: translate(-1px, -1px) translateZ(0);
  box-shadow: 7px 7px 0 #000;
  background: #1acf9f;
}

.btn-3d:active {
  transform: translate(2px, 2px) translateZ(0);
  box-shadow: 4px 4px 0 #000;
}

.btn-3d.btn-primary:active {
  transform: translate(2px, 2px) translateZ(0);
  box-shadow: 4px 4px 0 #000;
}

.btn-3d.btn-primary {
  background: #e9b50b;
  color: #000;
}

.btn-3d.btn-primary:hover {
  background: #ffd700;
  transform: translate(-1px, -1px) translateZ(0);
  box-shadow: 7px 7px 0 #000;
}

.btn-3d.btn-secondary {
  background: #8aa7c4;
  color: #fff;
}

.btn-3d.btn-secondary:hover {
  background: #9bb8d5;
  transform: translate(-1px, -1px) translateZ(0);
  box-shadow: 7px 7px 0 #000;
}

.btn-3d.btn-small {
  font-size: 14px;
  padding: 10px 16px;
}

#close-leaderboard-btn {
  background: #e9b50b;
  color: #000;
}

#close-leaderboard-btn:hover {
  background: #ffd700;
  box-shadow: 8px 8px 0 #000;
}

#start-btn {
  background: #e9b50b;
  color: #000;
}

#start-btn:hover {
  background: #ffd700;
  box-shadow: 8px 8px 0 #000 !important;
}

#start-btn:active {
  box-shadow: 4px 4px 0 #000 !important;
}

.button-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  width: 100%;
}

/* 3D Neomorphic Input Fields */
.input__container {
  position: relative;
  background: #f0f0f0;
  padding: 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 15px;
  border: 4px solid #000;
  max-width: 350px;
  margin: 20px auto;
  transition: all 400ms cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
  transform: rotateX(10deg) rotateY(-10deg);
  perspective: 1000px;
  box-shadow: 10px 10px 0 #000;
}

.input__container:hover {
  transform: rotateX(5deg) rotateY(-5deg) scale(1.05);
  box-shadow: 25px 25px 0 -5px #e9b50b, 25px 25px 0 0 #000;
}

.shadow__input {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  bottom: 0;
  z-index: -1;
  transform: translateZ(-50px);
  background: linear-gradient(
    45deg,
    rgba(255, 107, 107, 0.4) 0%,
    rgba(255, 107, 107, 0.1) 100%
  );
  filter: blur(20px);
}

.input__button__shadow {
  cursor: pointer;
  border: 3px solid #000;
  background: #e9b50b;
  transition: all 400ms cubic-bezier(0.23, 1, 0.32, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  transform: translateZ(20px);
  position: relative;
  z-index: 3;
  font-weight: bold;
  text-transform: uppercase;
}

.input__button__shadow:hover {
  background: #e9b50b;
  transform: translateZ(10px) translateX(-5px) translateY(-5px);
  box-shadow: 5px 5px 0 0 #000;
}

.input__button__shadow svg {
  fill: #000;
  width: 25px;
  height: 25px;
}

.input__search {
  width: 100%;
  outline: none;
  border: 3px solid #000;
  padding: 15px;
  font-size: 18px;
  background: #fff;
  color: #000;
  transform: translateZ(10px);
  transition: all 400ms cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
  z-index: 3;
  font-family: "Roboto", Arial, sans-serif;
  letter-spacing: -0.5px;
  box-sizing: border-box;
}

.input__search::placeholder {
  color: #666;
  font-weight: bold;
  text-transform: uppercase;
}

.input__search:hover,
.input__search:focus {
  background: #f0f0f0;
  transform: translateZ(20px) translateX(-5px) translateY(-5px);
  box-shadow: 5px 5px 0 0 #000;
}

.input__container::before {
  content: "USERNAME";
  position: absolute;
  top: -15px;
  left: 20px;
  background: #e9b50b;
  color: #000;
  font-weight: bold;
  padding: 5px 10px;
  font-size: 14px;
  transform: translateZ(50px);
  z-index: 4;
  border: 2px solid #000;
}

/* Shake animation for empty input validation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}

@keyframes pulse-error {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.4); }
}

#initial-player-name.shake {
  animation: shake 0.6s ease-in-out, pulse-error 1s ease-in-out;
  border-color: #ff6b6b !important;
  background: rgba(255, 107, 107, 0.1) !important;
}

/* Error placeholder styling */
#initial-player-name.shake::placeholder {
  color: #ff6b6b !important;
  font-weight: 600 !important;
}

/* Player Setup - 3D Neomorphic Design */
#player-setup {
  margin: 16px 0;
  padding: 0;
  background: transparent;
}

#player-setup label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #fff;
  font-size: 15px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: 0.3px;
}

#score-status {
  margin: 16px 0;
  padding: 16px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

#submit-score-btn {
  background: #17b890;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

#submit-score-btn:hover {
  background: #15a378;
}

#submit-score-btn:disabled {
  background: #666;
  cursor: not-allowed;
}

/* Leaderboard Styles */
#leaderboard {
  list-style: none;
  padding: 0 20px 0 0;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
}

/* Floating Ducks Animation */
.floating-ducks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.floating-duck {
  position: absolute;
  width: 60px;
  height: 60px;
  opacity: 0.4;
  animation: floatAndRotate 20s infinite ease-in-out;
  pointer-events: none;
  filter: blur(1px);
}

.floating-duck:nth-child(1) {
  top: 10%;
  left: 15%;
  animation-duration: 25s;
  animation-delay: 0s;
}

.floating-duck:nth-child(2) {
  top: 60%;
  left: 80%;
  animation-duration: 30s;
  animation-delay: 3s;
  width: 50px;
  height: 50px;
}

.floating-duck:nth-child(3) {
  top: 30%;
  left: 70%;
  animation-duration: 22s;
  animation-delay: 6s;
  width: 45px;
  height: 45px;
}

.floating-duck:nth-child(4) {
  top: 80%;
  left: 20%;
  animation-duration: 28s;
  animation-delay: 2s;
  width: 55px;
  height: 55px;
}

.floating-duck:nth-child(5) {
  top: 50%;
  left: 5%;
  animation-duration: 24s;
  animation-delay: 8s;
  width: 48px;
  height: 48px;
}

.floating-duck:nth-child(6) {
  top: 20%;
  left: 90%;
  animation-duration: 26s;
  animation-delay: 5s;
  width: 52px;
  height: 52px;
}

.floating-duck:nth-child(7) {
  top: 40%;
  left: 50%;
  animation-duration: 23s;
  animation-delay: 7s;
  width: 58px;
  height: 58px;
}

.floating-duck:nth-child(8) {
  top: 70%;
  left: 60%;
  animation-duration: 27s;
  animation-delay: 4s;
  width: 46px;
  height: 46px;
}

.floating-duck:nth-child(9) {
  top: 15%;
  left: 40%;
  animation-duration: 29s;
  animation-delay: 9s;
  width: 54px;
  height: 54px;
}

.floating-duck:nth-child(10) {
  top: 55%;
  left: 75%;
  animation-duration: 21s;
  animation-delay: 6s;
  width: 50px;
  height: 50px;
}

@keyframes floatAndRotate {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(30px, -40px) rotate(90deg);
  }
  50% {
    transform: translate(-20px, -80px) rotate(180deg);
  }
  75% {
    transform: translate(-50px, -40px) rotate(270deg);
  }
  100% {
    transform: translate(0, 0) rotate(360deg);
  }
}

/* Podium Styles για Top 3 - 3D Design */
.podium {
  margin: 20px 0;
  padding: 10px 30px;
}

.podium-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: 45px;
  width: 100%;
  max-width: 700px;
  padding: 30px 0;
  margin: 0 auto;
}

.podium-place {
  position: relative;
  background: #f0f0f0;
  border: 4px solid #000;
  padding: 25px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all 400ms cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
  perspective: 1000px;
  min-width: 110px;
  flex: 1;
  max-width: 170px;
}

.podium-place:hover {
  z-index: 10;
}

/* Ύψη των βάθρων */
.podium-place.tall {
  transform: rotateX(20deg) rotateY(-10deg);
  box-shadow: 6px 6px 0 #FFD700, 6px 6px 0 4px #000;
  min-height: 180px;
  order: 2;
}

.podium-place.tall::before {
  content: "🥇";
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%) translateZ(40px);
  font-size: 32px;
  background: #FFD700;
  border: 3px solid #000;
  border-radius: 50%;
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-place.medium {
  transform: rotateX(20deg) rotateY(-10deg);
  box-shadow: 5px 5px 0 #C0C0C0, 5px 5px 0 4px #000;
  min-height: 140px;
  order: 1;
}

.podium-place.medium::before {
  content: "🥈";
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%) translateZ(40px);
  font-size: 28px;
  background: #C0C0C0;
  border: 3px solid #000;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-place.short {
  transform: rotateX(20deg) rotateY(-10deg);
  box-shadow: 4px 4px 0 #CD7F32, 4px 4px 0 4px #000;
  min-height: 100px;
  order: 3;
}

.podium-place.short::before {
  content: "🥉";
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%) translateZ(40px);
  font-size: 24px;
  background: #CD7F32;
  border: 3px solid #000;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-medal {
  font-size: 48px;
  margin-bottom: 8px;
  display: none; /* Hiding because we use ::before instead */
}

.podium-player {
  font-weight: bold;
  font-size: 15px;
  color: #000;
  text-align: center;
  transform: translateZ(25px);
  word-break: break-word;
  max-width: 100%;
  line-height: 1.4;
}

.podium-score {
  font-size: 14px;
  color: #666;
  transform: translateZ(20px);
  font-weight: bold;
  margin-top: 5px;
}

.leaderboard-item {
  position: relative;
  background: #f0f0f0;
  border: 3px solid #000;
  padding: 12px 20px 12px 55px;
  margin: 0 0 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 300ms cubic-bezier(0.23, 1, 0.32, 1);
  transform-style: preserve-3d;
  transform: rotateX(3deg) rotateY(-1deg);
  box-shadow: 5px 5px 0 #000;
}

.leaderboard-item:hover {
  transform: rotateX(2deg) rotateY(0deg) scale(1.01);
  box-shadow: 10px 10px 0 -2px #e9b50b, 10px 10px 0 0 #000;
  z-index: 15;
}

.leaderboard-item::before {
  content: attr(data-rank);
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%) translateZ(30px);
  background: #e9b50b;
  color: #000;
  font-weight: bold;
  padding: 5px 8px;
  font-size: 14px;
  border: 2px solid #000;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.leaderboard-item .rank {
  font-weight: bold;
  min-width: 60px;
  font-size: 16px;
  color: #000;
  display: none; /* Hidden because we use ::before */
}

.leaderboard-item .player-name {
  flex: 1;
  margin: 0 12px;
  font-weight: bold;
  font-size: 16px;
  color: #000;
  text-align: left;
}

.leaderboard-item .score {
  font-weight: bold;
  font-size: 14px;
  color: #666;
}

/* Separator για να δείξει ότι υπάρχουν ενδιάμεσοι παίκτες */
.leaderboard-separator {
  text-align: center;
  padding: 15px 0;
  margin: 10px 0;
  color: #999;
  font-size: 24px;
  font-weight: bold;
  list-style: none;
}

/* Highlight για τον τρέχοντα παίκτη */
.leaderboard-item.current-player {
  background: linear-gradient(145deg, #fff9e6, #ffffff);
  border: 3px solid #e9b50b;
  box-shadow: 6px 6px 0 -1px #e9b50b, 6px 6px 0 0 #000;
}

.leaderboard-item.current-player .player-name {
  font-weight: bold;
  color: #000;
}

.no-scores, .error {
  text-align: center;
  padding: 20px;
  color: rgba(255,255,255,0.7);
  font-style: italic;
}

.error {
  color: #ff6b6b;
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
  .podium-container {
    gap: 8px;
    padding: 15px 0;
    max-width: 100%;
  }
  
  .podium-place {
    min-width: 70px;
    max-width: 95px;
    padding: 12px 8px;
    font-size: 12px;
  }
  
  .podium-place.tall {
    min-height: 110px;
  }
  
  .podium-place.medium {
    min-height: 90px;
  }
  
  .podium-place.short {
    min-height: 75px;
  }
  
  .podium-place.tall::before,
  .podium-place.medium::before,
  .podium-place.short::before {
    width: 32px;
    height: 32px;
    font-size: 16px;
    top: -16px;
  }
  
  .podium-player {
    font-size: 11px;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .podium-score {
    font-size: 10px;
    margin-top: 2px;
  }
  
  .leaderboard-item {
    padding: 8px 12px 8px 38px;
    margin: 0 0 10px 15px;
    box-shadow: 4px 4px 0 #000;
    font-size: 14px;
  }
  
  .leaderboard-item::before {
    left: -10px;
    width: 24px;
    height: 24px;
    font-size: 11px;
    padding: 4px 6px;
  }
  
  .leaderboard-item .player-name {
    font-size: 14px;
    margin: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .leaderboard-item .score {
    font-size: 12px;
    white-space: nowrap;
    min-width: 65px;
    text-align: right;
  }
  
  .leaderboard-item:hover {
    box-shadow: 6px 6px 0 -1px #e9b50b, 6px 6px 0 0 #000;
  }
  
  .outer-box {
    padding: 20px;
  }
  
  /* Mobile input adjustments */
  #initial-player-name {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 14px 16px !important;
    border-width: 2px !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: text;
    user-select: text;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
  }
  
  /* Ensure consistent mobile styling */
  #player-setup {
    padding: 20px 16px !important;
  }
  
  #player-setup label {
    font-size: 16px !important;
    margin-bottom: 10px !important;
  }
}

.code-display-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: #fff;
  border: 3px solid #000;
  padding: 15px 20px;
  margin: 15px 0;
  transform: rotateX(2deg) rotateY(-2deg);
  transform-style: preserve-3d;
  box-shadow: 6px 6px 0 #000;
}

.code-display-box .shadow__outer {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 3px solid #000;
  z-index: -1;
  pointer-events: none;
}

.code-display-box code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 18px;
  color: #000;
  flex: 1;
  text-align: center;
}

.code-display-box .input__button__shadow {
  margin: 0;
  flex-shrink: 0;
}

