/* Controls and result areas for individual tools. */

.tool-form {
    display: grid;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: end;
}

.field-row .field {
    flex: 1 1 180px;
}

textarea,
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
    width: 100%;
    font-family: ui-monospace, Consolas, "Microsoft YaHei", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
}

textarea {
    min-height: 180px;
    resize: vertical;
}

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

textarea:focus,
input:focus,
select:focus {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    border-color: #93b4fb;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

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

.checks label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: var(--text);
}

.status {
    min-height: 1.5em;
    color: var(--muted);
    font-weight: 500;
}

.status.ok {
    color: #157347;
}

.status.err {
    color: #b42318;
}

.result-box {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}

.result-box h2 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.result-box h2:not(:first-child) {
    margin-top: 16px;
}

.result-box .btn-row {
    margin-top: 10px;
}

.result-line,
.hash-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 10px;
}

.result-line code,
.hash-row code {
    font-family: ui-monospace, Consolas, monospace;
    word-break: break-all;
    line-height: 1.5;
    font-weight: 500;
}

.highlight {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    font-family: ui-monospace, Consolas, "Microsoft YaHei", sans-serif;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
    min-height: 80px;
    font-weight: 400;
}

.highlight mark {
    background: #dbe7ff;
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
}

.match-list {
    margin: 12px 0 0 1.2em;
    display: grid;
    gap: 8px;
    font-weight: 400;
}

.match-list li {
    line-height: 1.6;
    word-break: break-word;
}

.qr-wrap {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
}

.qr-wrap canvas {
    max-width: 100%;
    height: auto;
    background: #fff;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.preview-grid figure {
    margin: 0;
}

.preview-grid figcaption {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.preview-grid img:not([src]) {
    display: none;
}

.preview-grid img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--line);
    background:
        linear-gradient(45deg, #eef2f6 25%, transparent 25%, transparent 75%, #eef2f6 75%),
        linear-gradient(45deg, #eef2f6 25%, transparent 25%, transparent 75%, #eef2f6 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

.dropzone {
    border: 1px dashed #c5d0de;
    border-radius: 12px;
    padding: 22px;
    text-align: center;
    background: #f8fafc;
}

.dropzone.dragover {
    background: var(--soft);
    border-color: #93b4fb;
}

.dropzone .tool-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-weight: 400;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

#file-name {
    color: var(--muted);
    font-weight: 500;
}

.related {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.92rem;
}

.related a {
    text-decoration: none;
    background: var(--soft);
    color: var(--text);
    border-radius: 999px;
    padding: 4px 10px;
}

.related a:hover,
.related a[aria-current="page"] {
    background: #dbe7ff;
    color: var(--accent-dark);
}

.color-stage {
    display: flex;
    gap: 18px;
    align-items: center;
}

.color-stage > .swatch {
    flex: none;
    width: 120px;
    height: 120px;
    border-radius: 14px;
    border: 1px solid var(--line);
    overflow: hidden;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e5eaf1 25%, transparent 25%, transparent 75%, #e5eaf1 75%),
        linear-gradient(45deg, #e5eaf1 25%, transparent 25%, transparent 75%, #e5eaf1 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
}

.swatch-fill {
    width: 100%;
    height: 100%;
}

.preview-caption {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 400;
}

.field-color {
    flex: 0 0 auto;
}

.field-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

input[type="color"] {
    width: 64px;
    height: 42px;
    padding: 4px;
    cursor: pointer;
    background: #fff;
}

.callout {
    background: #fff8eb;
    border: 1px solid #f3d7a1;
    color: #6b4300;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.92rem;
    font-weight: 500;
}

.signature-line {
    margin: 0;
    word-break: break-all;
    font-family: ui-monospace, Consolas, monospace;
    font-weight: 500;
    font-size: 0.9rem;
}

.ad-slot:empty {
    display: none;
}

.ad-slot:not(:empty) {
    margin-top: 24px;
    min-height: 90px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(8px);
    background: #1b2430;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 30;
}

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

.tool-note {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.92rem;
    line-height: 1.6;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.split .field {
    min-width: 0;
}

.split textarea {
    min-height: 480px;
}

.md-preview {
    min-height: 480px;
    max-height: 70vh;
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.md-preview > :first-child {
    margin-top: 0;
}

.md-preview h1,
.md-preview h2,
.md-preview h3,
.md-preview h4,
.md-preview h5,
.md-preview h6 {
    line-height: 1.35;
    margin: 0.9em 0 0.4em;
    font-weight: 700;
}

.md-preview h1 { font-size: 1.5rem; }
.md-preview h2 { font-size: 1.25rem; }
.md-preview h3 { font-size: 1.08rem; }

.md-preview p,
.md-preview ul,
.md-preview ol,
.md-preview blockquote,
.md-preview pre,
.md-preview table {
    margin: 0.6em 0;
}

.md-preview ul,
.md-preview ol {
    padding-left: 1.3em;
}

.md-preview li + li {
    margin-top: 0.2em;
}

.md-preview a {
    color: var(--accent);
}

.md-preview code {
    font-family: ui-monospace, Consolas, monospace;
    background: #f1f5f9;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.92em;
}

.md-preview pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 10px;
    overflow: auto;
}

.md-preview pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.9rem;
}

.md-preview blockquote {
    padding: 2px 12px;
    border-left: 3px solid #93b4fb;
    color: var(--muted);
}

.md-preview hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1em 0;
}

.md-preview table {
    border-collapse: collapse;
    width: 100%;
}

.md-preview th,
.md-preview td {
    border: 1px solid var(--line);
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.md-preview th {
    background: #f8fafc;
}

.md-preview th.center,
.md-preview td.center {
    text-align: center;
}

.md-preview th.right,
.md-preview td.right {
    text-align: right;
}

.md-preview img {
    max-width: 100%;
    height: auto;
}

.md-empty {
    color: var(--muted);
    margin: 0;
}

.presets button[aria-pressed="true"] {
    background: var(--soft);
    border-color: #93b4fb;
    color: var(--accent-dark);
}

.explain {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.6;
}

.cron-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    gap: 8px;
}

.cron-cell {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 0;
}

.cron-cell span,
.cron-cell small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.cron-cell small {
    font-weight: 500;
    margin-top: 2px;
}

.cron-cell code {
    display: block;
    margin: 2px 0;
    font-family: ui-monospace, Consolas, monospace;
    font-weight: 600;
    word-break: break-all;
}

.run-list {
    margin: 0 0 0 1.2em;
    display: grid;
    gap: 6px;
    font-weight: 500;
}

.run-list time {
    font-family: ui-monospace, Consolas, monospace;
}

@media (max-width: 800px) {
    .result-line,
    .hash-row,
    .preview-grid,
    .split {
        grid-template-columns: 1fr;
    }

    .color-stage {
        align-items: flex-start;
    }

    textarea {
        min-height: 140px;
    }

    .split textarea,
    .md-preview {
        min-height: 240px;
    }
}

/* Side-by-side inputs and the text diff result. */
.split-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    min-width: 0;
}

