/* ===========================================================
   Guia de Nós Escoteiros — GE Brownsea 113/SC
   =========================================================== */

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

:root {
    --bg: #0f1b35;
    --card: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.10);
    --amarelo: #f2c94c;
    --vermelho: #c0392b;
    --verde: #2ecc71;
    --azul: #2e5dd8;
    --text-dim: rgba(255, 255, 255, 0.7);
}

body {
    font-family: 'Montserrat', Arial, sans-serif;
    background: var(--bg);
    color: #fff;
    padding: 84px 1em 3em;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Brasão de fundo + gradiente, igual às outras páginas */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('../../images/brasao.png') center center / 55% auto no-repeat;
    opacity: 0.04;
    filter: blur(4px);
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at top left, rgba(46, 93, 216, 0.25) 0%, transparent 60%),
                radial-gradient(ellipse at bottom right, rgba(155, 28, 28, 0.25) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ---------- BOTÃO VOLTAR ---------- */
.btn-voltar {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    max-width: 900px;
    margin: 0 auto 1.4em;
    padding: 0.5em 0.2em;
    width: 100%;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: color 0.2s ease;
}
.btn-voltar:hover { color: var(--amarelo); }

/* ---------- BARRA FIXA ---------- */
.fixed-progress {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    z-index: 15;
    background: rgba(15, 27, 53, 0.95);
    backdrop-filter: blur(8px);
    padding: 8px 15px;
    border-bottom: 1px solid var(--card-border);
}
.fixed-info {
    display: flex;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto 6px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-dim);
}
.fixed-bar {
    max-width: 900px;
    margin: 0 auto;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}
#progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(135deg, var(--amarelo), var(--vermelho));
    transition: width 0.4s ease;
}

/* ---------- CABEÇALHO ---------- */
.page-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 2em;
}
.page-badge {
    font-size: 2.4em;
    line-height: 1;
    margin-bottom: 0.2em;
}
.page-header h1 {
    font-size: 1.9em;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.page-header p {
    margin-top: 0.6em;
    font-size: 0.9em;
    color: var(--text-dim);
}
.btn-desafio {
    margin-top: 1.2em;
    padding: 0.7em 1.4em;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--amarelo), #e08e0b);
    color: #1a1a1a;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.9em;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(242, 201, 76, 0.25);
    transition: transform 0.15s ease;
}
.btn-desafio:hover { transform: translateY(-2px); }

/* ---------- INTRODUÇÃO ---------- */
.intro-slot { max-width: 900px; margin: 0 auto 2em; }
.intro-card {
    display: flex;
    gap: 1.2em;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.2em;
}
.intro-card img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
}
.intro-card h2 { font-size: 1.1em; margin-bottom: 0.3em; }
.intro-card p { font-size: 0.85em; color: var(--text-dim); margin-bottom: 0.7em; }

/* ---------- ESTANTE DE INSÍGNIAS ---------- */
.insignias-wrap { max-width: 900px; margin: 0 auto 2em; }
.insignias-title {
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 0.9em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.insignias {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.7em;
}
.insignia-tile {
    --c: #f2c94c;
    text-align: center;
    padding: 1em 0.6em;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--card-border);
    filter: grayscale(1);
    opacity: 0.5;
    transition: filter 0.3s ease, opacity 0.3s ease, transform 0.15s ease;
}
.insignia-tile.earned {
    filter: none;
    opacity: 1;
    border-color: var(--c);
    box-shadow: 0 0 24px -6px var(--c);
}
.insignia-tile.clickable { cursor: pointer; }
.insignia-tile.clickable:hover { transform: translateY(-3px); }
.ins-icon {
    width: 46px; height: 46px;
    margin: 0 auto 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    background: color-mix(in srgb, var(--c) 22%, transparent);
    color: var(--c);
    font-size: 1.1em;
}
.ins-name { font-size: 0.82em; font-weight: 700; }
.ins-sub { font-size: 0.7em; color: var(--text-dim); margin-top: 0.15em; }

/* ---------- CONTROLES ---------- */
.controls {
    max-width: 900px;
    margin: 0 auto 1.5em;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 0.6em;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.7em 1em;
    margin-bottom: 1em;
}
.search-box i { color: var(--text-dim); }
.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-family: inherit;
    font-size: 16px; /* <16px faz o Safari no iPhone dar zoom sozinho ao focar */
}
.search-box input::placeholder { color: rgba(255, 255, 255, 0.4); }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}
.chip {
    padding: 0.5em 1em;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    transition: all 0.15s ease;
}
.chip:hover { color: #fff; }
.chip.active {
    background: #fff;
    color: var(--bg);
    border-color: #fff;
}
.chip .medal { font-size: 0.9em; }

/* ---------- SEÇÕES DE CATEGORIA ---------- */
.cat-section { max-width: 900px; margin: 0 auto 2em; }
.cat-head {
    display: flex;
    align-items: center;
    gap: 0.6em;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--card-border);
}
.cat-head .cat-icon {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    font-size: 0.9em;
}
.cat-head h2 { font-size: 1.15em; font-weight: 700; flex: 1; }
.cat-head .cat-count { font-size: 0.8em; color: var(--text-dim); font-weight: 600; }
.cat-head .cat-medal {
    font-size: 1.1em;
    filter: grayscale(1) opacity(0.35);
    transition: filter 0.3s ease;
}
.cat-head .cat-medal.earned { filter: none; }

/* ---------- GRID DE CARDS ---------- */
.knot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1em;
}

.knot {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1em;
    transition: transform 0.18s ease, border-color 0.18s ease;
    display: flex;
    flex-direction: column;
}
.knot:hover { transform: translateY(-3px); }
.knot.done { border-color: var(--verde); }

