Files
cube/apps/write/frontend/src/styles.css
T
Fam Zheng 915b91d986
deploy write / build-and-deploy (push) Successful in 1m26s
write(ui): 对话框填满 + 🎙/发送按钮浮在 textarea 框内右下
- input-row 改 position: relative + flex:1 撑满 input-bar 高度
- textarea width/height 100% 填满,右/下加 padding (130px / 14px) 给按钮腾位
- btn-tray absolute right:8 bottom:8,pointer-events: none 让 textarea 仍可点
- 按钮 height 40→32 更紧凑
2026-05-24 21:20:28 +01:00

410 lines
10 KiB
CSS

:root {
--bg: #0f0f0f;
--bg-elev: #161616;
--bg-card: #1a1a2e;
--bg-hover: #232342;
--bg-active: #2a1a3e;
--border: #2a2a3a;
--border-soft: #1f1f2a;
--text: #e0e0e0;
--text-dim: #a0a0a0;
--text-mute: #666;
--accent: #c084fc;
--accent-strong: #7c5cbf;
--accent-cyan: #06b6d4;
--accent-green: #4ade80;
--accent-amber: #f59e0b;
--accent-red: #ef4444;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; width: 100%; overflow-x: hidden; }
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
background: var(--bg);
color: var(--text);
font-size: 14px;
-webkit-font-smoothing: antialiased;
}
.app { max-width: 100vw; overflow-x: hidden; }
button { font: inherit; cursor: pointer; }
textarea, input { font: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }
/* ====== layout ====== */
.app {
display: grid;
grid-template-columns: var(--sidebar-w, 260px) 6px 1fr;
height: 100vh;
}
.sidebar {
border-right: 1px solid var(--border-soft);
background: var(--bg-elev);
display: flex;
flex-direction: column;
min-width: 0;
}
.sidebar-header {
padding: 14px 16px;
border-bottom: 1px solid var(--border-soft);
display: flex;
align-items: center;
gap: 8px;
}
.sidebar-header h1 { margin: 0; font-size: 16px; font-weight: 600; }
.sidebar-header .new-btn {
margin-left: auto;
border: 1px solid var(--border);
background: var(--bg-elev);
color: var(--text-dim);
padding: 4px 10px;
border-radius: 6px;
font-size: 13px;
}
.sidebar-header .new-btn:hover { background: var(--bg-hover); color: var(--text); }
.doc-list { flex: 1; overflow-y: auto; padding: 6px; }
.doc-item {
padding: 8px 10px;
border-radius: 6px;
cursor: pointer;
margin-bottom: 2px;
font-size: 13px;
display: flex;
align-items: center;
gap: 8px;
color: var(--text-dim);
}
.doc-item:hover { background: var(--bg-card); color: var(--text); }
.doc-item.active { background: var(--bg-active); color: var(--accent); }
.doc-item .title {
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.doc-item .meta { font-size: 11px; color: var(--text-mute); }
.doc-item .del {
border: none;
background: transparent;
color: var(--accent-red);
font-size: 12px;
visibility: hidden;
}
.doc-item:hover .del { visibility: visible; }
/* ====== workspace ====== */
.workspace {
display: grid;
grid-template-rows: 1fr 6px var(--input-h, 140px);
min-width: 0;
min-height: 0;
background: var(--bg);
overflow: hidden;
}
.editor-pane > * { min-width: 0; min-height: 0; }
.workspace > * { min-width: 0; }
.input-bar { min-width: 0; box-sizing: border-box; overflow: hidden; }
.editor-pane {
display: grid;
grid-template-columns: var(--editor-fr, 1fr) 6px var(--preview-fr, 1fr);
grid-template-rows: auto 1fr;
min-height: 0;
border-bottom: 1px solid var(--border-soft);
}
/* 拖拽分隔条 */
.splitter {
background: var(--border-soft);
cursor: col-resize;
transition: background 0.12s;
user-select: none;
}
.splitter:hover { background: var(--accent-strong); }
.splitter-input { cursor: row-resize; }
@media (max-width: 768px) {
.splitter { display: none; }
}
.title-row {
grid-column: 1 / -1;
padding: 10px 16px;
border-bottom: 1px solid var(--border-soft);
background: var(--bg-elev);
}
.title-row input {
width: 100%;
border: none;
outline: none;
font-size: 16px;
font-weight: 600;
background: transparent;
color: var(--text);
}
.title-row input::placeholder { color: var(--text-mute); }
.editor, .preview {
min-height: 0;
overflow-y: auto;
padding: 16px;
}
.editor {
background: var(--bg-elev);
overflow-x: hidden;
}
.editor textarea {
width: 100%;
max-width: 100%;
height: 100%;
border: none;
outline: none;
resize: none;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 13px;
line-height: 1.6;
background: transparent;
color: var(--text);
word-break: break-all;
}
.editor textarea::placeholder { color: var(--text-mute); }
.preview {
background: var(--bg);
color: var(--text);
line-height: 1.6;
overflow-x: hidden;
word-wrap: break-word;
overflow-wrap: anywhere;
}
.preview h1, .preview h2, .preview h3 { margin: 18px 0 8px; color: var(--accent); }
.preview p { margin: 8px 0; }
.preview a { color: var(--accent-cyan); }
.preview strong { color: var(--accent); }
.preview pre {
background: var(--bg-elev); padding: 10px; border-radius: 6px;
font-size: 12px; overflow-x: auto;
max-width: 100%;
border: 1px solid var(--border-soft);
}
.preview code { background: var(--bg-elev); padding: 1px 4px; border-radius: 3px; font-size: 12px; color: var(--accent-amber); }
.preview pre code { background: transparent; padding: 0; word-wrap: normal; overflow-wrap: normal; color: var(--text); }
.preview blockquote { border-left: 3px solid var(--accent-strong); margin: 8px 0; padding: 4px 12px; color: var(--text-dim); }
.preview img { max-width: 100%; height: auto; }
.preview table { display: block; max-width: 100%; overflow-x: auto; }
.preview hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
/* ====== input bar ====== */
.input-bar {
background: var(--bg-elev);
border-top: 1px solid var(--border-soft);
padding: 10px 12px;
display: flex;
flex-direction: column;
min-height: 0;
}
.input-row {
flex: 1;
position: relative;
min-height: 0;
}
.input-row textarea {
width: 100%;
height: 100%;
/* 右 + 下 padding 给悬浮按钮腾空间,文字不会爬到按钮下 */
padding: 11px 130px 14px 14px;
resize: none;
border: 1px solid var(--border);
background: var(--bg);
color: var(--text);
border-radius: 10px;
outline: none;
font-size: 14px;
line-height: 1.5;
}
.input-row textarea::placeholder { color: var(--text-mute); }
.input-row textarea:focus { border-color: var(--accent-strong); }
.input-row textarea:disabled { opacity: 0.6; }
/* 悬浮在 textarea 框线内右下 */
.btn-tray {
position: absolute;
right: 8px;
bottom: 8px;
display: flex;
gap: 6px;
pointer-events: none; /* 让 textarea 仍接受点击右下空白处定位光标 */
}
.btn-tray > * { pointer-events: auto; }
.btn {
height: 32px;
padding: 0 14px;
border-radius: 7px;
border: 1px solid var(--border);
background: var(--bg-elev);
color: var(--text-dim);
font-size: 13px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn:hover { background: var(--bg-hover); color: var(--text); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:disabled { background: var(--bg-card); border-color: var(--border); color: var(--text-mute); cursor: not-allowed; }
.btn.mic { width: 36px; padding: 0; }
.btn.mic.on { background: var(--accent-red); border-color: var(--accent-red); color: #fff; }
.status {
font-size: 12px;
color: var(--text-mute);
padding: 4px 4px 0;
min-height: 18px;
}
.status.err { color: var(--accent-red); }
/* ====== mobile-only chrome ====== */
.mobile-bar {
display: none;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: var(--bg-elev);
border-bottom: 1px solid var(--border-soft);
padding-top: max(8px, env(safe-area-inset-top));
}
.mobile-bar .hamburger,
.mobile-bar .pane-tabs button {
border: 1px solid var(--border);
background: var(--bg-elev);
color: var(--text-dim);
border-radius: 6px;
font-size: 14px;
padding: 6px 10px;
}
.mobile-bar .pane-tabs {
margin-left: auto;
display: flex;
gap: 4px;
}
.mobile-bar .pane-tabs button.active {
background: var(--accent-strong);
color: #fff;
border-color: var(--accent-strong);
}
.mobile-bar .doc-title {
flex: 1 1 0;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: 600;
font-size: 14px;
}
.mobile-bar .doc-title input { min-width: 0; color: var(--text); }
.sidebar-backdrop {
display: none;
position: fixed; inset: 0;
background: rgba(0,0,0,0.55);
z-index: 50;
}
/* ====== mobile layout ====== */
@media (max-width: 768px) {
.app {
grid-template-columns: 1fr;
grid-template-rows: auto 1fr;
height: 100dvh;
}
.mobile-bar { display: flex; }
/* sidebar becomes a slide-in drawer */
.sidebar {
position: fixed;
top: 0; left: 0; bottom: 0;
width: 78vw;
max-width: 320px;
border-right: 1px solid var(--border-soft);
border-bottom: none;
transform: translateX(-100%);
transition: transform 0.2s ease;
z-index: 60;
box-shadow: 2px 0 8px rgba(0,0,0,0.5);
}
.app.drawer-open .sidebar { transform: translateX(0); }
.app.drawer-open .sidebar-backdrop { display: block; }
.editor-pane {
grid-template-columns: 1fr;
grid-template-rows: 1fr;
position: relative;
}
.title-row { display: none; }
.editor, .preview {
grid-column: 1;
grid-row: 1;
border-right: none;
border-bottom: none;
padding: 12px;
}
.editor { display: none; }
.preview { display: none; }
.app.pane-editor .editor { display: block; }
.app.pane-preview .preview { display: block; }
.input-bar {
padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.input-row textarea {
font-size: 16px;
}
.btn { height: 44px; }
.btn.mic { width: 48px; }
}
/* ====== modal ====== */
.modal-backdrop {
position: fixed; inset: 0;
background: rgba(0,0,0,0.7);
display: flex; align-items: center; justify-content: center;
z-index: 100;
backdrop-filter: blur(2px);
}
.modal {
background: var(--bg-card);
border: 1px solid var(--border);
padding: 24px;
border-radius: 12px;
width: 360px; max-width: 90vw;
box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.modal h2 { margin: 0 0 12px; font-size: 16px; color: var(--accent); }
.modal input {
width: 100%; padding: 9px 12px;
border: 1px solid var(--border);
background: var(--bg-elev);
color: var(--text);
border-radius: 6px;
margin-bottom: 12px; outline: none;
}
.modal input:focus { border-color: var(--accent-strong); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }