:root {
    --bg-main: #f9fafb;
    --bg-card: #ffffff;
    --bg-panel: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --radius-lg: 12px;
    --radius-sm: 8px;
    --font-main: "Inter", system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

/* Preview Section - Light Background */
.preview-section {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background-color: var(--bg-main);
    overflow: hidden;
    min-height: 50vh;
}

.card-container {
    width: 100%;
    max-width: 360px;
    padding: 10px;
    box-sizing: border-box;
}

/* Project Card Styles - Matching the reference image precisely */
.websim-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 1.4 / 1;
    background-color: #f3f4f6;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none; /* Hidden until source is set */
}

.card-img[src^="data:image"], .card-img[src^="http"], .card-img[src*="/"] {
    display: block;
}

.image-placeholder {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    padding: 20px;
    position: absolute;
}

.card-content {
    padding: 12px 14px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #e5e7eb;
    object-fit: cover;
}

.username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.stats-info {
    display: flex;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat .icon {
    width: 13px;
    height: 13px;
    stroke-width: 2.5;
}

.stat .icon-play {
    fill: currentColor;
    stroke-width: 1;
}

/* Controls Section (Bottom Panel) */
.controls-section {
    flex: 0 0 auto;
    height: 50vh;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}

.controls-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.download-btn {
    background-color: var(--text-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.download-btn:active {
    transform: scale(0.97);
}

.download-btn .icon {
    width: 14px;
    height: 14px;
}

.editor-form {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.half { flex: 1; }
.third { flex: 1; }

label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="text"] {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

input[type="text"]:focus {
    border-color: #3b82f6;
    background-color: #ffffff;
}

input[type="file"] {
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 7px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    width: 100%;
    outline: none;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background-color: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 4px;
    margin-right: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
}

/* Hide header for cleaner mobile look if it was there */
.app-header { display: none; }