:root {
    --bg-color: #0f172a;
    /* Slate 900 */
    --card-bg: #1e293b;
    /* Slate 800 */
    --primary-color: #3b82f6;
    /* Blue 500 */
    --primary-hover: #2563eb;
    /* Blue 600 */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --border-color: #334155;
    /* Slate 700 */
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --border-radius: 0.75rem;
    /* rounded-xl */
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.5;
}

.app-container {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-weight: 700;
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Upload Section */
.upload-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 3rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.upload-section:hover {
    border-color: var(--primary-color);
    background: #1e293b;
    /* keep same but maybe slight lighten if needed */
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-wrapper input[type=file] {
    font-size: 100px;
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

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

.hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Preview Section */
.preview-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.canvas-container {
    width: 100%;
    /* 9:16 Aspect Ratio container */
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    /* shadow-2xl */
    border: 1px solid var(--border-color);
}

canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Processing Overlay */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    /* Slate 900 w/ opacity */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.btn-action,
.btn-success {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.btn-action {
    background: var(--primary-color);
    color: white;
}

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

.btn-success {
    background: #10b981;
    /* Emerald 500 */
    color: white;
}

.btn-success:hover {
    background: #059669;
    /* Emerald 600 */
}

.hidden {
    display: none !important;
}

footer {
    margin-top: auto;
    font-size: 0.875rem;
    color: var(--text-secondary);
}