Files
spanish-diary/style.css
T

229 lines
7.2 KiB
CSS

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #f8f9fa;
--panel-bg: #ffffff;
--border: #dee2e6;
--text: #212529;
--text-muted: #6c757d;
--accent: #0d6efd;
--accent-hover: #0b5ed7;
--danger: #dc3545;
--success: #198754;
--highlight: #fff3cd;
--shadow: 0 1px 3px rgba(0,0,0,0.08);
--radius: 8px;
--font-mono: 'Consolas', 'Courier New', monospace;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #1a1d23;
--panel-bg: #212529;
--border: #373b3e;
--text: #e9ecef;
--text-muted: #9ca3af;
--accent: #3b82f6;
--accent-hover: #60a5fa;
--danger: #ef4444;
--success: #22c55e;
--highlight: #3d3520;
}
}
html, body { height: 100%; }
body {
font-family: system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--text);
display: flex;
justify-content: center;
align-items: stretch;
padding: 1rem;
}
#app {
display: grid;
grid-template-columns: 240px 1fr 280px;
gap: 1rem;
width: 100%;
max-width: 1200px;
min-height: 0;
}
#app > * {
background: var(--panel-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
display: flex;
flex-direction: column;
overflow: hidden;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--border);
gap: 0.5rem;
}
.panel-header h2 { font-size: 0.95rem; font-weight: 600; }
/* Left panel — entry list */
#panel-list { overflow-y: auto; }
#entry-list {
list-style: none;
flex: 1;
overflow-y: auto;
}
#entry-list li {
padding: 0.75rem 1rem;
cursor: pointer;
border-bottom: 1px solid var(--border);
transition: background 0.1s;
}
#entry-list li:hover { background: var(--highlight); }
#entry-list li.active { background: var(--highlight); border-left: 3px solid var(--accent); }
#entry-list .entry-date { font-size: 0.75rem; color: var(--text-muted); }
#entry-list .entry-preview { font-size: 0.85rem; margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-actions { display: none; gap: 0.3rem; margin-top: 0.3rem; }
#entry-list li:hover .entry-actions { display: flex; }
.entry-actions button {
background: none; border: 1px solid var(--border); border-radius: 4px;
padding: 0.15rem 0.4rem; font-size: 0.7rem; cursor: pointer; color: var(--text-muted);
}
.entry-actions .btn-delete { color: var(--danger); border-color: var(--danger); }
#btn-new {
background: var(--accent); color: #fff; border: none;
width: 28px; height: 28px; border-radius: 6px;
font-size: 1.2rem; cursor: pointer; line-height: 1;
}
#btn-new:hover { background: var(--accent-hover); }
/* Grammar quick access */
#grammar-quick {
border-top: 1px solid var(--border);
flex-shrink: 0;
}
.grammar-header {
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--border);
}
.more-link {
font-size: 0.75rem;
color: var(--accent);
text-decoration: none;
white-space: nowrap;
}
.more-link:hover { text-decoration: underline; }
#grammar-list {
list-style: none;
padding: 0.25rem 0;
max-height: 220px;
overflow-y: auto;
}
#grammar-list li {
padding: 0.35rem 1rem;
font-size: 0.8rem;
}
#grammar-list a {
color: var(--text);
text-decoration: none;
display: block;
}
#grammar-list a:hover { color: var(--accent); }
/* Center panel — editor */
#panel-editor { display: flex; flex-direction: column; }
#entry-date {
border: 1px solid var(--border); border-radius: 4px;
padding: 0.3rem 0.5rem; font-size: 0.85rem;
background: var(--panel-bg); color: var(--text);
}
#btn-save {
background: var(--accent); color: #fff; border: none;
padding: 0.35rem 0.75rem; border-radius: 6px;
font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
#btn-save:hover { background: var(--accent-hover); }
#entry-text {
flex: 1; resize: none; border: none; padding: 1rem;
font-size: 1.05rem; line-height: 1.7;
font-family: var(--font-mono);
background: transparent; color: var(--text);
outline: none;
}
#entry-hint { padding: 0.5rem 1rem; font-size: 0.75rem; color: var(--text-muted); border-top: 1px solid var(--border); }
/* Editor panel - live translation section */
#editor-translate { border-top: 1px solid var(--border); padding: 0.5rem 1rem; }
.editor-section-title { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4rem; }
.editor-translate-line { display: flex; gap: 0.4rem; margin-bottom: 0.25rem; font-size: 0.85rem; line-height: 1.5; }
.et-label { font-weight: 600; color: var(--text-muted); white-space: nowrap; min-width: 2.5rem; }
.et-text { color: var(--text); flex: 1; }
#selection-translate { margin-top: 0.3rem; padding: 0.3rem 0.5rem; background: var(--highlight); border-radius: 4px; }
/* Editor panel - vocabulary section */
#editor-vocab { border-top: 1px solid var(--border); padding: 0.5rem 1rem; max-height: 180px; overflow-y: auto; }
.vocab-item { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0; font-size: 0.85rem; border-bottom: 1px solid var(--border); }
.vocab-item:last-child { border-bottom: none; }
.vocab-word { font-weight: 600; font-family: var(--font-mono); color: var(--accent); min-width: 6rem; }
.vocab-en { color: var(--text-muted); flex: 1; }
.vocab-zh { color: var(--text); min-width: 3rem; }
.vocab-speech { background: none; border: 1px solid var(--border); border-radius: 4px; padding: 0.15rem 0.4rem; font-size: 0.7rem; cursor: pointer; color: var(--text-muted); line-height: 1; }
.vocab-speech:hover { border-color: var(--accent); color: var(--accent); }
/* Right panel — translation */
#panel-translate { overflow-y: auto; }
.translate-section {
padding: 1rem;
border-bottom: 1px solid var(--border);
}
.translate-label { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-muted); }
.translate-text {
font-size: 0.95rem; line-height: 1.6;
min-height: 3rem; padding: 0.5rem;
background: var(--bg); border-radius: 4px;
}
.btn-speech {
background: none; border: 1px solid var(--border); border-radius: 4px;
padding: 0.25rem 0.6rem; font-size: 0.75rem; cursor: pointer;
margin-top: 0.5rem; color: var(--text-muted);
}
.btn-speech:hover { border-color: var(--accent); color: var(--accent); }
/* Modal overlay for delete confirmation */
#modal-overlay {
display: none;
position: fixed; inset: 0;
background: rgba(0,0,0,0.4);
align-items: center; justify-content: center;
z-index: 100;
}
#modal-overlay.show { display: flex; }
#modal-box {
background: var(--panel-bg); border-radius: var(--radius);
padding: 1.5rem; max-width: 360px; width: 90%;
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
#modal-box p { margin-bottom: 1rem; font-size: 0.9rem; }
#modal-box .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
#modal-box button {
padding: 0.4rem 1rem; border-radius: 6px; border: 1px solid var(--border);
cursor: pointer; font-size: 0.85rem;
}
#modal-box .btn-cancel { background: var(--panel-bg); color: var(--text); }
#modal-box .btn-confirm { background: var(--danger); color: #fff; border-color: var(--danger); }
@media (max-width: 768px) {
body { padding: 0.5rem; }
#app { grid-template-columns: 1fr; }
#panel-list { max-height: 30vh; }
#panel-editor { min-height: 40vh; }
#panel-translate { max-height: 30vh; }
}