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

:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #141416;
    --bg-card: #1a1a1d;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #f4c542;
    --accent-hover: #d4a832;
    --border: #2a2a2d;
    --success: #4caf50;
    --error: #f44336;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.screen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.screen-content .icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.screen-content h2 {
    margin-bottom: 10px;
}

.screen-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Loader */
.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.logo {
    font-size: 18px;
    font-weight: 700;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-card);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--border);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    border-color: var(--accent);
    background: rgba(244, 197, 66, 0.1);
}

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

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    min-height: 120px;
    transition: border-color 0.2s;
}

.upload-area.dragover {
    border-color: var(--accent);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    cursor: pointer;
    color: var(--text-secondary);
}

.upload-placeholder svg {
    margin-bottom: 10px;
    opacity: 0.5;
}

.upload-placeholder p {
    margin-bottom: 5px;
}

.upload-hint {
    font-size: 12px;
    opacity: 0.7;
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
}

.upload-preview:empty {
    display: none;
}

.upload-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.upload-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Prompt */
.prompt-section {
    margin-bottom: 20px;
}

.prompt-section textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.prompt-section textarea:focus {
    border-color: var(--accent);
}

.prompt-section textarea::placeholder {
    color: var(--text-secondary);
}

.prompt-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.char-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Settings */
.settings-section {
    margin-bottom: 24px;
}

.setting-row {
    margin-bottom: 16px;
}

.setting-row label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.setting-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.option-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-btn.active {
    border-color: var(--accent);
    background: rgba(244, 197, 66, 0.15);
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-generate {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-generate:hover {
    background: var(--accent-hover);
}

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

/* Generating Screen */
.generating-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

/* Result Screen */
.result-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.result-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
}

.result-image-container img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    object-fit: contain;
}

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

.result-actions .btn {
    flex: 1;
    min-width: 100px;
}

/* Profile Screen */
.profile-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.profile-body {
    flex: 1;
    padding: 20px;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-id {
    font-size: 14px;
    color: var(--text-secondary);
}

.stats-card {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
}

.stat-item {
    flex: 1;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 480px) {
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}
