:root {
    --bg-primary: #f0f0f0;
    --bg-secondary: #ffffff;
    --accent: #000000;
    --text-primary: #3c3c3c;
    --text-secondary: #787878;
    --text-inverse: #ffffff;
    --border-light: #d2d2d2;
    --shadow: rgba(0, 0, 0, 0.1);
    --accent-hover: #3c3c3c;
    --primary: #000;
    --primaryT: hsla(0,0%,0%,0.5);
    --transDur: 0.3s;
    --bg: #f0f0f0;
    --light: #d8dbe0;
    --dark: #28292c;
    --link: rgb(27, 129, 112);
    --link-hover: rgb(24, 94, 82);
}

body {
    margin: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

html {
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow-x: hidden;
    overflow-y: scroll;
}

html::-webkit-scrollbar {
    display: none;
}

body.modo-escuro {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --accent: #ffffff;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-inverse: #000000;
    --border-light: #333333;
    --shadow: rgba(0, 0, 0, 0.3);
    --accent-hover: #cccccc;
    --primary: #fff;
    --primaryT: hsla(0,0%,100%,0.5);
    --bg: #121212;
}

.fundo-animado {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    opacity: 1;
}

.blob-1 {
    width: 280px;
    height: 320px;
    top: -180px;
    left: -120px;
    border-radius: 63% 37% 54% 46% / 55% 48% 52% 45%;
    background: #C4B454;
    animation: flutuar-1 22s ease-in-out infinite alternate;
}

.blob-2 {
    width: 350px;
    height: 300px;
    top: -140px;
    right: -160px;
    border-radius: 38% 62% 43% 57% / 48% 35% 65% 52%;
    background: #7A9B7F;
    animation: flutuar-2 26s ease-in-out infinite alternate;
}

.blob-3 {
    width: 320px;
    height: 380px;
    bottom: -220px;
    left: -140px;
    border-radius: 47% 53% 68% 32% / 62% 43% 57% 38%;
    background: #A39770;
    animation: flutuar-3 24s ease-in-out infinite alternate;
}

.blob-4 {
    width: 340px;
    height: 310px;
    bottom: -180px;
    right: -150px;
    border-radius: 57% 43% 37% 63% / 44% 58% 42% 56%;
    background: #6B8B6F;
    animation: flutuar-4 28s ease-in-out infinite alternate;
}

@keyframes flutuar-1 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, 30px) scale(1.08); }
    66% { transform: translate(-30px, 50px) scale(0.95); }
    100% { transform: translate(20px, -20px) scale(1.02); }
}

@keyframes flutuar-2 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-35px, 40px) scale(1.05); }
    66% { transform: translate(25px, 20px) scale(0.98); }
    100% { transform: translate(-15px, -25px) scale(1.03); }
}

@keyframes flutuar-3 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -40px) scale(1.06); }
    66% { transform: translate(-20px, -30px) scale(0.96); }
    100% { transform: translate(30px, 15px) scale(1.04); }
}

@keyframes flutuar-4 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-40px, -35px) scale(1.07); }
    66% { transform: translate(35px, -20px) scale(0.97); }
    100% { transform: translate(-25px, 25px) scale(1.01); }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.conteudo-animado {
    opacity: 0;
    transform: translateY(30px);
    animation: aparecer 0.6s ease-out forwards;
}

.cabecalho-wiki {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 40px;
    border-bottom: 2px solid var(--border-light);
}

.cabecalho-wiki h1 {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 700;
    color: var(--accent);
}

.cabecalho-wiki p {
    font-size: 1.2rem;
    margin: 5px 0 0;
    color: var(--text-secondary);
}

.materia-principal {
    display: flex;
    gap: 30px;
    margin-bottom: 50px;
    padding: 30px;
    background-color: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: 0 4px 15px var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.modo-escuro .materia-principal {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.materia-principal:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow);
}

.materia-principal:active {
    transform: translateY(-5px) scale(0.98);
}

.materia-principal img {
    width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
}

.texto-materia {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.texto-materia h2 {
    font-size: 2rem;
    margin: 0 0 10px;
    color: var(--text-primary);
}

.texto-materia .meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.texto-materia p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-primary);
    flex-grow: 1;
}

.botao-leia-mais {
    align-self: flex-start;
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-inverse);
    background-color: var(--accent);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.botao-leia-mais:hover {
    background-color: var(--accent-hover);
}

.outras-materias h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.outras-materias ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-noticia {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.modo-escuro .item-noticia {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.item-noticia:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px var(--shadow);
}

.item-noticia:active {
    transform: translateY(-3px) scale(0.98);
}

.item-noticia img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.texto-item h4 {
    font-size: 1.3rem;
    margin: 0 0 8px;
    color: var(--text-primary);
}

.texto-item .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.texto-item p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
}

