:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

#app {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

#user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

#user-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

#sign-out-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

#sign-out-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.hidden {
    display: none !important;
}

.login-card {
    text-align: center;
    padding: 48px 24px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.login-card h2 {
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.login-card .g_id_signin {
    display: inline-block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.project-row {
    display: flex;
    gap: 8px;
}

select, input[type="text"], textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

select:focus, input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

select option {
    background: var(--surface);
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.file-upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-area:hover, .file-upload-area.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.file-upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-area p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

#file-list {
    list-style: none;
    margin-top: 8px;
}

#file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--surface);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

#file-list li .file-size {
    color: var(--text-muted);
    font-size: 0.75rem;
}

#file-list li .remove-file {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
}

button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button[type="submit"]:hover {
    background: var(--primary-hover);
}

button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

#result-section {
    margin-top: 24px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

#result-section h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: var(--text-muted);
}

#result-output {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: "Fira Code", "Cascadia Code", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--success);
}

#result-output.error {
    color: var(--danger);
}

@media (max-width: 600px) {
    .project-row {
        flex-direction: column;
    }

    header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
