:root {
    color-scheme:light;
    --ink:#202c3a;
    --muted:#697585;
    --line:#e1e7ec;
    --accent:#167765;
    --bg:#f6f8fa
}
* {
    box-sizing:border-box
}
body {
    margin:0;
    background:var(--bg);
    color:var(--ink);
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
    font-size:14px;
    line-height:1.6
}
a {
    color:inherit;
    text-decoration:none
}
button,select,textarea {
    font:inherit
}
button,a,select {
    -webkit-tap-highlight-color:transparent
}
button {
    cursor:pointer
}
button:disabled {
    cursor:default;
    opacity:.45
}
button:focus-visible,a:focus-visible,select:focus-visible {
    outline:3px solid #78bcac;
    outline-offset:4px
}
[hidden] {
    display:none!important
}
.shell {
    max-width:1184px;
    padding:0 40px;
    margin:auto;
    min-height:100vh;
    display:flex;
    flex-direction:column
}
main {
    flex:1
}
.site-header {
    min-height:94px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    border-bottom:1px solid var(--line);
    gap:16px
}
.brand {
    display:flex;
    align-items:center;
    gap:12px;
    font-size:18px;
    font-weight:700;
    white-space:nowrap
}
.brand-mark {
    display:grid;
    place-items:center;
    background:var(--ink);
    color:white;
    border-radius:11px;
    width:38px;
    height:38px;
    font-size:24px
}
.brand-sub {
    font-size:10px;
    letter-spacing:2px;
    font-weight:500;
    color:var(--muted);
    margin-left:4px
}
.header-note {
    color:var(--muted);
    font-size:12px
}
.hero {
    padding:65px 0 47px
}
.eyebrow {
    color:var(--accent);
    font-size:12px;
    font-weight:600;
    letter-spacing:2px
}
h1 {
    font-size:38px;
    line-height:1.35;
    letter-spacing:-1px;
    margin:17px 0
}
h1 span {
    color:var(--accent)
}
.hero p,.workspace-heading p {
    color:var(--muted);
    font-size:15px;
    margin:0
}
.local-note {
    display:inline-flex;
    gap:8px;
    align-items:center;
    color:var(--muted);
    font-size:12px
}
.hero .local-note {
    margin-top:23px
}
.status-dot {
    width:6px;
    height:6px;
    border-radius:50%;
    background:var(--accent);
    flex-shrink:0
}
.section-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:18px;
    gap:12px
}
.section-heading h2 {
    font-size:17px;
    margin:0
}
.section-heading>span {
    font-size:12px;
    color:var(--muted)
}
.tool-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px
}
.tool-card {
    display:block;
    background:#fff;
    border:1px solid var(--line);
    border-radius:14px;
    padding:25px;
    transition:transform .18s,border-color .18s,box-shadow .18s
}
.tool-card:hover {
    transform:translateY(-3px);
    border-color:#8ab6ac;
    box-shadow:0 8px 22px #22334409
}
.card-top {
    display:flex;
    justify-content:space-between;
    align-items:center
}
.tool-icon {
    width:38px;
    height:38px;
    display:grid;
    place-items:center;
    background:#edf6f3;
    color:var(--accent);
    border-radius:10px;
    font-size:23px;
    font-weight:500
}
.category {
    color:var(--muted);
    font-size:11px
}
.tool-card h2 {
    font-size:19px;
    margin:20px 0 8px
}
.tool-card p {
    font-size:13px;
    color:var(--muted);
    margin:0 0 26px
}
.card-link {
    display:flex;
    justify-content:space-between;
    color:var(--accent);
    font-size:12px;
    font-weight:600
}
.site-footer {
    margin-top:65px;
    padding:25px 0;
    display:flex;
    justify-content:space-between;
    gap:12px;
    border-top:1px solid var(--line);
    color:var(--muted);
    font-size:11px
}
.site-footer a:hover {
    text-decoration:underline
}
.tool-nav {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    padding:25px 0;
    border-bottom:1px solid var(--line)
}
.tool-nav a {
    padding:7px 17px;
    border-radius:7px;
    color:var(--muted);
    font-size:13px
}
.tool-nav a:hover {
    background:#eaf0ef
}
.tool-nav a[aria-current="page"] {
    background:#e1efe9;
    color:#166451;
    font-weight:600
}
.workspace-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    padding:36px 0 28px
}
.workspace-heading h1 {
    font-size:32px;
    margin:10px 0
}
.workspace {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    position:relative;
    border:1px solid var(--line);
    border-radius:14px;
    overflow:hidden;
    background:#fff
}
.editor-panel {
    min-width:0
}
.editor-panel+.editor-panel {
    border-left:1px solid var(--line)
}
.panel-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:17px 20px;
    border-bottom:1px solid #eef1f4;
    min-height:64px
}
.panel-heading label {
    font-weight:600
}
.text-actions {
    display:flex;
    gap:16px
}
.text-actions button,.copy-button {
    border:0;
    padding:4px 0;
    background:transparent;
    color:var(--accent);
    font-size:12px
}
.text-actions button:hover,.copy-button:hover {
    text-decoration:underline
}
textarea {
    display:block;
    width:100%;
    min-height:275px;
    resize:vertical;
    border:0;
    background:transparent;
    color:var(--ink);
    padding:22px;
    line-height:1.8;
    font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
    font-size:14px;
    border-radius:0;
    overflow-wrap:anywhere
}
textarea:focus {
    outline:2px solid #86b8ac;
    outline-offset:-3px
}
textarea::placeholder {
    color:#929ca6
}
.result-panel {
    background:#fbfcfd
}
.panel-bottom {
    padding:12px 20px;
    display:flex;
    justify-content:space-between;
    color:var(--muted);
    font-size:11px;
    border-top:1px solid #eef1f4
}
.action-bar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-top:22px
}
.action-buttons {
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px
}
.button {
    border:1px solid transparent;
    border-radius:8px;
    padding:11px 25px;
    font-weight:600;
    font-size:13px
}
.primary {
    color:#fff;
    background:var(--accent)
}
.primary:hover {
    background:#105e4f
}
.secondary {
    background:#fff;
    border-color:var(--line);
    color:var(--ink)
}
select {
    max-width:100%;
    padding:10px;
    border:1px solid var(--line);
    border-radius:8px;
    background:white;
    color:var(--ink)
}
.shortcut {
    font-size:11px;
    color:var(--muted)
}
.feedback {
    min-height:23px;
    margin:12px 0;
    color:var(--accent);
    font-size:12px
}
.feedback.error {
    color:#b33636
}
.help-box {
    display:flex;
    gap:13px;
    padding:20px 23px;
    background:#eef2f5;
    border-radius:10px
}
.help-icon {
    width:19px;
    height:19px;
    border:1px solid #8a96a2;
    border-radius:50%;
    display:grid;
    place-items:center;
    font-size:12px;
    color:var(--muted);
    flex-shrink:0;
    margin-top:3px
}
.help-box h2 {
    font-size:13px;
    margin:0 0 5px
}
.help-box p {
    font-size:12px;
    color:var(--muted);
    margin:0;
    line-height:1.9
}
@media(min-width:1500px) {
    .hero {
        padding-top:80px
    }

}
@media(max-width:900px) {
    .shell {
        padding:0 26px
    }
    .tool-grid {
        grid-template-columns:repeat(2,minmax(0,1fr))
    }
    .brand-sub {
        display:none
    }
    .shortcut {
        display:none
    }

}
@media(max-width:600px) {
    .shell {
        padding:0 18px
    }
    .site-header {
        min-height:76px
    }
    .header-note {
        font-size:10px
    }
    .brand {
        font-size:16px;
        gap:8px
    }
    .brand-mark {
        width:32px;
        height:32px;
        font-size:21px
    }
    .hero {
        padding:39px 0 32px
    }
    h1 {
        font-size:30px
    }
    .hero h1 span {
        display:block;
        margin-top:6px
    }
    .hero p {
        font-size:13px;
        max-width:290px
    }
    .tool-grid {
        grid-template-columns:1fr;
        gap:12px
    }
    .tool-card {
        padding:21px
    }
    .tool-card h2 {
        margin-top:15px
    }
    .tool-card p {
        margin-bottom:17px
    }
    .section-heading>span {
        font-size:10px
    }
    .tool-nav {
        gap:4px;
        padding:18px 0
    }
    .tool-nav a {
        padding:7px 11px;
        font-size:12px
    }
    .workspace-heading {
        padding:26px 0 22px;
        align-items:flex-start;
        flex-direction:column;
        gap:12px
    }
    .workspace-heading h1 {
        font-size:27px
    }
    .workspace-heading p {
        font-size:13px
    }
    .workspace {
        grid-template-columns:1fr
    }
    .editor-panel+.editor-panel {
        border-left:0;
        border-top:1px solid var(--line)
    }
    textarea {
        min-height:190px;
        padding:17px;
        font-size:16px
    }
    .panel-heading {
        padding:13px 16px;
        min-height:55px
    }
    .panel-bottom {
        padding:10px 16px
    }
    .action-bar,.action-buttons {
        width:100%
    }
    .action-buttons .button {
        flex:1;
        padding:12px 17px
    }
    .action-buttons label {
        flex-basis:100%
    }
    .action-buttons select {
        width:100%
    }
    .site-footer {
        margin-top:40px;
        flex-direction:column;
        align-items:center;
        text-align:center
    }
    .help-box {
        padding:17px
    }

}
@media(prefers-reduced-motion:reduce) {
    .tool-card {
        transition:none
    }
    .tool-card:hover {
        transform:none
    }

}

