/* ===========================================================================
   metro.css —— /tools 下全部工具页的共享「简约 Metro」样式
   范本：/tools/convert/audio、/tools/qr（直角 / 细边框 / 白面板 / 单一强调色）
   页面自己只需要写各自的布局类，通用组件样式都在这里。
   =========================================================================== */

/* ---------- 设计令牌 ---------- */
:root{
  --mt-bg:#f7f7f7;
  --mt-surface:#ffffff;
  --mt-panel:#ffffff;
  --mt-field:#ffffff;
  --mt-sub:#fafafa;
  --mt-soft:#f4f8fd;
  --mt-line:#ddd;
  --mt-line-soft:#eee;
  --mt-fill:#dcdcdc;
  --mt-text:#222;
  --mt-text-2:#666;
  --mt-muted:#888;
  --mt-hint:#bbb;
  --mt-accent:#2c5fa8;
  --mt-accent-deep:#244d8a;
  --mt-accent-soft:#eef3fb;
  --mt-accent-line:#c9d8ee;
  --mt-ok:#2e7d32;
  --mt-ok-bg:#f4f8f4;
  --mt-ok-line:#cfe3cf;
  --mt-warn:#b36b00;
  --mt-warn-bg:#fef3e0;
  --mt-warn-line:#f0d0a0;
  --mt-err:#c62828;
  --mt-err-bg:#fde8e8;
  --mt-err-line:#f0c4c4;
  --mt-tag-warn:#fef3e0;
  --mt-tag-warn-t:#b36b00;
  --mt-stage:#fafafa;
  --mt-save:#2e7d32;
  --mt-load:#b36b00;
  --mt-alert:#c62828;
}
html[data-theme="dark"]{
  --mt-bg:#0f1115;
  --mt-surface:#15181d;
  --mt-panel:#15181d;
  --mt-field:#1a1e25;
  --mt-sub:#1a1e25;
  --mt-soft:#1a2433;
  --mt-line:#2a2f38;
  --mt-line-soft:#23282f;
  --mt-fill:#333a45;
  --mt-text:#e8eaed;
  --mt-text-2:#aab3c0;
  --mt-muted:#8b93a1;
  --mt-hint:#5f6774;
  --mt-accent:#5b8cff;
  --mt-accent-deep:#7aa3ff;
  --mt-accent-soft:#18243a;
  --mt-accent-line:#2a3a58;
  --mt-ok:#6cc08a;
  --mt-ok-bg:#14251a;
  --mt-ok-line:#2a4a33;
  --mt-warn:#d9b46a;
  --mt-warn-bg:#2a2318;
  --mt-warn-line:#4a3d22;
  --mt-err:#e08b84;
  --mt-err-bg:#2b1c1c;
  --mt-err-line:#4d2f2d;
  --mt-tag-warn:#332a18;
  --mt-tag-warn-t:#e0bd75;
  --mt-stage:#101318;
  --mt-save:#6cc08a;
  --mt-load:#d9b46a;
  --mt-alert:#e08b84;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body{
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--mt-bg); color: var(--mt-text); padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
}
.wrap{ max-width: 720px; margin: 0 auto; }
.wrap.wide{ max-width: 1080px; }
.wrap.xwide{ max-width: 1280px; }
h1{ font-size: 20px; font-weight: 600; margin: 0 0 4px; }
h2{ font-size: 16px; font-weight: 600; margin: 0 0 10px; }
h3{ font-size: 14px; font-weight: 600; margin: 0 0 8px; }
p{ margin: 0 0 12px; }
a{ color: var(--mt-accent); }
code, kbd, pre, .mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code{ background: var(--mt-sub); border: 1px solid var(--mt-line-soft); padding: 1px 4px; border-radius: 2px; font-size: 12px; }
.hidden{ display: none !important; }

/* 页头 */
.back{
  display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--mt-muted);
  min-height: 24px; line-height: 16px; text-decoration: none; padding: 3px 10px 3px 8px; writing-mode: horizontal-tb; border-radius: 2px;
  background: var(--mt-surface); border: 1px solid var(--mt-line);
  max-width: 240px; margin: 0 0 12px 0; position: relative; z-index: 40;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.back:hover{ color: var(--mt-accent); border-color: var(--mt-accent); }
