:root {
    --bg: #0f172a;
    --ink: #f8fafc;
    --ink-light: #475569;
    --mango: #f6b84b;
    --mango-glow: rgba(246, 184, 75, 0.4);
    --border: #e2e8f0;
    --tia: #3b82f6;
    --sia: #10b981;
    --dv: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
h1, h3, .badge { font-family: 'Georgia', serif; }

.app-container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.header { text-align: center; margin-bottom: 3rem; }
.badge { display: inline-block; background: var(--ink); color: #fff; padding: 0.4rem 1rem; border-radius: 30px; font-size: 0.8rem; margin-bottom: 1rem; }
.header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.header p { color: var(--ink-light); }

.calculator { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 2rem; box-shadow: 0 10px 40px rgba(0,0,0,0.03); }

.step-card { border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.step-card h3 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--ink-light); }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.input-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--ink-light); }
input { width: 100%; padding: 0.7rem; border: 2px solid var(--border); border-radius: 8px; font-size: 1rem; outline: none; transition: 0.2s; }
input:focus { border-color: var(--mango); box-shadow: 0 0 0 3px var(--mango-glow); }

.main-btn { 
    width: 100%; padding: 1.2rem; background: var(--ink); color: #fff; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; transition: 0.3s; font-size: 1.1rem; margin-top: 1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.main-btn:hover { background: var(--mango); transform: translateY(-2px); box-shadow: 0 8px 25px var(--mango-glow); }

.result-section { margin-top: 3rem; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.viz-container { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 700px) { .viz-container { grid-template-columns: 1fr; } }

.polar-wrapper { background: #fafafa; border-radius: 15px; padding: 1rem; position: relative; border: 1px solid var(--border); }
#polar-plot { width: 100%; height: auto; display: block; }

.legend { display: flex; justify-content: center; gap: 1rem; margin-top: 1rem; font-size: 0.8rem; font-weight: 600; }
.legend span { display: flex; align-items: center; gap: 0.4rem; }
.legend span::before { content: ""; width: 12px; height: 12px; border-radius: 2px; }
.l-tia::before { background: var(--tia); border: 2px dashed #000; }
.l-sia::before { background: var(--sia); }
.l-dv::before { background: var(--dv); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.stat-card { background: #fff; border: 1px solid var(--border); padding: 1rem; border-radius: 12px; text-align: center; }
.stat-card label { display: block; font-size: 0.75rem; color: var(--ink-light); margin-bottom: 0.3rem; }
.stat-card span { display: block; font-size: 1.4rem; font-weight: 800; }
.stat-card small { font-size: 0.7rem; color: var(--ink-light); }

.analysis-box { background: var(--bg); border: 1px solid var(--mango); padding: 1.5rem; border-radius: 12px; color: var(--ink); border-left: 6px solid var(--mango); margin-bottom: 2rem; }

/* Dropdown de Explicação da Matemática */
.math-dropdown { margin-bottom: 2rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.math-dropdown summary { padding: 0.8rem 1rem; font-weight: 600; cursor: pointer; color: var(--ink); list-style: none; user-select: none; background: rgba(246, 184, 75, 0.1); transition: background 0.2s; }
.math-dropdown summary:hover { background: rgba(246, 184, 75, 0.2); }
.math-dropdown summary::-webkit-details-marker { display: none; }
.math-dropdown summary::before { content: "►"; display: inline-block; margin-right: 0.5rem; transition: transform 0.2s; font-size: 0.8rem; color: var(--mango); }
.math-dropdown[open] summary::before { transform: rotate(90deg); }
.math-content { padding: 1rem; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--ink-light); line-height: 1.6; }
.math-content ul { padding-left: 1.2rem; margin-top: 0.8rem; }
.math-content li { margin-bottom: 0.8rem; }
.math-content em { color: var(--ink); font-weight: 600; }

.references { margin-top: 3rem; padding: 2rem; background: #f1f5f9; border-radius: 15px; font-size: 0.9rem; }
.references h3 { font-size: 1rem; margin-bottom: 1rem; }
.references .disclaimer { margin-top: 1rem; font-style: italic; color: #64748b; font-size: 0.85rem; border-top: 1px solid rgba(0,0,0,0.1); padding-top: 0.8rem; }

/* FAQ Section */
.faq-section { margin-top: 4rem; border-top: 2px solid var(--border); padding-top: 2rem; }
.faq-section h2 { font-size: 1.5rem; margin-bottom: 2rem; text-align: center; color: var(--ink); }
.faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .faq-grid { grid-template-columns: 1fr; } }

.faq-section details { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0; transition: 0.3s; }
.faq-section summary { padding: 1rem; font-weight: 700; cursor: pointer; color: var(--ink-light); list-style: none; font-size: 0.9rem; }
.faq-section details[open] { border-color: var(--mango); box-shadow: 0 5px 15px var(--mango-glow); }
.faq-section details[open] summary { color: var(--ink); border-bottom: 1px solid var(--border); }
.faq-section details p { padding: 1rem; font-size: 0.85rem; color: var(--ink-light); background: var(--bg); }
