Compare commits

...
9 Commits
12 changed files with 1015 additions and 161 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Speaking Lab 后台管理</title>
<link rel="stylesheet" href="./styles.css?v=20260605-auth">
<link rel="stylesheet" href="./styles.css?v=20260609-typography">
</head>
<body class="admin-page">
<header class="topbar admin-topbar">
@@ -0,0 +1,426 @@
# Speaking Lab Button Chip Style Refresh Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Refresh Speaking Lab buttons and chips into a TEco-inspired flat, refined style using CSS only.
**Architecture:** Keep all HTML, class names, IDs, and JavaScript behavior unchanged. Update `styles.css` by introducing shared button tokens in `:root`, then overriding existing button, chip, secondary, danger, and primary action selectors with consistent states. Verify through syntax checks and browser inspection on home, study, admin, and login pages.
**Tech Stack:** Plain HTML/CSS/JavaScript, existing FastAPI static server, in-app browser verification.
---
### Task 1: Button Token Foundation
**Files:**
- Modify: `styles.css`
- [ ] **Step 1: Add shared button tokens to `:root`**
Insert these variables inside the existing `:root` block after `--danger`:
```css
--control-surface: #f1eee7;
--control-surface-hover: #e8e1d6;
--control-surface-active: #ddd4c7;
--control-border: rgba(67, 56, 45, 0.10);
--control-ink: #33413c;
--control-muted: #746b60;
--primary-solid: #2f4b45;
--primary-solid-hover: #263f3a;
--primary-solid-active: #203631;
--primary-soft-shadow: 0 10px 22px rgba(47, 75, 69, 0.16);
--danger-soft: #fdecec;
--danger-soft-hover: #f9dddd;
--danger-ink: #9f2f35;
--focus-ring: 0 0 0 3px rgba(47, 125, 99, 0.18);
```
- [ ] **Step 2: Run a quick CSS selector scan**
Run:
```powershell
rg -n "--control-surface|--primary-solid|--danger-soft|--focus-ring" styles.css
```
Expected: each token appears in `:root`.
- [ ] **Step 3: Commit token foundation**
Run:
```powershell
git add styles.css
git commit -m "style: add button style tokens"
```
### Task 2: Chips and Secondary Actions
**Files:**
- Modify: `styles.css`
- [ ] **Step 1: Replace the existing `.chip` block**
Replace the current `.chip`, `.chip:hover`, and `.chip.active` rules with:
```css
.chip {
min-height: 32px;
border: 1px solid transparent;
border-radius: 999px;
padding: 0 15px;
color: var(--control-ink);
background: var(--control-surface);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
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;
}
.chip:hover {
border-color: var(--control-border);
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.09);
transform: translateY(-1px);
}
.chip.active {
color: #fffdf8;
border-color: var(--primary-solid);
background: var(--primary-solid);
box-shadow: var(--primary-soft-shadow);
}
```
- [ ] **Step 2: Replace `.primary-link, .secondary-action` and `.secondary-action:hover` area**
Update the existing `.primary-link, .secondary-action`, `.primary-link`, `.primary-link:hover`, and `.secondary-action:hover` rules near the admin styles so secondary actions use:
```css
.secondary-action {
min-height: 34px;
display: inline-flex;
align-items: center;
justify-content: center;
border: 1px solid transparent;
border-radius: 10px;
padding: 0 12px;
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: 750;
text-decoration: none;
white-space: nowrap;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.secondary-action:hover {
color: var(--control-ink);
border-color: var(--control-border);
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);
}
.secondary-action:active {
background: var(--control-surface-active);
box-shadow: inset 0 1px 2px rgba(47, 64, 57, 0.12);
transform: translateY(0);
}
```
Keep any more specific layout rules, such as `.admin-video-actions .secondary-action` widths, after this block.
- [ ] **Step 3: Add focus-visible support**
Near the button state rules, add:
```css
.chip:focus-visible,
.secondary-action:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
```
- [ ] **Step 4: Verify selectors**
Run:
```powershell
rg -n "\\.chip|\\.secondary-action|focus-visible" styles.css
```
Expected: the new chip and secondary-action rules are present once as the main definitions, with responsive/layout overrides preserved.
- [ ] **Step 5: Commit chips and secondary actions**
Run:
```powershell
git add styles.css
git commit -m "style: refresh chips and secondary buttons"
```
### Task 3: Danger and Primary Actions
**Files:**
- Modify: `styles.css`
- [ ] **Step 1: Replace `.danger-action` rules**
Replace `.danger-action` and `.danger-action:hover` with:
```css
.danger-action {
min-height: 34px;
border: 1px solid rgba(159, 47, 53, 0.10);
border-radius: 10px;
padding: 0 12px;
color: var(--danger-ink);
background: var(--danger-soft);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
font-size: 13px;
font-weight: 800;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.danger-action:hover {
border-color: rgba(159, 47, 53, 0.16);
color: #84262c;
background: var(--danger-soft-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(159, 47, 53, 0.08);
transform: translateY(-1px);
}
.danger-action:active {
background: #f4cccc;
box-shadow: inset 0 1px 2px rgba(159, 47, 53, 0.14);
transform: translateY(0);
}
.danger-action:focus-visible {
outline: none;
box-shadow: 0 0 0 3px rgba(159, 47, 53, 0.14);
}
```
- [ ] **Step 2: Consolidate primary action selectors**
Add this block after the global button disabled rules and before inputs:
```css
.primary-link,
#adminSubmitBtn,
.auth-form button[type="submit"],
.login-form button,
.admin-form button[type="submit"],
.activation-code-form button[type="submit"],
.practice-answer-row button {
border-color: var(--primary-solid);
color: #fffdf8;
background: var(--primary-solid);
box-shadow: var(--primary-soft-shadow);
font-weight: 800;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.primary-link:hover,
#adminSubmitBtn:hover,
.auth-form button[type="submit"]:hover,
.login-form button:hover,
.admin-form button[type="submit"]:hover,
.activation-code-form button[type="submit"]:hover,
.practice-answer-row button:hover {
border-color: var(--primary-solid-hover);
color: #fffdf8;
background: var(--primary-solid-hover);
box-shadow: 0 12px 26px rgba(47, 75, 69, 0.20);
transform: translateY(-1px);
}
.primary-link:active,
#adminSubmitBtn:active,
.auth-form button[type="submit"]:active,
.login-form button:active,
.admin-form button[type="submit"]:active,
.activation-code-form button[type="submit"]:active,
.practice-answer-row button:active {
border-color: var(--primary-solid-active);
background: var(--primary-solid-active);
box-shadow: 0 6px 14px rgba(47, 75, 69, 0.14);
transform: translateY(0);
}
.primary-link:focus-visible,
#adminSubmitBtn:focus-visible,
.auth-form button[type="submit"]:focus-visible,
.login-form button:focus-visible,
.admin-form button[type="submit"]:focus-visible,
.activation-code-form button[type="submit"]:focus-visible,
.practice-answer-row button:focus-visible {
outline: none;
box-shadow: var(--primary-soft-shadow), var(--focus-ring);
}
```
- [ ] **Step 3: Keep disabled state readable**
After the primary block, add:
```css
.primary-link:disabled,
#adminSubmitBtn:disabled,
.auth-form button[type="submit"]:disabled,
.login-form button:disabled,
.admin-form button[type="submit"]:disabled,
.activation-code-form button[type="submit"]:disabled,
.practice-answer-row button:disabled {
border-color: #d8d2c8;
color: #9b9388;
background: #e8e2d8;
box-shadow: none;
transform: none;
}
```
- [ ] **Step 4: Remove or neutralize conflicting older primary blocks**
Ensure these older rules do not override the new primary system with old teal/navy colors:
```css
.login-form button,
.admin-form button[type="submit"] {
color: #fff;
background: var(--brand);
border-color: var(--brand);
}
```
and:
```css
.practice-answer-row button {
color: #ffffff;
border-color: var(--brand);
background: var(--brand);
font-weight: 800;
}
```
Either remove those declarations or update them to match the new variables.
- [ ] **Step 5: Verify selector conflicts**
Run:
```powershell
rg -n "var\\(--brand\\)|var\\(--accent\\)|#111827|#0f172a|\\.danger-action|\\.primary-link|#adminSubmitBtn|practice-answer-row button" styles.css
```
Expected: old brand/accent rules may remain for non-button surfaces, but primary/danger action definitions should use the new variables.
- [ ] **Step 6: Commit danger and primary actions**
Run:
```powershell
git add styles.css
git commit -m "style: refresh primary and danger buttons"
```
### Task 4: Browser Verification and Final Polish
**Files:**
- Modify if needed: `styles.css`
- [ ] **Step 1: Run static checks**
Run:
```powershell
node --check app.js
node --check home.js
node --check admin.js
node --check login.js
```
Expected: all commands exit with code 0.
- [ ] **Step 2: Start the local server**
Run:
```powershell
python -m uvicorn backend.main:app --host 127.0.0.1 --port 8000
```
Expected: server starts and serves the app at `http://127.0.0.1:8000`.
- [ ] **Step 3: Inspect desktop views**
Open these pages in the browser:
```text
http://127.0.0.1:8000/index.html
http://127.0.0.1:8000/study.html
http://127.0.0.1:8000/admin.html
http://127.0.0.1:8000/login.html
```
Expected:
- chips are compact capsules;
- secondary buttons are quiet and refined;
- danger buttons are soft rose, not bright red;
- primary buttons use deep green solid styling;
- no button text overflows or overlaps.
- [ ] **Step 4: Inspect mobile-width views**
Use a viewport around `390x844` and revisit home, study, admin, and login.
Expected: wrapping still works, buttons remain tappable, and no text escapes the control bounds.
- [ ] **Step 5: Apply final CSS polish if needed**
If browser inspection reveals a problem, make only targeted CSS edits. Example fixes:
```css
.admin-video-actions .secondary-action,
.danger-action {
min-width: 70px;
}
.chip {
line-height: 1;
}
```
- [ ] **Step 6: Run final checks**
Run:
```powershell
node --check app.js
node --check home.js
node --check admin.js
node --check login.js
git diff --check
```
Expected: all checks pass, and `git diff --check` reports no whitespace errors.
- [ ] **Step 7: Commit final polish**
Run:
```powershell
git add styles.css
git commit -m "style: polish button responsive states"
```
If no final polish was needed after Task 3, skip this commit.
@@ -0,0 +1,117 @@
# Speaking Lab Button and Chip Style Refresh Design
## Goal
Refresh all Speaking Lab buttons and chips into a flatter, more refined style inspired by the saved TEco Lab reference page while preserving the current HTML structure and class names.
This is a CSS-only visual refactor unless implementation discovers a narrow accessibility issue that cannot be solved with CSS. Existing behavior, event wiring, IDs, and class names must remain unchanged.
## Reference Interpretation
The TEco Lab reference uses compact controls with:
- rounded-full chips and rounded-lg buttons;
- small, dense typography around 12px to 14px;
- low-contrast neutral backgrounds for inactive controls;
- solid dark/highlight backgrounds only for active or primary controls;
- minimal borders, soft inset or low shadow texture, and smooth hover/active feedback.
Speaking Lab should adapt those ideas to its Study Notebook direction: warm paper surfaces, deep green primary actions, subdued neutrals, and soft warning colors.
## Scope
Update `styles.css` for these existing selectors and related states:
- `.chip` and `.chip.active`;
- `.secondary-action`;
- `.danger-action`;
- `.primary-link`;
- `#adminSubmitBtn`;
- primary form buttons such as `.auth-form button[type="submit"]`, `.admin-form button[type="submit"]`, `.activation-code-form button[type="submit"]`, and `.practice-answer-row button`;
- relevant disabled, hover, active, and focus-visible states.
Do not rename selectors, add new required HTML, or change JavaScript behavior.
## Visual Rules
### Chips
`.chip` should become a compact capsule:
- pill radius;
- 12px font size;
- medium-bold weight;
- horizontal padding that supports short Chinese labels without crowding;
- inactive background in warm light neutral;
- no hard border in the default state;
- hover background slightly darker with subtle elevation;
- `.active` background deep green or dark ink, white text, and a low shadow.
### Secondary Actions
`.secondary-action` should be quiet and tactile:
- no heavy border;
- light warm neutral or translucent white background;
- muted text color;
- rounded-lg or small pill shape depending on existing dimensions;
- hover smoothly darkens the surface and text;
- active state gently presses down;
- disabled state is visibly inactive without looking broken.
This should cover admin entry, logout, cancel edit, refresh, edit, copy, and other secondary operations that use this class or existing secondary-action variants.
### Danger Actions
`.danger-action` should be soft warning, not pure red:
- pale rose background;
- dark rose text;
- transparent or rose-tinted border;
- hover deepens the rose background and text slightly;
- active state presses down;
- disabled state uses muted rose/neutral colors.
### Primary Actions
`#adminSubmitBtn`, `.primary-link`, login submit, activation-code submit, AI primary action, and practice check buttons should share a clear primary treatment:
- solid deep green background;
- white or warm-white text;
- minimal border matching the background;
- rounded pill or 10px radius based on control context;
- subtle shadow/elevation;
- hover slightly lightens or darkens while lifting by 1px;
- active removes the lift and compresses visually;
- focus-visible ring uses a soft green halo.
## Compatibility
The changes must not break:
- home category filters and material cards;
- study mode tabs and recording/sentence controls;
- login/register form controls;
- admin create/edit form buttons;
- admin video/user/activation-code action rows;
- disabled buttons and hidden states.
Existing responsive rules should keep working. If a button currently becomes full-width or wraps on small screens, preserve that behavior.
## Testing
Verification should include:
- syntax sanity via existing JS checks if implementation touches no JS;
- browser visual checks for home, study, admin, and login pages;
- at least one desktop viewport and one mobile-width viewport;
- confirm hover/active/focus/disabled states are not visually broken where practical;
- confirm no text overflows inside buttons or chips.
## Non-Goals
- No page structure redesign in this task.
- No new icon system in this task.
- No JavaScript behavior changes.
- No changes to backend or data model.
- No full Study Notebook layout implementation beyond button and chip styling.
+2 -1
View File
@@ -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();
+2 -3
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Speaking Lab</title>
<link rel="stylesheet" href="./styles.css?v=20260605-auth">
<link rel="stylesheet" href="./styles.css?v=20260609-typography">
</head>
<body class="home-page">
<header class="topbar home-topbar">
@@ -40,7 +40,6 @@
<h2>素材库</h2>
<p>搜索素材,按分类和学习状态继续练习。</p>
</div>
<a class="primary-link" href="./study.html">进入学习页</a>
</div>
<div id="homeCategoryFilters" class="home-categories"></div>
@@ -50,6 +49,6 @@
</main>
<script src="./auth.js?v=20260605-auth"></script>
<script src="./home.js?v=20260605-auth"></script>
<script src="./home.js?v=20260609-home-mobile"></script>
</body>
</html>
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登录 Speaking Lab</title>
<link rel="stylesheet" href="./styles.css?v=20260605-auth">
<link rel="stylesheet" href="./styles.css?v=20260609-typography">
</head>
<body class="auth-page">
<main class="auth-shell">
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Speaking Lab 学习页</title>
<link rel="stylesheet" href="./styles.css?v=20260605-auth">
<link rel="stylesheet" href="./styles.css?v=20260609-transcript-states">
</head>
<body>
<header class="topbar">
+366 -154
View File
@@ -11,7 +11,22 @@
--brand-soft: #e4f5f1;
--gold: #c98a12;
--danger: #b42318;
--control-surface: #f1eee7;
--control-surface-hover: #e8e1d6;
--control-surface-active: #ddd4c7;
--control-border: rgba(67, 56, 45, 0.10);
--control-ink: #33413c;
--control-muted: #746b60;
--primary-solid: #2f4b45;
--primary-solid-hover: #263f3a;
--primary-solid-active: #203631;
--primary-soft-shadow: 0 10px 22px rgba(47, 75, 69, 0.16);
--danger-soft: #fdecec;
--danger-soft-hover: #f9dddd;
--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;
}
* {
@@ -27,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 {
@@ -67,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 {
@@ -86,7 +106,7 @@ body {
display: grid;
gap: 8px;
font-size: 14px;
font-weight: 600;
font-weight: 680;
}
.auth-form input {
@@ -103,15 +123,6 @@ body {
margin-top: 4px;
border: 0;
border-radius: 999px;
color: #ffffff;
background: #111827;
font-weight: 700;
box-shadow: 0 10px 22px rgba(17, 24, 39, 0.18);
}
.auth-form button[type="submit"]:hover {
background: #0f172a;
transform: translateY(-1px);
}
.auth-message {
@@ -187,6 +198,78 @@ button:disabled {
cursor: not-allowed;
}
.primary-link,
#adminSubmitBtn,
#processAiSubtitlesBtn,
.auth-form button[type="submit"],
.login-form button,
.admin-form button[type="submit"],
.activation-code-form button[type="submit"],
.practice-answer-row button {
border-color: var(--primary-solid);
color: #fffdf8;
background: var(--primary-solid);
box-shadow: var(--primary-soft-shadow);
font-weight: 800;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.primary-link:hover,
#adminSubmitBtn:hover,
#processAiSubtitlesBtn:hover,
.auth-form button[type="submit"]:hover,
.login-form button:hover,
.admin-form button[type="submit"]:hover,
.activation-code-form button[type="submit"]:hover,
.practice-answer-row button:hover {
border-color: var(--primary-solid-hover);
color: #fffdf8;
background: var(--primary-solid-hover);
box-shadow: 0 12px 26px rgba(47, 75, 69, 0.20);
transform: translateY(-1px);
}
.primary-link:active,
#adminSubmitBtn:active,
#processAiSubtitlesBtn:active,
.auth-form button[type="submit"]:active,
.login-form button:active,
.admin-form button[type="submit"]:active,
.activation-code-form button[type="submit"]:active,
.practice-answer-row button:active {
border-color: var(--primary-solid-active);
background: var(--primary-solid-active);
box-shadow: 0 6px 14px rgba(47, 75, 69, 0.14);
transform: translateY(0);
}
.primary-link:focus-visible,
#adminSubmitBtn:focus-visible,
#processAiSubtitlesBtn:focus-visible,
.auth-form button[type="submit"]:focus-visible,
.login-form button:focus-visible,
.admin-form button[type="submit"]:focus-visible,
.activation-code-form button[type="submit"]:focus-visible,
.practice-answer-row button:focus-visible {
outline: none;
box-shadow: var(--primary-soft-shadow), var(--focus-ring);
}
.primary-link:disabled,
#adminSubmitBtn:disabled,
#processAiSubtitlesBtn:disabled,
.auth-form button[type="submit"]:disabled,
.login-form button:disabled,
.admin-form button[type="submit"]:disabled,
.activation-code-form button[type="submit"]:disabled,
.practice-answer-row button:disabled {
border-color: #d8d2c8;
color: #9b9388;
background: #e8e2d8;
box-shadow: none;
transform: none;
}
input,
select,
textarea {
@@ -257,7 +340,9 @@ textarea:focus {
.brand h1 {
margin: 0;
font-size: 17px;
font-weight: 760;
line-height: 1.1;
letter-spacing: 0;
}
.top-actions {
@@ -285,28 +370,31 @@ textarea:focus {
}
.chip {
min-height: 34px;
border-color: transparent;
border-radius: 20px;
padding: 0 14px;
color: #27364a;
background: #eef2f7;
min-height: 32px;
border: 1px solid transparent;
border-radius: 999px;
padding: 0 15px;
color: var(--control-ink);
background: var(--control-surface);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
font-size: 12px;
font-weight: 700;
font-weight: 750;
white-space: nowrap;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.chip:hover {
border-color: #cbd5e1;
background: #f8fafc;
box-shadow: 0 6px 16px rgba(15, 39, 66, 0.08);
border-color: var(--control-border);
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.09);
transform: translateY(-1px);
}
.chip.active {
color: #fff;
background: var(--accent);
border-color: var(--accent);
color: #fffdf8;
border-color: var(--primary-solid);
background: var(--primary-solid);
box-shadow: var(--primary-soft-shadow);
}
.login-form,
@@ -319,13 +407,6 @@ textarea:focus {
width: 150px;
}
.login-form button,
.admin-form button[type="submit"] {
color: #fff;
background: var(--brand);
border-color: var(--brand);
}
.user-menu {
color: var(--muted);
font-size: 13px;
@@ -517,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;
@@ -549,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 {
@@ -636,21 +735,6 @@ video {
min-width: 76px;
min-height: 42px;
align-self: start;
color: #ffffff;
border-color: var(--brand);
background: var(--brand);
font-weight: 800;
}
.practice-answer-row button:hover {
border-color: #0d625c;
background: #0d625c;
}
.practice-answer-row button:disabled {
color: #98a2b3;
border-color: #d8e2ec;
background: #e8eef5;
}
.practice-feedback {
@@ -678,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);
}
@@ -729,8 +814,6 @@ video {
.study-side-actions #favoriteBtn {
min-width: 68px;
color: #0f2742;
background: #fff;
}
.subtitle-card {
@@ -907,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 {
@@ -916,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;
@@ -949,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,
@@ -1029,12 +1141,6 @@ video {
display: none;
}
.admin-form .secondary-action {
color: var(--ink);
background: #fff;
border-color: var(--line);
}
.admin-page {
min-height: 100vh;
background: #f8fafc;
@@ -1348,62 +1454,111 @@ video {
}
.danger-action {
border-color: #fecdd3;
border-radius: 8px;
color: #be123c;
background: #fff1f2;
white-space: nowrap;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
min-height: 34px;
border: 1px solid rgba(159, 47, 53, 0.10);
border-radius: 10px;
padding: 0 12px;
color: var(--danger-ink);
background: var(--danger-soft);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
font-size: 13px;
font-weight: 800;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.danger-action:hover {
border-color: #fb7185;
color: #9f1239;
background: #ffe4e6;
box-shadow: 0 8px 18px rgba(190, 18, 60, 0.1);
border-color: rgba(159, 47, 53, 0.16);
color: #84262c;
background: var(--danger-soft-hover);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58), 0 8px 18px rgba(159, 47, 53, 0.08);
transform: translateY(-1px);
}
.primary-link,
.secondary-action {
.danger-action:active {
background: #f4cccc;
box-shadow: inset 0 1px 2px rgba(159, 47, 53, 0.14);
transform: translateY(0);
}
.danger-action:focus-visible {
outline: none;
box-shadow: 0 0 0 3px rgba(159, 47, 53, 0.14);
}
.danger-action:disabled {
border-color: rgba(159, 47, 53, 0.08);
color: #aa8e8f;
background: #f2e4e2;
box-shadow: none;
transform: none;
}
.secondary-action,
.user-menu button {
min-height: 34px;
display: inline-flex;
align-items: center;
justify-content: center;
border: 1px solid transparent;
border-radius: 10px;
padding: 0 12px;
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: 750;
text-decoration: none;
white-space: nowrap;
transition: color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.secondary-action:hover,
.user-menu button:hover {
color: var(--control-ink);
border-color: var(--control-border);
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);
}
.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,
.user-menu button:disabled,
.user-menu button:disabled:hover {
border-color: transparent;
color: #9b9388;
background: #e8e2d8;
box-shadow: none;
transform: none;
}
.chip:focus-visible,
.secondary-action:focus-visible,
.user-menu button:focus-visible {
outline: none;
box-shadow: var(--focus-ring);
}
.primary-link {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 36px;
border: 1px solid #dbe4ee;
border: 1px solid var(--primary-solid);
border-radius: 8px;
padding: 0 12px;
color: var(--ink);
background: #fff;
text-decoration: none;
cursor: pointer;
white-space: nowrap;
}
.admin-video-actions .secondary-action,
.admin-form .secondary-action {
color: #1f3b57;
border-color: #dbe4ee;
background: #f8fafc;
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}
.primary-link {
color: #fff;
background: var(--brand);
border-color: var(--brand);
}
.primary-link:hover {
color: #fff;
background: #0d625c;
border-color: #0d625c;
}
.secondary-action:hover {
border-color: #b8c7d9;
background: #f1f5f9;
}
.home-page {
min-height: 100vh;
background: #f8fafc;
@@ -1467,6 +1622,7 @@ video {
.home-plan-card strong {
color: #0f2742;
font-size: 22px;
font-weight: 760;
line-height: 1.15;
}
@@ -1519,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;
}
@@ -1580,6 +1737,8 @@ video {
.home-heading h2 {
margin: 0;
font-size: 24px;
font-weight: 760;
line-height: 1.22;
}
.home-heading p {
@@ -1674,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,
@@ -1742,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,
@@ -1800,7 +1963,7 @@ video {
.home-card-stats dd {
color: #1a202c;
font-weight: 800;
font-weight: 760;
font-size: 13px;
white-space: nowrap;
}
@@ -1915,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;
@@ -1926,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 {
+12
View File
@@ -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('<a class="primary-link" href="./study.html">进入学习页</a>'),
false,
);
+31
View File
@@ -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",
);
@@ -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",
);
+31
View File
@@ -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",
);