diff --git a/admin.html b/admin.html index cbbb26f..2371e5b 100644 --- a/admin.html +++ b/admin.html @@ -4,7 +4,7 @@ Speaking Lab 后台管理 - +
diff --git a/home.js b/home.js index bc840c5..8d0b61f 100644 --- a/home.js +++ b/home.js @@ -250,7 +250,8 @@ function createVideoCard(video) { statValues[2].textContent = `${difficultCount}`; const favorite = card.querySelector(".home-favorite"); - favorite.textContent = isFavorite ? "已收藏" : "收藏"; + favorite.textContent = isFavorite ? "♥" : "♡"; + favorite.setAttribute("aria-label", isFavorite ? "取消收藏素材" : "收藏素材"); favorite.classList.toggle("active", isFavorite); favorite.addEventListener("click", (event) => { event.preventDefault(); diff --git a/index.html b/index.html index 7572936..8360456 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Speaking Lab - +
@@ -40,7 +40,6 @@

素材库

搜索素材,按分类和学习状态继续练习。

- 进入学习页
@@ -50,6 +49,6 @@ - + diff --git a/login.html b/login.html index da469cf..a71b8ba 100644 --- a/login.html +++ b/login.html @@ -4,7 +4,7 @@ 登录 Speaking Lab - +
diff --git a/study.html b/study.html index 8695544..c42c7a7 100644 --- a/study.html +++ b/study.html @@ -4,7 +4,7 @@ Speaking Lab 学习页 - +
diff --git a/styles.css b/styles.css index dd8aa8f..d6b8874 100644 --- a/styles.css +++ b/styles.css @@ -26,6 +26,7 @@ --danger-ink: #9f2f35; --focus-ring: 0 0 0 3px rgba(47, 125, 99, 0.18); --shadow: 0 12px 30px rgba(25, 37, 59, 0.08); + --font-sans: Inter, "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif; } * { @@ -41,7 +42,11 @@ body { min-height: 100vh; background: var(--bg); color: var(--ink); - font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; + font-family: var(--font-sans); + line-height: 1.5; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } .auth-page { @@ -81,8 +86,9 @@ body { .auth-heading h1 { margin: 0; font-size: 28px; - font-weight: 700; + font-weight: 760; letter-spacing: 0; + line-height: 1.18; } .auth-heading p { @@ -100,7 +106,7 @@ body { display: grid; gap: 8px; font-size: 14px; - font-weight: 600; + font-weight: 680; } .auth-form input { @@ -334,7 +340,9 @@ textarea:focus { .brand h1 { margin: 0; font-size: 17px; + font-weight: 760; line-height: 1.1; + letter-spacing: 0; } .top-actions { @@ -590,29 +598,40 @@ video { .tool-row button { min-width: 54px; min-height: 38px; - border-radius: 10px; - border-color: #d8e2ec; - background: #f8fafc; - font-weight: 650; + border: 1px solid transparent; + border-radius: 999px; + color: var(--control-muted); + background: rgba(241, 238, 231, 0.88); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52); + font-weight: 750; white-space: nowrap; - transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; + transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; } .tool-row button:disabled { - border-color: #e2e8f0; - color: #98a2b3; - background: #f1f5f9; + border-color: transparent; + color: #9b9388; + background: #e8e2d8; box-shadow: none; transform: none; } .tool-row button:hover { - border-color: #b9dcd5; - background: var(--brand-soft); - box-shadow: 0 8px 20px rgba(15, 118, 110, 0.1); + border-color: var(--control-border); + color: var(--control-ink); + background: var(--control-surface-hover); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(47, 64, 57, 0.08); transform: translateY(-1px); } +.tool-row button:disabled:hover { + border-color: transparent; + color: #9b9388; + background: #e8e2d8; + box-shadow: none; + transform: none; +} + .right-practice-view { min-height: 0; overflow: auto; @@ -622,28 +641,35 @@ video { .practice-mode-bar { flex-wrap: wrap; - gap: 5px; + gap: 8px; } .practice-mode-bar .tab { - min-height: 32px; + min-height: 34px; border: 1px solid transparent; border-radius: 999px; - padding: 0 13px; - color: #344054; - background: #eef4f6; - font-weight: 750; + padding: 0 16px; + color: var(--control-muted); + background: rgba(241, 238, 231, 0.88); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52); + font-size: 13px; + font-weight: 800; + transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; } .practice-mode-bar .tab:hover { - border-color: #b9dcd5; - background: var(--brand-soft); + border-color: var(--control-border); + color: var(--control-ink); + background: var(--control-surface-hover); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(47, 64, 57, 0.08); + transform: translateY(-1px); } .practice-mode-bar .tab.active { - color: #fff; - border-color: var(--accent); - background: var(--accent); + color: #fffdf8; + border-color: var(--primary-solid); + background: var(--primary-solid); + box-shadow: var(--primary-soft-shadow); } .practice-body { @@ -736,47 +762,48 @@ video { .sentence-controls button { min-width: 76px; - color: #0f2742; - border-color: #c8d7e6; - background: #ffffff; font-size: 15px; font-weight: 800; } .sentence-controls #replayBtn { - color: #fff; - border-color: var(--accent); - background: var(--accent); + color: #fffdf8; + border-color: var(--primary-solid); + background: var(--primary-solid); + box-shadow: var(--primary-soft-shadow); } .sentence-controls #replayBtn:hover { - border-color: #1e3a5f; - background: #1e3a5f; - box-shadow: 0 10px 24px rgba(15, 39, 66, 0.2); + border-color: var(--primary-solid-hover); + background: var(--primary-solid-hover); + box-shadow: 0 12px 26px rgba(47, 75, 69, 0.20); } .sentence-controls #replayBtn:disabled { - border-color: #d8e2ec; - color: #98a2b3; - background: #e8eef5; + border-color: #d8d2c8; + color: #9b9388; + background: #e8e2d8; + box-shadow: none; } .study-side-actions .toggle { min-height: 42px; padding: 0 14px; - border: 1px solid #c8d7e6; + border: 1px solid transparent; border-radius: 999px; - color: #0f2742; - background: #f8fafc; + color: var(--control-muted); + background: rgba(241, 238, 231, 0.88); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52); font-size: 14px; font-weight: 800; - transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; + transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; } .study-side-actions .toggle:hover { - border-color: #b9dcd5; - background: var(--brand-soft); - box-shadow: 0 8px 20px rgba(15, 118, 110, 0.1); + border-color: var(--control-border); + color: var(--control-ink); + background: var(--control-surface-hover); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(47, 64, 57, 0.08); transform: translateY(-1px); } @@ -787,8 +814,6 @@ video { .study-side-actions #favoriteBtn { min-width: 68px; - color: #0f2742; - background: #fff; } .subtitle-card { @@ -965,8 +990,9 @@ video { } .line-button.is-practiced { - background: #f7fdf9; - border-color: #ccebdd; + background: #ecfdf3; + border-color: #86efac; + box-shadow: inset 3px 0 0 #16a34a; } .line-button.is-difficult { @@ -974,10 +1000,24 @@ video { box-shadow: inset 3px 0 0 var(--gold); } +.line-button.is-practiced.is-difficult { + background: #fff7e6; + border-color: #f4c86a; + box-shadow: + inset 3px 0 0 var(--gold), + inset 7px 0 0 #16a34a; +} + .line-button.active.is-difficult { box-shadow: inset 3px 0 0 var(--gold); } +.line-button.active.is-practiced.is-difficult { + box-shadow: + inset 3px 0 0 var(--gold), + inset 7px 0 0 #16a34a; +} + .line-time { color: var(--muted); font-size: 12px; @@ -1007,22 +1047,36 @@ video { .line-status-button { min-height: 26px; - padding: 0 7px; - border-radius: 6px; + border: 1px solid transparent; + border-radius: 999px; + padding: 0 9px; + color: var(--control-muted); + background: rgba(241, 238, 231, 0.74); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.50); font-size: 12px; + font-weight: 750; white-space: nowrap; + transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; +} + +.line-status-button:hover { + border-color: var(--control-border); + color: var(--control-ink); + background: var(--control-surface-hover); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 6px 14px rgba(47, 64, 57, 0.07); + transform: translateY(-1px); } .line-status-button.practiced.active { - color: #047857; - border-color: #9bd8c0; - background: #ecfdf5; + color: #475467; + border-color: #d8dee8; + background: #eef2f6; } .line-status-button.difficult.active { - color: #92400e; - border-color: #f5c56f; - background: #fffbeb; + color: var(--danger-ink); + border-color: rgba(159, 47, 53, 0.10); + background: var(--danger-soft); } .line-primary mark, @@ -1439,7 +1493,8 @@ video { transform: none; } -.secondary-action { +.secondary-action, +.user-menu button { min-height: 34px; display: inline-flex; align-items: center; @@ -1457,7 +1512,8 @@ video { transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; } -.secondary-action:hover { +.secondary-action:hover, +.user-menu button:hover { color: var(--control-ink); border-color: var(--control-border); background: var(--control-surface-hover); @@ -1465,14 +1521,17 @@ video { transform: translateY(-1px); } -.secondary-action:active { +.secondary-action:active, +.user-menu button:active { background: var(--control-surface-active); box-shadow: inset 0 1px 2px rgba(47, 64, 57, 0.12); transform: translateY(0); } .secondary-action:disabled, -.secondary-action:disabled:hover { +.secondary-action:disabled:hover, +.user-menu button:disabled, +.user-menu button:disabled:hover { border-color: transparent; color: #9b9388; background: #e8e2d8; @@ -1481,7 +1540,8 @@ video { } .chip:focus-visible, -.secondary-action:focus-visible { +.secondary-action:focus-visible, +.user-menu button:focus-visible { outline: none; box-shadow: var(--focus-ring); } @@ -1562,6 +1622,7 @@ video { .home-plan-card strong { color: #0f2742; font-size: 22px; + font-weight: 760; line-height: 1.15; } @@ -1614,12 +1675,13 @@ video { } .home-metric-label { - font-weight: 800; + font-weight: 720; } .home-metric strong { color: #0f2742; font-size: 28px; + font-weight: 760; line-height: 1; font-variant-numeric: tabular-nums; } @@ -1675,6 +1737,8 @@ video { .home-heading h2 { margin: 0; font-size: 24px; + font-weight: 760; + line-height: 1.22; } .home-heading p { @@ -1769,11 +1833,15 @@ video { top: 10px; right: 10px; z-index: 2; - min-height: 28px; + min-width: 44px; + min-height: 44px; border-color: rgba(255, 255, 255, 0.38); + border-radius: 999px; + padding: 0; color: #fff; background: rgba(17, 24, 39, 0.3); - font-size: 12px; + font-size: 20px; + line-height: 1; } .home-favorite:hover, @@ -1837,8 +1905,8 @@ video { margin: 0; color: #1a202c; font-size: 18px; - font-weight: 850; - line-height: 1.42; + font-weight: 760; + line-height: 1.35; } .home-card-meta, @@ -1895,7 +1963,7 @@ video { .home-card-stats dd { color: #1a202c; - font-weight: 800; + font-weight: 760; font-size: 13px; white-space: nowrap; } @@ -2010,6 +2078,49 @@ video { } @media (max-width: 720px) { + .home-topbar { + position: static; + display: grid; + grid-template-columns: 1fr; + gap: 10px; + height: auto; + padding: 12px 14px; + } + + .home-topbar .brand { + min-width: 0; + } + + .home-topbar .top-actions { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + gap: 8px; + width: 100%; + } + + .home-topbar .home-search { + grid-column: 1 / -1; + } + + .home-topbar .secondary-action { + justify-self: start; + width: auto; + min-width: 58px; + } + + .home-topbar .user-menu { + justify-content: flex-end; + min-width: 0; + } + + .home-topbar #homeUserLabel { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + .home-shell { grid-template-columns: 1fr; gap: 20px; @@ -2021,7 +2132,13 @@ video { } .home-metrics { - grid-template-columns: repeat(2, minmax(0, 1fr)); + grid-template-columns: 1fr; + gap: 10px; + } + + .home-metric { + min-height: 70px; + border-radius: 12px; } .home-heading { diff --git a/tests/home-entry-link.test.mjs b/tests/home-entry-link.test.mjs new file mode 100644 index 0000000..320952d --- /dev/null +++ b/tests/home-entry-link.test.mjs @@ -0,0 +1,12 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { dirname, join } from "node:path"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const html = readFileSync(join(__dirname, "..", "index.html"), "utf8"); + +assert.equal( + html.includes('进入学习页'), + false, +); diff --git a/tests/home-mobile-layout.test.mjs b/tests/home-mobile-layout.test.mjs new file mode 100644 index 0000000..bcacfc5 --- /dev/null +++ b/tests/home-mobile-layout.test.mjs @@ -0,0 +1,31 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const css = readFileSync(join(__dirname, "..", "styles.css"), "utf8"); + +assert.match( + css, + /@media\s*\(max-width:\s*720px\)[\s\S]*\.home-topbar\s*\{[\s\S]*position:\s*static;/, + "mobile home topbar should not remain sticky and tall above the content", +); + +assert.match( + css, + /@media\s*\(max-width:\s*720px\)[\s\S]*\.home-topbar\s+\.top-actions\s*\{[\s\S]*display:\s*grid;[\s\S]*grid-template-columns:\s*minmax\(0,\s*1fr\)\s+auto;/, + "mobile top actions should keep search and account controls compact", +); + +assert.match( + css, + /@media\s*\(max-width:\s*720px\)[\s\S]*\.home-metrics\s*\{[\s\S]*grid-template-columns:\s*1fr;/, + "mobile dashboard metrics should use one readable column", +); + +assert.match( + css, + /\.home-favorite\s*\{[\s\S]*min-width:\s*44px;[\s\S]*min-height:\s*44px;/, + "favorite buttons should meet mobile touch target sizing", +); diff --git a/tests/transcript-line-state-colors.test.mjs b/tests/transcript-line-state-colors.test.mjs new file mode 100644 index 0000000..c071e19 --- /dev/null +++ b/tests/transcript-line-state-colors.test.mjs @@ -0,0 +1,25 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const css = readFileSync(join(__dirname, "..", "styles.css"), "utf8"); + +assert.match( + css, + /\.line-button\.is-practiced\s*\{[\s\S]*background:\s*#ecfdf3;[\s\S]*border-color:\s*#86efac;[\s\S]*box-shadow:\s*inset 3px 0 0 #16a34a;/, + "practiced transcript rows should use a clear green row highlight", +); + +assert.match( + css, + /\.line-button\.is-difficult\s*\{[\s\S]*background:\s*#fffaf0;[\s\S]*box-shadow:\s*inset 3px 0 0 var\(--gold\);/, + "difficult transcript rows should keep the existing gold row highlight", +); + +assert.doesNotMatch( + css, + /\.line-status-button\.practiced\.active\s*\{[\s\S]*#16a34a/, + "the stronger practiced color should belong to the transcript row, not the status button", +); diff --git a/tests/typography-style.test.mjs b/tests/typography-style.test.mjs new file mode 100644 index 0000000..cc3e92c --- /dev/null +++ b/tests/typography-style.test.mjs @@ -0,0 +1,31 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const css = readFileSync(join(__dirname, "..", "styles.css"), "utf8"); + +assert.match( + css, + /--font-sans:\s*Inter,\s*"Noto Sans SC",\s*"Microsoft YaHei UI",\s*"PingFang SC"/, + "global font stack should pair polished Latin and Chinese UI fonts", +); + +assert.match( + css, + /body\s*\{[\s\S]*font-family:\s*var\(--font-sans\);[\s\S]*line-height:\s*1\.5;[\s\S]*text-rendering:\s*optimizeLegibility;[\s\S]*-webkit-font-smoothing:\s*antialiased;/, + "body should use the shared font stack with improved rendering", +); + +assert.match( + css, + /\.brand h1\s*\{[\s\S]*font-weight:\s*760;[\s\S]*letter-spacing:\s*0;/, + "brand title should use a refined strong weight", +); + +assert.match( + css, + /\.home-card-body h3\s*\{[\s\S]*font-weight:\s*760;[\s\S]*line-height:\s*1\.35;/, + "home card titles should be less heavy and easier to scan", +);