.knot-top { display: flex; gap: 0.9em; margin-bottom: 0.7em; }
.knot img {
    width: 84px; height: 84px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}
.knot-ph {
    width: 84px; height: 84px;
    flex-shrink: 0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
}
.knot-title h3 { font-size: 1em; margin-bottom: 0.35em; }

.tags { display: flex; flex-wrap: wrap; gap: 0.3em; }
.tag {
    font-size: 0.68em;
    font-weight: 700;
    padding: 0.2em 0.55em;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.tag.dif-1 { background: rgba(46, 204, 113, 0.18); color: #6ee7a8; }
.tag.dif-2 { background: rgba(242, 201, 76, 0.18); color: var(--amarelo); }
.tag.dif-3 { background: rgba(192, 57, 43, 0.22); color: #f08a7e; }
.tag.cat { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); }

.knot-uso {
    font-size: 0.8em;
    color: var(--text-dim);
    margin-bottom: 0.7em;
}
.knot-uso strong { color: rgba(255, 255, 255, 0.85); font-weight: 600; }

/* passo a passo */
.knot details {
    margin-bottom: 0.7em;
    border-top: 1px solid var(--card-border);
    padding-top: 0.6em;
}
.knot summary {
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--amarelo);
    list-style: none;
}
.knot summary::-webkit-details-marker { display: none; }
.knot summary::before { content: '📋 '; }
.knot details[open] summary::before { content: '📖 '; }
.knot ol {
    margin: 0.6em 0 0 1.1em;
    font-size: 0.8em;
    color: var(--text-dim);
    line-height: 1.5;
}
.knot ol li { margin-bottom: 0.3em; }

.knot-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    padding-top: 0.7em;
}
.video-btn {
    padding: 0.5em 0.9em;
    border: none;
    border-radius: 8px;
    background: var(--amarelo);
    color: #1a1a1a;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.8em;
    cursor: pointer;
    transition: filter 0.15s ease;
}
.video-btn:hover { filter: brightness(1.08); }
.video-btn:disabled {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
}
.check {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 0.82em;
    color: var(--text-dim);
    cursor: pointer;
    user-select: none;
}
.check input { width: 16px; height: 16px; accent-color: var(--verde); cursor: pointer; }

.empty-state {
    text-align: center;
    color: var(--text-dim);
    margin-top: 2em;
}

/* ---------- MENSAGEM FINAL ---------- */
.final-message {
    display: none;
    max-width: 900px;
    margin: 1.5em auto 0;
    text-align: center;
    padding: 1.4em;
    border-radius: 14px;
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.4);
}
.final-message.show { display: block; }
.final-message p { color: var(--verde); font-weight: 700; margin-bottom: 0.9em; }
.final-message .btn-desafio { margin-top: 0; }
.final-message small {
    display: block;
    margin-top: 0.9em;
    font-size: 0.72em;
    color: var(--text-dim);
    font-weight: 400;
}

/* ---------- MODAIS ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1em;
}
.modal[hidden] { display: none; }
.modal-inner {
    position: relative;
    width: 100%;
    max-width: 720px;
}
.modal-close {
    position: absolute;
    top: -2.6em;
    right: 0;
    background: var(--vermelho);
    border: none;
    color: #fff;
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
}
.video-box {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}
.video-box iframe { width: 100%; height: 100%; border: 0; }

/* ---------- INSÍGNIA ---------- */
.insignia-inner {
    max-width: 420px;
    background: #16244a;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.4em;
    text-align: center;
}
#insignia-canvas {
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: var(--bg);
}
.insignia-form {
    display: flex;
    flex-direction: column;
    gap: 0.6em;
    margin-top: 1em;
    text-align: left;
}
.insignia-form label { font-size: 0.78em; font-weight: 600; color: var(--text-dim); }
.insignia-form input {
    font-size: 16px; /* <16px faz o Safari no iPhone dar zoom sozinho ao focar */
    padding: 0.7em 0.9em;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-family: inherit;
    outline: none;
}
.insignia-form .btn-desafio { margin-top: 0.2em; }
.insignia-form small { font-size: 0.7em; color: var(--text-dim); line-height: 1.4; }

/* ---------- DESAFIO ---------- */
.quiz-inner {
    max-width: 480px;
    background: #16244a;
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 1.8em 1.5em;
}
.quiz-progress { font-size: 0.78em; color: var(--text-dim); margin-bottom: 0.8em; font-weight: 600; }
.quiz-situacao {
    font-size: 1.05em;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 1.2em;
}
.quiz-opts { display: flex; flex-direction: column; gap: 0.6em; }
.quiz-opt {
    text-align: left;
    padding: 0.8em 1em;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-family: inherit;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.12s ease;
}
.quiz-opt:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.quiz-opt.correct { background: rgba(46, 204, 113, 0.25); border-color: var(--verde); }
.quiz-opt.wrong { background: rgba(192, 57, 43, 0.25); border-color: var(--vermelho); }
.quiz-next {
    margin-top: 1.2em;
    width: 100%;
    padding: 0.8em;
    border: none;
    border-radius: 10px;
    background: var(--amarelo);
    color: #1a1a1a;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}
.quiz-result { text-align: center; }
.quiz-result .score {
    font-size: 2.4em;
    font-weight: 800;
    color: var(--amarelo);
    margin: 0.2em 0;
}
.quiz-result p { color: var(--text-dim); margin-bottom: 1.2em; }

/* ---------- RESPONSIVO ---------- */
@media (max-width: 520px) {
    body { padding-top: 76px; }
    .knot-grid { grid-template-columns: 1fr; }
    .intro-card { flex-direction: column; text-align: center; }
    .page-header h1 { font-size: 1.5em; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
