/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0a0e1a;
  --bg-card:      rgba(255,255,255,0.04);
  --bg-card-hover:rgba(255,255,255,0.06);
  --border:       rgba(255,255,255,0.08);
  --border-focus: rgba(59,130,246,0.5);
  --blue:         #3b82f6;
  --blue-dim:     rgba(59,130,246,0.15);
  --blue-glow:    rgba(59,130,246,0.4);
  --green:        #10b981;
  --green-dim:    rgba(16,185,129,0.15);
  --orange:       #f59e0b;
  --red:          #ef4444;
  --text-1:       #e2e8f0;
  --text-2:       #94a3b8;
  --text-3:       #4b5563;
  --mono:         'Space Mono', 'IBM Plex Mono', monospace;
  --sans:         'Inter', system-ui, sans-serif;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:  0 0 24px rgba(59,130,246,0.2);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background-color: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Background grid ──────────────────────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(59,130,246,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ── Page layout ──────────────────────────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}
.card:hover { border-color: rgba(255,255,255,0.12); }

/* ── Header ───────────────────────────────────────────────────────────────── */
.header { padding: 0; background: none; border: none; box-shadow: none; backdrop-filter: none; }
.header:hover { border-color: transparent; }

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.logo { display: flex; align-items: center; gap: 16px; }

.logo-icon {
  font-size: 36px;
  color: var(--blue);
  filter: drop-shadow(0 0 12px var(--blue-glow));
  animation: pulse-icon 3s ease-in-out infinite;
}
@keyframes pulse-icon {
  0%, 100% { filter: drop-shadow(0 0 8px var(--blue-glow)); }
  50%       { filter: drop-shadow(0 0 20px var(--blue-glow)); }
}

.logo-title {
  font-family: var(--mono);
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  background: linear-gradient(135deg, var(--blue), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.logo-sub {
  font-size: 14px;
  color: var(--text-2);
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

.badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid;
}
.badge-green  { color: var(--green);  background: var(--green-dim);  border-color: rgba(16,185,129,0.3); }
.badge-blue   { color: var(--blue);   background: var(--blue-dim);   border-color: rgba(59,130,246,0.3); }
.badge-orange { color: var(--orange); background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); }

.header-desc {
  font-size: 15px;
  color: var(--text-2);
  max-width: 680px;
  line-height: 1.7;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}
.tab {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  color: var(--text-2);
  background: transparent;
  transition: all 0.2s;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab.active {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.3);
}
.tab:hover:not(.active) { color: var(--text-1); background: rgba(255,255,255,0.05); }
.tab-icon { font-size: 12px; }

/* ── Tab panels ───────────────────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Prompt input ─────────────────────────────────────────────────────────── */
.prompt-input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 16px;
  padding: 16px;
  resize: vertical;
  min-height: 90px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.6;
}
.prompt-input::placeholder { color: var(--text-3); }
.prompt-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.example-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.examples-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.example-chip {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--sans);
}
.example-chip:hover {
  background: var(--blue-dim);
  color: var(--blue);
  border-color: rgba(59,130,246,0.4);
}

/* ── Dropzone ─────────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.dropzone.dragover {
  border-color: var(--blue);
  background: var(--blue-dim);
}
.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
}
.dropzone-icon {
  font-size: 32px;
  color: var(--text-3);
  line-height: 1;
}
.dropzone-text { font-size: 15px; color: var(--text-2); }
.dropzone-sub  { font-size: 13px; color: var(--text-3); }

.dropzone-preview {
  width: 100%;
  height: 100%;
  position: relative;
}
.dropzone-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  display: block;
}
.remove-file {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}
.remove-file:hover { background: var(--red); color: #fff; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--mono);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.04em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--blue), #2563eb);
  color: #fff;
  padding: 14px 28px;
  font-size: 15px;
  width: 100%;
  justify-content: center;
  margin-top: 20px;
  box-shadow: 0 4px 16px rgba(59,130,246,0.3);
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.btn-primary:hover:not(:disabled)::after { opacity: 1; }
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(59,130,246,0.5);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary.loading .btn-arrow { display: none; }
.btn-primary.loading .btn-spinner { display: inline; animation: spin 1s linear infinite; }
.btn-primary:not(.loading) .btn-spinner { display: none !important; }

.btn-outline {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  padding: 8px 16px;
  font-size: 13px;
}
.btn-outline:hover { color: var(--text-1); border-color: rgba(255,255,255,0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Terminal ─────────────────────────────────────────────────────────────── */
.terminal-card { padding: 0; overflow: hidden; }

