/* General body styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f6f9fc, #e9eff6);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    color: #333;
    text-align: center;
    padding: 20px;
}

/* Title */
h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Canvas container */
.canvas-container {
    position: relative;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    background-color: #fff;
    padding: 20px;
    text-align: center;
    max-width: 100%;
}

/* Canvas styling */
canvas {
    border: 2px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #f8f8f8;
    cursor: crosshair;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    display: block;
    margin: 0 auto;
}

/* Touch indicator */
.touch-indicator {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid red;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    transform: translate(-50%, -50%);
    z-index: 1000;
    opacity: 0.7;
    background-color: rgba(255, 0, 0, 0.1);
    animation: pulse 1s infinite;
}

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

.touch-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background-color: red;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Touch settings panel */
#touchSettings {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

#touchSettings h4 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
}

.setting-group {
    margin-bottom: 12px;
    text-align: left;
}

.setting-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #495057;
}

.setting-group input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.setting-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.setting-group span {
    font-weight: 600;
    color: #5e8bff;
    min-width: 50px;
}

/* Instructions */
.instructions {
    margin: 15px 0;
    padding: 0 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #666;
}

/* Buttons styling */
.button-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.btn svg {
    transition: transform 0.3s ease;
}

.btn:hover svg {
    transform: scale(1.1);
}

.btn-primary {
    background: linear-gradient(135deg, #5e8bff 0%, #4a7ef3 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4a7ef3 0%, #3968d8 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #ff6b6b 0%, #e63946 100%);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e63946 0%, #d62828 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn-info {
    background: linear-gradient(135deg, #4ecdc4 0%, #38a89d 100%);
}

.btn-info:hover {
    background: linear-gradient(135deg, #38a89d 0%, #2c8b80 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #fff;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
    position: relative;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 1.8rem;
    color: #333;
    margin: 0;
}

.modal-body {
    text-align: left;
    line-height: 1.6;
    color: #555;
}

.modal-body h4 {
    color: #333;
    margin: 20px 0 15px;
    font-size: 1.2rem;
}

.modal-body p {
    margin-bottom: 15px;
}

.modal-body ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 10px;
}

.modal-body ul {
    margin-left: 20px;
    margin-top: 10px;
}

.modal-body img {
    width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.modal-disclaimer {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 0.95rem;
}

/* Close button styling */
.close {
    color: white;
    font-size: 30px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: #e63946;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close:hover,
.close:focus {
    background-color: #d71e2f;
    transform: scale(1.1);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.close:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.4);
}

/* Responsive design */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .canvas-container {
        padding: 15px;
    }
    
    canvas {
        width: 100%;
        height: auto;
        max-width: 400px;
    }
    
    .button-container {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    #touchSettings {
        padding: 10px;
    }
    
    .setting-group input[type="range"] {
        max-width: 150px;
    }
    
    .modal-content {
        margin: 20px auto;
        padding: 20px;
        width: 95%;
    }
    
    .modal-header h3 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .instructions {
        font-size: 0.9rem;
        padding: 0 10px;
    }
    
    .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .canvas-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .button-container,
    #touchSettings,
    .instructions {
        display: none;
    }
}