.diff-report { margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; }
.diff-report h2 { margin: 0; font-size: 14px; }
#diff-summary { font-size: 12px; color: var(--muted); }
#diff-lines { margin: 0; padding: 14px 0; max-height: 500px; overflow: auto; font: 13px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; }
.diff-line { display: block; min-width: max-content; padding: 0 14px; white-space: pre; }
.diff-add { background: #e4f5ea; color: #1a6136; }
.diff-remove { background: #ffedeb; color: #9c3530; }

.diff-change { background: #fff5d9; color: #795500; }

.swap-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--accent);
    font-size: 18px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
    z-index: 1;
    margin: 0;
}
.swap-button:hover { border-color: var(--accent); background: #edf6f3; }

.result-actions { display: flex; gap: 16px; align-items: center; }

.regex-container { margin-top: 4px; }

.regex-pattern-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 14px;
}
.pattern-label { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 18px; color: var(--accent); font-weight: 600; flex-shrink: 0; }
#regex-pattern {
    flex: 1;
    min-width: 0;
    border: 0;
    border-bottom: 2px solid var(--line);
    border-radius: 0;
    padding: 6px 4px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 15px;
    background: transparent;
    color: var(--ink);
    outline: none;
}
#regex-pattern:focus { border-bottom-color: var(--accent); }

