511 lines
16 KiB
CSS
511 lines
16 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;
|
|
}
|
|
|
|
#mobile-nav { display: none; }
|
|
#mobile-header, #mobile-menu-overlay { display: none; }
|
|
#btn-back-list { display: none; }
|
|
|
|
/* User area and stats */
|
|
#user-area {
|
|
display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
|
|
padding: 0.6rem 1rem;
|
|
border-top: 1px solid var(--border);
|
|
font-size: 0.8rem;
|
|
flex-shrink: 0;
|
|
}
|
|
#user-area #user-name { flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
#user-area button, #user-area a {
|
|
background: none; border: 1px solid var(--border); border-radius: 4px;
|
|
padding: 0.25rem 0.5rem; font-size: 0.75rem; cursor: pointer;
|
|
color: var(--text-muted); text-decoration: none; white-space: nowrap;
|
|
}
|
|
#user-area button:hover, #user-area a:hover { border-color: var(--accent); color: var(--accent); }
|
|
|
|
#stats-panel { border-top: 1px solid var(--border); flex-shrink: 0; max-height: 260px; overflow-y: auto; }
|
|
#stats-content { padding: 0.6rem 1rem; font-size: 0.8rem; }
|
|
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; margin-top: 0.4rem; }
|
|
.stat-item { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; }
|
|
.stat-item .stat-value { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
|
|
.stat-item .stat-label { font-size: 0.7rem; color: var(--text-muted); }
|
|
.daily-stats { margin-top: 0.5rem; font-size: 0.75rem; color: var(--text-muted); }
|
|
|
|
.favorite-btn {
|
|
background: none; border: 1px solid var(--border); border-radius: 4px;
|
|
padding: 0.15rem 0.4rem; font-size: 0.75rem; cursor: pointer;
|
|
color: var(--text-muted); line-height: 1;
|
|
}
|
|
.favorite-btn.active { border-color: #f59f00; color: #f59f00; }
|
|
.favorite-btn:hover { border-color: #f59f00; }
|
|
|
|
#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); }
|
|
#btn-helper {
|
|
background: none; border: 1px solid var(--accent); color: var(--accent);
|
|
padding: 0.35rem 0.75rem; border-radius: 6px;
|
|
font-size: 0.85rem; cursor: pointer; white-space: nowrap;
|
|
}
|
|
#btn-helper:hover { background: var(--accent); color: #fff; }
|
|
#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); }
|
|
|
|
/* Chinese to Spanish helper modal */
|
|
#helper-modal-overlay {
|
|
display: none;
|
|
position: fixed; inset: 0;
|
|
background: rgba(0,0,0,0.4);
|
|
align-items: center; justify-content: center;
|
|
z-index: 110;
|
|
}
|
|
#helper-modal-overlay.show { display: flex; }
|
|
#helper-modal-box {
|
|
background: var(--panel-bg); border-radius: var(--radius);
|
|
padding: 1.5rem; max-width: 520px; width: 90%;
|
|
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
}
|
|
#helper-modal-box h3 {
|
|
font-size: 1rem; margin-bottom: 0.75rem;
|
|
}
|
|
#helper-input {
|
|
width: 100%; min-height: 90px; resize: vertical;
|
|
border: 1px solid var(--border); border-radius: 6px;
|
|
padding: 0.6rem; font-size: 0.95rem; line-height: 1.6;
|
|
background: var(--bg); color: var(--text); outline: none;
|
|
}
|
|
#helper-input:focus { border-color: var(--accent); }
|
|
#helper-preview {
|
|
margin: 0.75rem 0 1rem;
|
|
padding: 0.6rem 0.75rem;
|
|
background: var(--code-bg, var(--bg));
|
|
border-radius: 6px;
|
|
font-size: 0.9rem;
|
|
min-height: 2.5rem;
|
|
}
|
|
.helper-preview-label { color: var(--text-muted); font-weight: 600; }
|
|
#helper-result { font-family: var(--font-mono); color: var(--accent); }
|
|
#helper-modal-box .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
|
|
#helper-modal-box .modal-actions button {
|
|
padding: 0.4rem 1rem; border-radius: 6px; border: 1px solid var(--border);
|
|
cursor: pointer; font-size: 0.85rem;
|
|
}
|
|
#helper-modal-box .btn-cancel { background: var(--panel-bg); color: var(--text); }
|
|
#helper-modal-box .btn-confirm {
|
|
background: var(--accent); color: #fff; border-color: var(--accent);
|
|
}
|
|
#helper-modal-box .btn-confirm:disabled {
|
|
opacity: 0.45; cursor: not-allowed;
|
|
}
|
|
|
|
/* Translation settings modal */
|
|
#settings-modal-overlay {
|
|
display: none;
|
|
position: fixed; inset: 0;
|
|
background: rgba(0,0,0,0.4);
|
|
align-items: center; justify-content: center;
|
|
z-index: 120;
|
|
}
|
|
#settings-modal-overlay.show { display: flex; }
|
|
#settings-modal-box {
|
|
background: var(--panel-bg); border-radius: var(--radius);
|
|
padding: 1.5rem; max-width: 480px; width: 90%;
|
|
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
max-height: 90vh; overflow-y: auto;
|
|
}
|
|
#settings-modal-box h3 { font-size: 1rem; margin-bottom: 0.75rem; }
|
|
#settings-modal-box label { display: block; font-size: 0.8rem; color: var(--text-muted); margin: 0.6rem 0 0.25rem; }
|
|
#settings-modal-box select, #settings-modal-box input, #settings-modal-box textarea {
|
|
width: 100%; border: 1px solid var(--border); border-radius: 6px;
|
|
padding: 0.45rem 0.6rem; font-size: 0.85rem;
|
|
background: var(--bg); color: var(--text); outline: none;
|
|
}
|
|
#settings-modal-box select:focus, #settings-modal-box input:focus, #settings-modal-box textarea:focus {
|
|
border-color: var(--accent);
|
|
}
|
|
#settings-modal-box .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
|
|
#settings-modal-box .modal-actions button {
|
|
padding: 0.4rem 1rem; border-radius: 6px; border: 1px solid var(--border);
|
|
cursor: pointer; font-size: 0.85rem;
|
|
}
|
|
#settings-modal-box .btn-confirm { background: var(--accent); color: #fff; border-color: var(--accent); }
|
|
|
|
/* Change password modal */
|
|
#password-modal-overlay {
|
|
display: none;
|
|
position: fixed; inset: 0;
|
|
background: rgba(0,0,0,0.4);
|
|
align-items: center; justify-content: center;
|
|
z-index: 130;
|
|
}
|
|
#password-modal-overlay.show { display: flex; }
|
|
#password-modal-box {
|
|
background: var(--panel-bg); border-radius: var(--radius);
|
|
padding: 1.5rem; max-width: 420px; width: 90%;
|
|
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
}
|
|
#password-modal-box h3 { font-size: 1rem; margin-bottom: 0.75rem; }
|
|
#password-modal-box label { display: block; font-size: 0.8rem; color: var(--text-muted); margin: 0.6rem 0 0.25rem; }
|
|
#password-modal-box input {
|
|
width: 100%; border: 1px solid var(--border); border-radius: 6px;
|
|
padding: 0.45rem 0.6rem; font-size: 0.85rem;
|
|
background: var(--bg); color: var(--text); outline: none;
|
|
}
|
|
#password-modal-box input:focus { border-color: var(--accent); }
|
|
#password-msg {
|
|
min-height: 1.4em; font-size: 0.8rem; color: var(--danger);
|
|
margin-top: 0.6rem;
|
|
}
|
|
#password-modal-box .modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }
|
|
#password-modal-box .modal-actions button {
|
|
padding: 0.4rem 1rem; border-radius: 6px; border: 1px solid var(--border);
|
|
cursor: pointer; font-size: 0.85rem;
|
|
}
|
|
#password-modal-box .btn-cancel { background: var(--panel-bg); color: var(--text); }
|
|
#password-modal-box .btn-confirm { background: var(--accent); color: #fff; border-color: var(--accent); }
|
|
|
|
@media (max-width: 768px) {
|
|
body { padding: 0; overflow-x: hidden; }
|
|
|
|
#mobile-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 85;
|
|
height: 52px;
|
|
padding: 0 0.6rem;
|
|
background: var(--panel-bg);
|
|
border-bottom: 1px solid var(--border);
|
|
}
|
|
#mobile-header button {
|
|
width: 42px;
|
|
height: 42px;
|
|
border: none;
|
|
background: none;
|
|
font-size: 1.3rem;
|
|
cursor: pointer;
|
|
color: var(--text);
|
|
}
|
|
#mobile-title { font-weight: 700; font-size: 0.95rem; }
|
|
|
|
#mobile-menu-overlay {
|
|
display: none;
|
|
position: fixed;
|
|
inset: 0;
|
|
background: transparent;
|
|
z-index: 100;
|
|
}
|
|
#mobile-menu-overlay.show { display: block; }
|
|
#mobile-menu {
|
|
position: absolute;
|
|
left: 0.5rem;
|
|
top: 56px;
|
|
width: max-content;
|
|
min-width: 0;
|
|
max-width: 84vw;
|
|
max-height: calc(100vh - 72px);
|
|
background: var(--panel-bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
box-shadow: var(--shadow);
|
|
padding: 0.6rem;
|
|
overflow-y: auto;
|
|
}
|
|
.mobile-menu-head {
|
|
font-weight: 700;
|
|
font-size: 1.05rem;
|
|
padding: 0.5rem 0.5rem 1rem;
|
|
}
|
|
#mobile-menu button, #mobile-menu a {
|
|
display: flex;
|
|
width: 100%;
|
|
align-items: center;
|
|
gap: 0.6rem;
|
|
padding: 0.8rem 0.5rem;
|
|
border: none;
|
|
border-bottom: 1px solid var(--border);
|
|
background: none;
|
|
color: var(--text);
|
|
font-size: 0.95rem;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
#app { display: block; padding: 0; }
|
|
#panel-list, #panel-translate, #stats-panel { display: none; }
|
|
#panel-editor {
|
|
display: flex;
|
|
min-height: calc(100vh - 52px);
|
|
border: none;
|
|
border-radius: 0;
|
|
}
|
|
|
|
#panel-list {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
z-index: 70;
|
|
border: none;
|
|
border-radius: 0;
|
|
max-height: none;
|
|
}
|
|
body[data-view="list"] #panel-list { display: flex; }
|
|
#btn-back-list {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 30px;
|
|
height: 30px;
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
background: none;
|
|
color: var(--text);
|
|
font-size: 1rem;
|
|
cursor: pointer;
|
|
}
|
|
#panel-list #entry-list { max-height: none; }
|
|
|
|
#panel-translate {
|
|
position: fixed;
|
|
top: 52px;
|
|
right: 0;
|
|
width: min(420px, 94vw);
|
|
height: calc(100vh - 52px);
|
|
z-index: 60;
|
|
border: none;
|
|
border-radius: 0;
|
|
transform: translateX(100%);
|
|
transition: transform 0.25s ease;
|
|
pointer-events: none;
|
|
}
|
|
body[data-view="translate"] #panel-translate,
|
|
body[data-view="stats"] #panel-translate {
|
|
display: flex;
|
|
transform: translateX(0);
|
|
pointer-events: auto;
|
|
}
|
|
body[data-view="translate"] #stats-panel { display: flex; }
|
|
body[data-view="stats"] #panel-translate > .panel-header,
|
|
body[data-view="stats"] #panel-translate > .translate-section { display: none; }
|
|
body[data-view="stats"] #stats-panel {
|
|
display: flex;
|
|
max-height: none;
|
|
flex: 1;
|
|
}
|
|
}
|