/* Definição de Variáveis de Cores (Tema Claro por padrão) */
:root {
    --bg-global: #f1f2f2;
    --bg-navbar: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-footer: #f7f7f8;
    --border-color: #dee0e1;
    --border-subtle: #f1f2f2;
    
    --text-primary: #2e3031;
    --text-secondary: #636466;
    --text-light: #8f9092;
    
    --accent-red: #b92b27;
    --accent-red-hover: #a12320;
    --accent-blue: #1a73e8;
    
    --search-bg: #f7f7f8;
}

/* VARIÁVEIS PARA O MODO ESCURO */
[data-theme="dark"] {
    --bg-global: #18191a;
    --bg-navbar: #242526;
    --bg-card: #242526;
    --bg-sidebar: #242526;
    --bg-footer: #1c1d1e;
    --border-color: #3e4042;
    --border-subtle: #2f3031;
    
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-light: #8a8d91;
    
    --search-bg: #3a3b3c;
    /* vermelho da marca mais claro para ler bem no fundo escuro */
    --accent-red: #f05a52;
    --accent-red-hover: #d9443d;
}

/* Configurações Gerais e Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Transição suave ao mudar de tema */
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    background-color: var(--bg-global);
    color: var(--text-primary);
}

/* ESTRUTURA GRID */
.site-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    min-height: 100vh;
    min-height: 100dvh;
}

.left-area {
    display: flex;
    flex-direction: column;
}

/* NAVBAR */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% - 350px);
    height: 50px;
    background-color: var(--bg-navbar);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    min-width: 0;
    box-sizing: border-box;
}
.navbar .nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.nav-logo {
    color: var(--accent-red);
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: -1px;
}

