* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    -webkit-font-smoothing: antialiased;
    background: #ffffff;
    color: var(--color-text);
    overflow-x: hidden;
    padding-top: var(--header-height, 84px);
    min-height: 100vh;
}

/* ===== Header ===== */
.logo-icon img { width: 51px; }

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: slideInRight 0.6s ease;
}

.back-button:hover {
    background-color: white;
    color: var(--color-primary);
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.back-button svg { transition: transform 0.3s ease; }
.back-button:hover svg { transform: translateX(-3px); }

/* ===== Background ===== */
.background-animation {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.triangle { position: absolute; width: 0; height: 0; border-style: solid; }

.triangle-1 {
    top: 0; left: 0;
    border-width: 250px 250px 0 0;
    border-color: var(--color-primary) transparent transparent transparent;
    opacity: 0.06;
    transform: translateY(var(--header-height, 84px));
}
.triangle-2 {
    top: 0; right: 0;
    border-width: 0 250px 250px 0;
    border-color: transparent var(--color-primary) transparent transparent;
    opacity: 0.06;
    transform: translateY(var(--header-height, 84px));
}
.triangle-3 {
    bottom: 0; left: 0;
    border-width: 250px 0 0 250px;
    border-color: transparent transparent transparent var(--color-primary);
    opacity: 0.06;
}
.triangle-4 {
    bottom: 0; right: 0;
    border-width: 0 0 250px 250px;
    border-color: transparent transparent var(--color-primary) transparent;
    opacity: 0.06;
}

/* ===== Container ===== */
.main-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* ===== Hero ===== */
.hero-section { text-align: center; margin-bottom: 3rem; animation: fadeInUp 0.6s ease; }
.hero-section h1 { font-size: 2.5rem; font-weight: 700; color: var(--color-text); margin-bottom: 1rem; line-height: 1.2; }
.hero-section p { font-size: 1.125rem; color: var(--color-text-muted); max-width: 640px; margin: 0 auto; line-height: 1.6; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease;
}

.card:hover { box-shadow: var(--shadow-card-hover); }

.card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.success-icon { background: linear-gradient(135deg, #10b981, #34d399); }

.card h2 { text-align: center; font-size: 1.75rem; color: var(--color-text); margin-bottom: 0.5rem; }
.card-description { text-align: center; color: var(--color-text-muted); margin-bottom: 1.5rem; font-size: 1rem; }

/* ===== Alternador de modo (Gravar / Enviar arquivo) ===== */
.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    background: var(--color-surface-soft);
    border-radius: var(--radius-pill);
    padding: 0.35rem;
    max-width: 420px;
    margin: 0 auto 2rem;
    border: 1px solid var(--color-border);
}

.mode-toggle-btn {
    flex: 1;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle-btn.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    box-shadow: var(--shadow-primary-btn);
}

.mode-panel { animation: fadeInUp 0.4s ease; }

/* ===== Medidor de Volume (só visual, sem veredito baixo/ideal/alto) ===== */
.volume-meter-wrap { max-width: 480px; margin: 0 auto 2rem; }

.volume-meter {
    position: relative;
    height: 22px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
}

.volume-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary-light), var(--color-primary));
    transition: width 0.06s linear;
    pointer-events: none;
}

.volume-needle {
    position: absolute;
    top: -3px;
    left: 0%;
    width: 4px;
    height: 28px;
    background: var(--color-text);
    border-radius: 2px;
    transform: translateX(-2px);
    transition: left 0.06s linear;
    box-shadow: 0 0 0 2px white;
}

/* ===== Upload de arquivo ===== */
.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 1.5rem;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text-muted);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 480px;
    margin: 0 auto 1.5rem;
}

.upload-dropzone:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-surface-soft); }
.upload-dropzone svg { color: inherit; }

/* ===== Controles do microfone / ação ===== */
.mic-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; }