/* 工具页已自带「返回工具索引」，隐藏全站浮标，避免两个返回入口叠在一起 */
#nav-back-widget{ display: none !important; }
.sub{ color: var(--mt-muted); font-size: 13px; margin: 0 0 20px; }

/* ---------- 面板 / 卡片 ---------- */
.panel{
  background: var(--mt-panel); border: 1px solid var(--mt-line); border-radius: 2px;
  padding: 16px; margin-bottom: 16px;
}
.panel > :last-child{ margin-bottom: 0; }
.panel-title{
  font-size: 13px; font-weight: 600; color: var(--mt-text);
  margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--mt-line-soft);
}
.panel.muted{ background: var(--mt-sub); }
.note{ font-size: 12px; color: var(--mt-muted); line-height: 1.65; }

/* ---------- 按钮 ---------- */
.btn{
  padding: 7px 16px; border: 1px solid #bbb; border-radius: 2px;
  background: var(--mt-surface); color: var(--mt-text);
  font: inherit; font-size: 13px; line-height: 1.4; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  vertical-align: middle;
}
html[data-theme="dark"] .btn{ border-color: var(--mt-line); }
.btn:hover{ background: var(--mt-sub); }
.btn.primary{ background: var(--mt-accent); border-color: var(--mt-accent); color: #fff; }
.btn.primary:hover{ background: var(--mt-accent-deep); border-color: var(--mt-accent-deep); }
.btn.danger{ color: var(--mt-err); border-color: var(--mt-err-line); }
.btn.danger:hover{ background: var(--mt-err-bg); }
.btn.ghost{ border-color: transparent; background: transparent; }
.btn.ghost:hover{ background: var(--mt-sub); border-color: var(--mt-line); }
.btn:disabled, .btn[disabled]{ opacity: .5; cursor: not-allowed; }
.btn.small{ padding: 4px 10px; font-size: 12px; }
.btn.block{ width: 100%; }
.btn-icon{
  width: 26px; height: 26px; padding: 0; border: 1px solid #ccc; border-radius: 2px;
  background: var(--mt-surface); color: var(--mt-muted); cursor: pointer;
  font: inherit; font-size: 14px; line-height: 1; flex-shrink: 0;
}
.btn-icon:hover{ color: var(--mt-accent); border-color: var(--mt-accent); }
.btn-icon.del:hover{ color: var(--mt-err); border-color: var(--mt-err); }
.linkbtn{ color: var(--mt-accent); text-decoration: underline; cursor: pointer; }
.actions{ display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hint{ font-size: 12px; color: var(--mt-muted); }

/* ---------- 表单 ---------- */
input, select, textarea{
  font: inherit; font-size: 13px; color: var(--mt-text);
  background: var(--mt-field); border: 1px solid #ccc; border-radius: 2px;
  padding: 5px 8px; outline: none;
}
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea{ border-color: var(--mt-line); }
input:focus, select:focus, textarea:focus{
  border-color: var(--mt-accent); box-shadow: 0 0 0 2px var(--mt-accent-soft);
}
input[type="file"]{ padding: 0; border: 0; background: transparent; }
input[type="color"]{ padding: 0 2px; width: 42px; height: 30px; cursor: pointer; }
input[type="checkbox"], input[type="radio"]{ accent-color: var(--mt-accent); vertical-align: -2px; }
input[type="range"]{ padding: 0; border: 0; background: transparent; accent-color: var(--mt-accent); width: 140px; box-shadow: none; }
textarea{ width: 100%; min-height: 100px; resize: vertical; line-height: 1.6; }
input[type="text"], input[type="number"], input[type="password"], input[type="search"], input[type="url"], input[type="date"], select{ min-height: 30px; }
select{ cursor: pointer; }

.controls{ display: flex; flex-wrap: wrap; gap: 14px 24px; margin-bottom: 14px; }
.controls > label, .field{ display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mt-text-2); }
.controls > label:last-child{ margin-bottom: 0; }
.controls select, .controls input[type="text"], .controls input[type="number"]{ min-width: 120px; }
.controls .row, .field .row{ display: flex; align-items: center; gap: 8px; }
.val{ font-size: 12px; color: var(--mt-text); min-width: 70px; }
.field-row{ display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 12px; font-size: 13px; }
.field-row > label{ display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mt-text-2); }
.radio-group{ display: flex; gap: 14px; flex-wrap: wrap; }
.radio-group label{ display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--mt-text); cursor: pointer; }

