/* ==========================================================================
   在线工具箱 - 前台样式
   ========================================================================== */

:root {
    --bg: #f5f6fa;
    --bg-soft: #eef0f7;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --text: #161a22;
    --text-2: #5b6474;
    --muted: #8a93a6;
    --border: #e4e7ef;
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --primary-soft: #eef0ff;
    --success: #0f9d6e;
    --danger: #e5484d;
    --warning: #d97706;
    --header-bg: rgba(255, 255, 255, 0.78);
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 10px 36px rgba(16, 24, 40, 0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
    --bg: #0d0f14;
    --bg-soft: #12151c;
    --surface: #161a22;
    --surface-2: #1c212b;
    --text: #e9ecf3;
    --text-2: #a8b0c0;
    --muted: #78829a;
    --border: #262c38;
    --primary: #7c83ff;
    --primary-2: #a78bfa;
    --primary-soft: #1e2233;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --header-bg: rgba(13, 15, 20, 0.78);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(620px 320px at 12% -8%, rgba(79, 70, 229, 0.12), transparent 70%),
        radial-gradient(520px 280px at 88% -4%, rgba(124, 58, 237, 0.10), transparent 70%);
}

[data-theme="dark"] body::before {
    background:
        radial-gradient(620px 320px at 12% -8%, rgba(124, 131, 255, 0.14), transparent 70%),
        radial-gradient(520px 280px at 88% -4%, rgba(167, 139, 250, 0.10), transparent 70%);
}

a {
    color: var(--primary);
}

.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- 顶部导航 ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    height: 62px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    flex: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.3);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    font-weight: 700;
    font-size: 15px;
}

.brand-text em {
    font-style: normal;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.5px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-link {
    padding: 7px 11px;
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.18s ease;
}

.icon-btn:hover {
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.35);
}

.icon {
    width: 18px;
    height: 18px;
}