.btn-cam {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid var(--color-primary);
    background: white;
    color: var(--color-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-cam:hover { background: var(--color-primary); color: white; }
.btn-cam:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-cam:disabled:hover { background: white; color: var(--color-primary); }

.btn-gravar { border-color: var(--color-danger); color: var(--color-danger); }
.btn-gravar:hover { background: var(--color-danger); color: white; }
.btn-gravar.gravando { background: var(--color-danger); color: white; animation: pulse 1.2s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

.gravacao-timer {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-danger);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.mic-hint { text-align: center; font-size: 0.85rem; color: var(--color-text-muted); margin-top: 1.25rem; line-height: 1.5; }

/* ===== Status da análise ===== */
.analise-status {
    text-align: center;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    padding: 0.85rem 1.25rem;
    background: var(--color-surface-soft);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

/* ===== Player ===== */
.player-wrapper { margin-bottom: 1.5rem; }
.player-wrapper audio, .player-wrapper video {
    width: 100%;
    max-height: 260px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

/* ===== Buttons ===== */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    font-family: inherit;
}

.btn-primary { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)); color: white; box-shadow: var(--shadow-primary-btn); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(106, 62, 167, 0.4); }

.btn-secondary { background: white; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-secondary:hover { background: var(--color-primary); color: white; transform: translateY(-2px); }

.action-buttons { display: flex; gap: 1rem; margin-top: 2rem; }
.action-buttons button { flex: 1; }

/* ===== Resultado — blocos e subtítulos ===== */
.results-subtitle {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 1.75rem 0 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--color-border);
}

.results-card > .results-subtitle:first-of-type { margin-top: 0.5rem; }

.bloco {
    background: var(--color-surface-soft);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    border: 1px solid var(--color-border);
    font-size: 0.92rem;
    color: var(--color-text);
    line-height: 1.6;
}

.texto-transcrito { white-space: pre-wrap; max-height: 260px; overflow-y: auto; }
.texto-transcrito mark { background: #ffe082; padding: 0 2px; border-radius: 2px; }

.metrica-principal { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; }
.metrica-detalhe { color: var(--color-text-muted); font-size: 0.85rem; margin-top: 0.4rem; }

.lista-detalhes { list-style: none; margin-top: 0.6rem; }
.lista-detalhes li { padding: 0.3rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.88rem; }
.lista-detalhes li:last-child { border-bottom: none; }

.barra-dica { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 0.4rem; }

/* ===== Tags (repetições, preenchimento, ritmo resumo) ===== */
.tag {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin: 0.15rem 0.3rem 0.15rem 0;
    background: #ece7f6;
    color: var(--color-primary-dark);
    font-weight: 600;
}

.tag-alerta { background: #fef3c7; color: var(--color-warning); }
.tag-clicavel { cursor: pointer; transition: filter 0.15s; }
.tag-clicavel:hover { filter: brightness(0.93); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ===== Barra de ritmo ===== */
.barra-ritmo {
    display: flex;
    height: 30px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.75rem;
    cursor: pointer;
}

.segmento-ritmo { height: 100%; min-width: 2px; transition: opacity 0.15s; }
.segmento-ritmo:hover { opacity: 0.75; }
.segmento-lento     { background: #64b5f6; }
.segmento-moderado  { background: #81c784; }
.segmento-rapido    { background: #ffb74d; }
.segmento-silencio  { background: #d0d0d0; }

/* ===== Barra de pausas ===== */
.barra-pausas {
    position: relative;
    height: 20px;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
}

.marcador-pausa {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--color-primary-light);
    min-width: 4px;
    border-radius: 3px;
    cursor: pointer;
}
.marcador-pausa:hover { opacity: 0.8; }

/* ===== Barra de entonação ===== */
.barra-entonacao {
    display: flex;
    height: 30px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-top: 0.75rem;
    cursor: pointer;
}

.segmento-entonacao { height: 100%; min-width: 2px; transition: opacity 0.15s; }
.segmento-entonacao:hover { opacity: 0.75; }
.segmento-grave         { background: #8c9eff; }
.segmento-moderada      { background: #f2c94c; }
.segmento-aguda         { background: #f2994a; }
.segmento-indeterminado { background: #d0d0d0; }

/* ===== Legendas (compartilhada por ritmo/entonação) ===== */
.legenda-barra { display: none; gap: 14px; margin-top: 0.5rem; font-size: 0.8rem; color: var(--color-text-muted); flex-wrap: wrap; }
.legenda-item { display: flex; align-items: center; gap: 4px; }
.legenda-cor { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.cor-lento    { background: #64b5f6; }
.cor-moderado { background: #81c784; }
.cor-rapido   { background: #ffb74d; }
.cor-silencio { background: #d0d0d0; }
.cor-grave         { background: #8c9eff; }
.cor-moderada      { background: #f2c94c; }
.cor-aguda         { background: #f2994a; }
.cor-indeterminado { background: #d0d0d0; }

/* ===== Info Section ===== */
.info-section { margin: 4rem 0 2rem; }
.info-section h3 { text-align: center; font-size: 2rem; color: var(--color-text); margin-bottom: 2rem; }

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 2rem; margin-bottom: 3rem; }

.step-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); border-color: var(--color-primary); }

.step-number {
    width: 48px; height: 48px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 700;
}

.step-card h4 { font-size: 1.25rem; color: var(--color-text); margin-bottom: 0.5rem; }
.step-card p { color: var(--color-text-muted); line-height: 1.6; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-container { padding: 1rem; }
    .hero-section h1 { font-size: 2rem; }
    .hero-section p { font-size: 1rem; }
    .card { padding: 1.5rem; }
    .action-buttons { flex-direction: column; }
    .steps-grid { grid-template-columns: 1fr; }
    .mode-toggle { max-width: 100%; }
    body { padding-top: 100px; }
}
