@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #060910;
  --surface: #0d1117;
  --surface-2: #161b22;
  --surface-3: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --blue: #58a6ff;
  --blue-dark: #1f6feb;
  --pass: #3fb950;
  --fail: #f85149;
  --error: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(31, 111, 235, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(129, 140, 248, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.container {
  width: 100%;
  max-width: 800px;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: clamp(26px, 4vw, 32px);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

header p {
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  padding: 28px;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.hidden { display: none !important; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.field .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

input, textarea, select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

textarea {
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  min-height: 180px;
  line-height: 1.5;
}

button[type="submit"] {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  width: 100%;
  margin-top: 0.5rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue-dark), #388bfd);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}

button[type="submit"]:hover:not(:disabled) { opacity: 0.92; }
button[type="submit"]:active:not(:disabled) { transform: scale(0.99); }
button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }

#progress-bar {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue));
  transition: width 0.25s ease;
}

#progress-text { color: var(--muted); margin-bottom: 0.75rem; font-size: 0.9rem; }

#progress-log {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

#progress-log li {
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--border);
  border-radius: 4px;
}

#progress-log li:last-child { border-bottom: none; }
#progress-log li.pass { color: var(--pass); }
#progress-log li.fail { color: var(--fail); }
#progress-log li.error { color: var(--error); }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.summary-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.summary-item span {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
}

.summary-item label {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
  display: block;
}

.summary-item.pass span { color: var(--pass); }
.summary-item.fail span { color: var(--fail); }
.summary-item.error span { color: var(--error); }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.page-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.page-links { margin-top: 0.25rem; }
.page-links a {
  margin-right: 0.5rem;
  font-size: 0.78rem;
  color: var(--blue);
  text-decoration: none;
}

.page-links a:hover { text-decoration: underline; }

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.pass { background: rgba(63, 185, 80, 0.12); color: var(--pass); border: 1px solid rgba(63, 185, 80, 0.35); }
.status-badge.fail { background: rgba(248, 81, 73, 0.1); color: var(--fail); border: 1px solid rgba(248, 81, 73, 0.35); }
.status-badge.error { background: rgba(248, 81, 73, 0.1); color: var(--error); border: 1px solid rgba(248, 81, 73, 0.35); }

.thumb {
  width: 70px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: zoom-in;
  transition: border-color 0.15s;
}

.thumb:hover { border-color: var(--blue); }

.failure-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.failure-card.fail { border-left-color: var(--fail); }
.failure-card.error { border-left-color: var(--error); }

.failure-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.failure-header strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}

.viewport-tag {
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.failure-reason {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.failure-links a {
  margin-right: 0.75rem;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.82rem;
}

.failure-links a:hover { text-decoration: underline; }

.failure-diff {
  margin-top: 0.75rem;
  max-width: 100%;
  max-height: 260px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: zoom-in;
}

.badge {
  background: var(--fail);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 16, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  cursor: pointer;
}

.lightbox-close:hover { background: var(--surface-3); }

.pdf-link {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--blue);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.pdf-link:hover {
  background: var(--surface-3);
  text-decoration: none;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  body { padding: 1.5rem 0.75rem; }
  .card { padding: 20px; }
}
