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

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #5f6578;
  --border: #e2e4ea;
  --accent: #3b6ef6;
  --accent-hover: #2b5ad9;
  --green: #059669;
  --green-bg: #ecfdf5;
  --lime: #65a30d;
  --lime-bg: #f7fee7;
  --grey: #6b7280;
  --grey-bg: #f3f4f6;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --orange: #d97706;
  --orange-bg: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* Layout */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

/* Header */
header {
  margin-bottom: 32px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

h1 .icon {
  color: var(--accent);
  margin-right: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.925rem;
}

/* Form */
#check-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.12);
}

textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.char-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.char-count.over {
  color: var(--red);
  font-weight: 600;
}

button[type='submit'] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  min-height: 44px;
}

button[type='submit']:hover:not(:disabled) {
  background: var(--accent-hover);
}

button[type='submit']:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Verdict card */
.verdict-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.verdict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-verified .dot,
.status-verified { background: var(--green-bg); color: var(--green); }
.status-verified .dot { background: var(--green); }

.status-likely .dot,
.status-likely { background: var(--lime-bg); color: var(--lime); }
.status-likely .dot { background: var(--lime); }

.status-unverified .dot,
.status-unverified { background: var(--grey-bg); color: var(--grey); }
.status-unverified .dot { background: var(--grey); }

.status-disputed .dot,
.status-disputed { background: var(--red-bg); color: var(--red); }
.status-disputed .dot { background: var(--red); }

.status-misattributed .dot,
.status-misattributed { background: var(--orange-bg); color: var(--orange); }
.status-misattributed .dot { background: var(--orange); }

.confidence {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.verdict-body {
  padding: 0 20px 20px;
}

.summary {
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 16px;
}

.cached-badge {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--grey-bg);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
}

/* Expandable sections */
.expand-toggle {
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.1s;
}

.expand-toggle:hover {
  background: var(--bg);
}

.expand-toggle .arrow {
  transition: transform 0.2s;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.expand-toggle[aria-expanded='true'] .arrow {
  transform: rotate(90deg);
}

.expand-content {
  display: none;
  padding: 0 20px 16px;
}

.expand-content.open {
  display: block;
  animation: fadeUp 0.2s ease;
}

.source-item,
.news-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.source-item:last-child,
.news-item:last-child {
  border-bottom: none;
}

.source-item a,
.news-item a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.source-item a:hover,
.news-item a:hover {
  text-decoration: underline;
}

.source-meta,
.news-meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 2px;
}

.reasoning-text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Error card */
.error-card {
  background: var(--red-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 20px;
  animation: fadeUp 0.3s ease;
}

.error-card p {
  color: var(--red);
  font-size: 0.925rem;
  margin-bottom: 12px;
}

.error-card button {
  padding: 8px 16px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.error-card button:hover {
  opacity: 0.9;
}

/* Recent checks */
#recent-section {
  margin-top: 40px;
}

#recent-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

#recent-list {
  list-style: none;
}

#recent-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: box-shadow 0.15s;
  font-size: 0.875rem;
}

#recent-list li:hover {
  box-shadow: var(--shadow);
}

#recent-list .recent-claim {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 12px;
}

#recent-list .recent-status {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 24px 16px 60px;
  }

  h1 {
    font-size: 1.25rem;
  }

  .verdict-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
