:root {
    --bg-main: #272822;
    --bg-titlebar: #1e1f1c;
    --bg-hover: #49483e;
    --accent: #a6e22e;
    --text-main: #f8f8f2;
    --text-muted: #75715e;
    --danger: #f92672;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Fix mobile viewport: 100vh inclui a área atrás da barra de endereço.
   100dvh ajusta dinamicamente conforme a barra aparece/some. */
html, body {
    height: 100vh;       /* fallback */
    height: 100dvh;
}
.h-screen {
    height: 100vh;
    height: 100dvh;
}

/* Remove o safe-area antigo — não era esse o problema */
@supports (padding: env(safe-area-inset-bottom)) {
    .status-bar { padding-bottom: 0.375rem; }
}

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

.bg-titlebar { background-color: var(--bg-titlebar); }
.bg-menu-dropdown { background-color: var(--bg-main); border: 1px solid var(--bg-hover); }
.menu-item:hover, .menu-item:focus { background-color: var(--bg-hover); outline: none; }

.tab-bar { background-color: var(--bg-titlebar); }
.tab { cursor: pointer; user-select: none; transition: background-color 0.2s; }
.tab-active { background-color: var(--bg-main); color: var(--text-main); border-top: 2px solid var(--accent); }
.tab-inactive { background-color: #171814; color: var(--text-muted); border-top: 2px solid transparent; }
.tab-inactive:hover { background-color: var(--bg-main); color: var(--text-main); }
.close-btn:hover { color: var(--danger); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-titlebar); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.no-scrollbar::-webkit-scrollbar { display: none; }

/* Markdown preview */
.prose h1 { font-size: 2em; margin-bottom: 0.5em; font-weight: bold; }
.prose h2 { font-size: 1.5em; margin-bottom: 0.5em; font-weight: bold; border-bottom: 1px solid #ddd; padding-bottom: 0.2em; }
.prose p { margin-bottom: 1em; line-height: 1.6; }
.prose ul { list-style-type: disc; margin-left: 1.5em; margin-bottom: 1em; }
.prose code { background: #f4f4f4; padding: 0.2em 0.4em; border-radius: 3px; font-family: monospace; color: var(--danger); }
.prose pre code { background: none; color: inherit; padding: 0; }
.prose pre { background: var(--bg-main); color: var(--text-main); padding: 1em; border-radius: 5px; overflow-x: auto; margin-bottom: 1em; }

/* Settings modal */
.settings-form-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--bg-hover); }
.settings-form-row:last-child { border-bottom: 0; }
.settings-form-row label { color: var(--text-main); font-size: 0.875rem; }
.settings-form-row .help { color: var(--text-muted); font-size: 0.75rem; display: block; margin-top: 0.15rem; }
.settings-form-row select, .settings-form-row input[type="number"] {
    background: var(--bg-titlebar); color: var(--text-main); border: 1px solid var(--bg-hover);
    border-radius: 4px; padding: 0.3rem 0.5rem; font-size: 0.875rem; min-width: 6rem;
}

/* Toggle switch */
.tc-switch { position: relative; display: inline-block; width: 2.5rem; height: 1.25rem; }
.tc-switch input { opacity: 0; width: 0; height: 0; }
.tc-switch .slider { position: absolute; inset: 0; background: var(--bg-hover); border-radius: 1rem; transition: background 0.15s; cursor: pointer; }
.tc-switch .slider::before { content: ""; position: absolute; width: 0.95rem; height: 0.95rem; left: 0.1rem; top: 0.075rem; background: var(--text-muted); border-radius: 50%; transition: transform 0.15s, background 0.15s; }
.tc-switch input:checked + .slider { background: var(--accent); }
.tc-switch input:checked + .slider::before { transform: translateX(1.2rem); background: var(--bg-titlebar); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.stats-cell { background: var(--bg-titlebar); border: 1px solid var(--bg-hover); border-radius: 4px; padding: 0.6rem 0.75rem; }
.stats-cell strong { display: block; font-size: 1.25rem; color: var(--text-main); }
.stats-cell span { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* Plugin row */
.plugin-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--bg-hover); }
.plugin-row:last-child { border-bottom: 0; }
.plugin-meta { flex: 1; min-width: 0; }
.plugin-meta strong { display: block; font-size: 0.9rem; color: var(--text-main); }
.plugin-meta span { color: var(--text-muted); font-size: 0.8rem; display: block; margin-top: 0.15rem; }

/* Mobile: View button shows icon only */
@media (max-width: 640px) {
    .btn-view-label { display: none; }
    #btn-view { padding: 0.4rem 0.55rem; }
}

/* Status bar safe-area for mobile bottom address bar */
@supports (padding: env(safe-area-inset-bottom)) {
    .status-bar { padding-bottom: calc(0.375rem + var(--safe-bottom)); }
           }
