feat: implement Stage 5 (Interactive Reader, EPUB/TXT parser, Bookshelf, Click-to-Translate) and Stage 4.3 (Strict CEFR level calculation)

This commit is contained in:
2026-10-05 11:42:13 +03:00
parent c51c505b61
commit d8a2c6e34f
9 changed files with 2101 additions and 30 deletions
+382
View File
@@ -2396,4 +2396,386 @@ body {
}
}
/* ==========================================================================
Stage 5: Interactive Reader & Bookshelf Styles
========================================================================== */
.reader-view {
max-width: 1100px;
margin: 0 auto;
padding: 24px 20px 80px;
}
.bookshelf-header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 16px;
margin-bottom: 28px;
padding-bottom: 20px;
border-bottom: 1px solid var(--border-color);
}
.bookshelf-title-wrap h2 {
font-size: 24px;
font-weight: 700;
color: var(--text-main);
display: flex;
align-items: center;
gap: 8px;
}
.bookshelf-title-wrap .subtitle {
font-size: 14px;
color: var(--text-muted);
margin-top: 4px;
}
.bookshelf-actions {
display: flex;
align-items: center;
gap: 12px;
}
.file-upload-label {
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
}
.bookshelf-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}
.book-card {
background-color: var(--bg-surface);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
transition: var(--transition);
position: relative;
box-shadow: var(--shadow-sm);
}
.book-card:hover {
border-color: var(--border-focus);
box-shadow: var(--shadow-md);
transform: translateY(-2px);
}
.book-card-top {
display: flex;
align-items: flex-start;
gap: 14px;
margin-bottom: 14px;
}
.book-cover-icon {
font-size: 32px;
background: var(--bg-input);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
width: 52px;
height: 64px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.book-card-info {
flex: 1;
min-width: 0;
}
.book-card-title {
font-size: 16px;
font-weight: 700;
color: var(--text-main);
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.book-card-author {
font-size: 13px;
color: var(--text-muted);
margin-bottom: 8px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.book-card-badges {
display: flex;
align-items: center;
gap: 8px;
}
.badge-format {
text-transform: uppercase;
font-size: 10px;
font-weight: 700;
padding: 2px 6px;
border-radius: var(--radius-sm);
background: var(--tag-bg);
color: var(--tag-text);
}
.badge-words {
font-size: 12px;
color: var(--text-dim);
}
.book-progress-wrap {
margin: 14px 0 16px;
}
.book-progress-labels {
display: flex;
justify-content: space-between;
font-size: 12px;
color: var(--text-dim);
margin-bottom: 6px;
}
.book-progress-bar-bg {
width: 100%;
height: 6px;
background-color: var(--bg-input);
border-radius: var(--radius-full);
overflow: hidden;
}
.book-progress-bar-fill {
height: 100%;
background-color: var(--primary);
border-radius: var(--radius-full);
transition: width 0.3s ease;
}
.book-card-actions {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding-top: 12px;
border-top: 1px solid var(--border-color);
}
/* Reader Interface */
.reader-interface {
background-color: var(--bg-surface);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
overflow: hidden;
}
.reader-toolbar {
position: sticky;
top: 0;
z-index: 100;
background-color: var(--bg-surface);
border-bottom: 1px solid var(--border-color);
padding: 12px 18px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 12px;
}
.reader-toolbar-left {
display: flex;
align-items: center;
gap: 14px;
}
.reader-meta {
display: flex;
flex-direction: column;
}
.reader-title {
font-size: 16px;
font-weight: 700;
color: var(--text-main);
line-height: 1.2;
}
.reader-author {
font-size: 12px;
color: var(--text-muted);
}
.reader-toolbar-center {
display: flex;
align-items: center;
gap: 8px;
}
.reader-select {
padding: 6px 12px;
border-radius: var(--radius-sm);
background-color: var(--bg-input);
color: var(--text-main);
border: 1px solid var(--border-color);
font-size: 13px;
outline: none;
max-width: 240px;
}
.reader-toolbar-right {
display: flex;
align-items: center;
gap: 10px;
}
.font-controls {
display: flex;
align-items: center;
gap: 4px;
}
.reader-scroll-area {
padding: 36px 24px 60px;
max-width: 780px;
margin: 0 auto;
min-height: 60vh;
}
.reader-content-body {
font-family: Georgia, 'Times New Roman', serif;
font-size: 19px;
line-height: 1.85;
color: var(--text-main);
word-break: break-word;
user-select: text;
}
.reader-content-body h1,
.reader-content-body h2,
.reader-content-body h3 {
font-family: var(--font-family);
margin: 28px 0 16px;
color: var(--text-main);
}
.reader-content-body p {
margin-bottom: 20px;
text-indent: 1.2em;
}
/* Interactive Words */
.reader-word {
cursor: pointer;
border-radius: 3px;
transition: background-color 0.12s ease, color 0.12s ease;
padding: 1px 2px;
}
.reader-word:hover {
background-color: var(--primary-dim);
color: var(--primary);
}
.reader-word.status-mastered.highlight-enabled {
border-bottom: 2px dotted rgba(16, 185, 129, 0.5);
}
.reader-word.status-learning.highlight-enabled {
border-bottom: 2px dotted rgba(56, 189, 248, 0.5);
}
/* Click-to-Translate Popup */
.reader-word-popup {
position: fixed;
z-index: 10001;
background-color: var(--bg-surface);
border: 1px solid var(--border-focus);
border-radius: var(--radius-lg);
box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.5);
width: 320px;
max-width: calc(100vw - 32px);
padding: 16px;
animation: fadeInScale 0.15s ease-out;
}
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
padding-bottom: 8px;
border-bottom: 1px solid var(--border-color);
}
.popup-term-wrap {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.popup-term {
font-size: 18px;
color: var(--text-main);
}
.popup-phonetic {
font-size: 13px;
color: var(--primary);
font-family: monospace;
}
.popup-close-btn {
background: none;
border: none;
color: var(--text-dim);
font-size: 16px;
cursor: pointer;
padding: 4px;
}
.popup-close-btn:hover {
color: var(--text-main);
}
.popup-translation {
font-size: 15px;
font-weight: 600;
color: var(--success);
margin-bottom: 8px;
}
.popup-context {
font-size: 12px;
color: var(--text-muted);
font-style: italic;
background: var(--bg-input);
padding: 8px 10px;
border-radius: var(--radius-sm);
margin-bottom: 14px;
line-height: 1.4;
border-left: 3px solid var(--primary);
}
.popup-saved-badge {
text-align: center;
font-size: 13px;
font-weight: 600;
color: var(--success);
padding: 6px;
}