body {
    background: #111;
    color: #fff;
    font-family: Arial, sans-serif;
    padding: 30px;
}

.container {
    max-width: 520px;
    margin: auto;
    background: #1a1a1a;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 0 20px #000;
}

h1 {
    text-align: center;
    margin-bottom: 5px;
}

.subtitle {
    text-align: center;
    opacity: 0.7;
    margin-bottom: 20px;
}

label {
    font-size: 14px;
    margin-top: 12px;
    display: block;
}

input,
select,
textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    margin-top: 5px;
    background: #2a2a2a;
    color: #fff;
    resize: vertical;
    box-sizing: border-box;
}

button {
    width: 100%;
    background: #4caf50;
    border: none;
    padding: 14px;
    border-radius: 8px;
    margin-top: 20px;
    cursor: pointer;
    font-size: 18px;
}

button:hover {
    background: #43a047;
}

.hidden {
    display: none;
}

.divider {
    margin: 20px 0 10px;
    border: none;
    border-top: 1px solid #333;
}

.section-title {
    font-size: 15px;
    margin-top: 5px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.8;
}

.loader {
    border: 4px solid #333;
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: auto;
}

@keyframes spin {
    0% { transform: rotate(0deg);}
    100% { transform: rotate(360deg);}
}

#result {
    margin-top: 25px;
}

/* 🔥 PREVIEW CORRIGIDO — LARGURA MAIOR, PROPORÇÃO REAL (2:3), VISUAL EQUILIBRADO */
.cover-preview {
    position: relative;
    width: 100%;
    max-width: 460px;        /* A capa agora ficou mais larga e elegante */
    aspect-ratio: 2 / 3;     /* Mantém proporção perfeita sem virar poste */

    margin: 10px auto 15px;
    border-radius: 14px;
    overflow: hidden;
    background-color: #222;
    box-shadow: 0 0 25px rgba(0,0,0,0.7);

    --title-size: 2.6rem;
    --subtitle-size: 1.3rem;
    --author-size: 0.9rem;
    --title-offset: 10%;
    --author-offset: 4%;
    --text-align: center;

    --title-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --subtitle-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --author-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

    --author-align: right;
}

/* Fundo da capa como IMG — html2canvas captura corretamente */
.cover-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    padding: 16px 14px 18px;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.55) 0%,
        rgba(0,0,0,0.25) 40%,
        rgba(0,0,0,0.65) 100%
    );
    box-sizing: border-box;
}

.cover-text-block {
    position: absolute;
    left: 8%;
    right: 8%;
    top: var(--title-offset);
    text-align: var(--text-align);
}

.cover-title {
    font-family: var(--title-font);
    font-size: var(--title-size);
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.85);
}

.cover-subtitle {
    font-family: var(--subtitle-font);
    margin-top: 8px;
    font-size: var(--subtitle-size);
    line-height: 1.35;
    max-width: 100%;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    margin-left: auto;
    margin-right: auto;
}

.cover-author {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: var(--author-offset);
    font-family: var(--author-font);
    font-size: var(--author-size);
    font-weight: 600;
    text-align: var(--author-align);
    opacity: 0.95;
    text-shadow: 0 2px 4px rgba(0,0,0,0.85);
}

.download {
    display: block;
    background: #2196f3;
    padding: 12px;
    text-align: center;
    color: #fff;
    margin-top: 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
}

.download:hover {
    background: #1976d2;
}

.download-secondary {
    background: #555;
    border: none;
}

.download-secondary:hover {
    background: #666;
}

#imageUrl {
    font-size: 0.75rem;
    word-break: break-all;
    opacity: 0.7;
    margin-top: 6px;
}