.nav-icons {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.nav-icon-link {
    color: var(--text-secondary);
    font-size: 20px;
    width: 42px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.nav-icon-link.active {
    color: var(--accent-red);
    border-bottom: 3px solid var(--accent-red);
}

/* Barra de Pesquisa */
.nav-search-box {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search-submit {
    position: absolute;
    left: 0;
    top: 0;
    width: 36px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 1;
    appearance: none;
    -webkit-appearance: none;
}
.nav-search-submit:hover,
.nav-search-submit:focus {
    color: var(--text-secondary);
    outline: none;
}

.nav-search-box i {
    position: static;
    left: auto;
    color: inherit;
    font-size: 14px;
    pointer-events: none;
}

.nav-search-input {
    width: 100%;
    min-width: 0;
    height: 35px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    background-color: var(--search-bg);
    color: var(--text-primary);
    box-sizing: border-box;
    font: inherit;
    font-size: 14px;
}

.nav-search-input:focus {
    border-color: var(--accent-blue);
    background-color: var(--bg-navbar);
}

/* Perfil e Botão */
.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.profile-pic {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    margin-left: 25px;
}
.sidebar-icon-link {
    margin-left: 0;
    color: var(--accent-red-hover, #a12320);
    font-size: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    box-sizing: border-box;
    line-height: 0;
    text-decoration: none;
    text-align: center;
}
.sidebar-icon-link h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: 0;
}
.sidebar-icon-link i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    margin: 0;
    font-size: 16px;
    line-height: 1;
    text-align: center;
}
.sidebar-icon-link svg {
    display: block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    overflow: visible;
}
a.sidebar-icon-link:hover { color: var(--accent-red, #b92b27); }
a.sidebar-icon-link:focus-visible { outline: 2px solid var(--accent-red, #b92b27); outline-offset: 2px; }
.sidebar-header .sidebar-btn-wiki {
    margin-left: auto;
    flex-shrink: 0;
    text-decoration: none;
    color: #fff;
    box-sizing: border-box;
}
.sidebar-header .sidebar-btn-wiki:visited,
.sidebar-header .sidebar-btn-wiki:hover,
.sidebar-header .sidebar-btn-wiki:focus {
    color: #fff;
    text-decoration: none;
}
.sidebar-header h2 {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.btn-add-question {
    background-color: var(--accent-red);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

/* FEED PRINCIPAL */
.main-content {
    margin-top: 50px;
    padding: 30px;
    max-width: 800px;
    width: 100%;
    align-self: center;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.post-card h2 { margin-bottom: 10px; color: var(--text-primary); }
.post-card p { color: var(--text-secondary); line-height: 1.5; }

/* SIDEBAR DIREITA COMPLETA */
.right-sidebar {
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 350px;
    height: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    z-index: 1001;
}

.sidebar-header {
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 12px 0 20px;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 16px;
    color: var(--text-primary);
}

/* Corpo interno (Scroll independente) */
.sidebar-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* BLOCOS DAS ABAS */
.sidebar-tab-content {
    display: none;
}

.sidebar-tab-content.active {
    display: block;
    opacity: 1;
}

.sidebar-block {
    margin-bottom: 20px;
}

.sidebar-block h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Listas internas */
.tab-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tab-list li {
    font-size: 13.5px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.tab-list li:hover {
    color: var(--accent-red);
}

/* CONFIGURAÇÕES ESTILO */
.config-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-primary);
}

/* Customização básica do checkbox */
.config-item input[type="checkbox"] {
    width: 40px;
    height: 20px;
    appearance: none;
    background-color: var(--t-surface2, #ccc);
    border-radius: 20px;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.config-item input[type="checkbox"]:checked {
    background-color: var(--accent-red);
}

.config-item input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    background-color: white;
    transition: transform 0.2s;
}

.config-item input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* ESTILIZAÇÃO DO AD (OFERTAS) */
.ad-block {
    background: var(--bg-global);
    border: 1px dashed var(--text-light);
    border-radius: 6px;
    padding: 15px;
    position: relative;
}

.ad-badge {
    background-color: #e6a23c;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    position: absolute;
    top: 10px;
    right: 10px;
}

.ad-block p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 8px 0 12px;
    line-height: 1.4;
}

.btn-ad {
    background-color: #e6a23c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    width: 100%;
}

/* RODAPÉ COM BOTÕES DE NAVEGAÇÃO */
.sidebar-footer {
    min-height: 60px;
    height: auto;
    border-top: 1px solid var(--border-color);
    display: flex;
    background-color: var(--bg-footer);
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.footer-tab-btn {
    flex: 1;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary);
}

.footer-tab-btn i {
    font-size: 18px;
}

.footer-tab-btn span {
    font-size: 11px;
    font-weight: 500;
}

.footer-tab-btn.active {
    color: var(--accent-red);
    background-color: var(--bg-sidebar);
}

/* Animação */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsividade */
@media (max-width: 950px) {
    .site-container { grid-template-columns: 1fr; }
    .navbar { width: 100%; }
}

.btn-toggle-sidebar {
    display: none; /* Escondido por padrão no computador */
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

.btn-close-sidebar {
    display: none; /* Escondido por padrão no computador */
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    margin-left: auto; /* Joga o botão para a extrema direita */
}

/* --- 2. REGRAS PARA TELAS MENORES (ATUALIZADO) --- */
@media (max-width: 950px) {
    .site-container { 
        grid-template-columns: 1fr; /* O feed ocupa a tela toda */
    }
    
    .navbar { 
        width: 100%; /* Navbar ocupa toda a largura */
    }

    .nav-container {
        padding: 0 8px;
        gap: 4px;
    }
    .nav-icon-link {
        width: 36px;
    }
    .navbar .nav-left {
        gap: 8px;
    }
    .navbar .nav-left .nav-logo {
        flex-shrink: 0;
        font-size: 20px;
    }

    /* Exibe o botão de abrir na navbar */
    .btn-toggle-sidebar {
        display: flex;
    }

    /* Exibe o botão de fechar na sidebar */
    .btn-close-sidebar {
        display: block;
    }

    /* TRANSFORMA A SIDEBAR EM UM MENU RETRÁTIL */
    .right-sidebar {
        position: fixed;
        display: flex;
        flex-direction: column;
        right: -350px; /* Joga a sidebar totalmente para fora da tela (direita) */
        top: 0;
        bottom: 0;
        width: 310px; /* Um pouco mais estreita no mobile */
        height: auto;
        max-height: none;
        min-height: 0;
        overflow: hidden;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease; /* Animação suave de deslize */
        z-index: 2000; /* Fica por cima de tudo */
    }

    /* CLASSE QUE O JAVASCRIPT VAI ATIVAR */
    .right-sidebar.mobile-open {
        right: 0; /* Traz a sidebar de volta para dentro da tela */
    }
}
/* Letra "S" usada como ícone na navbar, no mesmo tamanho dos ícones */
.nav-letter-icon {
    font-weight: 900;
    font-size: 1.15em;
    line-height: 1;
    font-family: inherit;
}

/* Ícone "?" que ocupa o lugar da foto de perfil */
.sidebar-icon-link.sidebar-help-link {
    margin-left: 25px;
}
button.sidebar-icon-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    line-height: inherit;
}
button.sidebar-icon-link:hover { color: var(--accent-red, #b92b27); }
button.sidebar-icon-link:focus-visible { outline: 2px solid var(--accent-red, #b92b27); outline-offset: 2px; }

/* Ajuda contextual do "?" */
.bd-ajuda-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, .5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8vh 14px 16px;
    overflow-y: auto;
}
.bd-ajuda-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    box-sizing: border-box;
    background: var(--bg-card, var(--t-surface, #fff));
    color: var(--text-primary, var(--t-text, #2e3031));
    border: 1px solid var(--border-color, var(--t-border, #dee0e1));
    border-radius: 8px;
    padding: 16px 18px 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
    font-size: 14px;
    line-height: 1.45;
}
[data-theme="dark"] .bd-ajuda-box { background: #1f2124; color: #e8e8e8; border-color: #3a3d42; }
[data-theme="papel"] .bd-ajuda-box { background: #f6efdc; color: #2b2418; border-color: #c9b98f; }
.bd-ajuda-box h2 { margin: 0 36px 10px 0; font-size: 18px; color: inherit; }
.bd-ajuda-box h3 { margin: 12px 0 6px; font-size: 13px; font-weight: 700; color: var(--text-secondary, var(--t-text2, #636466)); }
.bd-ajuda-box p, .bd-ajuda-box li { margin: 0 0 8px; }
.bd-ajuda-box ul { margin: 0 0 8px; padding-left: 1.15em; }
.bd-ajuda-box a { color: var(--accent-red, #b92b27); }
.bd-ajuda-box a:hover { text-decoration: underline; }
.bd-ajuda-geral { margin-top: 8px; }
.bd-ajuda-fechar {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-color, var(--t-border, #dee0e1));
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.bd-ajuda-fechar:hover { border-color: var(--text-secondary, #636466); }
.bd-ajuda-fechar:focus-visible { outline: 2px solid var(--accent-red, #b92b27); outline-offset: 1px; }
@media (max-width: 950px) {
    .bd-ajuda-overlay { padding: 12vh 10px 16px; }
    .bd-ajuda-fechar { width: 36px; height: 36px; }
}

/* Ícone combinado de engrenagem com chave */
.icon-gear-wrench {
    position: relative;
    display: inline-block;
    line-height: 1;
}
.icon-gear-wrench .fa-wrench {
    position: absolute;
    right: -6px;
    bottom: -4px;
    font-size: 0.6em;
    background: var(--bg-navbar);
    border-radius: 50%;
    padding: 1px;
}

/* Slogan acima de "Visto recentemente", com a mesma fonte */
.sidebar-block h3.sidebar-slogan {
    margin-bottom: 24px;
}

/* ===== FEED EM GRADE (MASONRY) ===== */
.main-content {
    max-width: none;
    padding: 16px;
    align-self: stretch;
}
.feed-grid { column-count: 3; column-gap: 16px; }
@media (max-width: 1250px) { .feed-grid { column-count: 2; } }
@media (max-width: 640px) { .feed-grid { column-count: 1; } .main-content { padding: 10px; } }

.feed-card {
    break-inside: avoid;
    display: inline-block; width: 100%;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.card-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.card-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent-red); color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-author { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-time { font-size: 12px; color: var(--text-light); }
.card-badge {
    font-size: 11px; padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--accent-red); color: var(--accent-red); white-space: nowrap;
}
.card-body { padding: 0 14px 10px; }
.card-title { font-size: 16px; color: var(--text-primary); margin-bottom: 8px; }
.card-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 8px; }
.read-more { font-size: 13px; color: var(--accent-red); text-decoration: none; font-weight: 600; }
.card-caption { font-size: 14px; color: var(--text-secondary); margin-top: 8px; line-height: 1.4; }
.card-img { width: 100%; display: block; border-radius: 6px; background: var(--search-bg); }

.video-wrap { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.video-wrap img, .video-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--accent-red); color: #fff; font-size: 20px;
}
.video-play:hover { background: var(--accent-red-hover); }
.video-duration {
    position: absolute; right: 8px; bottom: 8px; font-size: 12px;
    background: rgba(0,0,0,.75); color: #fff; padding: 2px 6px; border-radius: 4px;
}

.card-actions { display: flex; border-top: 1px solid var(--border-subtle); }
.card-action {
    flex: 1; background: none; border: none; cursor: pointer; padding: 10px 4px;
    font-size: 13px; color: var(--text-secondary); display: flex; gap: 6px; align-items: center; justify-content: center;
}
.card-action:hover, .card-action.on { color: var(--accent-red); }

/* Ferramentas */
.tool-checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tool-checklist label { font-size: 14px; color: var(--text-primary); display: flex; gap: 8px; align-items: center; cursor: pointer; }
.tool-checklist input { accent-color: var(--accent-red); }
.tool-checklist input:checked + span, .tool-checklist li.done label { text-decoration: line-through; color: var(--text-light); }
.tool-add { display: flex; gap: 6px; }
.tool-add input, .tool-add button { height: 32px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--search-bg); color: var(--text-primary); }
.tool-add input { flex: 1; padding: 0 10px; outline: none; }
.tool-add button { width: 36px; background: var(--accent-red); color: #fff; border: none; cursor: pointer; }
.tool-hint { font-size: 12px; color: var(--text-light); margin-top: 8px; }

.tool-poll { display: flex; flex-direction: column; gap: 8px; }
.poll-opt {
    position: relative; overflow: hidden; text-align: left; padding: 9px 12px; cursor: pointer;
    border: 1px solid var(--border-color); border-radius: 6px; background: var(--search-bg);
    color: var(--text-primary); font-size: 14px;
}
.poll-opt .poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--accent-red); opacity: .18; transition: width .4s; }
.poll-opt .poll-pct { float: right; font-weight: 600; position: relative; }
.poll-opt .poll-label { position: relative; }
.poll-opt.voted { border-color: var(--accent-red); }

.tool-timer { text-align: center; }
.timer-display { font-size: 40px; font-weight: 700; color: var(--accent-red); display: block; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.timer-btns { display: flex; gap: 8px; justify-content: center; }
.timer-btns button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--accent-red); background: none; color: var(--accent-red); cursor: pointer; }
.timer-btns .timer-start { background: var(--accent-red); color: #fff; }

.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--text-primary); font-weight: 600; font-size: 14px; }
.cal-head button { background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-size: 12px; }
.cal-grid .dow { color: var(--text-light); font-weight: 600; }
.cal-grid .day { padding: 6px 0; border-radius: 50%; color: var(--text-primary); cursor: pointer; }
.cal-grid .day:hover { background: var(--search-bg); }
.cal-grid .day.today { background: var(--accent-red); color: #fff; }
.cal-grid .day.sel { outline: 2px solid var(--accent-red); }

/* Cabeçalho da sidebar no celular: ícones cabem e o × fica no fim */
@media (max-width: 950px) {
    .sidebar-header { gap: 8px; padding: 0 12px 0 16px; }
    .sidebar-header .sidebar-btn-wiki { margin-left: auto; }
    .sidebar-header .sidebar-icon-link { margin-left: 0; }
    .sidebar-header .sidebar-icon-link.sidebar-help-link { margin-left: 0; }
    .sidebar-header .btn-close-sidebar { order: 3; margin-left: 0; }
}

/* Caixa ADM no lugar do antigo card de ofertas */
.adm-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    color: var(--text-primary);
    opacity: 1;
}
.adm-box h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.adm-box p {
    font-size: 13px;
    color: var(--text-primary);
    margin: 0 0 14px;
    line-height: 1.5;
}
.adm-box a[href^="mailto:"] {
    color: var(--accent-red);
    text-decoration: underline;
    font-weight: 700;
    word-break: break-all;
}
.adm-box a[href^="mailto:"]:hover { text-decoration: underline; }
.btn-adm-page {
    display: block;
    text-align: center;
    background-color: var(--accent-red);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    opacity: 1;
}
.btn-adm-page:hover { background-color: var(--accent-red-hover); color: #fff; }

/* Conta na aba Meu / cabeçalho da sidebar */
.sidebar-account-block { margin-bottom: 18px; }
.sidebar-account { margin-bottom: 12px; }
.sidebar-acesso-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 10px;
}
.sidebar-account-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar-account-actions a,
a.sidebar-btn-entrar,
a.sidebar-btn-cadastro {
    display: block;
    text-align: center;
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    padding: 9px 12px;
    border-radius: 4px;
    box-sizing: border-box;
    width: 100%;
}
a.sidebar-btn-entrar {
    background-color: var(--accent-red);
    color: #fff;
    border: none;
}
a.sidebar-btn-entrar:hover { background-color: var(--accent-red-hover); color: #fff; }
a.sidebar-btn-cadastro {
    background-color: var(--bg-card, var(--t-surface, #fff));
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}
a.sidebar-btn-cadastro:hover { background-color: var(--bg-global); color: var(--accent-red); }
.sidebar-account-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.sidebar-account-user .user-mention { font-size: 16px; }
.sidebar-history-block h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.sidebar-history-block h3.sidebar-slogan {
    margin-bottom: 16px;
    color: var(--text-primary);
}
.sidebar-history-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 10px;
    font-weight: 600;
}

/* Destaca a publicação aberta a partir da busca */
.feed-card.busca-target {
    outline: 2px solid var(--accent-red);
    outline-offset: 3px;
}

/* Página de resultados da busca */
.busca-page {
    max-width: 800px;
}
.busca-page h1 {
    font-size: 22px;
    margin: 0 0 8px;
    color: var(--text-primary);
}
.busca-status {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    min-height: 0;
}
.busca-status.erro { color: var(--accent-red); }
.busca-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 16px;
}
.busca-empty {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px 20px;
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
}
.busca-lista { display: flex; flex-direction: column; gap: 12px; }
.busca-item {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
}
.busca-item:hover {
    border-color: var(--accent-red);
}
.busca-tipo {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-red);
    margin-bottom: 6px;
}
.busca-item-title {
    font-size: 17px;
    margin: 0 0 4px;
    color: var(--text-primary);
    line-height: 1.3;
}
.busca-item-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px;
}
.busca-item-trecho {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}
.busca-mark {
    background: var(--t-warn-bg, #ffe08a);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}
[data-theme="dark"] .busca-mark {
    background: #6b5420;
    color: var(--text-primary);
}

/* ===== Temas: Escuro e Papel =====
   As folhas usam var(--t-*, <cor original>): no tema padrão as --t-* não existem e vale a cor original;
   nos temas abaixo elas são definidas e cobrem o site inteiro. */
[data-theme="dark"] {
    color-scheme: dark;
    --t-surface: #1f2021;
    --t-surface2: #2a2b2d;
    --t-input: #18191a;
    --t-info-bg: #1d2a3a;
    --t-ok-bg: #1c2a1d;
    --t-warn-bg: #2e2814;
    --t-err-bg: #3a1e1d;
    --t-text: #e4e6eb;
    --t-text2: #b0b3b8;
    --t-text3: #8a8d91;
    --t-link: #8ab4f8;
    --t-link2: #7fb2e5;
    --t-visited: #c58af9;
    --t-red: #ff6b63;
    --t-red-dark: #ff8a84;
    --t-green: #5cc85c;
    --t-green-dark: #8fd88f;
    --t-warn-text: #e0b25a;
    --t-border: #3e4042;
    --t-info-border: #34506e;
    --t-ok-border: #2f4a30;
    --t-warn-border: #6b5a20;
    /* leitor da Bíblia Amarela */
    --bk-paper: #24201a;
    --bk-note: #2f2a21;
    --bk-btn: #2c271e;
    --bk-btn-hover: #3a3326;
    --bk-input: #1b1814;
    --bk-err: #3a1e1d;
    --bk-text: #e8dfcc;
    --bk-text2: #c4b79e;
    --bk-text3: #a89b82;
    --bk-link: #e9a25f;
    --bk-gold: #e0bf5a;
    --bk-border: #4f4535;
}

[data-theme="papel"] {
    color-scheme: light;
    --bg-global: #efe6d2;
    --bg-navbar: #f7f0df;
    --bg-card: #fbf6ea;
    --bg-sidebar: #f7f0df;
    --bg-footer: #ece2cc;
    --border-color: #d9caa8;
    --border-subtle: #e6dcc4;
    --text-primary: #3b2f20;
    --text-secondary: #5e4d36;
    --text-light: #85735a;
    --accent-red: #9b2420;
    --accent-red-hover: #7f1c19;
    --accent-blue: #7a3410;
    --search-bg: #f1e8d4;
    --t-surface: #fbf6ea;
    --t-surface2: #f1e8d4;
    --t-input: #fffaf0;
    --t-info-bg: #ece1c6;
    --t-ok-bg: #e9e6c8;
    --t-warn-bg: #f3e3b8;
    --t-err-bg: #f3d9cc;
    --t-text: #3b2f20;
    --t-text2: #5e4d36;
    --t-text3: #85735a;
    --t-link: #7a3410;
    --t-link2: #6b3e1a;
    --t-visited: #6b2c5e;
    --t-red: #9b2420;
    --t-red-dark: #7f1c19;
    --t-green: #2f6b2a;
    --t-green-dark: #2f5a25;
    --t-warn-text: #7a4e0e;
    --t-border: #d9caa8;
    --t-info-border: #c9b48a;
    --t-ok-border: #c9c49a;
    --t-warn-border: #d6b86a;
}
/* Papel: fonte com serifa (especificidade zero: ícones e monoespaçados mantêm a própria fonte) */
:where([data-theme="papel"]) :where(body, body *) {
    font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Cambria, "Times New Roman", serif;
}
/* Controles de formulário sem estilo próprio */
:where([data-theme="dark"], [data-theme="papel"]) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select) {
    background-color: var(--t-input);
    color: var(--t-text);
    border-color: var(--t-border);
}
:where([data-theme="dark"], [data-theme="papel"]) :where(input, textarea)::placeholder { color: var(--t-text3); opacity: 1; }
:where([data-theme="dark"], [data-theme="papel"]) :where(pre, code, table, th, td) { border-color: var(--t-border); }
:where([data-theme="dark"]) :where(a:not([class])) { color: var(--t-link2); }
:where([data-theme="dark"], [data-theme="papel"]) :where(hr) { border-color: var(--t-border); }

/* ===== Ajustes → Tema: chaves (0  ) ===== */
.tema-block h3 { margin-bottom: 8px; }
.tema-options { display: flex; flex-direction: column; gap: 10px; }
.tema-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 15px; color: var(--text-primary); user-select: none; }
.tema-item input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tema-pill {
    position: relative; flex-shrink: 0; width: 46px; height: 24px; border-radius: 999px;
    border: 2px solid var(--text-secondary); background: transparent;
    transition: background-color .2s ease, border-color .2s ease;
}
.tema-pill::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--text-secondary); background: transparent; box-sizing: border-box;
    transition: left .2s ease, background-color .2s ease, border-color .2s ease;
}
.tema-item input:checked + .tema-pill { border-color: var(--accent-red); background: var(--accent-red); }
.tema-item input:checked + .tema-pill::after { left: 24px; background: #fff; border-color: #fff; }
.tema-item input:focus-visible + .tema-pill { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

/* ===== Cores das artes ASCII (paleta fixa, uma variante por tema; sem hex livre do usuário) ===== */
:root {
    --ac-1: #c62828; --ac-2: #b34700; --ac-3: #8a6500; --ac-4: #2e7d32;
    --ac-5: #00737d; --ac-6: #1565c0; --ac-7: #7b1fa2; --ac-8: #6b6b6b;
}
[data-theme="dark"] {
    --ac-1: #ff6b6b; --ac-2: #ffa04d; --ac-3: #ffd84d; --ac-4: #6ee07a;
    --ac-5: #4dd8e6; --ac-6: #7ab0ff; --ac-7: #c99cf0; --ac-8: #a8a8a8;
}
[data-theme="papel"] {
    --ac-1: #a8201a; --ac-2: #943f00; --ac-3: #725600; --ac-4: #2d6a1f;
    --ac-5: #00666f; --ac-6: #1d4f91; --ac-7: #6a2c8a; --ac-8: #655d52;
}
.ac-1 { color: var(--ac-1); } .ac-2 { color: var(--ac-2); } .ac-3 { color: var(--ac-3); } .ac-4 { color: var(--ac-4); }
.ac-5 { color: var(--ac-5); } .ac-6 { color: var(--ac-6); } .ac-7 { color: var(--ac-7); } .ac-8 { color: var(--ac-8); }
/* Os spans de cor herdam a fonte monoespaçada da arte (há regra global de fonte em span). */
.ac-1, .ac-2, .ac-3, .ac-4, .ac-5, .ac-6, .ac-7, .ac-8 { font-family: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; letter-spacing: inherit; }

/* ---------- MOR-43: feed real da página inicial (mesmo visual dos cards) ---------- */
.inicio-feed { display: flex; flex-direction: column; gap: 28px; max-width: 1120px; }
.inicio-feed-nav { display: flex; flex-direction: column; gap: 8px; }
.inicio-tabs {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 6px;
    margin: 0;
    padding: 0;
}
.inicio-tabs a {
    display: block;
    padding: 5px 10px 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--t-link2, #369);
    text-decoration: none;
    background: var(--t-info-bg, #eff7ff);
    border: 1px solid var(--t-border, #ddd);
    border-radius: 4px;
}
.inicio-tabs .selected a {
    background: var(--t-surface, #fff);
    color: #ff4500;
    border-color: #ff4500;
}
[data-theme="dark"] .inicio-tabs .selected a,
[data-theme="papel"] .inicio-tabs .selected a { color: var(--accent-red, #ff4500); }
.inicio-periodo {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 0;
    font-size: 12px;
}
.inicio-periodo a { color: var(--t-link2, #369); text-decoration: none; }
.inicio-periodo .selected a { font-weight: 700; color: #ff4500; text-decoration: none; }
.inicio-sec-h { font-size: 13px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.02em; margin: 0 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.inicio-sec-h a { font-weight: 600; font-size: 13px; color: var(--accent-red); text-decoration: none; }
.inicio-sec-h a:hover { text-decoration: underline; }
.inicio-loading, .inicio-vazio, .inicio-erro { font-size: 14px; color: var(--text-secondary); margin: 8px 0 0; }
.inicio-erro { color: var(--accent-red); }

.inicio-lit { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.inicio-lit .feed-card { margin: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.inicio-lit .card-body { padding-bottom: 14px; }
.inicio-lit-cover { width: 100%; aspect-ratio: 3 / 4; max-height: 220px; object-fit: cover; object-position: center top; display: block; background: #e3b210; }
.inicio-lit .card-title { margin-top: 10px; }

.inicio-b-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.inicio-b-card { margin: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; overflow: hidden; }
.inicio-b-card:hover { border-color: var(--accent-red); }
/* Cabeçalho: avatar da b/ + nome da comunidade (sem o prefixo b/). Miniatura no canto, no tamanho do feed das b/ (70px / 56px), um pouco abaixo do avatar. */
.inicio-b-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 6px; min-width: 0; }
.inicio-b-av { flex: 0 0 auto; line-height: 0; }
.inicio-b-av .or-b-icon-mini { display: block; }
.inicio-b-nome { font-size: 13px; font-weight: 600; color: var(--accent-red); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inicio-b-main { display: flex; flex-direction: column; padding: 0 14px 12px; flex: 1; min-width: 0; }
/* overflow no recorte (não no parágrafo): o texto pode envolver a miniatura flutuante, como num post da b/. */
/* A altura máxima é definida em JS (inicio.js), sempre no fim de uma linha inteira. */
.inicio-b-copy { overflow: hidden; position: relative; font-size: 14px; }
.inicio-b-copy.is-clamped::after { content: "…"; position: absolute; right: 0; bottom: 0; height: 1.5em; line-height: 1.5em; padding-left: 1.6em; background: linear-gradient(to right, transparent, var(--bg-card) 40%); color: var(--text-secondary); pointer-events: none; }
.inicio-b-thumb { float: left; position: relative; width: 70px; height: 70px; margin: 0 10px 6px 0; border: 1px solid var(--border-color, #ccc); border-radius: 2px; background: var(--search-bg); overflow: hidden; }
.inicio-b-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inicio-b-play { position: absolute; right: 3px; bottom: 3px; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 10px; line-height: 15px; }
.inicio-b-card .card-title { font-size: 15px; margin: 0 0 4px; }
.inicio-b-card .card-text { margin: 0; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; line-height: 1.5; }
.inicio-b-foot { clear: both; margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--text-light); }

.inicio-perfil { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.inicio-perfil .feed-card { margin: 0; display: flex; flex-direction: column; }
.inicio-perfil .card-author { text-decoration: none; color: var(--text-primary); }
.inicio-perfil .card-author:hover { color: var(--accent-red); }
.inicio-perfil .card-text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.inicio-perfil .card-actions { margin-top: auto; }
.inicio-perfil .card-action { text-decoration: none; }

@media (max-width: 640px) {
    .inicio-b-grid, .inicio-perfil, .inicio-lit { grid-template-columns: 1fr; }
    .inicio-lit-cover { max-height: 180px; }
    .inicio-b-thumb { width: 56px; height: 56px; }
}

/* Link da wiki na aba ADM da barra lateral */
.adm-wiki-link { margin: 10px 0 0; text-align: center; }


/* Hide English UI until i18n has rewritten chrome (no-op on basedisso.com). */
html[data-lang="en"]:not([data-i18n-ready]) body { visibility: hidden; }
html[data-lang="en"] [data-i18n-en]:not([data-i18n-applied]) { visibility: hidden; }
