Files
tools/assets/styles.css
T
2026-11-02 16:01:16 +08:00

1946 lines
32 KiB
CSS

/* ============================================================
功能工具箱 · 共享设计系统
------------------------------------------------------------
设计变量 / 基础重置 / 组件 / 工具页布局
============================================================ */
:root {
color-scheme: light;
--font-sans:
-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
--font-mono:
ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas,
"Courier New", monospace;
--bg: #f5f6fa;
--surface: #ffffff;
--surface-2: #f4f5f9;
--surface-3: #eceef5;
--border: #e4e6ef;
--border-strong: #d3d7e3;
--text: #101322;
--text-secondary: #565c6e;
--text-muted: #8b90a0;
--accent: #5b5bd6;
--accent-hover: #4a4ac4;
--accent-soft: #eef0ff;
--accent-contrast: #ffffff;
--success: #0f9d76;
--success-soft: #e7f8f1;
--danger: #e5484d;
--danger-soft: #fdecec;
--warning: #c2760a;
--warning-soft: #fdf4e5;
--ring: rgba(91, 91, 214, 0.2);
--shadow-sm: 0 1px 2px rgba(16, 19, 34, 0.05);
--shadow-md: 0 12px 32px -14px rgba(16, 19, 34, 0.22);
--shadow-lg: 0 24px 64px -24px rgba(16, 19, 34, 0.3);
--radius-xs: 8px;
--radius-sm: 10px;
--radius: 14px;
--radius-lg: 18px;
--rate: 0.18s;
}
html[data-theme="dark"] {
color-scheme: dark;
--bg: #0b0d14;
--surface: #11141e;
--surface-2: #161a26;
--surface-3: #1c2130;
--border: #242938;
--border-strong: #333a4d;
--text: #e8eaf2;
--text-secondary: #a1a7b8;
--text-muted: #6f7689;
--accent: #8b8cf7;
--accent-hover: #a5a6ff;
--accent-soft: rgba(124, 125, 245, 0.14);
--accent-contrast: #0b0d14;
--success: #34d399;
--success-soft: rgba(52, 211, 153, 0.1);
--danger: #f87171;
--danger-soft: rgba(248, 113, 113, 0.1);
--warning: #fbbf24;
--warning-soft: rgba(251, 191, 36, 0.1);
--ring: rgba(139, 140, 247, 0.25);
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
--shadow-md: 0 12px 32px -14px rgba(0, 0, 0, 0.7);
--shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.8);
}
/* ---------- 基础 ---------- */
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body {
margin: 0;
padding: 0;
}
body {
font-family: var(--font-sans);
font-size: 15px;
line-height: 1.6;
background: var(--bg);
color: var(--text);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
h1,
h2,
h3,
h4 {
margin: 0;
line-height: 1.25;
letter-spacing: -0.015em;
}
p {
margin: 0;
}
a {
color: var(--accent);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button,
input,
select,
textarea {
font: inherit;
color: inherit;
}
button {
-webkit-tap-highlight-color: transparent;
}
img,
svg {
display: block;
max-width: 100%;
}
::selection {
background: var(--accent);
color: var(--accent-contrast);
}
:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--border-strong);
border: 2px solid transparent;
border-radius: 999px;
background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
background-clip: content-box;
}
/* ---------- 通用工具类 ---------- */
.mono {
font-family: var(--font-mono);
}
.muted {
color: var(--text-muted);
}
.secondary {
color: var(--text-secondary);
}
.hidden,
[hidden] {
display: none !important;
}
.row {
display: flex;
align-items: center;
gap: 8px;
}
.spacer {
flex: 1;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.kbd {
display: inline-flex;
align-items: center;
padding: 2px 6px;
border: 1px solid var(--border-strong);
border-bottom-width: 2px;
border-radius: 5px;
background: var(--surface);
color: var(--text-muted);
font-family: var(--font-mono);
font-size: 0.7rem;
line-height: 1.4;
}
/* ---------- 工具页骨架 ---------- */
/* 工具页内统一使用线性图标 */
.tool-page svg,
.editor-app svg {
fill: none;
stroke: currentColor;
stroke-width: 1.8;
stroke-linecap: round;
stroke-linejoin: round;
}
.tool-page {
width: 100%;
max-width: 1180px;
margin: 0 auto;
padding: clamp(20px, 3.6vw, 40px);
}
.tool-page--narrow {
max-width: 880px;
}
.tool-header {
display: flex;
align-items: flex-start;
gap: 16px;
margin-bottom: 26px;
}
.tool-header .tool-icon {
width: 48px;
height: 48px;
flex: none;
display: grid;
place-items: center;
border-radius: 14px;
background: var(--accent-soft);
color: var(--accent);
}
.tool-header .tool-icon svg {
width: 24px;
height: 24px;
}
.tool-header h1 {
font-size: clamp(1.45rem, 2.6vw, 1.9rem);
font-weight: 700;
letter-spacing: -0.025em;
margin-bottom: 4px;
}
.tool-header p {
color: var(--text-secondary);
font-size: 0.92rem;
}
.tool-header .header-actions {
margin-left: auto;
display: flex;
align-items: center;
gap: 8px;
flex: none;
}
/* ---------- 卡片 ---------- */
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow-sm);
padding: clamp(18px, 2.6vw, 26px);
}
.card + .card {
margin-top: 16px;
}
.card--flush {
padding: 0;
overflow: hidden;
}
.card-head {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 18px;
}
.card-head h2 {
font-size: 1rem;
font-weight: 650;
}
.card-head .spacer {
flex: 1;
}
.card-head .hint {
font-size: 0.8rem;
color: var(--text-muted);
}
/* ---------- 按钮 ---------- */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 7px;
padding: 9px 16px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface);
color: var(--text);
font-size: 0.875rem;
font-weight: 550;
line-height: 1.2;
cursor: pointer;
white-space: nowrap;
transition:
background var(--rate) ease,
border-color var(--rate) ease,
color var(--rate) ease,
transform var(--rate) ease,
box-shadow var(--rate) ease;
}
.btn svg {
width: 17px;
height: 17px;
flex: none;
}
.btn:hover {
background: var(--surface-2);
border-color: var(--border-strong);
}
.btn:active {
transform: translateY(1px);
}
.btn--primary {
background: var(--accent);
border-color: transparent;
color: var(--accent-contrast);
box-shadow: 0 6px 16px -8px var(--accent);
}
.btn--primary:hover {
background: var(--accent-hover);
border-color: transparent;
color: var(--accent-contrast);
}
.btn--soft {
background: var(--accent-soft);
border-color: transparent;
color: var(--accent);
}
.btn--soft:hover {
background: var(--accent-soft);
border-color: transparent;
filter: brightness(0.96);
}
html[data-theme="dark"] .btn--soft:hover {
filter: brightness(1.15);
}
.btn--ghost {
background: transparent;
border-color: transparent;
color: var(--text-secondary);
}
.btn--ghost:hover {
background: var(--surface-2);
border-color: transparent;
color: var(--text);
}
.btn--danger {
background: var(--danger-soft);
border-color: transparent;
color: var(--danger);
}
.btn--danger:hover {
background: var(--danger-soft);
border-color: transparent;
filter: brightness(0.96);
}
.btn--sm {
padding: 6px 11px;
font-size: 0.8rem;
border-radius: var(--radius-xs);
}
.btn--icon {
width: 38px;
height: 38px;
padding: 0;
border-radius: var(--radius-sm);
}
.btn--icon.btn--sm {
width: 30px;
height: 30px;
}
.btn:disabled {
opacity: 0.45;
cursor: not-allowed;
transform: none;
}
/* 主题按钮图标切换 */
[data-theme-toggle] .icon-sun {
display: none;
}
html[data-theme="dark"] [data-theme-toggle] .icon-sun {
display: block;
}
html[data-theme="dark"] [data-theme-toggle] .icon-moon {
display: none;
}
/* ---------- 表单 ---------- */
.field {
display: flex;
flex-direction: column;
gap: 6px;
min-width: 0;
}
.field > label,
.field-label {
font-size: 0.82rem;
font-weight: 600;
color: var(--text-secondary);
}
.field .help {
font-size: 0.76rem;
color: var(--text-muted);
}
input[type="text"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="email"],
select,
textarea {
width: 100%;
padding: 9px 12px;
border: 1px solid var(--border-strong);
border-radius: var(--radius-sm);
background: var(--surface);
color: var(--text);
font-size: 0.9rem;
transition:
border-color var(--rate) ease,
box-shadow var(--rate) ease,
background var(--rate) ease;
}
input::placeholder,
textarea::placeholder {
color: var(--text-muted);
}
input:focus,
select:focus,
textarea:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--ring);
}
select {
appearance: none;
padding-right: 34px;
background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
linear-gradient(135deg, currentColor 50%, transparent 50%);
background-position:
calc(100% - 17px) calc(50% - 2px),
calc(100% - 12px) calc(50% - 2px);
background-size: 5px 5px, 5px 5px;
background-repeat: no-repeat;
cursor: pointer;
}
input[type="range"] {
width: 100%;
height: 22px;
accent-color: var(--accent);
cursor: pointer;
}
input[type="checkbox"] {
width: 16px;
height: 16px;
accent-color: var(--accent);
cursor: pointer;
}
.input-row {
display: flex;
gap: 8px;
align-items: center;
}
.input-row > input {
flex: 1;
}
.form-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
gap: 14px;
}
.checkline {
display: inline-flex;
align-items: center;
gap: 8px;
font-size: 0.84rem;
color: var(--text-secondary);
cursor: pointer;
user-select: none;
}
/* ---------- 分段控件 ---------- */
.segmented {
display: inline-flex;
gap: 2px;
padding: 4px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface-2);
}
.segmented .seg {
position: relative;
display: inline-flex;
cursor: pointer;
}
.segmented .seg input {
position: absolute;
opacity: 0;
pointer-events: none;
}
.segmented .seg span {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 14px;
border-radius: 9px;
color: var(--text-secondary);
font-size: 0.83rem;
font-weight: 550;
white-space: nowrap;
transition:
background var(--rate) ease,
color var(--rate) ease,
box-shadow var(--rate) ease;
}
.segmented .seg:hover span {
color: var(--text);
}
.segmented .seg input:checked + span {
background: var(--surface);
color: var(--text);
box-shadow: var(--shadow-sm);
}
.segmented .seg input:focus-visible + span {
outline: 2px solid var(--accent);
outline-offset: 1px;
}
/* ---------- 徽标 / 状态 ---------- */
.badge {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 3px 9px;
border-radius: 999px;
background: var(--surface-2);
color: var(--text-secondary);
font-size: 0.72rem;
font-weight: 600;
white-space: nowrap;
}
.badge--accent {
background: var(--accent-soft);
color: var(--accent);
}
.badge--success {
background: var(--success-soft);
color: var(--success);
}
.badge--danger {
background: var(--danger-soft);
color: var(--danger);
}
.badge--warning {
background: var(--warning-soft);
color: var(--warning);
}
.status-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
/* ---------- 统计卡片 ---------- */
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 12px;
}
.stat {
padding: 14px 16px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface-2);
}
.stat-label {
font-size: 0.76rem;
color: var(--text-muted);
margin-bottom: 2px;
}
.stat-value {
font-size: 1.4rem;
font-weight: 700;
letter-spacing: -0.025em;
font-variant-numeric: tabular-nums;
}
.stat-value .unit {
font-size: 0.72rem;
font-weight: 500;
color: var(--text-muted);
margin-left: 2px;
letter-spacing: 0;
}
.stat--accent {
background: var(--accent-soft);
border-color: transparent;
}
.stat--accent .stat-value,
.stat--accent .stat-label {
color: var(--accent);
}
/* ---------- 结果行 / 复制字段 ---------- */
.result-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.result-row {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface-2);
min-width: 0;
}
.result-row .row-label {
width: 46px;
flex: none;
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.05em;
color: var(--text-muted);
text-transform: uppercase;
}
.result-row code {
flex: 1;
min-width: 0;
overflow: auto;
white-space: nowrap;
font-family: var(--font-mono);
font-size: 0.86rem;
color: var(--text);
}
.copy-btn {
flex: none;
display: inline-flex;
align-items: center;
gap: 5px;
padding: 5px 9px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--surface);
color: var(--text-secondary);
font-size: 0.75rem;
font-weight: 550;
cursor: pointer;
transition: all var(--rate) ease;
}
.copy-btn:hover {
border-color: var(--accent);
color: var(--accent);
}
.copy-btn svg {
width: 14px;
height: 14px;
}
.copy-field {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 6px 6px 12px;
border: 1px solid var(--border);
border-radius: 10px;
background: var(--surface-2);
min-width: 0;
}
.copy-field code {
flex: 1;
min-width: 0;
overflow: auto;
white-space: nowrap;
font-family: var(--font-mono);
font-size: 0.82rem;
}
/* ---------- 提示条 ---------- */
.alert {
display: flex;
align-items: flex-start;
gap: 9px;
padding: 10px 13px;
border-radius: 10px;
font-size: 0.83rem;
line-height: 1.5;
border: 1px solid transparent;
}
.alert svg {
width: 16px;
height: 16px;
flex: none;
margin-top: 2px;
}
.alert--error {
background: var(--danger-soft);
border-color: color-mix(in srgb, var(--danger) 24%, transparent);
color: var(--danger);
}
.alert--warning {
background: var(--warning-soft);
border-color: color-mix(in srgb, var(--warning) 24%, transparent);
color: var(--warning);
}
.alert--success {
background: var(--success-soft);
border-color: color-mix(in srgb, var(--success) 24%, transparent);
color: var(--success);
}
.alert--info {
background: var(--accent-soft);
border-color: transparent;
color: var(--accent);
}
/* ---------- 上传区 ---------- */
.dropzone {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
padding: 34px 20px;
border: 1.5px dashed var(--border-strong);
border-radius: var(--radius);
background: var(--surface-2);
text-align: center;
cursor: pointer;
transition:
border-color var(--rate) ease,
background var(--rate) ease,
transform var(--rate) ease;
}
.dropzone:hover,
.dropzone.drag-over {
border-color: var(--accent);
background: var(--accent-soft);
}
.dropzone.drag-over {
transform: scale(1.005);
}
.dropzone-icon {
width: 48px;
height: 48px;
display: grid;
place-items: center;
border-radius: 14px;
background: var(--surface);
color: var(--accent);
box-shadow: var(--shadow-sm);
margin-bottom: 4px;
}
.dropzone-icon svg {
width: 24px;
height: 24px;
}
.dropzone strong {
font-size: 0.95rem;
font-weight: 600;
}
.dropzone span {
font-size: 0.8rem;
color: var(--text-muted);
}
.dropzone input[type="file"] {
display: none;
}
/* 已有图片时收窄上传区,变成一条“继续添加”的操作条 */
.dropzone--compact {
flex-direction: row;
flex-wrap: wrap;
gap: 10px;
padding: 14px 18px;
}
.dropzone--compact .dropzone-icon {
width: 30px;
height: 30px;
margin: 0;
border-radius: 9px;
}
.dropzone--compact .dropzone-icon svg {
width: 16px;
height: 16px;
}
.dropzone--compact strong {
font-size: 0.85rem;
}
.dropzone--compact span {
display: none;
}
/* ---------- 图片网格 ---------- */
.image-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
gap: 12px;
}
.image-card {
position: relative;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
overflow: hidden;
transition:
border-color var(--rate) ease,
box-shadow var(--rate) ease,
transform var(--rate) ease;
}
.image-card:hover {
border-color: var(--border-strong);
box-shadow: var(--shadow-md);
}
.image-card.dragging {
opacity: 0.45;
transform: scale(0.97);
}
.image-card .thumb {
position: relative;
height: 118px;
background: var(--surface-2);
cursor: zoom-in;
overflow: hidden;
}
.image-card .thumb img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.3s ease;
}
.image-card:hover .thumb img {
transform: scale(1.04);
}
.image-card .thumb .thumb-hint {
position: absolute;
left: 6px;
bottom: 6px;
padding: 2px 7px;
border-radius: 6px;
background: rgba(5, 7, 15, 0.62);
color: #fff;
font-size: 0.65rem;
opacity: 0;
transition: opacity var(--rate) ease;
pointer-events: none;
}
.image-card:hover .thumb-hint {
opacity: 1;
}
.image-card .card-actions {
position: absolute;
top: 6px;
right: 6px;
display: flex;
gap: 4px;
opacity: 0;
transition: opacity var(--rate) ease;
}
.image-card:hover .card-actions,
.image-card:focus-within .card-actions {
opacity: 1;
}
.icon-bubble {
width: 24px;
height: 24px;
display: grid;
place-items: center;
border: none;
border-radius: 999px;
background: rgba(5, 7, 15, 0.62);
color: #fff;
font-size: 12px;
line-height: 1;
cursor: pointer;
backdrop-filter: blur(4px);
transition: background var(--rate) ease;
}
.icon-bubble:hover {
background: var(--accent);
}
.icon-bubble.danger:hover {
background: var(--danger);
}
.icon-bubble svg {
width: 13px;
height: 13px;
}
.image-card .meta {
padding: 9px 11px 10px;
font-size: 0.75rem;
}
.image-card .name {
font-weight: 550;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 3px;
}
.image-card .detail {
display: flex;
align-items: center;
justify-content: space-between;
gap: 6px;
color: var(--text-muted);
font-size: 0.72rem;
}
.image-card .detail .sizes {
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
font-variant-numeric: tabular-nums;
}
.image-card .detail .sizes s {
color: var(--text-muted);
opacity: 0.75;
}
.image-card .detail .sizes b {
color: var(--success);
font-weight: 650;
}
.badge-ratio {
padding: 1px 6px;
border-radius: 999px;
background: var(--success-soft);
color: var(--success);
font-size: 0.65rem;
font-weight: 700;
white-space: nowrap;
}
.index-badge {
position: absolute;
top: 6px;
left: 6px;
width: 20px;
height: 20px;
display: grid;
place-items: center;
border-radius: 999px;
background: rgba(5, 7, 15, 0.62);
color: #fff;
font-size: 0.65rem;
font-weight: 700;
backdrop-filter: blur(4px);
}
/* ---------- 进度 ---------- */
.progress-wrap {
display: none;
margin-top: 16px;
}
.progress-wrap.show {
display: block;
}
.progress-track {
height: 6px;
border-radius: 999px;
background: var(--surface-3);
overflow: hidden;
}
.progress-bar {
height: 100%;
width: 0;
border-radius: 999px;
background: linear-gradient(90deg, var(--accent), #a78bfa);
transition: width 0.25s ease;
}
.progress-text {
margin-top: 7px;
text-align: center;
font-size: 0.78rem;
color: var(--text-muted);
}
/* ---------- 空状态 ---------- */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
padding: 44px 20px;
text-align: center;
}
.empty-state .empty-icon {
width: 48px;
height: 48px;
display: grid;
place-items: center;
border-radius: 14px;
background: var(--surface-2);
color: var(--text-muted);
margin-bottom: 8px;
}
.empty-state .empty-icon svg {
width: 23px;
height: 23px;
}
.empty-state strong {
font-size: 0.92rem;
font-weight: 600;
}
.empty-state span {
font-size: 0.8rem;
color: var(--text-muted);
}
/* ---------- 编辑器工作区(JSON / URL) ---------- */
.editor-app {
width: 100%;
max-width: 1500px;
height: 100vh;
height: 100dvh;
margin: 0 auto;
padding: 18px clamp(14px, 2.6vw, 28px) 16px;
display: flex;
flex-direction: column;
gap: 12px;
}
.editor-app .tool-header {
margin-bottom: 0;
align-items: center;
}
.editor-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
padding: 9px 11px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
box-shadow: var(--shadow-sm);
}
.editor-toolbar .toolbar-group {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
}
.editor-toolbar .toolbar-label {
font-size: 0.78rem;
color: var(--text-muted);
font-weight: 550;
}
.editor-split {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
flex: 1;
min-height: 0;
}
.editor-pane {
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
overflow: hidden;
box-shadow: var(--shadow-sm);
}
.editor-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 9px 13px;
border-bottom: 1px solid var(--border);
background: var(--surface-2);
font-size: 0.78rem;
font-weight: 600;
color: var(--text-secondary);
flex: none;
}
.editor-head .count {
font-weight: 500;
color: var(--text-muted);
font-variant-numeric: tabular-nums;
}
.editor-body {
position: relative;
flex: 1;
min-height: 0;
}
.editor-textarea {
display: block;
width: 100%;
height: 100%;
padding: 14px 16px;
border: none;
border-radius: 0;
background: transparent;
color: var(--text);
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.65;
resize: none;
tab-size: 2;
}
.editor-textarea:focus {
outline: none;
box-shadow: none;
border: none;
}
.code-output {
width: 100%;
height: 100%;
margin: 0;
padding: 14px 16px;
overflow: auto;
background: transparent;
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.65;
white-space: pre;
tab-size: 2;
}
.code-output .placeholder {
color: var(--text-muted);
}
.tok-key {
color: #7c3aed;
}
.tok-string {
color: #047857;
}
.tok-number {
color: #0369a1;
}
.tok-boolean {
color: #b45309;
}
.tok-null {
color: #be123c;
}
html[data-theme="dark"] .tok-key {
color: #c4b5fd;
}
html[data-theme="dark"] .tok-string {
color: #6ee7b7;
}
html[data-theme="dark"] .tok-number {
color: #7dd3fc;
}
html[data-theme="dark"] .tok-boolean {
color: #fcd34d;
}
html[data-theme="dark"] .tok-null {
color: #fda4af;
}
.editor-status {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 4px;
font-size: 0.76rem;
color: var(--text-muted);
flex: none;
}
.editor-status .status-text {
color: var(--text-secondary);
}
/* ---------- 双栏布局 ---------- */
.split {
display: grid;
grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
gap: 16px;
align-items: start;
}
.split > .card + .card {
margin-top: 0;
}
.sticky {
position: sticky;
top: 16px;
}
/* ---------- 颜色选择器 ---------- */
.color-layout {
display: grid;
grid-template-columns: minmax(260px, 1fr) minmax(280px, 1fr);
gap: 16px;
align-items: start;
}
.sv-panel {
position: relative;
height: 260px;
border-radius: 12px;
overflow: hidden;
cursor: crosshair;
touch-action: none;
background: hsl(0, 100%, 50%);
border: 1px solid var(--border);
}
.sv-panel::before,
.sv-panel::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.sv-panel::before {
background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
}
.sv-panel::after {
background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));
}
.sv-cursor {
position: absolute;
width: 16px;
height: 16px;
border: 2px solid #fff;
border-radius: 50%;
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.45),
0 2px 6px rgba(0, 0, 0, 0.35);
transform: translate(-50%, -50%);
pointer-events: none;
z-index: 2;
}
.hue-strip {
position: relative;
height: 14px;
margin-top: 14px;
border-radius: 999px;
cursor: pointer;
touch-action: none;
background: linear-gradient(
to right,
#f00 0%,
#ff0 16.66%,
#0f0 33.33%,
#0ff 50%,
#00f 66.66%,
#f0f 83.33%,
#f00 100%
);
border: 1px solid var(--border);
}
.hue-cursor {
position: absolute;
top: 50%;
width: 20px;
height: 20px;
border-radius: 50%;
background: #fff;
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.28),
0 2px 6px rgba(0, 0, 0, 0.25);
transform: translate(-50%, -50%);
pointer-events: none;
}
.color-preview-big {
height: 106px;
border-radius: 12px;
border: 1px solid var(--border);
background: #ffffff;
margin-bottom: 14px;
position: relative;
overflow: hidden;
}
.color-preview-big .preview-hex {
position: absolute;
left: 10px;
bottom: 10px;
padding: 3px 8px;
border-radius: 7px;
font-family: var(--font-mono);
font-size: 0.75rem;
font-weight: 600;
color: #fff;
background: rgba(5, 7, 15, 0.42);
backdrop-filter: blur(4px);
}
.slider-stack {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 4px;
}
.slider-row {
display: flex;
align-items: center;
gap: 10px;
}
.slider-row .slider-key {
width: 20px;
flex: none;
font-family: var(--font-mono);
font-size: 0.75rem;
font-weight: 700;
color: var(--text-muted);
}
.slider-row input[type="range"] {
flex: 1;
}
.slider-row .slider-num {
width: 40px;
flex: none;
text-align: right;
font-family: var(--font-mono);
font-size: 0.78rem;
color: var(--text-secondary);
font-variant-numeric: tabular-nums;
}
.swatch-list {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.swatch {
width: 32px;
height: 32px;
border-radius: 9px;
border: 1px solid rgba(0, 0, 0, 0.08);
cursor: pointer;
transition:
transform var(--rate) ease,
box-shadow var(--rate) ease;
}
html[data-theme="dark"] .swatch {
border-color: rgba(255, 255, 255, 0.12);
}
.swatch:hover {
transform: scale(1.1);
box-shadow: var(--shadow-sm);
}
/* ---------- 选项统计 ---------- */
.option-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 13px;
}
.meta-line {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
font-size: 0.85rem;
}
.meta-line .meta-label {
color: var(--text-secondary);
}
.meta-line .meta-value {
font-weight: 650;
font-variant-numeric: tabular-nums;
}
.divider {
height: 1px;
background: var(--border);
margin: 14px 0;
}
/* ---------- PDF 预览 ---------- */
.preview-frame {
display: flex;
align-items: center;
justify-content: center;
min-height: 340px;
padding: 16px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface-2);
overflow: auto;
}
.preview-frame canvas {
max-width: 100%;
max-height: 460px;
border-radius: 4px;
box-shadow: var(--shadow-md);
background: #fff;
}
.preview-controls {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 12px;
}
.page-nav {
display: flex;
align-items: center;
gap: 6px;
font-size: 0.8rem;
color: var(--text-secondary);
font-variant-numeric: tabular-nums;
}
.zoom-control {
display: flex;
align-items: center;
gap: 7px;
font-size: 0.8rem;
color: var(--text-secondary);
}
.zoom-control input[type="range"] {
width: 96px;
}
.preview-meta {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 8px;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--border);
font-size: 0.75rem;
color: var(--text-muted);
}
/* ---------- 模态框 / 图片预览 ---------- */
.overlay {
position: fixed;
inset: 0;
z-index: 1000;
display: none;
align-items: center;
justify-content: center;
padding: 22px;
background: rgba(5, 7, 15, 0.66);
backdrop-filter: blur(5px);
}
.overlay.show {
display: flex;
}
.modal {
width: min(920px, 100%);
max-height: 92vh;
display: flex;
flex-direction: column;
border: 1px solid var(--border);
border-radius: var(--radius-lg);
background: var(--surface);
box-shadow: var(--shadow-lg);
overflow: hidden;
}
.modal-head {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 16px;
border-bottom: 1px solid var(--border);
font-size: 0.85rem;
font-weight: 600;
flex: none;
}
.modal-head .modal-title {
flex: 1;
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.modal-body {
flex: 1;
min-height: 160px;
display: flex;
align-items: center;
justify-content: center;
padding: 18px;
background: var(--surface-2);
overflow: auto;
}
.modal-body img {
max-width: 100%;
max-height: 68vh;
object-fit: contain;
border-radius: 4px;
transition: transform 0.15s ease;
transform-origin: center center;
}
.modal-foot {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 10px 16px;
border-top: 1px solid var(--border);
flex-wrap: wrap;
}
/* ---------- Toast ---------- */
.toast-wrap {
position: fixed;
left: 50%;
bottom: 26px;
z-index: 2000;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
transform: translateX(-50%);
pointer-events: none;
padding: 0 16px;
width: max-content;
max-width: 100%;
}
.toast {
display: flex;
align-items: center;
gap: 8px;
padding: 9px 15px;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 10px;
background: #151827;
color: #f4f5fb;
font-size: 0.82rem;
font-weight: 500;
box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.6);
opacity: 0;
transform: translateY(8px);
transition:
opacity 0.2s ease,
transform 0.2s ease;
max-width: 92vw;
}
.toast.show {
opacity: 1;
transform: none;
}
.toast-icon {
width: 16px;
height: 16px;
flex: none;
display: grid;
place-items: center;
border-radius: 50%;
font-size: 10px;
font-weight: 800;
background: rgba(255, 255, 255, 0.14);
}
.toast--success .toast-icon {
background: #10b981;
color: #04120c;
}
.toast--error .toast-icon {
background: #f87171;
color: #260607;
}
/* ---------- 其他页面元素 ---------- */
.hint {
color: var(--text-muted);
font-size: 0.78rem;
}
.text-center {
text-align: center;
}
.stack {
display: flex;
flex-direction: column;
gap: 12px;
}
.stack-sm {
display: flex;
flex-direction: column;
gap: 8px;
}
.wrap {
flex-wrap: wrap;
}
/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
.split,
.color-layout {
grid-template-columns: 1fr;
}
.sticky {
position: static;
}
}
@media (max-width: 760px) {
body {
font-size: 14.5px;
}
.tool-page {
padding: 18px 16px 28px;
}
.tool-header {
gap: 12px;
margin-bottom: 20px;
}
.tool-header .tool-icon {
width: 42px;
height: 42px;
border-radius: 12px;
}
.tool-header p {
display: none;
}
.editor-app {
height: auto;
min-height: 100dvh;
padding: 14px 12px;
}
.editor-app .tool-header p {
display: none;
}
.editor-split {
display: flex;
flex-direction: column;
}
.editor-pane {
min-height: 300px;
}
.editor-toolbar {
position: sticky;
top: 0;
z-index: 5;
}
.editor-status > span:last-child {
display: none;
}
.image-grid {
grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
gap: 10px;
}
.stat-value {
font-size: 1.25rem;
}
.sv-panel {
height: 220px;
}
}
@media (max-width: 480px) {
.segmented {
width: 100%;
}
.segmented .seg {
flex: 1;
}
.segmented .seg span {
width: 100%;
justify-content: center;
padding: 6px 8px;
}
.image-grid {
grid-template-columns: repeat(2, 1fr);
}
.modal-body img {
max-height: 58vh;
}
}
@media (hover: none) {
.image-card .card-actions {
opacity: 1;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
scroll-behavior: auto !important;
}
}