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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 40px 20px 40px;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 200px;
}

header::after {
    content: "";
    display: table;
    clear: both;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
    text-align: left;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    text-align: left;
}

.auth-notice-container {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 10;
    flex-wrap: wrap;
}

.auth-notice {
    display: flex !important;
    align-items: center;
    justify-content: center !important;
    gap: 10px;
    font-size: 14px;
    color: #ffffff !important;
    background: rgba(255, 193, 7, 0.3) !important;
    padding: 10px 16px;
    border-radius: 12px;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 193, 7, 0.5) !important;
    flex: 1;
    min-width: 300px;
    text-align: center !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
}

.auth-notice-icon {
    font-size: 18px;
    flex: 0 0 auto;
}

.auth-notice-text {
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    text-align: center;
    flex: 0 0 auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.user-info {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0;
    font-size: 16px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 20px;
    border-radius: 12px;
    display: inline-block;
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
    flex-shrink: 0;
}

/* Когда пользователь авторизован, выравниваем по правому краю */
header > .user-info {
    align-self: flex-end;
    margin-top: 20px;
}

.user-info strong {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 255, 255, 0.3);
    letter-spacing: 0.3px;
    filter: brightness(1.2);
}

.user-info .logout-link,
.user-info .login-link {
    color: #ffffff;
    text-decoration: none;
    margin-left: 12px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    display: inline-block;
}

.user-info .login-link {
    margin-left: 0;
}

.user-info .logout-link:hover,
.user-info .login-link:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Бейдж для измененного имени пользователя */
.username-badge {
    display: inline-block;
    background: rgba(255, 193, 7, 0.9);
    color: #000;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 8px;
    margin-left: 8px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: help;
    vertical-align: middle;
    line-height: 1.2;
}

.username-badge:hover {
    background: rgba(255, 193, 7, 1);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

main {
    padding: 40px;
}

/* Загрузка файла */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 10px;
}

.upload-link {
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
}

.upload-hint {
    color: #666;
    font-size: 0.9em;
}

.preview-container {
    position: relative;
    margin: 20px 0;
    text-align: center;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #ff3838;
    transform: scale(1.1);
}

/* Выбор стиля */
.style-selection {
    margin-top: 30px;
}

.style-selection h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5em;
}

.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.style-card {
    position: relative;
    cursor: pointer;
}

.style-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.style-content {
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: white;
}

.style-card input[type="radio"]:checked + .style-content {
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.style-card:hover .style-content {
    border-color: #667eea;
    transform: translateY(-2px);
}

.style-content h4 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.style-content p {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
}

/* Кнопки */
.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    margin-top: 15px;
    width: 100%;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Прогресс */
.progress-section {
    text-align: center;
    padding: 40px 20px;
}

.progress-section h3 {
    margin-bottom: 30px;
    color: #333;
    font-size: 1.5em;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 15px;
}

.progress-text {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Результат */
.result-section {
    text-align: center;
    padding: 40px 20px;
}

.result-section h3 {
    margin-bottom: 30px;
    color: #333;
    font-size: 1.8em;
}

.result-image-container {
    margin: 30px 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    display: inline-block;
    max-width: 100%;
}

.result-image-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

.result-actions {
    margin-top: 30px;
}

.result-actions a {
    margin-bottom: 15px;
}

/* Ошибка */
.error-section {
    text-align: center;
    padding: 40px 20px;
}

.error-message {
    background: #fff5f5;
    border: 2px solid #ff4757;
    border-radius: 15px;
    padding: 30px;
}

.error-message h3 {
    color: #ff4757;
    margin-bottom: 15px;
}

.error-message p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
}

/* Адаптивность */
@media (max-width: 768px) {
    header {
        padding: 30px 15px 15px 15px;
        min-height: auto;
    }
    
    header h1 {
        font-size: 1.6em;
        line-height: 1.3;
        margin-bottom: 8px;
    }
    
    .subtitle {
        font-size: 1em;
        line-height: 1.4;
    }
    
    main {
        padding: 20px;
    }
    
    .styles-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-notice-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-top: 15px;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .auth-notice {
        text-align: center;
        min-width: 0;
        width: 100%;
        padding: 10px 12px;
        font-size: 12px;
        gap: 8px;
        flex: 1 1 100%;
        box-sizing: border-box;
    }
    
    .auth-notice-text {
        font-size: 12px;
        line-height: 1.4;
        word-break: break-word;
    }
    
    .auth-notice-icon {
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .user-info {
        width: 100%;
        text-align: center;
        padding: 10px 16px;
        font-size: 14px;
        box-sizing: border-box;
    }
}

/* Блок покупки */
.purchase-block {
    margin-top: 35px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.purchase-title {
    color: #667eea;
    margin: 0;
    font-size: 1.2em;
}

.purchase-block .btn-primary {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .purchase-block {
        flex-direction: column;
        text-align: center;
    }
    
    .purchase-block .btn-primary {
        width: 100%;
    }
}