/* ---------- 标签页 ---------- */
.tabs{ display: flex; border-bottom: 1px solid var(--mt-line); margin-bottom: 16px; flex-wrap: wrap; }
.tab{
  padding: 10px 20px; cursor: pointer; font-size: 14px; color: var(--mt-text-2);
  border: 1px solid transparent; border-bottom: none; border-radius: 2px 2px 0 0;
  margin-bottom: -1px; background: transparent; font-family: inherit; font-size: 14px;
}
.tab:hover{ color: var(--mt-text); }
.tab.active{ background: var(--mt-panel); border-color: var(--mt-line); color: var(--mt-text); font-weight: 600; }
/* 子级/分段式标签 */
.mode-tabs{ display: flex; border-bottom: 1px solid var(--mt-line); margin: 8px 0 14px; flex-wrap: wrap; }
.mode-tab{
  padding: 7px 16px; cursor: pointer; font-size: 13px; color: var(--mt-text-2);
  border: 1px solid transparent; border-bottom: none; border-radius: 2px 2px 0 0;
  margin-bottom: -1px; background: transparent; font-family: inherit;
}
.mode-tab:hover{ color: var(--mt-text); }
.mode-tab.active{ background: var(--mt-panel); border-color: var(--mt-line); color: var(--mt-text); font-weight: 600; }
/* 紧凑分段切换（选中=实心强调色） */
.seg{ display: inline-flex; border: 1px solid var(--mt-line); border-radius: 2px; overflow: hidden; }
.seg > button{ padding: 5px 12px; background: var(--mt-surface); color: var(--mt-text); font-size: 12px; cursor: pointer; border: 0; text-align: center; }
.seg > button + button{ border-left: 1px solid var(--mt-line); }
.seg > button:hover{ background: var(--mt-sub); }
.seg > button.active{ background: var(--mt-accent); color: #fff; }

/* ---------- 选择卡片（Metro 方块磁贴） ---------- */
.tiles, .cards-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.tile{
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 14px; background: var(--mt-panel); border: 1px solid var(--mt-line); border-radius: 2px;
  color: inherit; text-decoration: none; cursor: pointer; font: inherit; text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.tile:hover{ border-color: var(--mt-accent); background: var(--mt-soft); }
.tile.active{ border-color: var(--mt-accent); background: var(--mt-accent-soft); box-shadow: inset 3px 0 0 var(--mt-accent); }
.tile .tile-title{ font-size: 14px; font-weight: 600; color: var(--mt-text); }
.tile .tile-desc{ font-size: 12px; color: var(--mt-muted); line-height: 20px; height: 40px; overflow: hidden; }
.tile .tile-meta{ font-size: 11px; color: var(--mt-hint); line-height: 16px; height: 16px; overflow: hidden; }
.tile .tile-ico{
  display: inline-block; min-width: 34px; padding: 3px 6px; margin-bottom: 2px;
  background: var(--mt-accent); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-align: center; border-radius: 1px;
}
.tile:hover .tile-ico{ background: var(--mt-accent-deep); }
.tile-search{
  width: 100%; padding: 8px 10px; border: 1px solid var(--mt-line); border-radius: 2px;
  font: inherit; font-size: 13px; background: var(--mt-panel); color: var(--mt-text);
}
.tile-search:focus{ outline: none; border-color: var(--mt-accent); box-shadow: 0 0 0 1px var(--mt-accent); }
.empty{ grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--mt-muted); font-size: 13px; }

/* ---------- 拖放区 ---------- */
.drop{
  border: 2px dashed #ccc; border-radius: 2px; padding: 32px 16px;
  text-align: center; color: var(--mt-text-2); font-size: 14px;
  background: var(--mt-surface); cursor: pointer; margin-bottom: 16px;
  transition: border-color .15s, background .15s, color .15s;
}
html[data-theme="dark"] .drop{ border-color: var(--mt-line); }
.drop:hover{ border-color: var(--mt-accent-line); }
.drop.over{ border-color: var(--mt-accent); background: var(--mt-accent-soft); color: var(--mt-accent); }
.drop.small{ padding: 18px 12px; font-size: 13px; }
.file-info{ font-size: 13px; margin-top: 10px; color: var(--mt-text-2); }

/* ---------- 状态：进度 / 提示 / 结果 ---------- */
.bar{
  height: 6px; background: var(--mt-line-soft); border-radius: 2px; overflow: hidden;
  margin-top: 12px; display: none;
}
.bar.on{ display: block; }
.bar > i{ display: block; height: 100%; background: var(--mt-accent); width: 0%; transition: width .15s linear; }
.status{ font-size: 13px; margin-top: 8px; min-height: 18px; }
.status.err{ color: var(--mt-err); white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.status.ok{ color: var(--mt-ok); }
.status.warn{ color: var(--mt-warn); }
.result, .result-box{
  margin-top: 14px; padding: 12px; background: var(--mt-ok-bg);
  border: 1px solid var(--mt-ok-line); border-radius: 2px; display: none;
}
.result.on, .result-box.on{ display: block; }
.result .row, .result-box .row{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.result-box .fmt{ color: var(--mt-ok); font-weight: 600; font-size: 13px; }
.result-box .text{
  margin-top: 6px; padding: 8px; background: var(--mt-surface); border: 1px solid var(--mt-line-soft);
  border-radius: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
  word-break: break-all; white-space: pre-wrap; max-height: 200px; overflow: auto;
}
.callout{
  padding: 10px 12px; border: 1px solid var(--mt-accent-line); border-left: 3px solid var(--mt-accent);
  background: var(--mt-accent-soft); border-radius: 2px; font-size: 12px; color: var(--mt-text-2); line-height: 1.65;
  margin-bottom: 16px;
}
.callout.warn{ border-color: var(--mt-warn-line); border-left-color: var(--mt-warn); background: var(--mt-warn-bg); color: var(--mt-warn); }
.callout.err{ border-color: var(--mt-err-line); border-left-color: var(--mt-err); background: var(--mt-err-bg); color: var(--mt-err); }
.chip{
  display: inline-block; padding: 2px 8px; font-size: 11px; border-radius: 2px;
  background: var(--mt-accent-soft); color: var(--mt-accent); border: 1px solid var(--mt-accent-line);
}
.chip.warn{ background: var(--mt-warn-bg); color: var(--mt-warn); border-color: var(--mt-warn-line); }
.chip.err{ background: var(--mt-err-bg); color: var(--mt-err); border-color: var(--mt-err-line); }
.chip.ok{ background: var(--mt-ok-bg); color: var(--mt-ok); border-color: var(--mt-ok-line); }

/* ---------- 列表 / 行 ---------- */
.list{ background: var(--mt-panel); border: 1px solid var(--mt-line); border-radius: 2px; overflow: hidden; }
.list-item{
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--mt-line-soft);
  text-decoration: none; color: inherit; font-size: 13px;
}
.list-item:last-child{ border-bottom: none; }
.list-item:hover{ background: var(--mt-soft); }
.rowline{ display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--mt-sub); border: 1px solid var(--mt-line-soft); border-radius: 2px; flex-wrap: wrap; }
.rows{ display: flex; flex-direction: column; gap: 8px; }

/* ---------- 表格 ---------- */
.table-wrap{ overflow: auto; border: 1px solid var(--mt-line); border-radius: 2px; background: var(--mt-panel); }
table{ border-collapse: collapse; width: 100%; font-size: 13px; }
table th, table td{ padding: 7px 10px; border-bottom: 1px solid var(--mt-line-soft); text-align: left; white-space: nowrap; }
table th{ background: var(--mt-sub); font-weight: 600; font-size: 12px; color: var(--mt-text-2); position: sticky; top: 0; z-index: 1; }
table tr:last-child td{ border-bottom: none; }
table tbody tr:hover{ background: var(--mt-soft); }

/* ---------- 预览 / 网格 ---------- */
.preview{
  margin-top: 14px; padding: 14px; background: var(--mt-stage);
  border: 1px solid var(--mt-line-soft); border-radius: 2px; text-align: center;
}
.preview canvas, .stage canvas{ max-width: 100%; height: auto; background: #fff; }
.cell{
  border: 1px solid var(--mt-line); background: var(--mt-surface); border-radius: 2px;
  padding: 8px; text-align: center; display: flex; flex-direction: column; gap: 6px;
}
.cell .cap{ font-size: 11px; color: var(--mt-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 角标 / 统计 ---------- */
.stats{ display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.stat{ background: var(--mt-panel); border: 1px solid var(--mt-line); border-radius: 2px; padding: 12px 14px; }
.stat .k{ font-size: 12px; color: var(--mt-muted); margin-bottom: 4px; }
.stat .v{ font-size: 20px; font-weight: 600; color: var(--mt-text); }

/* ---------- 页脚 ---------- */
.foot{ color: var(--mt-muted); font-size: 12px; text-align: center; margin: 20px 0 0; line-height: 1.8; }
.foot code{ background: var(--mt-sub); padding: 1px 4px; border-radius: 2px; font-size: 11px; }

/* ---------- 打印 ---------- */
@media print{
  body{ background: #fff; color: #000; padding: 0; }
  .panel, .drop, .tabs, .btn, .back, .foot, #nav-back-widget{ display: none !important; }
}

@media (max-width: 480px){
  body{ padding: 16px 12px; }
  .panel{ padding: 12px; }
  .tab{ padding: 9px 14px; }
}

/* ---------- 工具页公用小工具类 ---------- */
.mt4{ margin-top: 4px !important; } .mt6{ margin-top: 6px !important; }
.mt8{ margin-top: 8px !important; } .mt12{ margin-top: 12px !important; } .mt16{ margin-top: 16px !important; }
.mb4{ margin-bottom: 4px !important; } .mb8{ margin-bottom: 8px !important; } .mb12{ margin-bottom: 12px !important; }
.w-full{ width: 100% !important; } .nowrap{ white-space: nowrap; }
.right{ margin-left: auto; } .spacer{ flex: 1; }
.text-mut{ color: var(--mt-muted); } .text-err{ color: var(--mt-err); } .text-ok{ color: var(--mt-ok); }
.examples{ display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
/* 大数计算器 */
.expr{ min-height: 74px; max-height: 200px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }
.out{ min-height: 120px; max-height: 260px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.stats .stat .v{ font-size: 16px; word-break: break-all; }
.spin{
  display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px;
  border: 2px solid var(--mt-accent-line); border-top-color: var(--mt-accent); border-radius: 50%;
  animation: mt-spin .7s linear infinite;
}
@keyframes mt-spin{ to { transform: rotate(360deg); } }


/* ============================================================
   工具页专用组件（类名沿用各页原有命名，统一在这里出样式）
   ============================================================ */

/* ---------- 图片工具 / 转换：结果列表 ---------- */
.img-list{ display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; margin-top: 12px; }
.img-cell{
  position: relative; background: var(--mt-surface); border: 1px solid var(--mt-line);
  border-radius: 2px; padding: 6px; text-align: center; cursor: pointer;
}
.img-cell.selected{ border-color: var(--mt-accent); box-shadow: 0 0 0 1px var(--mt-accent) inset; }
.img-cell .thumb{ width: 100%; height: 76px; object-fit: contain; background: var(--mt-stage); display: block; }
.img-cell .cap{ font-size: 11px; color: var(--mt-text-2); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-cell .del{
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 16px; padding: 0;
  border: 1px solid var(--mt-line); border-radius: 2px; background: var(--mt-panel); color: var(--mt-muted);
  font-size: 12px; cursor: pointer;
}
.img-cell .del:hover{ color: var(--mt-err); border-color: var(--mt-err); }
.result-list{ display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.result-item{ background: var(--mt-surface); border: 1px solid var(--mt-line); border-radius: 2px; padding: 8px; text-align: center; }
.result-item img.preview{ max-width: 100%; max-height: 130px; height: auto; background: var(--mt-stage); border: 0; margin: 0; padding: 0; }
.result-item .meta{ font-size: 11px; color: var(--mt-text-2); margin-top: 6px; line-height: 1.5; }
.result-item .meta .name{ color: var(--mt-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-item .meta .info.ok{ color: var(--mt-ok); }
.result-item .meta .info.err{ color: var(--mt-err); }
.result-item .actions{ justify-content: center; margin-top: 6px; }
.preview-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }

/* ---------- 图片裁剪 ---------- */
.crop-stage{ position: relative; display: inline-block; max-width: 100%; background: var(--mt-stage); border: 1px solid var(--mt-line-soft); user-select: none; touch-action: none; }
.crop-stage img{ display: block; max-width: 100%; height: auto; pointer-events: none; }
.crop-box{ position: absolute; border: 1px solid var(--mt-accent); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); cursor: move; }
.crop-box .handle{ position: absolute; width: 10px; height: 10px; background: var(--mt-panel); border: 1px solid var(--mt-accent); }
.crop-box .h-tl{ left: -5px; top: -5px; cursor: nwse-resize; }
.crop-box .h-tr{ right: -5px; top: -5px; cursor: nesw-resize; }
.crop-box .h-bl{ left: -5px; bottom: -5px; cursor: nesw-resize; }
.crop-box .h-br{ right: -5px; bottom: -5px; cursor: nwse-resize; }
.crop-box .h-t{ left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.crop-box .h-b{ left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.crop-box .h-l{ top: 50%; left: -5px; margin-top: -5px; cursor: ew-resize; }
.crop-box .h-r{ top: 50%; right: -5px; margin-top: -5px; cursor: ew-resize; }
.crop-info{ font-size: 12px; color: var(--mt-text-2); margin-top: 8px; }

/* ---------- 成绩分析 ---------- */
.num-sm{ width: 76px; }
.cards{ display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.card{ background: var(--mt-surface); border: 1px solid var(--mt-line); border-radius: 2px; padding: 12px 14px; }
.card .c-title{ font-size: 13px; font-weight: 600; color: var(--mt-text); padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--mt-line-soft); }
.card .c-row{ display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--mt-text-2); padding: 3px 0; }
.card .c-row strong{ color: var(--mt-text); font-weight: 600; }
.card .c-row.big strong{ font-size: 18px; color: var(--mt-accent); }
.chart-toolbar{ display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.chart-wrap{ padding: 12px; background: var(--mt-stage); border: 1px solid var(--mt-line-soft); border-radius: 2px; }
.chart-wrap canvas{ max-height: 360px; }
#map-table td.sample{ color: var(--mt-muted); font-size: 12px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
#map-table select{ min-width: 120px; min-height: 28px; }
.rank-wrap{ max-height: 480px; overflow: auto; }
.rank-wrap table td, .rank-wrap table th{ font-size: 12px; }

/* ---------- 工具索引 ---------- */
.sec-title{
  font-size: 13px; font-weight: 600; color: var(--mt-text); margin: 22px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.sec-title::after{ content: ""; flex: 1; height: 1px; background: var(--mt-line); }
.sec-count{ order: 3; font-size: 11px; font-weight: 400; color: var(--mt-muted); }
.cards-grid .tile .tile-meta{ margin-top: auto; font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- 工具栏位于页首的工具（如 gama）：返回链接做成工具条里的一颗按钮 ---------- */
a.back.back--bar{
  display: inline-block; margin: 12px 16px 0; padding: 6px 12px; font-size: 13px;
  background: var(--mt-panel); border: 1px solid var(--mt-line); border-radius: 2px;
  color: var(--mt-accent);
}
a.back.back--bar:hover{ border-color: var(--mt-accent); background: var(--mt-soft); text-decoration: none; }
@media (max-width: 720px){ a.back.back--bar{ margin: 10px 12px 0; } }

/* ---------- 全局元素兜底：直接写 <button>/<input>/<textarea> 的老页面也保持 Metro 外观 ---------- */
button:not([class]):not(.seg > button){
  padding: 7px 16px; border: 1px solid #bbb; border-radius: 2px;
  background: var(--mt-surface); color: var(--mt-text);
  font: inherit; font-size: 13px; line-height: 1.4; cursor: pointer; text-align: center;
}
button:not([class]):hover{ background: var(--mt-sub); border-color: var(--mt-accent); }
input:not([type]), input[type="text"], input[type="number"], input[type="search"], input[type="url"],
input[type="password"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"],
select, textarea{
  font: inherit; font-size: 13px; color: var(--mt-text);
  background: var(--mt-field); border: 1px solid #ccc; border-radius: 2px;
  padding: 5px 8px; outline: none;
}
textarea{ width: 100%; min-height: 100px; resize: vertical; line-height: 1.6; }
