|
42 | 42 | --control-border: #c9d4e3; |
43 | 43 | --control-active-bg: #17202e; |
44 | 44 | --control-active-text: #f8fbff; |
| 45 | + --toggle-indicator-bg: #ffffff; |
| 46 | + --toggle-indicator-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04); |
45 | 47 | --focus-ring: rgba(37, 99, 235, 0.28); |
46 | 48 | --danger: #c2410c; |
47 | 49 | --danger-soft: #fff0e8; |
|
85 | 87 | --control-border: #30465d; |
86 | 88 | --control-active-bg: #e6edf8; |
87 | 89 | --control-active-text: #10213a; |
| 90 | + --toggle-indicator-bg: #223147; |
| 91 | + --toggle-indicator-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06); |
88 | 92 | --focus-ring: rgba(125, 171, 255, 0.32); |
89 | 93 | --danger: #ff9a73; |
90 | 94 | --danger-soft: #3a2118; |
|
127 | 131 | --control-border: #30465d; |
128 | 132 | --control-active-bg: #e6edf8; |
129 | 133 | --control-active-text: #10213a; |
| 134 | + --toggle-indicator-bg: #223147; |
| 135 | + --toggle-indicator-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06); |
130 | 136 | --focus-ring: rgba(125, 171, 255, 0.32); |
131 | 137 | --danger: #ff9a73; |
132 | 138 | --danger-soft: #3a2118; |
|
334 | 340 |
|
335 | 341 | .os-toggle, |
336 | 342 | .theme-toggle { |
| 343 | + position: relative; |
337 | 344 | display: inline-flex; |
338 | 345 | align-items: center; |
339 | | - gap: 0.25rem; |
340 | 346 | padding: 0.2rem; |
341 | 347 | border: 1px solid var(--control-border); |
342 | 348 | border-radius: 999px; |
343 | 349 | background: var(--control-bg); |
| 350 | + isolation: isolate; |
| 351 | +} |
| 352 | + |
| 353 | +/* 滑块指示器 */ |
| 354 | +.os-toggle::before, |
| 355 | +.theme-toggle::before { |
| 356 | + content: ""; |
| 357 | + position: absolute; |
| 358 | + top: 0.2rem; |
| 359 | + bottom: 0.2rem; |
| 360 | + left: 0.2rem; |
| 361 | + width: calc(50% - 0.2rem); |
| 362 | + background: var(--toggle-indicator-bg); |
| 363 | + border-radius: 999px; |
| 364 | + box-shadow: var(--toggle-indicator-shadow); |
| 365 | + transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1); |
| 366 | + z-index: 1; |
| 367 | +} |
| 368 | + |
| 369 | +/* 滑动位移 */ |
| 370 | +.os-toggle:has([data-os="win"].active)::before, |
| 371 | +.theme-toggle:has([data-theme="dark"].active)::before { |
| 372 | + transform: translateX(100%); |
344 | 373 | } |
345 | 374 |
|
346 | 375 | .os-btn, |
|
351 | 380 | color: var(--text-soft); |
352 | 381 | font: inherit; |
353 | 382 | cursor: pointer; |
354 | | -} |
355 | | - |
356 | | -.os-btn, |
357 | | -.theme-btn { |
358 | 383 | min-height: 44px; |
359 | | - min-width: 44px; |
360 | 384 | padding: 0.6rem 0.95rem; |
361 | 385 | border-radius: 999px; |
362 | 386 | display: inline-flex; |
363 | 387 | align-items: center; |
364 | 388 | justify-content: center; |
365 | 389 | gap: 0.4rem; |
366 | | - transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease; |
| 390 | + position: relative; |
| 391 | + z-index: 2; |
| 392 | + flex: 1; |
| 393 | + transition: color 0.2s ease, transform 0.1s ease; |
| 394 | +} |
| 395 | + |
| 396 | +.os-btn { |
| 397 | + min-width: 4.8rem; |
| 398 | +} |
| 399 | + |
| 400 | +.theme-btn { |
| 401 | + min-width: 3.2rem; |
| 402 | + font-weight: 700; |
| 403 | +} |
| 404 | + |
| 405 | +/* 按钮点击缩放反馈 */ |
| 406 | +.os-btn:active, |
| 407 | +.theme-btn:active { |
| 408 | + transform: scale(0.95); |
367 | 409 | } |
368 | 410 |
|
369 | 411 | .github-star-link { |
|
426 | 468 | } |
427 | 469 |
|
428 | 470 | .os-btn.active, |
429 | | -.theme-btn.active, |
| 471 | +.theme-btn.active { |
| 472 | + color: var(--text); |
| 473 | + font-weight: 800; |
| 474 | +} |
| 475 | + |
430 | 476 | .section-switcher-btn.active { |
431 | 477 | background: var(--control-active-bg); |
432 | 478 | color: var(--control-active-text); |
433 | 479 | } |
434 | 480 |
|
435 | 481 | .os-btn:hover:not(.active), |
436 | | -.theme-btn:hover:not(.active), |
| 482 | +.theme-btn:hover:not(.active) { |
| 483 | + color: var(--text); |
| 484 | +} |
| 485 | + |
437 | 486 | .section-switcher-btn:hover:not(.active) { |
438 | 487 | background: color-mix(in srgb, var(--panel) 60%, var(--control-bg)); |
439 | 488 | } |
|
1137 | 1186 | min-height: 38px; |
1138 | 1187 | padding: 0.48rem 0.72rem; |
1139 | 1188 | flex: 1; |
| 1189 | + min-width: 0; |
1140 | 1190 | } |
1141 | 1191 |
|
1142 | 1192 | .github-star-link { |
|
0 commit comments