.thermal-tool .files { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.thermal-tool .file { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); min-width: 0; }
.thermal-tool .file input[type="file"] { display: block; font-size: 0.85rem; font-weight: 400; width: 100%; min-width: 0; max-width: 100%; color: var(--text); }

.thermal-tool .status { background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; }
.thermal-tool .status.err { color: var(--danger); }

.thermal-tool .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.thermal-tool .panel { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.thermal-tool .panel canvas { width: 100%; display: block; touch-action: none; border-radius: 6px; background: #e2e8f0; cursor: crosshair; }
.thermal-tool .panel.next canvas { outline: 3px solid var(--primary); outline-offset: 2px; }
.thermal-tool figcaption { font-size: 0.8rem; color: var(--muted); display: flex; justify-content: space-between; }
.thermal-tool .num { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }

.thermal-tool .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.thermal-tool .tools button,
.thermal-tool .tools select { font: inherit; font-size: 0.9rem; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; }
.thermal-tool .tools button:hover { border-color: var(--primary); color: var(--primary); }
.thermal-tool .tools button.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.thermal-tool .tools button.primary:hover { background: var(--primary-hover); }
.thermal-tool button:focus-visible,
.thermal-tool select:focus-visible,
.thermal-tool input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.thermal-tool .result { display: grid; gap: 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.thermal-tool .result h3 { font-size: 1.05rem; font-weight: 700; color: #1e293b; }
.thermal-tool .ctrls { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.thermal-tool .ctrl { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); }
.thermal-tool .ctrl input { width: 100%; accent-color: var(--primary); }
.thermal-tool #out { width: 100%; border-radius: 6px; display: block; }
.thermal-tool .errs { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.thermal-tool .errs b { color: var(--text); }
.thermal-tool .hint { font-size: 0.82rem; color: var(--muted); margin: 0; }
.thermal-tool [hidden] { display: none !important; }

#loupe { position: fixed; top: 12px; right: 12px; z-index: 5; border: 2px solid var(--primary); border-radius: 50%; overflow: hidden; width: 150px; height: 150px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); pointer-events: none; background: #000; }
#loupe[hidden] { display: none; }
#loupe canvas { width: 150px; height: 150px; display: block; }

.thermal-guide ol { padding-left: 20px; margin-bottom: 16px; }
.thermal-guide details { border-bottom: 1px solid var(--border); padding: 10px 0; }
.thermal-guide summary { font-weight: 600; cursor: pointer; font-size: 0.95rem; color: #1e293b; }
.thermal-guide details p { margin: 8px 0 0; }

@media (max-width: 680px) {
  .thermal-card { padding: 18px; }
}
.thermal-tool .file { position: relative; }
.thermal-tool .file .pick { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; font-weight: 400; color: var(--text); }
.thermal-tool .file .pick b { flex: none; padding: 5px 10px; border: 1px solid #767676; border-radius: 6px; background: #efefef; font-weight: 400; cursor: pointer; }
.thermal-tool .file .pick i { font-style: normal; min-width: 0; max-width: 100%; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thermal-tool .file:has(.pick) input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
