* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
}

#viewport {
    width: 100%;
    height: 100%;
    position: relative;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Game HUD */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

#hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.site-home {
    position: absolute;
    left: 20px;
    top: 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 0.2s;
    pointer-events: auto;
}

.site-home:hover {
    color: #4a9eff;
    background: rgba(0, 0, 0, 0.9);
}

#round-info, #score-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
}

#round-info {
    color: #a78bfa;
}

#score-display {
    color: #fbbf24;
}

#hud-center {
    display: flex;
    justify-content: center;
}

#controls-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
}

#hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

#stats {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 10px;
    border-radius: 4px;
}

/* Game Buttons */
.game-btn {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(99, 102, 241, 0.9);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.game-btn:hover {
    background: #6366f1;
    transform: translateY(-2px);
}

.game-btn:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
}

.game-btn.primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    padding: 14px 32px;
    font-size: 18px;
}

.game-btn.primary:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.game-btn.primary:disabled {
    background: rgba(100, 100, 100, 0.5);
}

/* Map Overlay */
#map-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#map-container {
    background: #1a1a2e;
    border-radius: 16px;
    overflow: hidden;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #252540;
}

#map-header h3 {
    color: #fff;
    font-size: 18px;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
}

.close-btn:hover {
    color: #fff;
}

#map-wrapper {
    position: relative;
    overflow: auto;
    max-height: calc(90vh - 140px);
    cursor: crosshair;
}

#map-image {
    display: block;
    max-width: 800px;
    height: auto;
    user-select: none;
}

#guess-marker, #actual-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

#actual-marker {
    z-index: 11;
}

#map-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #252540;
}

#guess-info {
    color: #888;
    font-size: 14px;
}

/* Round Result */
#round-result {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
}

#result-content {
    text-align: center;
    padding: 40px;
}

#result-title {
    font-size: 48px;
    color: #fff;
    margin-bottom: 20px;
}

#result-score {
    font-size: 36px;
    color: #22c55e;
    font-weight: 700;
    margin-bottom: 10px;
}

#result-distance {
    font-size: 20px;
    color: #888;
    margin-bottom: 30px;
}

/* Game Over */
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 70;
}

#game-over-content {
    text-align: center;
    padding: 40px;
}

#game-over-content h1 {
    font-size: 56px;
    color: #fff;
    margin-bottom: 30px;
}

#final-score-display {
    font-size: 48px;
    margin-bottom: 30px;
}

#final-score {
    color: #fbbf24;
    font-weight: 700;
}

.max-score {
    color: #666;
    font-size: 32px;
}

#score-breakdown {
    margin-bottom: 40px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.breakdown-round {
    color: #888;
}

.breakdown-score {
    color: #22c55e;
    font-weight: 600;
}

/* Loading Overlay */
#loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f0f1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
    max-width: 400px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-content h2 {
    color: #fff;
    margin-bottom: 10px;
}

#loading-status {
    color: #888;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.3s ease;
}

/* Start Screen */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f0f1a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.start-content {
    text-align: center;
}

.start-content h1 {
    font-size: 48px;
    color: #fff;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.start-content > p {
    color: #888;
    margin-bottom: 30px;
    font-size: 18px;
}

/* Drop Zone */
.drop-zone {
    width: 400px;
    padding: 40px;
    border: 2px dashed #444;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 30px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #888;
}

.drop-zone-content svg {
    color: #6366f1;
}

.drop-zone-content p {
    margin: 0;
    color: #ccc;
}

.drop-zone-content .hint {
    font-size: 14px;
    color: #666;
}

.drop-zone input[type="file"] {
    display: none;
}

/* Game Modes */
.game-modes {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px;
}

.game-modes h3 {
    color: #888;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-row label {
    color: #ccc;
}

.setting-row select {
    padding: 8px 16px;
    background: #1a1a2e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

/* Crosshair */
#viewport::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    font-weight: 100;
}

/* Responsive */
@media (max-width: 768px) {
    .start-content h1 {
        font-size: 32px;
    }

    .drop-zone {
        width: 90vw;
        padding: 30px 20px;
    }

    #map-image {
        max-width: 100%;
    }

    #map-container {
        max-width: 95vw;
    }

    .game-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    #result-title {
        font-size: 32px;
    }

    #result-score {
        font-size: 28px;
    }

    #game-over-content h1 {
        font-size: 36px;
    }

    #final-score-display {
        font-size: 32px;
    }
}
