body {
    margin: 0;
    overflow: hidden;
    background-color: #f0f0f0;
    font-family: 'Fredoka', sans-serif; /* Ensure you have this font or fallback */
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #ffffff 0%, #dbe9f4 100%);
}

canvas {
    background-color: #ffffff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border-radius: 12px;
}

.ui-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.85);
    padding: 40px;
    border-radius: 30px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.15);
    text-align: center;
    min-width: 350px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 25px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.6);
}

@keyframes popIn {
    from { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.hidden {
    display: none !important;
}

h1 {
    color: #222;
    font-size: 56px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(45deg, #0055ff, #00aaff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1));
}

h2 {
    color: #444;
    margin: 0;
    font-weight: 700;
}

input[type="text"] {
    padding: 16px;
    border-radius: 15px;
    border: 2px solid #e0e0e0;
    font-size: 20px;
    width: 240px;
    text-align: center;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
}

input[type="text"]:focus {
    border-color: #0055ff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 85, 255, 0.1);
}

button {
    padding: 18px 36px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #0066ff, #0099ff);
    color: white;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(0, 100, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 1px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 100, 255, 0.35);
}

button:active {
    transform: translateY(1px);
}

#settings-btn {
    background: #f5f5f5;
    color: #666;
    font-size: 16px;
    padding: 12px 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-top: 10px;
}
#settings-btn:hover {
    background: #e8e8e8;
    color: #333;
}

#reset-leaderboard-btn {
    display: none !important;
}

#hud {
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

#score {
    font-size: 48px;
    font-weight: 800;
    color: #333;
    text-shadow: 2px 2px 0 #fff, 0 5px 15px rgba(0,0,0,0.1);
}

#name-display {
    font-size: 24px;
    font-weight: 700;
    color: #444;
    background: rgba(255,255,255,0.9);
    padding: 8px 20px;
    border-radius: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}

.color-picker {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

.color-option {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #fff;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.2);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

#leaderboard-preview {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid #eee;
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    text-align: left;
    max-height: 220px;
    overflow-y: auto;
    font-size: 16px;
    margin: 0;
}

/* Scrollbar for leaderboard */
#leaderboard-list::-webkit-scrollbar {
    width: 6px;
}
#leaderboard-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}
#leaderboard-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#leaderboard-list li {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid #f5f5f5;
    color: #666;
    transition: background 0.2s;
}

#leaderboard-list li:last-child {
    border-bottom: none;
}

#leaderboard-list li:hover {
    background: #fafafa;
}

#leaderboard-list li.rank-1 {
    color: #0066ff;
    font-weight: 800;
    font-size: 18px;
    background: rgba(0, 102, 255, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(0, 102, 255, 0.1);
    margin: 5px 0;
}

.final-score {
    font-size: 32px;
    color: #333;
    font-weight: 800;
    margin: 10px 0;
}

/* Toggle Switch for Sound */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
input:checked + .slider {
  background-color: #00cc66;
}
input:focus + .slider {
  box-shadow: 0 0 1px #00cc66;
}
input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    canvas {
        border-radius: 0;
        box-shadow: none;
        /* Ensure canvas fills screen on mobile */
    }
    .ui-panel {
        width: 85%;
        min-width: auto;
        padding: 25px;
    }
    h1 {
        font-size: 42px;
    }
}