/**
 * Styles for One Stroke 3D
 * Responsive, mobile-first design with neon/material theme
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: #0a0a1a;
    color: #ffffff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Canvas */
#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
    cursor: grab;
    transition: cursor 0.2s ease;
}

#game-canvas:active {
    cursor: grabbing;
}

#game-canvas.hovering-node {
    cursor: pointer;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.loading-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.loading-content {
    text-align: center;
}

.game-title {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 0, 255, 0.8));
    }
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 255, 255, 0.2);
    border-top-color: #00ffff;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* HUD */
.hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1rem;
    z-index: 100;
    pointer-events: none;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.level-info {
    font-size: 1.2rem;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.hud-stats {
    display: flex;
    gap: 1rem;
}

.stat {
    background: rgba(0, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #ff00ff);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Control Buttons */
.controls {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.btn-control {
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 50%;
    color: #00ffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-control:hover {
    background: rgba(0, 255, 255, 0.4);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
}

.btn-control:active {
    transform: scale(0.95);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a3a 0%, #0a0a1a 100%);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-subtitle {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 2rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid rgba(255, 0, 0, 0.5);
    border-radius: 50%;
    color: #ff0000;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 0, 0, 0.4);
    transform: rotate(90deg);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(45deg, #00ffff, #0088ff);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.8);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Stars */
.stars {
    font-size: 3rem;
    margin: 1rem 0;
    color: #ffff00;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
    animation: starPulse 1s ease-in-out infinite;
}

@keyframes starPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.victory-stats {
    display: flex;
    justify-content: space-around;
    margin: 1rem 0;
}

.victory-stats>div {
    background: rgba(0, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

/* Stats */
.stats {
    background: rgba(0, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    margin: 1rem 0;
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.stats>div {
    margin: 0.5rem 0;
}

/* Social Share */
.social-share {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.social-share p {
    margin-bottom: 0.5rem;
    color: #aaa;
    font-size: 0.9rem;
}

.btn-social {
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Level Select */
.level-select-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.level-button {
    aspect-ratio: 1;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-button:hover {
    background: rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.level-button.completed {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.1);
}

.level-number {
    font-size: 1.5rem;
    font-weight: bold;
}

.level-stars {
    font-size: 0.8rem;
    color: #ffff00;
}

/* Messages */
.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.2rem;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    max-width: 80%;
    text-align: center;
}

.message.active {
    opacity: 1;
}

.message-error {
    background: rgba(255, 0, 0, 0.9);
    border: 2px solid #ff0000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.message-hint {
    background: rgba(0, 255, 255, 0.9);
    color: #000;
    border: 2px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }

    .controls {
        right: 0.5rem;
    }

    .btn-control {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }

    .level-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }

    .hud {
        padding: 0.5rem;
    }

    .stat {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .btn-control {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .level-info {
        font-size: 1rem;
    }

    .hud-stats {
        gap: 0.5rem;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .controls {
        flex-direction: row;
        top: auto;
        bottom: 1rem;
        right: 50%;
        transform: translateX(50%);
    }

    .hud-top {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Custom Scrollbar */
.level-select-content::-webkit-scrollbar {
    width: 8px;
}

.level-select-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.level-select-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 4px;
}

.level-select-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.7);
}

/* Locked Level Style */
.level-button.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.level-button.locked:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.05);
}