/* in5.cn 工具页通用样式 */
:root {
  --bg: #121212;
  --panel: #1E1E1E;
  --ink: #E0E0E0;
  --muted: #AAAAAA;
  --line: #363636;
  --soft: #272727;
  --acc: #BB86FC;
  --acc-ink: #121212;
  --ok: #70D59A;
  --bad: #FF8A80;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { width: 100%; max-width: 100%; overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body { width: 100%; max-width: 100%; overflow-x: hidden; overflow-wrap: break-word; margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.7 var(--sans); }
a { color: var(--acc); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }

.in5-main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 36px 20px 24px; }
.page-head { margin-bottom: 22px; max-width: 760px; }
.page-head h1 { font-family: var(--serif); font-size: 34px; line-height: 1.25; font-weight: 700; margin: 0 0 8px; letter-spacing: .01em; }
.lede { margin: 0; color: var(--muted); font-size: 16px; }

/* 工具面板 */
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.tool + .tool { margin-top: 16px; }
.tool h2 { font-size: 16px; margin: 0 0 12px; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.row > *, .split > *, .related-grid > * { min-width: 0; max-width: 100%; }
.row + .row, .row + .block, .block + .row, .block + .block { margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field > span { font-size: 13px; }
input[type=text], input[type=number], select, textarea {
  background: #151515; border: 1px solid #444; border-radius: 5px; padding: 7px 10px; color: var(--ink); font-size: 15px;
}
input[type=text].bad { border-color: var(--bad); background: #321D1D; }
input[type=number] { width: 88px; }
textarea { width: 100%; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
input[type=range] { accent-color: var(--acc); }

.color-field { display: inline-flex; align-items: center; border: 1px solid #444; border-radius: 5px; background: #151515; overflow: hidden; }
.color-field input[type=color] { width: 44px; height: 38px; padding: 0; border: 0; background: none; cursor: pointer; }
.color-field input[type=color]::-webkit-color-swatch-wrapper { padding: 4px; }
.color-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.color-field input[type=text] { border: 0; border-left: 1px solid var(--line); border-radius: 0; width: 120px; font-family: var(--mono); text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 5px; cursor: pointer;
  border: 1px solid #444; background: var(--soft); color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.4;
}
.btn:hover { border-color: var(--acc); color: var(--acc); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--acc-ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-mini { border: 1px solid var(--line); background: var(--soft); border-radius: 4px; padding: 1px 8px; font-size: 12px; cursor: pointer; color: var(--muted); }
.btn-mini:hover { color: var(--acc); border-color: var(--acc); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 分段选择 */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #444; border-radius: 5px; overflow: hidden; background: #151515; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 13px; font-size: 14px; color: var(--ink); cursor: pointer; border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--acc); color: var(--acc-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: -2px; }

/* 上传区 */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 180px; padding: 24px; border: 1.5px dashed #555; border-radius: 8px; background: var(--soft); cursor: pointer;
}
.drop strong { font-size: 17px; }
.drop span { color: var(--muted); font-size: 13px; }
.drop.over, .drop:hover { border-color: var(--acc); background: #302840; }
.drop.small { min-height: 110px; }
.status { color: var(--muted); font-size: 14px; min-height: 1.7em; margin: 10px 0 0; }
.note { color: var(--muted); font-size: 13px; }
.warn { color: var(--bad); }

/* 色块与色板 */
.bar { display: flex; height: 44px; border-radius: 6px; overflow: hidden; }
.bar span { min-width: 2px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sw { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.sw-chip { display: block; width: 100%; height: 74px; border: 0; cursor: pointer; }
.sw-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sw-hex { border: 0; background: none; padding: 0; text-align: left; font-family: var(--mono); font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink); }
.sw-hex:hover { color: var(--acc); }
.sw-rgb, .sw-pct { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.cn-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); text-decoration: none; font-size: 13px; }
.cn-tag i { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.cn-tag em { font-style: normal; color: var(--muted); font-size: 11px; }
.cn-tag:hover { color: var(--acc); }

.big-chip { border-radius: 8px; min-height: 140px; display: flex; align-items: flex-end; padding: 14px 16px; font-family: var(--mono); font-size: 20px; font-weight: 600; border: 1px solid rgba(0,0,0,.06); }
.fmt { margin: 0; display: grid; gap: 6px; }
.fmt div { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 8px; }
.fmt dt { color: var(--muted); font-size: 12px; }
.fmt dd { min-width: 0; margin: 0; display: flex; align-items: center; gap: 8px; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.fmt code { min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 14px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.split.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.block > h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.result-line { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; background: var(--soft); border-radius: 6px; }
.result-line code { max-width: 100%; overflow-wrap: anywhere; font-family: var(--mono); font-size: 24px; font-weight: 600; }

/* 检测结果 */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 5px; background: var(--soft); font-size: 14px; }
.checks li > * { min-width: 0; overflow-wrap: anywhere; }
.checks b { font-weight: 600; }
.pass b { color: var(--ok); }
.fail b { color: var(--bad); }

/* 图片网格 */
.canvas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.canvas-grid figure { margin: 0; }
.canvas-grid canvas { width: 100%; height: auto; display: block; border-radius: 6px; background: var(--soft); }
.canvas-grid figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* 说明区块 */
.info { margin-top: 36px; max-width: 820px; }
.info h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 12px; }
.info p { margin: 0 0 10px; }
.howto { margin: 0; padding-left: 1.4em; }
.howto li { margin-bottom: 4px; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details > div { color: var(--muted); padding-top: 6px; }
.related { max-width: none; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.related h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.related ul { margin: 0; padding: 0; list-style: none; }
.related li { padding: 2px 0; }
.related a { color: var(--ink); text-decoration: none; }
.related a:hover { color: var(--acc); }

/* 页脚 */
.site-foot { margin-top: 40px; border-top: 1px solid var(--line); background: var(--panel); }
.site-foot-inner { max-width: 1180px; margin: 0 auto; padding: 24px 20px 30px; display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: center; justify-content: space-between; }
.follow { display: flex; align-items: center; gap: 14px; }
.follow img { border-radius: 4px; border: 1px solid var(--line); }
.follow p { margin: 0; font-size: 14px; }
.follow p span { color: var(--muted); font-size: 13px; }
.follow.no-qr img { display: none; }
.legal { color: var(--muted); font-size: 13px; }
.legal p { margin: 2px 0; }
.legal a { color: var(--muted); margin-right: 12px; text-decoration: none; }
.legal a:hover { color: var(--acc); }

/* 提示 */
.in5-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100% - 28px); text-align: center; overflow-wrap: anywhere;
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 14px; z-index: 100;
  transition: opacity .18s, transform .18s;
}
.in5-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .in5-main { padding-top: 24px; }
  .page-head h1 { font-size: 27px; }
  .tool { padding: 16px; }
  .split, .split.wide-left { grid-template-columns: 1fr; }
  .swatches { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .legal { width: 100%; }
  .legal a { display: inline-block; margin: 3px 8px 3px 0; }
}
@media (max-width: 420px) {
  .in5-main { padding-left: 14px; padding-right: 14px; }
  .tool { padding: 14px; }
  .color-field { max-width: 100%; }
  .color-field input[type=text] { min-width: 0; width: 108px; }
  .swatches { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .canvas-grid, .related-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
