* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    overflow: hidden;
    background: #1a1a1a;
}

body.playing {
    cursor: none; /* Hide default cursor during gameplay */
}

#canvas-container {
    width: 100vw;
    height: 100vh;
}

/* Start Screen */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

#start-screen.hidden {
    display: none;
}

#start-content {
    text-align: center;
    color: white;
    max-width: 600px;
    max-height: 90vh;
    padding: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    border: 2px solid rgba(76, 175, 80, 0.5);
    overflow-y: auto;
}

/* Custom scrollbar for start content */
#start-content::-webkit-scrollbar {
    width: 10px;
}

#start-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

#start-content::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.6);
    border-radius: 5px;
}

#start-content::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.8);
}

#start-content h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #4CAF50;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

/* Level Selection */
#level-select {
    margin-bottom: 30px;
}

#level-select h3 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 20px;
}

#level-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

/* Custom scrollbar for level selection */
#level-buttons-grid::-webkit-scrollbar {
    width: 8px;
}

#level-buttons-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#level-buttons-grid::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.6);
    border-radius: 4px;
}

#level-buttons-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.8);
}

.level-select-btn {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(76, 175, 80, 0.4);
    min-height: 65px;
    justify-content: center;
}

.level-select-btn:hover {
    background: linear-gradient(135deg, #66BB6A, #81C784);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.level-select-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

.level-select-btn[data-level="5"],
.level-select-btn[data-level="6"],
.level-select-btn[data-level="7"],
.level-select-btn[data-level="8"],
.level-select-btn[data-level="9"],
.level-select-btn[data-level="10"],
.level-select-btn[data-level="11"],
.level-select-btn[data-level="12"],
.level-select-btn[data-level="13"],
.level-select-btn[data-level="14"] {
    grid-column: span 1;
}

.level-number {
    font-size: 16px;
    margin-bottom: 5px;
}

.level-info {
    font-size: 11px;
    font-weight: normal;
    opacity: 0.9;
    line-height: 1.3;
}

#start-button {
    font-size: 24px;
    padding: 20px 60px;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#start-button:hover {
    background: linear-gradient(135deg, #66BB6A, #81C784);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

#start-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

#start-instructions {
    margin-top: 30px;
    text-align: left;
    padding: 18px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

#start-instructions h3 {
    color: #4CAF50;
    margin-bottom: 12px;
    font-size: 18px;
}

#start-instructions p {
    margin-bottom: 8px;
    font-size: 15px;
    color: #ddd;
}

#start-instructions p:last-child {
    margin-bottom: 0;
}

#start-instructions strong {
    color: #4CAF50;
}

#ui-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

#ui-container.hidden {
    display: none;
}

/* Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.crosshair-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
}

.crosshair-line.horizontal {
    width: 20px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.crosshair-line.vertical {
    width: 2px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.crosshair-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* HUD */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-size: 16px;
}

.hud-item {
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
}

.hud-item:last-child {
    margin-bottom: 0;
}

.hud-item label {
    font-weight: bold;
    color: #aaa;
}

.hud-item span {
    color: #fff;
    font-weight: bold;
}

#score {
    color: #4CAF50;
}

/* Timer Display (Top Center) */
#timer-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#timer-display.hidden {
    display: none;
}

#timer-container {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px 40px;
    border-radius: 15px;
    border: 3px solid #FFC107;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.5);
}

#time-remaining {
    font-size: 72px;
    font-weight: bold;
    color: #FFC107;
    line-height: 1;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.8),
                 0 0 20px rgba(255, 193, 7, 0.6);
}

#timer-label {
    font-size: 16px;
    color: #FFC107;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#time-remaining.warning {
    color: #FF5722;
    border-color: #FF5722;
    animation: pulse 0.5s infinite;
}

#timer-container.warning {
    border-color: #FF5722;
    box-shadow: 0 0 30px rgba(255, 87, 34, 0.8);
}

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

/* Perfect Shot Warning */
#perfect-shot-warning {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#perfect-shot-warning.hidden {
    display: none;
}

#warning-container {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 30px;
    border-radius: 10px;
    border: 3px solid #00FF00;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

#warning-text {
    font-size: 24px;
    font-weight: bold;
    color: #00FF00;
    line-height: 1.2;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

#warning-subtext {
    font-size: 16px;
    color: #FF0000;
    margin-top: 5px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* Charge Bar */
#charge-container {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    opacity: 0;
    transition: opacity 0.2s;
}

#charge-container.active {
    opacity: 1;
}

/* Wind Indicator (Windsock) */
#wind-indicator {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 1;
}

#wind-indicator.hidden {
    display: none;
}

#windsock-container {
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
}

#windsock {
    display: block;
    margin: 0 auto;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

#wind-speed-text {
    color: white;
    font-weight: bold;
    font-size: 14px;
    margin-top: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#charge-bar-bg {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#charge-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #FFC107, #F44336);
    transition: width 0.05s linear;
    border-radius: 15px;
}

#charge-text {
    text-align: center;
    color: white;
    font-weight: bold;
    margin-top: 8px;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Instructions */
#instructions {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
}

#instructions h3 {
    margin-bottom: 10px;
    color: #4CAF50;
    font-size: 18px;
}

#instructions p {
    margin-bottom: 5px;
    font-size: 14px;
    color: #ddd;
}

#instructions p:last-child {
    margin-bottom: 0;
}

/* Target Preview */
#target-preview {
    position: absolute;
    top: 160px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    color: white;
}

#target-preview h4 {
    margin: 0 0 10px 0;
    color: #4CAF50;
    font-size: 16px;
    text-align: center;
}

#target-canvas {
    display: block;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: #FFFFFF;
}

#level-stats {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#level-stats p {
    margin-bottom: 5px;
    font-size: 12px;
    color: #ddd;
}

#level-stats p:last-child {
    margin-bottom: 0;
}

#level-stats strong {
    color: #4CAF50;
}

#level-stats span {
    color: #fff;
    font-weight: bold;
}

/* Level Complete Screen */
#level-complete-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

#level-complete-screen.hidden {
    display: none;
}

#level-complete-content {
    text-align: center;
    color: white;
    max-width: 500px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    border: 3px solid #4CAF50;
}

#level-result-title {
    font-size: 42px;
    margin-bottom: 20px;
    color: #4CAF50;
}

#level-result-title.failed {
    color: #F44336;
}

#stars-display {
    font-size: 60px;
    margin: 20px 0;
    letter-spacing: 10px;
}

#final-score {
    font-size: 32px;
    margin: 20px 0;
    color: #FFC107;
}

#star-requirement {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 30px;
}

#level-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

#level-buttons button {
    font-size: 18px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

#level-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

#next-level-button.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    #hud, #instructions {
        font-size: 12px;
        padding: 10px 15px;
    }

    #charge-container {
        width: 200px;
    }
}