.split-2 textarea {
    min-height: 220px;
    min-width: 0;
}

.tool-form > .diff-result {
    min-width: 0;
}

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

.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;
}

.diff-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted);
}

.diff-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.diff-legend .swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(27, 36, 48, 0.08);
    flex: none;
    overflow: visible;
    background-image: none;
}

.swatch-del {
    background: #fdecea;
}

.swatch-add {
    background: #e8f7ee;
}

.swatch-chg {
    background: #fff6dc;
}

.diff-view {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    min-height: 80px;
    padding: 14px;
    color: var(--muted);
    font-weight: 400;
    line-height: 1.6;
}

.diff-view.has-table {
    padding: 0;
    overflow: auto;
    max-height: 520px;
    max-width: 100%;
    min-width: 0;
    color: var(--text);
}

.diff-table {
    width: 100%;
    min-width: 640px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-family: ui-monospace, Consolas, "Microsoft YaHei", sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.55;
}

.diff-table col.num {
    width: 3.4rem;
}

.diff-table col.tag {
    width: 1.6rem;
}

.diff-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    padding: 8px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.diff-table td {
    border-bottom: 1px solid #eef2f6;
    vertical-align: top;
}

.diff-num {
    text-align: right;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    padding: 3px 6px;
    user-select: none;
}

.diff-tag {
    text-align: center;
    font-weight: 700;
    color: var(--muted);
    padding: 3px 0;
    user-select: none;
}

.diff-tag-del {
    color: #b42318;
}

.diff-tag-add {
    color: #157347;
}

.diff-tag-chg {
    color: #946200;
}

.diff-line {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    padding: 3px 8px;
    color: var(--text);
}

td.diff-del {
    background: #fdecea;
}

td.diff-add {
    background: #e8f7ee;
}

td.diff-chg {
    background: #fff6dc;
}

td.diff-empty {
    color: #c5d0de;
    background: #fbfcfd;
}

.diff-mark-del {
    background: #f6c4bf;
    border-radius: 2px;
}

.diff-mark-add {
    background: #b7e4c7;
    border-radius: 2px;
}

@media (max-width: 800px) {
    .split-2 {
        grid-template-columns: 1fr;
    }

    .split-2 textarea {
        min-height: 140px;
    }
}