.icon-sun {
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

/* ---------- 首页 Hero ---------- */

.hero {
    padding: 66px 0 26px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 12.5px;
    color: var(--text-2);
    box-shadow: var(--shadow);
}

.hero-badge b {
    color: var(--primary);
    font-weight: 600;
}

.hero h1 {
    margin: 18px 0 12px;
    font-size: clamp(30px, 4.6vw, 44px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 800;
}

.hero h1 span {
    background: linear-gradient(100deg, var(--primary), var(--primary-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    max-width: 620px;
    margin: 0 auto;
    color: var(--text-2);
    font-size: 15px;
}

.hero-search {
    position: relative;
    max-width: 560px;
    margin: 28px auto 10px;
}

.hero-search svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 19px;
    height: 19px;
    color: var(--muted);
    pointer-events: none;
}

.hero-search input {
    width: 100%;
    height: 52px;
    padding: 0 20px 0 48px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    box-shadow: var(--shadow);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.hero-search input:focus {
    border-color: rgba(79, 70, 229, 0.5);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), var(--shadow);
}

.hero-search input::placeholder {
    color: var(--muted);
}

.hero-meta {
    color: var(--muted);
    font-size: 12.5px;
}

/* ---------- 分类筛选 ---------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 24px 0 26px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s ease;
}

.chip:hover {
    border-color: rgba(79, 70, 229, 0.35);
    color: var(--primary);
}

.chip.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
}

.chip .count {
    font-size: 11.5px;
    opacity: 0.65;
    font-variant-numeric: tabular-nums;
}

/* ---------- 工具卡片 ---------- */

.tool-section {
    padding-bottom: 64px;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
    gap: 16px;
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 11px;
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(79, 70, 229, 0.35);
}

.tool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-badge {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.5px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.26);
}

.tool-card h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tool-card p {
    margin: 0;
    flex: 1;
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.65;
}

.tool-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
}

.tool-card-tag {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.empty-state {
    display: none;
    padding: 64px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state.show {
    display: block;
}

.empty-state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-2);
    font-size: 15px;
}

/* ---------- 工具详情页 ---------- */

.tool-page {
    padding: 28px 0 72px;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 22px;
    font-size: 13px;
    color: var(--muted);
}

.crumbs a {
    color: var(--text-2);
    text-decoration: none;
}

.crumbs a:hover {
    color: var(--primary);
}

.crumbs .sep {
    color: var(--muted);
    opacity: 0.6;
}

.tool-head {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 26px;
}

.tool-head .tool-badge {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 18px;
    flex: none;
}

.tool-head h1 {
    margin: 0 0 6px;
    font-size: clamp(22px, 3vw, 27px);
    letter-spacing: -0.02em;
    font-weight: 700;
}

.tool-head p {
    margin: 0;
    color: var(--text-2);
    font-size: 14px;
}

.tool-panel {
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* ---------- 表单控件 ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field + .field {
    margin-top: 18px;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
}

.hint {
    font-size: 12px;
    color: var(--muted);
}

.input,
.textarea,
.select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input {
    height: 40px;
}

.textarea {
    min-height: 240px;
    resize: vertical;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
}

.textarea.short {
    min-height: 120px;
}

.textarea.tall {
    min-height: 340px;
}

.select {
    height: 40px;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.input:focus,
.textarea:focus,
.select:focus {
    border-color: rgba(79, 70, 229, 0.55);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--muted);
    opacity: 0.85;
}

.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.editor-grid > .field + .field {
    margin-top: 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.toolbar .spacer {
    flex: 1;
}

.inline-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.inline-group > .field {
    flex: 1;
    min-width: 150px;
}

.inline-group > .field + .field {
    margin-top: 0;
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.18s ease;
}

.btn:hover {
    border-color: rgba(79, 70, 229, 0.35);
    color: var(--primary);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
}

.btn-primary:hover {
    color: #fff;
    filter: brightness(1.06);
    border-color: transparent;
}

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--text-2);
}

.btn-ghost:hover {
    background: var(--surface-2);
}

.btn-sm {
    height: 30px;
    padding: 0 11px;
    border-radius: 7px;
    font-size: 12.5px;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- 结果与状态 ---------- */

.result-box {
    position: relative;
    min-height: 52px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
}

.result-box.muted {
    color: var(--muted);
}

.result-actions {
    position: absolute;
    top: 8px;
    right: 8px;
}

.status {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}

.status.ok {
    background: rgba(15, 157, 110, 0.1);
    color: var(--success);
}

.status.err {
    background: rgba(229, 72, 77, 0.1);
    color: var(--danger);
}

.status.info {
    background: var(--primary-soft);
    color: var(--primary);
}

.status:empty {
    display: none;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 12px;
}

.stat-item {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stat-label {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--muted);
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.result-row .k {
    flex: none;
    width: 132px;
    font-size: 12.5px;
    color: var(--muted);
}

.result-row .v {
    flex: 1;
    min-width: 0;
    font-family: var(--mono);
    font-size: 13.5px;
    word-break: break-all;
}

.result-row .v.level {
    font-weight: 600;
}
.level-thin { color: #2563eb; }
.level-normal { color: var(--success); }
.level-overweight { color: var(--warning); }
.level-obese { color: var(--danger); }

.tip-line {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.7;
}

.checks {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.range-value {
    min-width: 40px;
    text-align: right;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--primary);
}

.textarea-highlight {
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 180px;
    max-height: 420px;
    overflow: auto;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.75;
}

mark {
    padding: 1px 2px;
    border-radius: 3px;
    background: rgba(250, 204, 21, 0.55);
    color: inherit;
}

[data-theme="dark"] mark {
    background: rgba(250, 204, 21, 0.32);
}

.match-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}

.match-item {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 12.5px;
}

.match-item .idx {
    color: var(--muted);
    margin-right: 8px;
}

.match-item .groups {
    display: block;
    margin-top: 4px;
    color: var(--text-2);
    font-size: 12px;
}

/* ---------- 表格 ---------- */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.param-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.param-table th,
.param-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.param-table th {
    background: var(--surface-2);
    color: var(--text-2);
    font-weight: 600;
    font-size: 12.5px;
    white-space: nowrap;
}

.param-table tr:last-child td {
    border-bottom: none;
}

.param-table td .input {
    height: 34px;
    font-size: 13px;
    font-family: var(--mono);
}

.param-table td.actions {
    width: 64px;
    text-align: right;
}

.param-empty {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ---------- 图片工具 ---------- */

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 42px 20px;
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-2);
    text-align: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: rgba(79, 70, 229, 0.55);
    background: var(--primary-soft);
    color: var(--primary);
}

.dropzone strong {
    font-size: 14px;
}

.dropzone span {
    font-size: 12.5px;
    color: var(--muted);
}

.image-preview-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.image-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background:
        repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 280px;
    border-radius: 6px;
    display: block;
}

.image-meta {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------- 说明与相关工具 ---------- */

.tool-bottom {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    margin-top: 20px;
}

.card {
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
}

.card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-2);
    font-size: 13.5px;
    line-height: 1.85;
}

.card ul li + li {
    margin-top: 6px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.related-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.18s ease;
}

.related-list a:hover {
    background: var(--surface-2);
}

