/* 工具页（美化 / 解码） */
.nav__inner--app { padding: 0 var(--s-5); }

/* ---------- 美化工作台 ----------
   三栏：内容 320 · 画布 自适应 · 外观 320
   面板规范：头部 52 · 左右内边距 20 · 区块上下 20 · 区块内间距 12
   层级：面板标题 14/22 600 → 区块标题 13/20 600 → 标签 13/20 400 次要 → 提示 12/20 */
body.app-body { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; }
.panel { min-height: 0; display: flex; flex-direction: column; background: var(--page-bg); }
.panel--left { border-right: 1px solid var(--line-200); }
.panel--right { border-left: 1px solid var(--line-200); }
.panel__head { flex-shrink: 0; height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--s-5); border-bottom: 1px solid var(--line-200); }
.panel__title { font-size: var(--fs-14); line-height: var(--lh-14); font-weight: 600; }
.panel__step { font-size: var(--fs-12); line-height: 1; font-weight: 600; color: var(--ink-400); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.panel__tabs { flex-shrink: 0; padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--line-200); }
.panel__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--s-5) var(--s-6); scrollbar-width: thin; scrollbar-color: var(--line-300) transparent; }

.sec { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5) 0; }
.sec + .sec { border-top: 1px solid var(--line-200); }
.sec__title { font-size: var(--fs-13); line-height: var(--lh-13); font-weight: 600; color: var(--ink-900); }
.form { display: flex; flex-direction: column; gap: var(--s-4); }
.label { font-weight: 500; }

/* 属性行：左标签 56 + 右控件，行高 36 */
.prop { display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: var(--s-3); min-height: 36px; }
.prop__label { font-size: var(--fs-13); line-height: var(--lh-13); color: var(--ink-500); }
.prop .color { height: 36px; }
.prop .range { height: 36px; }
.seg--sm button { height: 28px; }

/* 内容类型 */
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.type { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 60px; border: 1px solid var(--line-200); border-radius: var(--r-10); background: var(--white); font-size: var(--fs-12); line-height: 1; font-weight: 500; color: var(--ink-500); transition: all .15s var(--ease); }
.type svg { width: 20px; height: 20px; }
.type:hover { color: var(--ink-900); border-color: var(--line-300); }
.type.is-active { color: var(--brand-600); border-color: var(--brand-500); background: var(--brand-50); }
.privacy { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-10); background: var(--bg-50); font-size: var(--fs-12); line-height: var(--lh-12); color: var(--ink-500); }
.privacy svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--mint-500); }

/* 预设 */
.presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2); }
.preset { position: relative; padding: 3px; border: 1px solid var(--line-200); border-radius: var(--r-10); background: #fff; transition: all .15s var(--ease); }
.preset:hover { border-color: var(--line-300); transform: translateY(-1px); }
.preset.is-active { border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-100); }
.preset svg, .preset canvas { width: 100%; height: auto; border-radius: 6px; display: block; }
.preset[data-tip]:hover::after, .opt[data-tip]:hover::after, .lg[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: var(--r-6); background: #0E1116; color: #fff; font-size: var(--fs-12); line-height: 16px; white-space: nowrap; z-index: 5; pointer-events: none; }

/* 形状选项：图标按钮，名称用 tooltip，减少文字噪音 */
.opts { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s-2); }
.opts--inline { display: flex; gap: var(--s-2); }
.opt { position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line-200); border-radius: var(--r-8); background: var(--white); color: var(--ink-700); transition: all .15s var(--ease); }
.opt--sm { width: 36px; height: 36px; aspect-ratio: auto; }
.opt:hover { border-color: var(--line-300); color: var(--ink-900); }
.opt.is-active { border-color: var(--brand-500); color: var(--brand-500); background: var(--brand-50); }
.opt .shape { width: 18px; height: 18px; }
.opt--sm .shape { width: 18px; height: 18px; }

/* 色板 */
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.sw { aspect-ratio: 1; border-radius: var(--r-6); border: 1px solid var(--line-300); cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.sw:hover { transform: scale(1.08); }
.sw.is-active { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--brand-500); }

/* Logo 网格 */
.logos-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2); }
.lg { position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line-200); border-radius: var(--r-10); background: var(--white); transition: all .15s var(--ease); }
.lg:hover { border-color: var(--line-300); background: var(--bg-50); }
.lg.is-active { border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-100); }
.lg img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.lg svg { width: 18px; height: 18px; color: var(--ink-500); }
.lg--none span { font-size: var(--fs-12); color: var(--ink-500); }

