:root {
  --bg: #08090c;
  --panel: #0e1015;
  --titlebar: #14171e;
  --border: #22252e;
  --border-soft: #1a1d24;
  --text: #e6e8ee;
  --text-dim: #aab0bd;
  --muted: #5c6270;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.16);
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #7c8494;
  --mark-bg: rgba(45, 212, 191, 0.22);
  --mark-text: #6ee7db;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(45, 212, 191, 0.05), transparent),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(124, 132, 148, 0.04), transparent);
}

body {
  margin: 0;
  color: var(--text);
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 70px;
}

/* ---- Terminal window chrome ---- */

.window {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 20px 50px -25px rgba(0, 0, 0, 0.6);
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--titlebar);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green { background: #28c840; }

.titlebar-label {
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.panel-body {
  padding: 26px 28px;
}

/* ---- Command line ---- */

.cmd-line {
  font-size: 14.5px;
  margin-bottom: 26px;
  color: var(--text);
}
.prompt { color: var(--accent); margin-right: 10px; font-weight: 700; }
.cmd { color: var(--text-dim); }
.cursor {
  color: var(--accent);
  animation: blink 1.1s step-end infinite;
  margin-left: 1px;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---- Fields ---- */

.field-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
  margin-top: 20px;
}
.field-label:first-of-type { margin-top: 0; }

.field {
  width: 100%;
  background: #0a0c10;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field::placeholder { color: #454a56; }

.row {
  display: flex;
  gap: 20px;
}
.col-main { flex: 3; }
.col-side { flex: 1; min-width: 130px; }

/* ---- Buttons ---- */

.actions {
  margin-top: 26px;
  display: flex;
  gap: 12px;
}

.btn {
  border: none;
  border-radius: 7px;
  padding: 13px 20px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.32; cursor: not-allowed; }
.btn-icon { font-size: 10px; }

.btn-start {
  background: var(--accent);
  color: #04211d;
}
.btn-start:hover:not(:disabled) {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-stop {
  background: transparent;
  color: var(--error);
  border: 1px solid #3a2323;
}
.btn-stop:hover:not(:disabled) { background: #1a1010; }

/* ---- Log window ---- */

.log-window .titlebar { position: relative; }

.status {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 5px;
}
.status-idle { color: var(--muted); background: #1a1c22; }
.status-running {
  color: #04211d;
  background: var(--accent);
  animation: pulse-glow 1.6s ease-in-out infinite;
}
.status-done { color: #052b1c; background: var(--success); }
.status-stopped { color: #3a2f10; background: var(--warning); }
.status-error { color: #fff; background: var(--error); }

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(45, 212, 191, 0); }
}

.timer {
  font-size: 12px;
  color: var(--muted);
  margin-left: 10px;
  font-variant-numeric: tabular-nums;
}

.log-body { padding: 18px 24px; }

.progress-track {
  height: 4px;
  background: #1a1d24;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #5eead4);
  border-radius: 2px;
  transition: width 0.25s ease;
}

.log {
  font-size: 13px;
  line-height: 1.85;
  max-height: 420px;
  overflow-y: auto;
}
.log::-webkit-scrollbar { width: 8px; }
.log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.log-line {
  white-space: pre-wrap;
  word-break: break-word;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}
.log-time { color: var(--muted); margin-right: 10px; }
.log-info { color: var(--info); }
.log-success { color: var(--success); }
.log-warning { color: var(--warning); }
.log-error { color: var(--error); }
.log-empty { color: var(--muted); }

.log-snippet {
  color: var(--text-dim);
  margin: 2px 0 8px 62px;
  font-size: 12px;
  line-height: 1.6;
}
.log-snippet mark {
  background: var(--mark-bg);
  color: var(--mark-text);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 700;
}

/* ---- Stats ---- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 18px 20px;
}
.stat-label {
  font-size: 10px;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}
.stat-value.stat-hit { color: var(--accent); }

/* ---- Results ---- */

.results-window .titlebar { position: relative; }

.export-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.results-list {
  max-height: 420px;
  overflow-y: auto;
}
.result-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.result-row:last-child { border-bottom: none; }

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.result-url {
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
  font-size: 13px;
}
.result-url:hover { color: var(--accent); }
.result-count {
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.result-snippet {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 6px;
}
.result-snippet mark {
  background: var(--mark-bg);
  color: var(--mark-text);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .row { flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .panel-body { padding: 20px; }
  .log-snippet { margin-left: 0; }
}
