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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

h1 a {
    color: inherit;
    text-decoration: none;
}

h1 a:hover {
    opacity: 0.8;
}

header p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    background: white;
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 5px 5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.upload-area:hover, .upload-area:active {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.upload-area p {
    font-size: 1rem;
    color: #4a5568;
    margin-bottom: 2px;
}

.upload-area small {
    color: #a0aec0;
    font-size: 0.8rem;
}

input[type="file"] {
    display: none;
}

.upload-area {
    display: block;
    cursor: pointer;
}

/* Controls Section */
.controls-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}


.grid-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

/* Checkbox styling */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    color: #4a5568;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 22px;
    height: 22px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    color: white;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    font-size: 14px;
    font-weight: bold;
}

.label-text {
    color: #4a5568;
    font-size: 1rem;
    font-weight: 500;
}

/* Button groups */
.button-group {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    border-color: #cbd5e0;
    background: #edf2f7;
}

.btn-icon.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 20px;
    height: 20px;
}

.icon-grid span {
    background: #cbd5e0;
    border-radius: 1px;
}

.btn-icon.active .icon-grid span {
    background: #a0aec0;
}

.icon-grid span.active {
    background: #667eea !important;
}

.btn-icon.active .icon-grid span.active {
    background: white !important;
}

/* Number inputs */
.number-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.number-input-group label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

.number-control {
    display: flex;
    align-items: center;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.btn-number {
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    transition: all 0.2s ease;
}

.btn-number:hover {
    background: #e2e8f0;
}

.btn-number:active {
    background: #cbd5e0;
}

.number-display {
    padding: 10px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    min-width: 50px;
    text-align: center;
}

/* Result section */
.result-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.result-preview {
    text-align: center;
    margin-bottom: 20px;
}

#resultCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.download-section {
    text-align: center;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    box-shadow: 0 8px 15px rgba(72, 187, 120, 0.3);
}

/* Footer */
footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #e2e8f0;
}

.donation-section {
    text-align: center;
    color: #6c757d;
}

.donation-section p {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.donation-placeholder {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 40px;
    }
    
    .option-row {
        flex-wrap: nowrap;
    }
    
    .number-input-group {
        flex-direction: row;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .controls-section {
        padding: 20px;
    }
}