/* 画布区：状态栏 / 画布 / 导出栏 */
.stage { min-height: 0; display: grid; grid-template-rows: 52px minmax(0, 1fr) auto; background: var(--page-bg); }
.stage__bar { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-6); border-bottom: 1px solid var(--line-200); background: var(--page-bg); }
.stage__tip { font-size: var(--fs-13); line-height: var(--lh-13); color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage__center { min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-5); padding: var(--s-8) var(--s-6); }
.canvas { width: min(100%, 400px); padding: var(--s-5); border-radius: var(--r-20); box-shadow: var(--sh-lg); }
.canvas__qr { aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--r-12); overflow: hidden; }
.canvas__qr svg, .canvas__qr canvas { width: 100% !important; height: 100% !important; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #F2F4F7 25%, transparent 25%), linear-gradient(-45deg, #F2F4F7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #F2F4F7 75%), linear-gradient(-45deg, transparent 75%, #F2F4F7 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.stats { margin: 0; width: min(100%, 400px); display: grid; grid-template-columns: repeat(4, 1fr); }
.stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stats div + div { border-left: 1px solid var(--line-200); }
.stats dt { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--ink-500); }
.stats dd { margin: 0; font-size: var(--fs-14); line-height: var(--lh-14); font-weight: 600; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.export { margin: 0 var(--s-6) var(--s-6); align-self: end; justify-self: center; width: min(calc(100% - 48px), 560px); display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2); border-radius: var(--r-16); box-shadow: var(--sh-lg); }
.export__fmt { flex: 1; width: auto; }
.export__size { width: 104px; height: 38px; }
.export__copy { width: 38px; height: 38px; padding: 0; }
.export__dl { height: 38px; padding: 0 var(--s-5); }

/* 上传区 */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2); text-align: center; padding: var(--s-8) var(--s-6); border: 1.5px dashed var(--line-300); border-radius: var(--r-16); background: var(--bg-50); cursor: pointer; transition: all .2s var(--ease); }
.drop:hover, .drop.is-over { border-color: var(--brand-500); background: var(--brand-50); }
.drop svg { width: 24px; height: 24px; color: var(--brand-500); }
.drop--sm { padding: var(--s-6) var(--s-4); }
.drop__title { font-size: var(--fs-14); line-height: var(--lh-14); font-weight: 600; color: var(--ink-900); }
.pay-result { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); padding: var(--s-3); border-radius: var(--r-10); background: var(--bg-50); }
.pay-result code { font-family: var(--mono); font-size: var(--fs-12); line-height: var(--lh-12); color: var(--ink-700); word-break: break-all; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 288px minmax(0, 1fr) 300px; }
  .presets, .logos-grid { grid-template-columns: repeat(4, 1fr); }
  .opts { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  body.app-body { height: auto; overflow: auto; }
  .workspace { display: flex; flex-direction: column; }
  .stage { order: -1; grid-template-rows: auto auto auto; }
  .panel--left, .panel--right { border: 0; border-top: 1px solid var(--line-200); }
  .panel__scroll { overflow: visible; }
  .export { flex-wrap: wrap; }
  .export__fmt { flex-basis: 100%; }
  .export__dl { flex: 1; }
}

/* ---------- 解码页 ---------- */
.dec { padding: var(--s-16) 0 var(--s-24); }
.dec__head { text-align: center; max-width: 640px; margin: 0 auto var(--s-12); }
.dec__head h1 { font-size: var(--fs-40); line-height: var(--lh-40); letter-spacing: -0.02em; }
.dec__head p { text-wrap: balance; margin-top: var(--s-3); font-size: var(--fs-16); line-height: var(--lh-16); color: var(--ink-500); }
.dec__box { max-width: 800px; margin: 0 auto; padding: var(--s-2); border-radius: var(--r-20); }
.dec__tabs { padding: var(--s-2) var(--s-2) 0; max-width: 360px; }
.dec__body { padding: var(--s-4) var(--s-2) var(--s-2); }
.dec .drop { min-height: 280px; gap: var(--s-3); }
.dec .drop svg { width: 40px; height: 40px; padding: 8px; box-sizing: content-box; border-radius: var(--r-12); background: var(--white); box-shadow: var(--sh-sm); }
.drop__keys { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--ink-500); }
kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border: 1px solid var(--line-300); border-bottom-width: 2px; border-radius: 4px; background: var(--white); font-family: var(--font); font-size: 11px; color: var(--ink-700); }
.cam { position: relative; aspect-ratio: 4/3; border-radius: var(--r-16); overflow: hidden; background: var(--ink-900); display: grid; place-items: center; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam__frame { position: absolute; width: 56%; aspect-ratio: 1; border-radius: var(--r-16); box-shadow: 0 0 0 999px rgba(14,17,22,.45); outline: 2px solid rgba(255,255,255,.9); }
.cam__tip { position: absolute; bottom: var(--s-4); left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: var(--r-full); background: rgba(14,17,22,.6); color: #fff; font-size: var(--fs-12); }
.cam__empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-4); color: rgba(255,255,255,.72); font-size: var(--fs-14); }
.url-row { display: flex; gap: var(--s-2); }

