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

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #3b82f6;
    flex-shrink: 0;
}

.home-link {
    text-decoration: none;
    font-size: 1.5rem;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    transition: background 0.2s;
}
.home-link:hover {
    background: rgba(255,255,255,0.2);
}

header h1 {
    font-size: 1.4rem;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#score-bar {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
    color: #94a3b8;
}

#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#riddle-box {
    background: #1e293b;
    padding: 16px 20px;
    text-align: center;
    flex-shrink: 0;
}

#difficulty-label {
    font-size: 0.9rem;
    margin-bottom: 6px;
    opacity: 0.9;
}

#riddle-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 8px;
}

#attempts {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #94a3b8;
}

#attempts-dots {
    display: flex;
    gap: 6px;
    direction: ltr;
}

.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #475569;
    transition: background 0.3s, transform 0.3s;
}

.dot.used-far { background: #ef4444; transform: scale(1.1); }
.dot.used-medium { background: #f97316; transform: scale(1.1); }
.dot.used-close { background: #22c55e; transform: scale(1.1); }
.dot.used-win { background: #facc15; transform: scale(1.2); }

#feedback {
    margin-top: 8px;
    font-size: 1.1rem;
    min-height: 2.5em;
    font-weight: 600;
    transition: opacity 0.3s;
    line-height: 1.4;
}

#game-controls {
    padding: 10px 20px;
    text-align: center;
    background: #1e293b;
}

#map {
    flex: 1;
    min-height: 0;
    z-index: 1;
}

/* Continue Button */
.continue-button {
    display: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    margin-top: 10px;
}

.continue-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Large Target Marker */
.target-marker-container {
    background: none !important;
    border: none !important;
}

.target-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 2.5rem;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    animation: bounceIn 0.5s ease;
}

.target-label {
    background: #e74c3c;
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    margin-top: -8px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

/* Pulse animation for target circle */
.pulse-marker {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
    100% { opacity: 0.8; transform: scale(1); }
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Overlay */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

#overlay.hidden { display: none; }

#overlay-box {
    background: #1e293b;
    border: 2px solid #3b82f6;
    border-radius: 16px;
    padding: 32px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
}

#overlay-title {
    font-size: 1.6rem;
    margin-bottom: 12px;
    color: #60a5fa;
}

#overlay-msg {
    font-size: 1.1rem;
    color: #cbd5e1;
    margin-bottom: 20px;
    line-height: 1.6;
}

#overlay-btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s;
}

#overlay-btn:hover { transform: scale(1.05); }

/* MapLibre cursor */
.maplibregl-map { cursor: crosshair !important; }
.maplibregl-canvas { cursor: crosshair !important; }

/* Click markers */
.click-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Responsive */
@media (max-width: 600px) {
    header { flex-direction: column; gap: 4px; padding: 8px; }
    header h1 { font-size: 1.1rem; }
    #riddle-text { font-size: 1.1rem; }
    #riddle-box { padding: 10px; }
    .continue-button { padding: 12px 28px; font-size: 1.1rem; }
    .target-marker { font-size: 2rem; }
    .target-label { font-size: 0.9rem; padding: 4px 10px; }
}

/* Score Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-content {
    background: #1e293b;
    border: 2px solid #3b82f6;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}
.modal-content h2 {
    color: #fbbf24;
    margin-bottom: 15px;
}
.modal-content .form-group {
    margin: 15px 0;
    text-align: right;
}
.modal-content label {
    display: block;
    margin-bottom: 5px;
    color: #94a3b8;
}
.modal-content input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #475569;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 1em;
}
.modal-content input:focus {
    outline: none;
    border-color: #3b82f6;
}
.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}
.btn-submit {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
}
.btn-submit:hover { transform: scale(1.05); }
.btn-skip {
    background: #475569;
    color: #e2e8f0;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
}
