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

/* ─── Design tokens ──────────────────────────────────────── */
:root {
  --bg:         #f8f9fa;
  --white:      #ffffff;
  --ink:        #0f172a;
  --ink-2:      #334155;
  --ink-3:      #64748b;
  --ink-4:      #94a3b8;
  --border:     #e2e8f0;
  --border-hover: #94a3b8;
  --red:        #b91c1c;
  --red-bg:     #fef2f2;
  --red-border: #fecaca;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow:    0 4px 16px rgba(15, 23, 42, .08), 0 1px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 8px 28px rgba(15, 23, 42, .11), 0 2px 8px rgba(15, 23, 42, .05);

  --radius-sm: 6px;
  --radius:    10px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", "Fira Code", ui-monospace, "Cascadia Code", monospace;
}

/* ─── Base ───────────────────────────────────────────────── */
html, body {
  min-height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  /* [6] PAGE BACKGROUND — revert to background: var(--bg) to undo */
  background: linear-gradient(to bottom, #000000 0%, #4a5568 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Page layout ────────────────────────────────────────── */
.page-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

/* [7] CARD — revert border-radius to 10px, padding to 52px 52px 44px, box-shadow to var(--shadow) to undo */
.card {
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .06),
    0 0 60px rgba(255, 255, 255, .04),
    0 2px 4px rgba(15, 23, 42, .06),
    0 8px 32px rgba(15, 23, 42, .12),
    0 32px 80px rgba(15, 23, 42, .10);
  width: 100%;
  max-width: 660px;
  padding: 56px 56px 48px;
}

/* ─── Header / logo ──────────────────────────────────────── */
/* [8] LOGO — revert site-header to margin-bottom:52px / align-items:flex-start and logo-img to 80px to undo */
.site-header {
  margin-bottom: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-img {
  display: block;
  max-height: 110px;
  width: auto;
}

.wordmark {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

/* ─── Hero ───────────────────────────────────────────────── */
/* [5] HERO HIERARCHY — revert headline font-weight to 700 and subheadline color to var(--ink-3) to undo; remove text-align center to left-align */
.hero {
  margin-bottom: 40px;
  text-align: center;
}

.headline {
  font-size: 2.75rem;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.12;
  color: var(--ink);
  margin-bottom: 10px;
}

.subheadline {
  font-size: 0.8125rem;
  color: var(--ink);
  line-height: 1.7;
  max-width: 100%;
  white-space: nowrap;
}

/* ─── Input ──────────────────────────────────────────────── */
/* [4] INPUT — revert .input-group margin-bottom to 20px to undo */
.input-group {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0.005em;
  color: var(--ink);
  margin-bottom: 7px;
  text-align: left;
}

.patent-input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
  border: 3px solid #4a5568;
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.patent-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, .08);
}

.patent-input::placeholder {
  color: var(--ink-4);
}

/* [2+3] ACTION BUTTONS — revert .report-card to transparent bg / border-radius 100px / border 1px to restore chips */
/* ─── Report cards ───────────────────────────────────────── */
.report-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.report-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 17px 14px;
  background: #000000;
  border: 1px solid #3d5270;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font-family: var(--font);
  transition: background .15s, box-shadow .15s, transform .12s;
}

.report-card:hover {
  background: #4a5568;
  border-color: #64748b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
  transform: translateY(-1px);
}

.report-card:focus-visible {
  outline: 2px solid #94a3b8;
  outline-offset: 2px;
}

.report-card:active {
  background: #0f172a;
  transform: translateY(0);
  box-shadow: none;
}

.report-card:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  line-height: 1;
}

/* [8] FOOTER REFINEMENT — revert to padding-top 20px and original font sizes to undo */
/* ─── Page footer ────────────────────────────────────────── */
.page-footer {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  text-align: center;
}

.footer-copyright {
  font-size: 0.6875rem;
  color: #4a5568;
  letter-spacing: 0.01em;
  margin-top: 10px;
}

.footer-beta {
  display: inline-block;
  margin-top: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--red);
  text-transform: uppercase;
  border: 1px solid rgba(185, 28, 28, .35);
  padding: 5px 16px;
  border-radius: 100px;
}

/* ─── Loading overlay ────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(248, 249, 250, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-panel {
  text-align: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 44px 52px;
  max-width: 340px;
  width: 100%;
}

.loading-msg {
  margin-top: 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.loading-sub {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.loading-cancel {
  display: inline-block;
  margin-top: 20px;
  font-size: 0.8125rem;
  color: var(--ink-4);
  text-decoration: none;
  transition: color .15s;
}

.loading-cancel:hover {
  color: var(--ink);
}

/* ─── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--border);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
  margin-bottom: 4px;
}

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

/* ─── Polling page ───────────────────────────────────────── */
.polling-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 0 4px;
}

.polling-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 20px;
  margin-bottom: 10px;
}

.polling-patent {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 12px;
  margin-bottom: 20px;
}

.polling-msg {
  font-size: 0.875rem;
  color: var(--ink-3);
}

.polling-error {
  font-size: 0.9375rem;
  color: var(--red);
  max-width: 400px;
  line-height: 1.6;
  margin-top: 8px;
  font-weight: 500;
}

.back-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.8125rem;
  color: var(--ink-4);
  text-decoration: none;
  transition: color .15s;
}

.back-link:hover {
  color: var(--ink);
}

.back-link--error {
  margin-top: 20px;
  color: var(--ink-2);
  font-size: 0.875rem;
}

.back-link--error:hover {
  color: var(--ink);
}

/* ─── Error page ─────────────────────────────────────────── */
.error-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.error-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.error-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 10px;
}

.error-message {
  font-size: 0.9375rem;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 20px;
}

.error-details {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 28px;
}

/* ─── Button ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: box-shadow .15s, opacity .1s;
}

.btn--primary {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.btn--primary:hover {
  box-shadow: 0 2px 10px rgba(15, 23, 42, .22);
  opacity: .92;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .card {
    padding: 40px 28px 36px;
    border-radius: 14px;
  }

  .headline {
    font-size: 1.875rem;
  }

  .report-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .loading-panel {
    padding: 36px 28px;
  }
}
