:root {
    --bg-color: #0f172a;
    --game-bg: #1e293b;
    --tile-color: #f7fafc;
    --tile-border: #e2e8f0;
    --tile-shadow: #0f172a;
    --text-color: #f1f5f9;
    --accent-color: #a855f7;
    /* Purple */
    --accent-color-glow-strong: rgba(168, 85, 247, 0.4);
    --accent-color-glow-medium: rgba(168, 85, 247, 0.2);
    --accent-color-glow-weak: rgba(168, 85, 247, 0.1);
    --overlay-bg: rgba(15, 23, 42, 0.85);
    --tile-selected: #a855f7;
    --tile-hint: rgba(16, 185, 129, 0.3);
    --tile-matched: rgba(34, 197, 94, 0.6);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    margin: 0 auto;
    max-width: 1200px;
}

/* Game Container */
.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-color) 0%, #1e293b 100%);
}

/* Canvas Styling */
#game-canvas {
    background-color: var(--game-bg);
    border-radius: 8px;
    border: 2px solid #334155;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    
    /* Prevent text selection and improve touch behavior */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* UI Overlays */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    text-align: center;
    padding: 20px;
}

.ui-overlay.hidden {
    display: none;
}

.ui-overlay h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-color-glow-medium);
}

.ui-overlay h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.ui-overlay p {
    font-size: 1.2rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

/* Start Screen Options */
.start-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.start-options button {
    background: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
}

.start-options button:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-color-glow-medium);
}

/* Score Display */
.score-display {
    background: rgba(30, 41, 59, 0.6);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #334155;
}

.score-display p {
    font-size: 1.1rem;
    margin: 5px 0;
}

/* Settings Panel */
.settings-panel {
    background: rgba(30, 41, 59, 0.9);
    border-radius: 12px;
    padding: 30px;
    border: 2px solid #334155;
    backdrop-filter: blur(10px);
    max-width: 400px;
    width: 90%;
}

.settings-panel h3 {
    color: var(--accent-color);
    margin-bottom: 20px;
    text-align: center;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-group select,
.setting-group input[type="checkbox"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #334155;
    background: var(--game-bg);
    color: var(--text-color);
    font-size: 1rem;
    width: 100%;
}

.setting-group input[type="checkbox"] {
    width: auto;
    margin-left: 10px;
    transform: scale(1.2);
}

.settings-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

/* Instructions */
.desktop-instruction {
    display: block;
}

.mobile-instruction {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ui-overlay h1 {
        font-size: 2rem;
    }

    .ui-overlay h2 {
        font-size: 1.5rem;
    }

    .desktop-instruction {
        display: none;
    }

    .mobile-instruction {
        display: block;
    }

    .game-container {
        width: 100%;
    }

    #game-canvas {
        width: 95vw;
        height: 70vh;
        width: 100% !important;
        height: 100% !important;
        max-width: 410px;
        max-height: 620px;
    }

    .settings-panel {
        padding: 20px;
        width: 95%;
    }

    .start-options {
        width: 100%;
    }

    .start-options button {
        min-width: auto;
        width: 100%;
    }
}

#help-count {
    font-size: 0.75rem;
    opacity: 0.8;
}