.related-list .tool-badge {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 10.5px;
    box-shadow: none;
    flex: none;
}

.related-list .name {
    font-size: 13.5px;
}

.related-list .cat {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--muted);
}

/* ---------- 页脚 ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 22px;
    padding-bottom: 22px;
    font-size: 12.5px;
    color: var(--muted);
}

.footer-inner p {
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    color: var(--text-2);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary);
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    z-index: 200;
    padding: 10px 18px;
    border-radius: 10px;
    background: #111318;
    color: #fff;
    font-size: 13.5px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    opacity: 0;
    transform: translate(-50%, 14px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ---------- 文本对比 ---------- */

.diff-view {
    max-height: 480px;
    overflow: auto;
    padding: 8px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.65;
}

.diff-line {
    display: flex;
    gap: 10px;
    padding: 1px 14px;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line .ln {
    flex: none;
    width: 16px;
    text-align: center;
    color: var(--muted);
    user-select: none;
}

.diff-line .txt {
    flex: 1;
    min-width: 0;
}

.diff-add {
    background: rgba(15, 157, 110, 0.12);
}

.diff-del {
    background: rgba(229, 72, 77, 0.12);
}

.diff-add .ln {
    color: var(--success);
    font-weight: 700;
}

.diff-del .ln {
    color: var(--danger);
    font-weight: 700;
}

.diff-same {
    color: var(--text-2);
}

/* ---------- 颜色工具 ---------- */

.color-picker {
    width: 100%;
    height: 40px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    cursor: pointer;
}

.color-preview {
    height: 96px;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

/* ---------- 二维码 ---------- */

.qr-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    margin-top: 18px;
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.qr-preview canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #fff;
}

/* ---------- 教程与内容页 ---------- */

.content-head {
    margin: 22px 0 26px;
}

.content-head h1 {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.25;
}

.content-head p {
    margin: 0;
    color: var(--text-2);
}

.article-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.article-item {
    display: block;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.article-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.article-item h2 {
    margin: 10px 0;
    font-size: 20px;
    line-height: 1.45;
}

.article-item p {
    margin: 0 0 16px;
    color: var(--text-2);
    line-height: 1.7;
}

.article-item time,
.article-meta {
    color: var(--muted);
    font-size: 13px;
}

.article-type {
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
}

.article-body {
    color: var(--text);
    font-size: 16px;
    line-height: 1.85;
}

.article-body > :first-child {
    margin-top: 0;
}

.article-body > :last-child {
    margin-bottom: 0;
}

.article-body h2 {
    margin: 28px 0 12px;
    font-size: 22px;
    line-height: 1.4;
}

.article-body h3 {
    margin: 22px 0 10px;
    font-size: 18px;
}

.article-body p,
.article-body ul {
    margin: 0 0 16px;
}

.article-body ul {
    padding-left: 22px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body a {
    color: var(--primary);
}

.content-section {
    margin-top: 22px;
}

.content-section > h2 {
    margin-top: 0;
}

.narrow-container {
    max-width: 900px;
}

.update-list {
    display: grid;
    gap: 18px;
}

.update-item time {
    color: var(--muted);
    font-size: 13px;
}

.update-item h2 {
    margin: 8px 0 16px;
    font-size: 21px;
}

.faq-item + .faq-item {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.faq-item h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.faq-item p {
    margin: 0;
    color: var(--text-2);
    line-height: 1.75;
}

@media (max-width: 720px) {
    .article-list {
        grid-template-columns: 1fr;
    }

    .content-head h1 {
        font-size: 26px;
    }
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
    .editor-grid,
    .image-preview-wrap,
    .tool-bottom {
        grid-template-columns: 1fr;
    }

    .tool-head p {
        font-size: 13.5px;
    }
}

@media (max-width: 760px) {
    .container {
        padding: 0 16px;
    }

    .header-inner {
        flex-wrap: wrap;
        height: auto;
        gap: 8px;
        padding: 10px 0;
    }

    .brand-text em {
        display: none;
    }

    .main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .hero {
        padding: 40px 0 18px;
    }

    .hero-search {
        margin-top: 22px;
    }

    .filter-bar {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding: 18px 0 22px;
        -webkit-overflow-scrolling: touch;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .chip {
        flex: none;
    }

    .tool-panel {
        padding: 18px;
        border-radius: 16px;
    }

    .tool-head {
        gap: 14px;
    }

    .tool-head .tool-badge {
        width: 46px;
        height: 46px;
        font-size: 15px;
        border-radius: 13px;
    }

    .result-row .k {
        width: 96px;
        font-size: 12px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
