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

:root {
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --color-green: #10b981;
    --color-blue: #3b82f6;
    --color-ciano: #06b6d4;
    --color-red: #ef4444;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at top left, #0f172a, #020617);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

/* ==========================================================================
   Utilitários Globais
   ========================================================================== */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

.container {
    padding: 2rem;
    max-width: 1000px;
    width: 100%;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    margin: auto;
}

.highlight {
    color: var(--color-green);
    font-weight: 800;
}

/* ==========================================================================
   Menu Dropdown e Botão
   ========================================================================== */
.menu-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

#botaoMenu {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    padding: 0;
}

#botaoMenu span {
    width: 100%;
    height: 3px;
    background: var(--color-green);
    border-radius: 2px;
    transition: all 0.3s linear;
}

#botaoMenu.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

#botaoMenu.open span:nth-child(2) {
    opacity: 0;
}

#botaoMenu.open span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 35px;
    background: var(--color-blue);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    min-width: 150px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.dropdown-content.show {
    display: flex;
    flex-direction: column;
}

.dropdown-content a,
.dropdown-content .menu-version {
    color: var(--text-primary);
    padding: 12px 16px;
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-content .menu-version {
    border-bottom: none;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Header
   ========================================================================== */
header {
    text-align: center;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

h1 {
    font-weight: 300;
    letter-spacing: 2px;
    font-size: clamp(1.2rem, 4vw, 2rem);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Main Content e Layout Principal
   ========================================================================== */
.main-content {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: flex-start;
    overflow-y: auto;
    padding-right: 5px;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* ==========================================================================
   Controles e Inputs
   ========================================================================== */
.controls {
    flex: 1;
    min-width: 300px;
}

.input-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

select,
input {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

/* ==========================================================================
   Grid de Resultados
   ========================================================================== */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.result-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    transition: transform 0.3s;
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-card span {
    font-size: 0.65rem;
    color: var(--text-secondary);
    display: block;
}

.result-card strong {
    font-size: 1.3rem;
    color: var(--color-green);
}

.highlight-card {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), transparent);
    border-color: rgba(59, 130, 246, 0.4);
}

.highlight-card strong {
    font-size: 2.2rem;
    color: var(--color-blue);
}

/* ==========================================================================
   Visualizador SVG
   ========================================================================== */
.visualizer {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--glass-border);
    flex: 1;
    min-width: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

#renderer {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    overflow: visible;
}

#hexagono {
    stroke: var(--color-blue);
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#labels {
    font-size: 11px;
    fill: #e2e8f0;
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
}

/* ==========================================================================
   Modal Info
   ========================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    padding: 2rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    position: relative;
}

.modal-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow-y: auto;
    margin-bottom: 1.5rem;
    padding-right: 10px;
}

.modal-content::-webkit-scrollbar {
    width: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

#conteudoTexto {
    white-space: pre-line;
}

.btn-fechar-modal {
    background: var(--color-green);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s, background 0.2s;
    align-self: flex-end;
}

.btn-fechar-modal:hover {
    transform: scale(1.05);
    background: var(--color-blue);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 1rem;
    flex-shrink: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.highlight-alt span {
    color: var(--color-ciano);
    font-weight: bold;
    text-transform: uppercase;
}

/* ==========================================================================
   Responsividade
   ========================================================================== */
@media (max-width: 900px) {
    .container {
        padding: 15px;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    header {
        margin-bottom: 0.5rem;
        padding: 50px;
    }

    h1 {
        font-size: 1.2rem;
    }

    .main-content {
        flex-direction: column;
        align-items: stretch;
        overflow: hidden;
        gap: 10px;
    }

    .controls,
    .visualizer {
        width: 100%;
        min-width: 0;
    }

    .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .controls .input-group:nth-child(3) {
        grid-column: span 2;
        margin-bottom: 0;
    }

    .input-group {
        margin-bottom: 0;
    }

    label {
        margin-bottom: 5px;
    }

    select,
    input {
        padding: 10px;
    }

    .results-grid {
        margin-top: 10px;
        grid-column: span 2;
        gap: 10px;
    }

    .visualizer {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
    }

    .result-card {
        padding: 10px;
    }

    .highlight-card {
        grid-column: span 2;
    }

    .highlight-card strong {
        font-size: 1.8rem;
    }
}