.tool-box{
  --bg: #f5f5fb; --panel: #ffffff; --panel-2: #eeecf9; --line: #dbd8f0;
  --accent: #5847c9; --accent-soft: #e1ddf7; --accent-dim: #f4f2fb;
  --text: #201c38; --muted: #5f5a80; --muted-2: #9a94ba; --bad: #b3402f;
  --mid: #b7791f; --high: #b3402f;
}

/* ---- FILE INPUT ---- */
.tool-box .tool-input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  margin-bottom: 22px;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
}

/* ---- SLIDER ---- */
.tool-box .slider-wrapper {
  position: relative;
  margin-bottom: 30px;
  height: 50px;
}

.tool-box .slider-range {
  --fill: 0%;
  width: 100%;
  height: 10px;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill), var(--line) var(--fill), var(--line) 100%);
  transition: background 0.15s ease;
}

.tool-box .slider-range.mid {
  background: linear-gradient(to right, var(--mid) 0%, var(--mid) var(--fill), var(--line) var(--fill), var(--line) 100%);
}
.tool-box .slider-range.high {
  background: linear-gradient(to right, var(--high) 0%, var(--high) var(--fill), var(--line) var(--fill), var(--line) 100%);
}

.tool-box .slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  position: relative;
  z-index: 2;
}

.tool-box .slider-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.tool-box .slider-tooltip {
  position: absolute;
  top: -34px;
  padding: 4px 10px;
  background: var(--text);
  color: #fff;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  font-family: 'JetBrains Mono', monospace;
  transform: translateX(-50%);
  pointer-events: none;
  transition: left 0.1s;
}

/* ---- INTERACTIVE CANVAS PREVIEW ---- */
.tool-box .preview-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
  min-height: 60px;
}

.tool-box .blur-canvas-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
}

.tool-box .blur-canvas-wrap {
  display: flex;
  justify-content: center;
  background: repeating-conic-gradient(var(--panel-2) 0% 25%, var(--panel) 0% 50%) 50% / 20px 20px;
  padding: 10px;
}

.tool-box .blur-canvas-wrap canvas {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  cursor: crosshair;
  touch-action: none; /* required so dragging to select a region doesn't scroll the page on touch devices */
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.tool-box .blur-canvas-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.tool-box .blur-hint {
  font-size: 12px;
  color: var(--muted);
}

.tool-box .blur-clear-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.tool-box .blur-clear-btn:hover{ border-color: var(--accent); color: var(--accent); }

.tool-box .blur-empty {
  width: 100%;
  text-align: center;
  color: var(--muted-2);
  font-size: 13.5px;
  padding: 30px 0;
}

.tool-box .blur-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: blur-spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes blur-spin{ to{ transform: rotate(360deg); } }

/* ---- TABLE ---- */
.tool-box .table-wrapper {
  overflow-x: auto;
}

.tool-box .table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  min-width: 480px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.tool-box .table-wrapper th,
.tool-box .table-wrapper td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: center;
}

.tool-box .table-wrapper tr:last-child td{ border-bottom: none; }
.tool-box .table-wrapper tr:nth-child(even) td{ background: var(--accent-dim); }

.tool-box .table-wrapper th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.tool-box .blur-thumb {
  max-width: 64px;
  max-height: 64px;
  border-radius: 6px;
}

.tool-box .blurVal {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--accent);
}

.tool-box .blur-download-btn {
  padding: 9px 18px;
  font-size: 12.5px;
  font-weight: 700;
  border: none;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.tool-box .blur-download-btn:hover{ filter: brightness(1.08); transform: translateY(-1px); }
.tool-box .blur-download-btn:active{ transform: translateY(0); }

/* ---- DOWNLOAD ALL BUTTON ---- */
.tool-box .download {
  display: none;
  text-align: right;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.tool-box .download.show{ display: block; }

.tool-box .app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: filter .15s ease, transform .12s ease;
}
.tool-box .app:hover{ filter: brightness(1.08); transform: translateY(-1px); }
.tool-box .app:active{ transform: translateY(0); }
.tool-box .app[disabled]{ opacity: .65; cursor: not-allowed; transform: none; }

/* RESPONSIVE */
@media (max-width: 500px) {
  .tool-box .blur-canvas-actions { flex-direction: column; align-items: stretch; text-align: center; }
  .tool-box .download { text-align: center; }
  .tool-box .app { width: 100%; }
}
