/* Importação de fontes */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&family=Teko:wght@400;600&display=swap');

/* --- VARIÁVEIS DE COR (TEMA CLARO - PADRÃO) --- */
:root {
    --body-bg: #f0f2f5;
    --card-bg: #fff;
    --text-color: #333;
    --text-secondary-color: #555;
    --header-border-color: #19486A;
    --header-title-color: #19486A;
    --button-bg: #007bff;
    --button-hover-bg: #0056b3;
    --hint-button-bg: #6c757d;
    --hint-button-hover-bg: #5a6268;
    --nav-link-bg: #fff;
    --nav-link-hover-bg: #e2e6ea;
    --nav-link-border: #ddd;
    --solution-bg: #f9f9f9;
    --welcome-text-color: #333;
    --scrollbar-thumb: #a0a0a0;
    --scrollbar-thumb-hover: #707070;
}

/* --- VARIÁVEIS PARA O TEMA ESCURO --- */
body.dark-mode {
    --body-bg: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --text-secondary-color: #b0b0b0;
    --header-border-color: #007bff;
    --header-title-color: #e0e0e0;
    --button-bg: #0056b3;
    --button-hover-bg: #004494;
    --hint-button-bg: #5a6268;
    --hint-button-hover-bg: #495057;
    --nav-link-bg: #333;
    --nav-link-hover-bg: #555;
    --nav-link-border: #555;
    --solution-bg: #2c2c2c;
    --welcome-text-color: #e0e0e0;
    --scrollbar-thumb: #555;
    --scrollbar-thumb-hover: #777;
}

/* --- ESTILOS GERAIS --- */
body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* --- PÁGINA DE BOAS-VINDAS (LANDING PAGE) --- */
body.landing-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}
.main-welcome {
    max-width: 900px;
    margin: auto;
}
.welcome-content h1 {
    font-family: 'Teko', sans-serif;
    font-size: 4.5em;
    color: var(--welcome-text-color);
    margin-bottom: 20px;
}
.welcome-content p {
    font-size: 1.3em;
    color: var(--text-secondary-color);
    margin-bottom: 40px;
}
.main-navbar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}
.tutorial-basico {
    margin: 40px auto;
    max-width: 650px;
    padding: 20px;
    border: 1px solid var(--nav-link-border);
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.02);
}
body.dark-mode .tutorial-basico {
    background-color: rgba(255, 255, 255, 0.05);
}
.tutorial-basico h3 {
    font-family: 'Teko', sans-serif;
    font-size: 2em;
    margin-top: 0;
    color: var(--header-title-color);
}
.tutorial-basico p {
    font-size: 1.1em;
    color: var(--text-secondary-color);
    margin-bottom: 10px;
}


/* --- IMAGENS LATERAIS (LANDING PAGE) --- */
.side-image {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: auto;
    opacity: 0.8;
    z-index: -1;
    transition: opacity 0.3s;
}
.side-image-left {
    left: 40px;
}
.side-image-right {
    right: 40px;
}
@media (max-width: 1200px) {
    .side-image {
        display: none;
    }
}


/* --- ESTILOS DAS PÁGINAS DE ODS --- */
header {
    text-align: center;
    max-width: 1200px;
    margin: 0 auto 40px auto;
    border-bottom: 3px solid var(--header-border-color);
    padding: 20px;
    position: relative;
}
header h1 {
    padding-top: 0.7em;
    font-family: 'Teko', sans-serif;
    font-size: 3.5em;
    color: var(--header-title-color);
    margin: 0 0 10px 0;
}
header p {
    font-size: 1.2em;
    color: var(--text-secondary-color);
    max-width: 800px;
    margin: 0 auto 20px auto;
}
.navbar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 8px; /* <-- A MUDANÇA ESTÁ AQUI */
    padding: 10px 0;
}
.nav-link {
    text-decoration: none;
    border: 1px solid var(--nav-link-border);
    background-color: var(--nav-link-bg);
    color: var(--text-color);
    padding: 8px 14px;
    border-radius: 25px;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.9em;
}
.nav-link:hover {
    background-color: var(--nav-link-hover-bg);
}
.nav-link.active {
    background-color: var(--button-bg);
    color: white;
    border-color: var(--button-bg);
}


/* --- INTERRUPTOR DE TEMA --- */
.theme-switch-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
}
.theme-switch-wrapper span {
    margin-left: 10px;
    font-size: 1em;
    color: var(--text-secondary-color);
}
.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--button-bg);
}
input:checked + .slider:before {
    transform: translateX(26px);
}


/* --- ESTRUTURA E ANIMAÇÃO DAS CARTAS --- */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}
.card.is-flipped .card-inner {
    transform: rotateY(180deg);
}
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background-color: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.card-back {
    transform: rotateY(180deg);
}
.card-header {
    padding: 15px 20px;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}
.card-header h2 {
    font-family: 'Teko', sans-serif;
    font-size: 1.8em;
    margin: 0;
}

/* --- LAYOUT INTERNO DO CARD (COM CORREÇÃO DE SCROLL E SOBREPOSIÇÃO) --- */
.card-content {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--card-bg);
}
.enigma {
    font-style: italic;
    color: var(--text-secondary-color);
    border-left: 4px solid;
    padding-left: 15px;
    margin-bottom: 15px;
}