.results { max-width: 800px; margin: var(--s-6) auto 0; display: flex; flex-direction: column; gap: var(--s-4); }
.res { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-6); padding: var(--s-6); border-radius: var(--r-16); animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.res__img { position: relative; border-radius: var(--r-12); overflow: hidden; background: var(--bg-50); border: 1px solid var(--line-200); align-self: start; }
.res__img canvas { width: 100%; height: auto; }
.res__main { min-width: 0; display: flex; flex-direction: column; gap: var(--s-4); }
.res__top { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.res__label { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--ink-500); margin-bottom: 6px; }
.res__data { position: relative; padding: var(--s-3) var(--s-4); padding-right: 48px; border-radius: var(--r-10); background: var(--bg-50); border: 1px solid var(--line-200); font-family: var(--mono); font-size: var(--fs-14); line-height: var(--lh-14); color: var(--ink-900); word-break: break-all; white-space: pre-wrap; max-height: 200px; overflow: auto; }
.res__copy { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: var(--r-8); background: transparent; color: var(--ink-500); display: grid; place-items: center; }
.res__copy:hover { background: var(--bg-100); color: var(--ink-900); }
.res__copy svg { width: 16px; height: 16px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-2) var(--s-4); }
.kv div { display: flex; flex-direction: column; gap: 2px; }
.kv dt { font-size: var(--fs-12); line-height: var(--lh-12); color: var(--ink-500); }
.kv dd { margin: 0; font-size: var(--fs-14); line-height: var(--lh-14); color: var(--ink-900); font-weight: 500; word-break: break-all; }
.res__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.warn { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-3); border-radius: var(--r-10); background: var(--warn-50); color: #B54708; font-size: var(--fs-13); line-height: var(--lh-13); }
.empty { padding: var(--s-6); border-radius: var(--r-16); text-align: center; color: var(--ink-500); }
.empty strong { display: block; color: var(--ink-900); font-size: var(--fs-16); line-height: var(--lh-16); margin-bottom: 4px; font-weight: 600; }

.tips { max-width: 800px; margin: var(--s-12) auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); }
.tip { padding: var(--s-5); border-radius: var(--r-16); background: var(--white); border: 1px solid var(--line-200); }
.tip h3 { font-size: var(--fs-14); line-height: var(--lh-14); }
.tip p { margin-top: 4px; font-size: var(--fs-13); line-height: var(--lh-13); color: var(--ink-500); }

@media (max-width: 768px) {
  .dec { padding: var(--s-10) 0 var(--s-16); }
  .dec__head h1 { font-size: var(--fs-32); line-height: var(--lh-32); }
  .res { grid-template-columns: 1fr; padding: var(--s-4); }
  .res__img { max-width: 200px; }
  .tips { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .nav__inner--app { padding: 0 var(--s-4); gap: var(--s-2); }
  #resetBtn { width: 44px; height: 44px; padding: 0; }
  #resetBtn span { display: none; }
  .stage__bar { padding: 0 var(--s-4); min-width: 0; overflow: hidden; }
  .stage__bar > * { min-width: 0; }
  .stage__center { padding: var(--s-6) var(--s-4); min-width: 0; }
}

/* 码点 13 种：7 列 */
.opts[data-group="dots"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
/* 上传已有二维码 */
.import { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-5) 0 0; padding: var(--s-3); border: 1px dashed var(--line-300); border-radius: var(--r-12); background: var(--bg-50); cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.import:hover, .import.is-over { border-color: var(--brand-500); background: var(--brand-50); }
.import__icon { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: var(--r-10); background: var(--white); color: var(--brand-500); box-shadow: inset 0 0 0 1px var(--line-200); }
.import__icon svg { width: 20px; height: 20px; }
.import__text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.import__text b { font-size: var(--fs-14); line-height: 20px; font-weight: 600; color: var(--ink-900); }
.import__text span { font-size: var(--fs-12); line-height: 18px; color: var(--ink-500); }
