:root {
    --bg: #f2f4f7;
    --card: #ffffff;
    --primary: #1f6feb;
    --primary-dark: #174ea6;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

h1 {
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}

h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 10px;
    color: var(--muted);
}

label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

input {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    outline: none;
    background: var(--card);
}

input:focus {
    border-color: var(--primary);
}

/* ---------- ÁREAS ---------- */

.areas {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.areas button {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.areas button::after {
    content: "›";
    float: right;
    font-size: 22px;
    color: var(--muted);
}

.areas button:active {
    background: #eef2ff;
    border-color: var(--primary);
}

/* ---------- CÂMERA ---------- */

video {
    width: 100%;
    border-radius: 18px;
    margin-top: 10px;
    background: black;
}

/* ---------- BOTÕES ---------- */

button {
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
    background: var(--primary);
    color: white;
    margin-top: 12px;
    box-shadow: 0 6px 16px rgba(31, 111, 235, 0.25);
}

button:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.voltar {
    background: transparent;
    color: var(--muted);
    box-shadow: none;
    font-size: 14px;
    padding: 4px 6px;
}

.voltar:hover {
    color: var(--text);
}

.voltar:active {
    transform: scale(0.98);
}

/* ---------- PREVIEW ---------- */

#preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
}

.preview-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    background: #000;
    cursor: pointer;
}

.preview-item img,
.preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}




canvas {
    display: none;
}

/* ---------- MODAL RESPONSIVO ---------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 16px;
    /* evita colar na borda */
}

.modal-content {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 75vh;
    /* LIMITE REAL */
    width: auto;
    height: auto;
    object-fit: contain;
    /* mantém proporção */
    border-radius: 12px;
}

.btn-excluir {
    margin-top: 12px;
    width: 100%;
    max-width: 400px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
}


/* ---------- RESPONSIVO ---------- */

@media (min-width: 600px) {
    body {
        max-width: 480px;
        margin: auto;
    }
}

.wizard {
    width: 100%;
    max-width: 420px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
}

.wizard-step h2 {
    font-size: 18px;
    margin-bottom: 12px;
}

.wizard-step label {
    display: block;
    padding: 10px;
    background: #f3f4f6;
    border-radius: 10px;
    margin-bottom: 8px;
}

.wizard-nav {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.wizard-nav button {
    flex: 1;
}


/* ---------- WIZARD (ISOLADO) ---------- */

.modal-content.wizard {
    background: var(--card);
    border-radius: 16px;
    padding: 16px;
    max-width: 420px;
    width: 100%;
}

.modal-content.wizard h2 {
    color: var(--text);
}

.modal-content.wizard label {
    background: #f3f4f6;
    color: var(--text);
}


.resumo-area {
    background: var(--card);
    border-radius: 16px;
    padding: 14px;
    margin-top: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.resumo-area h2 {
    font-size: 16px;
    margin-bottom: 10px;
}

.resumo-area ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resumo-area li {
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.resumo-area li:last-child {
    border-bottom: none;
}

/* ---------- BOTÕES DE AÇÃO (MODELO LIMPO) ---------- */

.btn-acao {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 12px 14px;
    font-size: 15px;
    font-weight: 500;

    box-shadow: none;
}

/* hover sutil */
.btn-acao:hover {
    background: #f9fafb;
}

/* toque mobile */
.btn-acao:active {
    background: #eef2ff;
}

/* ---------- CÂMERA ---------- */

.camera-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
}


.camera-wrapper video {
    width: 100%;
    border-radius: 18px;
    background: black;
}

/* ---------- FLASH LOCAL ---------- */

#flash {
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    border-radius: 18px;
    transition: opacity 0.15s ease;
}

#flash.ativo {
    opacity: 0.9;
}

/* ---------- AÇÃO DISCRETA (LINK) ---------- */

.titulo-area {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    /* 🔑 CHAVE */
    margin: 10px 0 6px;
}

.titulo-area .acao-link {
    margin-left: auto;
}

button.acao-link {
    all: unset;
    /* REMOVE 100% DO CSS GLOBAL */
    cursor: pointer;

    font-size: 13px;
    font-weight: 500;
    color: var(--muted);

    white-space: nowrap;
}

button.acao-link:hover {
    text-decoration: underline;
    color: var(--text);
}


/* ---------- INDICADOR DE GRAVAÇÃO ---------- */

#recIndicator {
    position: absolute;
    bottom: 10px;
    /* 🔽 bem embaixo */
    left: 50%;
    transform: translateX(-50%);

    display: inline-flex;
    align-items: center;
    /* 🔑 ESSENCIAL */
    justify-content: center;
    gap: 6px;

    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 13px;
    font-weight: 600;

    padding: 6px 12px;
    border-radius: 999px;

    width: auto;
    height: auto;

    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

#recIndicator .dot {
    width: 8px;
    height: 8px;
    background: #ff3b30;
    border-radius: 50%;
    animation: pulse 1s infinite;

    display: inline-block;
    flex-shrink: 0;
    margin-top: 1px;
    /* 🔑 AJUSTE FINO */
}



@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}


#preview img,
#preview video {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    background: black;
}


.play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    background: rgba(0, 0, 0, 0.25);
    pointer-events: none;
}