:root { --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", Menlo, monospace; }

/* 卡片网格 */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem 1.25rem; padding: 0; }
.tool-card { display: block; border: 1px solid var(--pico-muted-border-color); border-radius: .75rem; padding: 1rem 1.1rem; text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
.tool-card:hover { box-shadow: var(--pico-box-shadow); transform: translateY(-2px); }
.tool-card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.tool-card .icon { font-size: 1.4rem; margin-right: .45rem; }
.tool-card p { margin: 0; color: var(--pico-muted-color); font-size: .85rem; }
.badge { display: inline-block; font-size: .72rem; color: var(--pico-secondary); border: 1px solid var(--pico-muted-border-color); border-radius: 1rem; padding: .05rem .6rem; margin-bottom: .5rem; }

/* 工具页布局 */
.mono { font-family: var(--mono); }
textarea.mono, pre.mono { font-size: .85rem; line-height: 1.5; }
pre { white-space: pre-wrap; word-break: break-all; max-height: 60vh; overflow: auto; padding: .8rem 1rem; border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; background: var(--pico-card-background-color); }
.output-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.output-actions button, .output-actions .btn { width: auto; padding: .3rem .9rem; font-size: .85rem; margin: 0; }
.detail-hint { color: var(--pico-muted-color); font-size: .8rem; margin-top: .35rem; }

/* ===== 文本对比：双栏 ===== */
:root {
  --d2-del-bg: rgba(234, 74, 90, .16);
  --d2-add-bg: rgba(46, 160, 67, .16);
  --d2-ci-del-bg: rgba(234, 74, 90, .38);
  --d2-ci-add-bg: rgba(46, 160, 67, .38);
  --d2-hatch: rgba(127, 127, 127, .25);
}
[data-theme="dark"] {
  --d2-del-bg: rgba(248, 81, 73, .18);
  --d2-add-bg: rgba(63, 185, 80, .18);
  --d2-ci-del-bg: rgba(248, 81, 73, .40);
  --d2-ci-add-bg: rgba(63, 185, 80, .40);
  --d2-hatch: rgba(170, 170, 170, .20);
}
.diff2-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--pico-muted-border-color); border-radius: .5rem; background: var(--pico-card-background-color); }
.diff2 { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .8rem; line-height: 1.6; }
.diff2 td { padding: 0 .6rem; vertical-align: top; }
/* 行号列：右对齐、不可选中、与内容列之间有分隔线 */
.diff2 .d2-g { width: 1%; min-width: 3.5em; text-align: right; color: var(--pico-muted-color); white-space: nowrap; user-select: none; -webkit-user-select: none; border-right: 1px solid var(--pico-muted-border-color); }
/* 内容列：等宽不折行，长行随容器整体横向滚动；中缝分隔线画在左栏代码列右缘 */
.diff2 .d2-c { white-space: pre; }
.diff2 .d2-c:not(:last-child), .diff2 .d2-hatch:not(:last-child) { border-right: 1px solid var(--pico-muted-border-color); }
.diff2 .d2-del { background: var(--d2-del-bg); }
.diff2 .d2-add { background: var(--d2-add-bg); }
/* 行内字符级高亮 */
.diff2 .d2-ci { border-radius: 2px; }
.diff2 .d2-cr { background: var(--d2-ci-del-bg); }
.diff2 .d2-ca { background: var(--d2-ci-add-bg); }
/* 单侧缺失行的斜纹空位 */
.diff2 .d2-hatch { background-image: repeating-linear-gradient(45deg, var(--d2-hatch) 0 1px, transparent 1px 8px); }
/* 折叠条与上限提示 */
.diff2 .d2-foldrow td { text-align: center; color: var(--pico-muted-color); font-size: .78rem; padding: .2rem .6rem; }
.diff2 .d2-foldrow td[data-fold], .diff2 .d2-foldrow td[data-more] { cursor: pointer; }
.diff2 .d2-foldrow td[data-fold]:hover, .diff2 .d2-foldrow td[data-more]:hover { color: var(--pico-primary); text-decoration: underline; }
.diff2 .d2-note td { text-align: center; color: var(--pico-muted-color); font-size: .78rem; padding: .2rem .6rem; }

