studynote/src/index.css
MikiVL dff9f90bf2 fix: 移动端侧边栏响应式布局
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 03:08:41 +08:00

358 lines
8.9 KiB
CSS

@import "tailwindcss";
@layer base {
:root {
--bg: #ffffff;
--bg-subtle: #f8f9fa;
--bg-muted: #f1f3f5;
--border: #e9ecef;
--text: #1a1a2e;
--text-muted: #6c757d;
--text-faint: #adb5bd;
--accent: #6366f1;
--accent-hover: #4f46e5;
--accent-subtle: #eef2ff;
}
[data-theme="dark"] {
--bg: #0f0f13;
--bg-subtle: #17171f;
--bg-muted: #1e1e28;
--border: #2a2a38;
--text: #e8e8f0;
--text-muted: #8888a8;
--text-faint: #4a4a68;
--accent: #818cf8;
--accent-hover: #a5b4fc;
--accent-subtle: #1e1b4b;
}
* { box-sizing: border-box; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: system-ui, -apple-system, sans-serif;
font-size: 15px;
line-height: 1.6;
overflow: hidden;
height: 100vh;
-webkit-font-smoothing: antialiased;
}
#root {
height: 100vh;
display: flex;
overflow: hidden;
width: 100%;
max-width: 100%;
margin: 0;
text-align: left;
border: none;
min-height: unset;
flex-direction: row;
}
}
/* ── TipTap editor ── */
.ProseMirror {
outline: none;
min-height: 60vh;
padding-bottom: 120px;
font-size: 16px;
line-height: 1.8;
color: var(--text);
}
.ProseMirror p { margin: 0 0 0.75em; }
.ProseMirror p:last-child { margin-bottom: 0; }
.ProseMirror h1 { font-size: 1.9em; font-weight: 700; margin: 1.2em 0 0.4em; line-height: 1.2; }
.ProseMirror h2 { font-size: 1.45em; font-weight: 600; margin: 1.1em 0 0.4em; }
.ProseMirror h3 { font-size: 1.2em; font-weight: 600; margin: 1em 0 0.35em; }
.ProseMirror h4 { font-size: 1.05em; font-weight: 600; margin: 0.9em 0 0.3em; }
.ProseMirror ul, .ProseMirror ol { padding-left: 1.4em; margin: 0.5em 0; }
.ProseMirror li { margin: 0.2em 0; }
.ProseMirror blockquote {
border-left: 3px solid var(--accent);
padding-left: 1em;
margin: 0.75em 0;
color: var(--text-muted);
font-style: italic;
}
.ProseMirror code {
background: var(--bg-muted);
border-radius: 4px;
padding: 0.15em 0.4em;
font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
font-size: 0.875em;
color: var(--accent);
}
.ProseMirror pre {
background: var(--bg-muted);
border: 1px solid var(--border);
border-radius: 8px;
padding: 1em 1.2em;
margin: 0.75em 0;
overflow-x: auto;
}
.ProseMirror pre code {
background: none;
padding: 0;
color: var(--text);
font-size: 0.875em;
}
.ProseMirror hr {
border: none;
border-top: 1px solid var(--border);
margin: 1.5em 0;
}
.ProseMirror a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.ProseMirror mark {
background: #fef08a;
color: #1a1a1a;
border-radius: 2px;
padding: 0.1em 0.15em;
}
[data-theme="dark"] .ProseMirror mark { background: #713f12; color: #fef9c3; }
/* Task list */
.ProseMirror ul[data-type="taskList"] { list-style: none; padding-left: 0.25em; }
.ProseMirror ul[data-type="taskList"] li { display: flex; align-items: flex-start; gap: 0.5em; }
.ProseMirror ul[data-type="taskList"] li > label { flex-shrink: 0; margin-top: 0.35em; cursor: pointer; }
.ProseMirror ul[data-type="taskList"] li > div { flex: 1; }
.ProseMirror ul[data-type="taskList"] li[data-checked="true"] > div {
text-decoration: line-through;
color: var(--text-muted);
}
/* Table */
.ProseMirror table { border-collapse: collapse; width: 100%; margin: 0.75em 0; font-size: 0.9em; }
.ProseMirror th, .ProseMirror td { border: 1px solid var(--border); padding: 0.5em 0.75em; text-align: left; }
.ProseMirror th { background: var(--bg-muted); font-weight: 600; }
/* Placeholder */
.ProseMirror p.is-editor-empty:first-child::before {
content: attr(data-placeholder);
color: var(--text-faint);
pointer-events: none;
float: left;
height: 0;
}
/* Slash command menu */
.slash-menu {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 10px;
box-shadow: 0 8px 32px rgba(0,0,0,0.14);
overflow: hidden;
width: 260px;
max-height: 320px;
overflow-y: auto;
}
.slash-menu-item {
display: flex;
align-items: center;
gap: 0.75em;
padding: 0.55em 0.85em;
cursor: pointer;
transition: background 0.1s;
}
.slash-menu-item:hover, .slash-menu-item.active { background: var(--bg-muted); }
.slash-menu-item-icon {
width: 30px; height: 30px;
display: flex; align-items: center; justify-content: center;
background: var(--bg-subtle);
border-radius: 6px;
flex-shrink: 0;
color: var(--text-muted);
}
.slash-menu-item-label { font-size: 0.88em; font-weight: 500; color: var(--text); }
.slash-menu-item-desc { font-size: 0.76em; color: var(--text-muted); }
/* Floating toolbar */
.floating-toolbar {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
box-shadow: 0 4px 16px rgba(0,0,0,0.12);
display: flex;
align-items: center;
gap: 2px;
padding: 4px;
}
.toolbar-btn {
display: flex; align-items: center; justify-content: center;
width: 28px; height: 28px;
border-radius: 5px;
border: none;
background: transparent;
color: var(--text-muted);
cursor: pointer;
transition: background 0.1s, color 0.1s;
}
.toolbar-btn:hover { background: var(--bg-muted); color: var(--text); }
.toolbar-btn.active { background: var(--accent-subtle); color: var(--accent); }
.toolbar-divider { width: 1px; height: 16px; background: var(--border); margin: 0 2px; }
/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
/* ── Sidebar focus-mode transition ── */
.sidebar-panel {
transition: width 0.25s ease, opacity 0.2s ease;
overflow: hidden;
}
.sidebar-panel.hidden {
width: 0 !important;
opacity: 0;
pointer-events: none;
}
/* ── Image in editor ── */
.ProseMirror img {
max-width: 100%;
border-radius: 6px;
margin: 0.75em 0;
display: block;
}
.ProseMirror img.ProseMirror-selectednode {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* ── Syntax highlighting (highlight.js / lowlight) ── */
/* Light theme */
:root {
--hl-comment: #6a737d;
--hl-keyword: #d73a49;
--hl-string: #032f62;
--hl-number: #005cc5;
--hl-function: #6f42c1;
--hl-type: #22863a;
--hl-meta: #e36209;
--hl-builtin: #005cc5;
}
[data-theme="dark"] {
--hl-comment: #8b949e;
--hl-keyword: #ff7b72;
--hl-string: #a5d6ff;
--hl-number: #79c0ff;
--hl-function: #d2a8ff;
--hl-type: #7ee787;
--hl-meta: #ffa657;
--hl-builtin: #79c0ff;
}
.hljs-comment, .hljs-quote { color: var(--hl-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-addition { color: var(--hl-keyword); font-weight: 500; }
.hljs-string, .hljs-attr, .hljs-doctag { color: var(--hl-string); }
.hljs-number, .hljs-literal, .hljs-boolean { color: var(--hl-number); }
.hljs-title, .hljs-function, .hljs-name { color: var(--hl-function); }
.hljs-type, .hljs-class, .hljs-tag { color: var(--hl-type); }
.hljs-built_in, .hljs-variable, .hljs-params { color: var(--hl-builtin); }
.hljs-meta, .hljs-deletion { color: var(--hl-meta); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: bold; }
/* ── AI streaming cursor ── */
@keyframes ai-blink {
0%, 100% { opacity: 1; }
50% { opacity: 0; }
}
.ai-cursor {
display: inline-block;
width: 2px;
height: 1em;
background: var(--accent);
margin-left: 2px;
vertical-align: text-bottom;
border-radius: 1px;
animation: ai-blink 0.8s ease infinite;
}
/* 移动端响应式 */
.mobile-menu-btn {
display: none;
}
@media (max-width: 640px) {
.mobile-menu-btn {
display: flex;
position: fixed;
top: 12px;
left: 12px;
z-index: 40;
width: 36px;
height: 36px;
align-items: center;
justify-content: center;
border-radius: 8px;
font-size: 18px;
background: var(--bg-subtle);
border: 1px solid var(--border);
color: var(--text);
cursor: pointer;
}
.sidebar-panel {
position: fixed !important;
top: 0;
left: 0;
bottom: 0;
z-index: 35;
transform: translateX(-100%);
transition: transform 0.22s ease;
box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}
.sidebar-panel[data-mobile-open="true"] {
transform: translateX(0);
}
.editor-main {
margin-left: 0 !important;
padding-left: 48px;
}
}
/* ── Print / PDF export ── */
@media print {
aside, [data-ai-panel], .floating-toolbar, .editor-toolbar,
.toolbar-btn, [class*="sidebar"] {
display: none !important;
}
.ProseMirror {
padding: 0 !important;
min-height: unset !important;
}
body {
overflow: visible !important;
background: white !important;
color: black !important;
}
#root {
display: block !important;
height: auto !important;
}
.flex-1.flex.flex-col.min-w-0.h-full {
display: block !important;
height: auto !important;
}
}