feat(mobile): implement iOS Safari responsive layout, bottom tab bar, and mobile bottom sheet

This commit is contained in:
2026-10-05 16:08:05 +03:00
parent d5e9354016
commit c0fdcd776b
4 changed files with 707 additions and 50 deletions
+505 -22
View File
@@ -38,6 +38,11 @@
--font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
--transition: all 0.18s ease-in-out;
--sat: env(safe-area-inset-top, 0px);
--sar: env(safe-area-inset-right, 0px);
--sab: env(safe-area-inset-bottom, 0px);
--sal: env(safe-area-inset-left, 0px);
}
[data-theme="light"] {
@@ -75,6 +80,11 @@
padding: 0;
}
html, body {
overflow-x: hidden;
-webkit-tap-highlight-color: transparent;
}
body {
background-color: var(--bg-main);
color: var(--text-main);
@@ -82,6 +92,7 @@ body {
line-height: 1.5;
-webkit-font-smoothing: antialiased;
min-height: 100vh;
min-height: 100dvh;
}
.hidden {
@@ -2321,75 +2332,547 @@ body {
75% { transform: translateX(4px); }
}
/* Responsive */
@media (max-width: 640px) {
/* Mobile Navigation & Tab Bar (iOS Native Style Base) */
.mobile-only-btn,
.mobile-tab-bar,
.mobile-only {
display: none;
}
.mobile-tab-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: calc(56px + env(safe-area-inset-bottom, 0px));
padding-bottom: env(safe-area-inset-bottom, 0px);
background-color: rgba(30, 41, 59, 0.94);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border-top: 1px solid var(--border-color);
z-index: 1000;
align-items: center;
justify-content: space-around;
}
[data-theme="light"] .mobile-tab-bar {
background-color: rgba(255, 255, 255, 0.94);
}
.tab-item {
flex: 1;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
background: none;
border: none;
color: var(--text-muted);
cursor: pointer;
position: relative;
padding: 6px 0;
-webkit-tap-highlight-color: transparent;
transition: var(--transition);
}
.tab-item:active {
transform: scale(0.92);
}
.tab-item.active {
color: var(--primary);
}
.tab-icon {
font-size: 19px;
line-height: 1;
}
.tab-label {
font-size: 10px;
font-weight: 600;
letter-spacing: -0.2px;
}
.tab-badge {
position: absolute;
top: 5px;
right: calc(50% - 18px);
background-color: #ef4444;
color: #ffffff;
font-size: 10px;
font-weight: 700;
padding: 1px 5px;
border-radius: 9999px;
line-height: 1.2;
}
/* Mobile Sheet / Menu */
.mobile-sheet-window {
max-width: 440px;
}
.mobile-user-card {
display: flex;
align-items: center;
gap: 12px;
padding: 14px 16px;
background: var(--bg-input);
border: 1px solid var(--border-color);
border-radius: var(--radius-md);
margin-bottom: 16px;
}
.mobile-user-avatar {
font-size: 28px;
background: var(--bg-surface-hover);
width: 48px;
height: 48px;
display: flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-full);
}
.mobile-user-info strong {
font-size: 16px;
color: var(--text-main);
}
.mobile-user-info .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.mobile-menu-actions {
display: flex;
flex-direction: column;
gap: 10px;
}
/* Sheet drag handle for mobile bottom sheets */
.sheet-drag-handle {
width: 38px;
height: 4px;
border-radius: 2px;
background-color: var(--border-color);
margin: 0 auto 10px auto;
}
/* ==========================================================================
Comprehensive Mobile & Responsive System (iPhone 12 / iOS WebKit & Mobile)
========================================================================== */
@media (max-width: 768px) {
/* 1. iOS Safari Auto-Zoom Fix (< 16px triggers zoom) */
input, select, textarea,
.input-styled, .search-input-box input, .form-group input,
.search-mini-box input, .reader-select {
font-size: 16px !important;
}
/* 2. Global Mobile App Container & Safe Areas */
html, body {
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
min-height: 100dvh;
}
.app-shell {
min-height: 100dvh;
overflow-x: hidden;
}
.main-content,
.srs-view,
.reader-view {
padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
}
/* 3. Header & Navigation: Clean iOS App Header */
.navbar {
padding: 10px 14px;
padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px 12px;
position: sticky;
top: 0;
}
.brand-sub {
display: none;
.brand-sub,
.nav-center,
.nav-actions #nav-reader-btn,
.nav-actions #srs-trainer-btn,
.nav-actions #stats-open-btn,
.nav-actions #export-open-btn,
.nav-actions .user-profile {
display: none !important;
}
.trainer-text {
display: none;
.mobile-only-btn {
display: inline-flex !important;
align-items: center;
justify-content: center;
}
.mobile-tab-bar {
display: flex !important;
}
.mobile-only {
display: block !important;
}
/* 4. Dictionary & Search */
.main-content {
padding: 16px 12px;
gap: 24px;
padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px));
gap: 20px;
}
.field-row {
.search-input-box {
padding: 6px 8px 6px 12px;
}
.search-input-box input {
padding: 8px 0;
min-width: 0;
}
.translate-action-btn {
padding: 8px 14px;
font-size: 14px;
white-space: nowrap;
}
.hotkey-hints {
display: none !important;
}
.lookup-card {
padding: 16px 14px;
}
.lookup-header {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
.res-term {
font-size: 22px;
.meta-inputs-grid .field-row {
flex-direction: column;
gap: 12px;
}
.result-actions .btn {
width: 100%;
justify-content: center;
min-height: 48px;
}
.result-actions .btn-subtext {
display: none;
}
/* Horizontal scrollable chips for collections and tags */
.filter-chips-row {
flex-wrap: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
padding-bottom: 6px;
scrollbar-width: none;
}
.filter-chips-row::-webkit-scrollbar {
display: none;
}
.col-chip, .filter-chip {
flex-shrink: 0;
}
.list-controls {
width: 100%;
display: flex;
align-items: center;
gap: 8px;
margin-top: 10px;
}
.section-header {
flex-direction: column;
align-items: stretch;
}
.search-mini-box {
flex: 1;
}
.search-mini-box input {
min-width: 0;
}
.search-mini-box input {
width: 100%;
min-width: 0;
}
.fc-flip-btn-wrap {
display: block;
/* Cards */
.vocab-card {
padding: 14px;
gap: 8px;
}
.card-top {
gap: 8px;
}
.card-term {
font-size: 17px;
}
.card-actions .icon-btn {
min-width: 36px;
min-height: 36px;
display: flex;
align-items: center;
justify-content: center;
}
.card-bottom {
font-size: 11px;
}
/* 5. SRS Trainer */
.srs-topbar {
padding: 10px 12px;
flex-direction: column;
align-items: stretch;
gap: 8px;
}
.srs-topbar-left, .srs-topbar-right {
justify-content: space-between;
width: 100%;
}
.srs-mode-switch {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
}
.srs-mode-switch::-webkit-scrollbar {
display: none;
}
.srs-tab {
flex-shrink: 0;
padding: 6px 10px;
font-size: 12px;
}
.flashcard-wrapper {
min-height: 270px;
max-height: 48dvh;
}
.flashcard-inner {
min-height: 270px;
}
.fc-main-term {
font-size: 28px;
}
.fc-footer-hint {
font-size: 11px;
}
.srs-rating-bar {
grid-template-columns: 1fr 1fr;
gap: 8px;
width: 100%;
}
.btn-rate {
min-height: 48px;
padding: 8px 6px;
}
.rate-key {
display: none;
}
.quiz-options-grid {
grid-template-columns: 1fr;
gap: 8px;
}
.quiz-option-btn {
min-height: 48px;
font-size: 14px;
padding: 10px 14px;
}
/* 6. Bookshelf & Reader View */
.reader-view {
padding: 14px 12px calc(76px + env(safe-area-inset-bottom, 0px));
}
.bookshelf-header {
flex-direction: column;
align-items: stretch;
gap: 12px;
margin-bottom: 18px;
}
.bookshelf-title-wrap h2 {
font-size: 19px;
}
.bookshelf-actions {
width: 100%;
display: flex;
gap: 8px;
}
.bookshelf-actions .btn,
.bookshelf-actions .file-upload-label {
flex: 1;
justify-content: center;
text-align: center;
padding: 10px;
}
.bookshelf-grid {
grid-template-columns: 1fr;
gap: 12px;
}
.book-card {
padding: 14px;
}
/* Reader Interface Toolbar */
.reader-toolbar {
padding: 8px 10px;
gap: 8px;
flex-direction: column;
align-items: stretch;
}
.reader-toolbar-left {
width: 100%;
justify-content: space-between;
gap: 8px;
}
.reader-meta {
flex: 1;
min-width: 0;
}
.reader-title {
font-size: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.reader-author {
font-size: 11px;
}
.reader-toolbar-center {
width: 100%;
justify-content: space-between;
gap: 6px;
}
.reader-select {
flex: 1;
max-width: none;
min-width: 0;
}
.reader-toolbar-right {
width: 100%;
justify-content: space-between;
gap: 6px;
border-top: 1px solid var(--border-color);
padding-top: 6px;
}
.reader-content-body {
padding: 14px 12px;
font-size: 17px;
line-height: 1.65;
}
/* 7. Bottom Sheet for Word Translation Popup on Mobile */
.reader-word-popup {
position: fixed !important;
top: auto !important;
bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
left: 8px !important;
right: 8px !important;
width: auto !important;
max-width: none !important;
border-radius: 18px !important;
box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5) !important;
border: 1px solid var(--border-focus) !important;
background-color: var(--bg-surface) !important;
z-index: 10005 !important;
padding: 14px 16px !important;
animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
@keyframes slideUpSheet {
from {
transform: translateY(100%);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
/* 8. Modals: Mobile Bottom-Sheet style */
.modal-backdrop {
padding: 0;
align-items: flex-end;
}
.modal-window {
max-width: 100%;
max-height: calc(90dvh - env(safe-area-inset-top, 0px));
border-radius: 20px 20px 0 0;
border-bottom: none;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding-bottom: env(safe-area-inset-bottom, 0px);
animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.stats-modal-window {
width: 100%;
max-width: 100%;
}
.stats-hero-grid {
grid-template-columns: 1fr 1fr;
gap: 8px;
}
.export-grid {
grid-template-columns: 1fr;
}
.summary-metrics {
grid-template-columns: 1fr;
.heatmap-container-wrap {
-webkit-overflow-scrolling: touch;
}
/* 9. Batch action bar */
.batch-action-bar {
flex-direction: column;
gap: 10px;
bottom: 12px;
bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
left: 10px;
right: 10px;
}
.batch-actions {
width: 100%;
justify-content: space-between;