/* JSON 高亮 */
.json-hl .k { color: #0550ae; }
.json-hl .s { color: #116329; }
.json-hl .n { color: #953800; }
.json-hl .b { color: #8250df; }
.json-hl .z { color: var(--pico-muted-color); }
[data-theme="dark"] .json-hl .k { color: #79c0ff; }
[data-theme="dark"] .json-hl .s { color: #7ee787; }
[data-theme="dark"] .json-hl .n { color: #ffa657; }
[data-theme="dark"] .json-hl .b { color: #d2a8ff; }

/* 二维码画布 */
.qr-box canvas { max-width: 260px; width: 100%; height: auto; }
/* 透明背景可见衬底：棋盘格 */
.qr-trans { background: repeating-conic-gradient(#cfcfcf 0 25%, #ffffff 0 50%) 0 0 / 20px 20px; border-radius: .5rem; padding: .5rem; width: fit-content; }
[data-theme="dark"] .qr-trans { background: repeating-conic-gradient(#4a4a4a 0 25%, #333333 0 50%) 0 0 / 20px 20px; }

/* 二维码拖放识别区 */
.drop-zone { border: 2px dashed var(--pico-muted-border-color); border-radius: .75rem; padding: 1.25rem 1.25rem .75rem; text-align: center; transition: border-color .15s ease, background .15s ease; }
.drop-zone.drag-on { border-color: var(--pico-primary); background: color-mix(in srgb, var(--pico-primary) 8%, transparent); }
.drop-zone input[type="file"] { display: inline-block; width: auto; max-width: 24rem; }
.drop-zone kbd { padding: .1rem .45rem; border-radius: .3rem; font-size: .8em; }

/* number 输入框隐藏浏览器原生加减箭头，风格与文本输入保持一致 */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* opt-row 主操作按钮：与 3.125rem 输入框同高、同底对齐 */
/* opt-row 主操作按钮：盒模型与 Pico 输入框完全同公式，保证同高同底对齐 */
.opt-btn {
  margin: 0 !important;
  width: auto;
  height: calc(1rem * var(--pico-line-height, 1.5) + var(--pico-form-element-spacing-vertical, .75rem) * 2 + var(--pico-border-width, .0625rem) * 2);
  line-height: var(--pico-line-height, 1.5);
  padding-top: var(--pico-form-element-spacing-vertical, .75rem);
  padding-bottom: var(--pico-form-element-spacing-vertical, .75rem);
}
/* 行内快捷小按钮 */
.mini-btn { margin: 0 !important; width: auto; padding: .3rem .9rem; font-size: .85rem; }
/* Pico 默认 label 有 0.375rem margin-bottom，flex-end 按含 margin 的外沿对齐，
   会把输入框 label 的底边上抬 6px——按钮与提示行因此永远差一截。归零由行间距 gap 承担 */
.opt-row > label { margin-bottom: 0 !important; }
/* Pico 还给 input/select 自身加了 margin-bottom: 1rem，参与 flex 外沿对齐时
   把所在 label/容器的底边抬高一截，按钮因此视觉下坠。opt-row 内一律归零 */
.opt-row :where(input, select, textarea) { margin-bottom: 0 !important; }

/* 输入框与复选框组同行排布：复选组带提示行 + 等高复选区，实时与 Pico 输入框底线对齐 */
.opt-row { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; margin-bottom: .75rem; align-items: flex-end; }
.opt-group { display: flex; flex-direction: column; }
.opt-group .opt-hint { margin: 0 0 .15rem; }
.opt-group .opt-space { height: 3.125rem; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1rem; }
.opt-group label { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }

/* 裁剪工具 */
.crop-stage { position: relative; display: inline-block; max-width: 100%; margin-top: .25rem; line-height: 0; border-radius: .5rem; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.crop-stage img { display: block; max-width: 100%; max-height: 62vh; touch-action: none; border-radius: .5rem; }
.crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .38); border: 1px solid rgba(255, 255, 255, .9); cursor: move; }
.crop-handle { position: absolute; width: 18px; height: 18px; right: 7px; bottom: 7px; border-radius: 50%; background: var(--pico-primary); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); cursor: nwse-resize; }
.crop-badge { position: absolute; top: 7px; left: 7px; line-height: 1.4; font-size: .72rem; color: #fff; background: rgba(0, 0, 0, .55); border-radius: .3rem; padding: .1rem .45rem; white-space: nowrap; pointer-events: none; }

