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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f13;
    color: #e0e0e0;
    min-height: 100vh;
}

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

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

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #888;
    margin-top: 8px;
    font-size: 1.1rem;
}

/* Steps */
.step {
    display: none;
    margin-bottom: 40px;
    animation: fadeIn 0.3s ease;
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.step-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

/* Upload zone */
.upload-zone {
    border: 2px dashed #333;
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #18181f;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #6366f1;
    background: #1a1a2e;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.upload-content .link {
    color: #6366f1;
    text-decoration: underline;
    cursor: pointer;
}

.hint {
    color: #666;
    font-size: 0.9rem;
    margin-top: 6px;
    margin-bottom: 12px;
}

/* Canvas */
.canvas-wrapper {
    background: #18181f;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 16px;
}

canvas {
    max-width: 100%;
    cursor: crosshair;
    border-radius: 8px;
}

/* Settings */
.settings-grid {
    display: grid;
    gap: 24px;
    margin-bottom: 28px;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.field input[type="text"],
.field select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #333;
    border-radius: 10px;
    background: #18181f;
    color: #e0e0e0;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.field input[type="text"]:focus,
.field select:focus {
    outline: none;
    border-color: #6366f1;
}

.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 2px solid #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #18181f;
    font-size: 0.9rem;
}

.color-option:has(input:checked) {
    border-color: #6366f1;
    background: #1a1a2e;
}

.color-option input {
    display: none;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: #252530;
    color: #e0e0e0;
    border: 1px solid #333;
}

.btn-secondary:hover {
    background: #2a2a38;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #333;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results */
.result-full {
    background: #18181f;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    margin-bottom: 24px;
}

.result-full img {
    width: 100%;
    border-radius: 8px;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-text {
    color: #ef4444;
    background: #1c1017;
    border: 1px solid #ef4444;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    text-align: center;
}

/* Telegram WebApp mode */
.tg-mode .container {
    padding: 16px 12px;
}

.tg-mode header {
    margin-bottom: 24px;
}

.tg-mode header h1 {
    font-size: 1.6rem;
}

.tg-mode .upload-zone {
    padding: 40px 16px;
}

.tg-mode .canvas-wrapper {
    padding: 8px;
}

.tg-mode .step-header h2 {
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 640px) {
    header h1 {
        font-size: 1.8rem;
    }
    .container {
        padding: 24px 12px;
    }
}