.hint {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0 10px;
    font-size: 0.9em;
    font-style: italic;
    color: var(--text-secondary-color);
    background-color: var(--solution-bg);
    border-radius: 5px;
    border-left: 4px solid var(--button-bg);
    transition: all 0.5s ease-in-out;
}
.hint.visible {
    opacity: 1;
    max-height: 100px;
    margin-bottom: 8px;
    padding: 10px;
}
.buttons-wrapper {
    margin-top: auto; /* Empurra os botões para o fundo */
    padding-top: 15px; /* Garante espaço acima dos botões */
    flex-shrink: 0;
    display: flex;
    gap: 10px;
}
.buttons-wrapper .toggle-button {
    margin-top: 0;
}
.toggle-button {
    background-color: var(--button-bg);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
}
.toggle-button:hover {
    background-color: var(--button-hover-bg);
}
.hint-button {
    background-color: var(--hint-button-bg);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    flex-shrink: 0;
}
.hint-button:hover {
    background-color: var(--hint-button-hover-bg);
}
.hint-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* --- ESTILOS DO VERSO DA CARTA E FOOTER --- */
.solution {
    font-size: 1em;
    background-color: var(--solution-bg);
    padding: 15px;
    border-radius: 5px;
}
.solution strong {
    color: var(--button-bg);
    display: block;
    margin-bottom: 10px;
}
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 0.9em;
    color: var(--text-secondary-color);
}

/* --- SCROLLBAR ESTILIZADA --- */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 20px;
    border: 2px solid var(--card-bg);
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

/* --- CORES ESPECÍFICAS DAS ODS --- */
#ods1 .card-front .card-header, #ods1 .enigma { border-color: #E5243B; } #ods1 .card-front .card-header { background-color: #E5243B; }
#ods2 .card-front .card-header, #ods2 .enigma { border-color: #DDA63A; } #ods2 .card-front .card-header { background-color: #DDA63A; }
#ods3 .card-front .card-header, #ods3 .enigma { border-color: #4C9F38; } #ods3 .card-front .card-header { background-color: #4C9F38; }
#ods4 .card-front .card-header, #ods4 .enigma { border-color: #C5192D; } #ods4 .card-front .card-header { background-color: #C5192D; }
#ods5 .card-front .card-header, #ods5 .enigma { border-color: #FF3A21; } #ods5 .card-front .card-header { background-color: #FF3A21; }
#ods6 .card-front .card-header, #ods6 .enigma { border-color: #26BDE2; } #ods6 .card-front .card-header { background-color: #26BDE2; }
#ods7 .card-front .card-header, #ods7 .enigma { border-color: #FCC30B; } #ods7 .card-front .card-header { background-color: #FCC30B; }
#ods8 .card-front .card-header, #ods8 .enigma { border-color: #A21942; } #ods8 .card-front .card-header { background-color: #A21942; }
#ods9 .card-front .card-header, #ods9 .enigma { border-color: #FD6925; } #ods9 .card-front .card-header { background-color: #FD6925; }
#ods10 .card-front .card-header, #ods10 .enigma { border-color: #DD1367; } #ods10 .card-front .card-header { background-color: #DD1367; }
#ods11 .card-front .card-header, #ods11 .enigma { border-color: #FD9D24; } #ods11 .card-front .card-header { background-color: #FD9D24; }
#ods12 .card-front .card-header, #ods12 .enigma { border-color: #BF8B2E; } #ods12 .card-front .card-header { background-color: #BF8B2E; }
#ods13 .card-front .card-header, #ods13 .enigma { border-color: #3F7E44; } #ods13 .card-front .card-header { background-color: #3F7E44; }
#ods14 .card-front .card-header, #ods14 .enigma { border-color: #0A97D9; } #ods14 .card-front .card-header { background-color: #0A97D9; }
#ods15 .card-front .card-header, #ods15 .enigma { border-color: #56C02B; } #ods15 .card-front .card-header { background-color: #56C02B; }
#ods16 .card-front .card-header, #ods16 .enigma { border-color: #00689D; } #ods16 .card-front .card-header { background-color: #00689D; }
#ods17 .card-front .card-header, #ods17 .enigma { border-color: #19486A; } #ods17 .card-front .card-header { background-color: #19486A; }
#ods18 .card-front .card-header, #ods18 .enigma { border-color: #7A300F; } #ods18 .card-front .card-header { background-color: #7A300F; }
.card-back .card-header {
    background-color: #6c757d;
}
.card a {
  position: absolute;
  bottom: 10px; /* 10px do fundo do card */
  left: 50%;
  transform: translateX(-50%);
  font-family: "Teko", sans-serif;
  font-size: 1.5rem;
  color: #fcfcfc;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap; /* Evita quebra de linha */
  width: auto;
}
.card img {
  width: 100%;
  border-radius: 5%;
  display: block;
}
.card {
  position: relative;
  background-color: transparent;
  height: 450px;
  perspective: 1000px;
  border: none;
  box-shadow: none;
}