.regex-flags { display: flex; gap: 8px; flex-shrink: 0; }
.regex-flags label {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
}
.regex-flags label:hover { background: #eaf0ef; }
.regex-flags input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

.regex-workspace {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}
.regex-output {
    padding: 16px 20px;
    min-height: 275px;
    max-height: 500px;
    overflow: auto;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 14px;
    line-height: 1.8;
}
.regex-highlight {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef1f4;
}
.regex-highlight mark {
    background: #d4f0db;
    color: #1a5c30;
    border-radius: 2px;
    padding: 1px 3px;
}
.regex-match-list { display: flex; flex-direction: column; gap: 6px; }
.match-item {
    padding: 6px 10px;
    background: #f8fafb;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
}
.match-index { color: var(--muted); font-size: 11px; min-width: 28px; }
.match-text { color: var(--accent); font-weight: 500; }
.match-pos { color: var(--muted); font-size: 11px; }
.match-groups { width: 100%; padding-left: 38px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.group-label { color: var(--muted); font-weight: 500; margin-right: 4px; }
.regex-error { color: #b33636; font-size: 13px; }
.regex-empty { color: var(--muted); font-size: 13px; }

.tool-search {
    display: block;
    width: 100%;
    max-width: 360px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: var(--ink);
    margin-bottom: 20px;
}
.tool-search:focus { outline: 2px solid #86b8ac; outline-offset: -2px; border-color: transparent; }
.tool-search::placeholder { color: #929ca6; }

.category-title {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 1px;
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.category-title:first-child { margin-top: 0; }
.no-results { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0; }

@media(max-width:600px) {
    .regex-workspace { grid-template-columns: 1fr; }
    .regex-pattern-bar { flex-wrap: wrap; padding: 12px 14px; gap: 4px; }
    #regex-pattern { font-size: 16px; flex-basis: 100%; order: -1; }
    .regex-flags { flex-wrap: wrap; gap: 4px; }
    .regex-output { min-height: 190px; font-size: 16px; }
    .tool-search { max-width: 100%; }
}

/* Keep the native textarea for editing, selection and clipboard access. */
.json-editor { position: relative; }
.json-editor textarea,
.json-highlight {
    font: 14px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace;
    padding: 22px;
    white-space: pre;
    overflow-wrap: normal;
    tab-size: 8;
    letter-spacing: normal;
}
.json-editor textarea { position: relative; color: transparent; caret-color: var(--ink); }
.json-editor textarea::selection { background: #b9dccc; color: var(--ink); }
.json-highlight {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    border: 0;
    overflow: hidden;
    pointer-events: none;
    color: var(--ink);
}
.json-key { color: #175ca4; }
.json-string { color: #247344; }
.json-number { color: #99500c; }
.json-boolean { color: #8540a3; }
.json-null { color: #a33357; }
.json-punctuation { color: #697585; }
@media(max-width:600px) {
    .json-editor textarea, .json-highlight { padding: 17px; font-size: 16px; }
}
@media(forced-colors:active) {
    .json-editor textarea { color: CanvasText; }
    .json-highlight { visibility: hidden; }
}