.terminal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
}
.terminal-dots { display: flex; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot-red    { background: #ef4444; }
.dot-yellow { background: var(--orange); }
.dot-green  { background: var(--green); }

.terminal-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.12em;
  flex: 1;
}

.step-indicator {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  background: rgba(0,0,0,0.4);
  border-radius: 4px;
  padding: 2px 8px;
}

.progress-bar-wrap {
  height: 2px;
  background: var(--border);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--blue-glow);
}

.terminal-body {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  padding: 20px;
  max-height: 300px;
  overflow-y: auto;
  color: #a7f3d0;
  background: rgba(0,0,0,0.2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.terminal-body::-webkit-scrollbar { width: 6px; }
.terminal-body::-webkit-scrollbar-track { background: transparent; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.log-line { display: block; }
.log-line::before { content: '> '; color: var(--green); opacity: 0.6; }
.log-step {
  display: block;
  color: var(--blue);
  font-weight: 700;
  margin-top: 8px;
}
.log-step::before { content: ''; }
.log-error { color: var(--red); }
.log-warn  { color: var(--orange); }
.log-ok    { color: var(--green); }

/* ── Results grid ─────────────────────────────────────────────────────────── */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 280px;
  gap: 16px;
}
@media (max-width: 900px) {
  .results-grid { grid-template-columns: 1fr 1fr; }
  .proof-card   { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .results-grid { grid-template-columns: 1fr; }
}

.result-card { padding: 20px; }

.result-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.result-icon { color: var(--blue); font-size: 14px; }
.result-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.3);
}
.result-badge.agent2 {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(16,185,129,0.3);
}

.image-wrap {
  aspect-ratio: 1;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  position: relative;
}
.result-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  animation: fadeIn 0.4s ease;
}
.image-placeholder {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}
.image-loading {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  animation: spin 1.5s linear infinite;
  color: var(--blue);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.result-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-top: 10px;
  text-align: center;
}

/* ── Proof card ───────────────────────────────────────────────────────────── */
.proof-card { display: flex; flex-direction: column; gap: 16px; }

.proof-items { display: flex; flex-direction: column; gap: 10px; flex: 1; }

.proof-item {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.2s;
}
.proof-item:hover { border-color: rgba(59,130,246,0.3); }

.proof-item-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.proof-item-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-1);
  word-break: break-all;
}
.proof-link {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.proof-link:hover { color: #60a5fa; }
.proof-link-icon { font-size: 10px; flex-shrink: 0; }
.proof-skipped { color: var(--orange); font-size: 11px; }

.agent-identity {
  background: var(--blue-dim);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.agent-identity-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}
.agent-identity-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-1);
  word-break: break-all;
  line-height: 1.5;
}

/* ── Reputation card ──────────────────────────────────────────────────────── */
.reputation-card {}

.rep-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.rep-icon {
  font-size: 28px;
  color: var(--green);
  filter: drop-shadow(0 0 8px rgba(16,185,129,0.5));
}
.rep-title {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
}
.rep-sub {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
}
.rep-header .btn { margin-left: auto; }

.rep-loading {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

.rep-content {}

.rep-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.rep-stat {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  min-width: 140px;
}
.rep-stat-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}
.rep-stat-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.rep-bar-wrap {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.rep-bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.rep-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}
.rep-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #34d399);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(16,185,129,0.5);
}

.rep-agent-info {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8;
}
.rep-agent-info a {
  color: var(--blue);
  text-decoration: none;
}
.rep-agent-info a:hover { color: #60a5fa; text-decoration: underline; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.footer a {
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s;
}
.footer a:hover { color: var(--blue); }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* Subtle entrance animation */
.card { animation: slideUp 0.3s ease both; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