@keyframes aparecer {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tv-ligar {
    0% { transform: scaleY(0.01) scaleX(1); filter: brightness(0.3); opacity: 1; }
    20% { transform: scaleY(0.01) scaleX(0.5); filter: brightness(0.1); }
    40% { transform: scaleY(0.8) scaleX(1); filter: brightness(2); }
    60% { transform: scaleY(1.05) scaleX(1); filter: brightness(1.5); }
    100% { transform: scaleY(1) scaleX(1); filter: brightness(1); opacity: 1; }
}

@keyframes tv-desligar {
    0% { transform: scaleY(1) scaleX(1); filter: brightness(1); opacity: 1; }
    40% { transform: scaleY(0.01) scaleX(1); filter: brightness(20); }
    70% { transform: scaleY(0.005) scaleX(0.5); filter: brightness(50); }
    100% { transform: scaleY(0) scaleX(0); filter: brightness(100); opacity: 0; }
}

.modal-container {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-container.modal-ativado {
    animation: fade-in 0.3s ease;
}

.modal-container.modal-fechando {
    animation: fade-out 0.6s ease forwards;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal-conteudo {
    background-color: var(--bg-secondary);
    padding: 0;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transition: filter 0.4s ease;
}

.modal-container.modal-ativado .modal-conteudo {
    animation: tv-ligar 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.modal-container.modal-fechando .modal-conteudo {
    animation: tv-desligar 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.modal-conteudo.modo-tela-cheia {
    filter: brightness(1.2);
}

.modal-conteudo:fullscreen {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
}

.modal-conteudo.contraste-alto {
    background-color: #000;
    color: #fff;
}

.modal-conteudo.contraste-alto .modal-cabecalho h2,
.modal-conteudo.contraste-alto #modal-meta,
.modal-conteudo.contraste-alto #modal-conteudo p {
    color: #fff;
}

.modal-cabecalho {
    padding: 25px 30px 15px;
    border-bottom: 1px solid var(--border-light);
}

.modal-cabecalho h2 {
    margin: 0 0 5px;
    font-size: 2.2rem;
    color: var(--text-primary);
}

#modal-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.barra-de-ferramentas {
    padding: 10px 30px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
}

.barra-de-ferramentas button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-light);
    background-color: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.barra-de-ferramentas button:hover {
    background-color: var(--accent);
    color: var(--text-inverse);
}

.modal-corpo {
    padding: 20px 30px;
    overflow-y: auto;
    flex-grow: 1;
}

#modal-conteudo {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: justify;
}

.modal-galeria {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.modal-galeria img {
    max-width: 100%;
    width: 250px;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.rodape-modal {
    padding: 15px 30px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.botao-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.botao-link:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.fechar-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: var(--text-secondary);
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    z-index: 1001;
}

.fechar-modal:hover {
    color: var(--accent);
}

.icone-config-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: 60px;
    height: 60px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.icone-config-container:active {
    transform: scale(0.95);
}

.icone-config-container:hover {
    transform: scale(1.1);
}

.icone-config {
    background-color: var(--accent);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--shadow), 0 0 0 3px var(--bg-secondary);
    transition: all 0.3s ease;
    animation: pulsar 2s ease-in-out infinite;
    pointer-events: none;
}

body.modo-escuro .icone-config {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2), 0 0 0 3px var(--bg-secondary);
}

.icone-config-container:hover .icone-config {
    box-shadow: 0 6px 25px var(--shadow), 0 0 0 5px var(--bg-secondary);
    transform: rotate(15deg);
}

.icone-config svg {
    width: 32px;
    height: 32px;
    color: var(--text-inverse);
}

@keyframes pulsar {
    0% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(0, 0, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.secao-config {
    margin-bottom: 25px;
}

.secao-config h3 {
    margin: 0 0 15px;
    font-size: 1.3rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.secao-config p {
    margin: 0 0 10px;
    line-height: 1.6;
    color: var(--text-primary);
}

.opcao-config {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch-track {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.theme-switch-thumb {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .theme-switch-track {
    background-color: #2196F3;
}

input:checked + .theme-switch-track + .theme-switch-thumb {
    transform: translateX(24px);
}

body.modo-escuro .theme-switch-track {
    background-color: #555;
}

@media (max-width: 768px) {
    .blob-1 { width: 200px; height: 220px; top: -120px; left: -80px; }
    .blob-2 { width: 250px; height: 210px; top: -90px; right: -100px; }
    .blob-3 { width: 220px; height: 260px; bottom: -140px; left: -90px; }
    .blob-4 { width: 240px; height: 220px; bottom: -120px; right: -100px; }

    .container {
        padding: 15px;
    }

    .cabecalho-wiki h1 {
        font-size: 2rem;
    }

    .materia-principal {
        flex-direction: column;
        padding: 20px;
    }

    .materia-principal img {
        width: 100%;
        height: 200px;
    }

    .item-noticia {
        flex-direction: column;
    }

    .item-noticia img {
        width: 100%;
        height: 180px;
    }

    .modal-conteudo {
        max-height: 95vh;
    }

    .icone-config-container {
        top: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
        z-index: 1100;
    }

    .icone-config {
        width: 50px;
        height: 50px;
        margin: 3px;
    }

    .icone-config svg {
        width: 26px;
        height: 26px;
    }
}