:root {
  --bg: #fdf6ec;
  --surface: #ffffff;
  --surface-2: #f4eefb;
  --border: #e9dff2;
  --text: #382f4d;
  --text-muted: #665b7c;
  --accent: #6f5fc4;
  --accent-strong: #5b4aad;
  --accent-soft: #efe9fb;
  --blue: #1a66c2;
  --blue-soft: #e8f1fb;
  --danger: #c33b34;
  --danger-soft: #fdecea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 28px -10px rgba(111, 95, 196, 0.28);
  --shadow-sm: 0 4px 14px -6px rgba(111, 95, 196, 0.22);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  background-color: var(--bg);
  background-image:
    radial-gradient(420px circle at 8% 0%, rgba(111, 95, 196, 0.14), transparent 60%),
    radial-gradient(480px circle at 100% 18%, rgba(26, 102, 194, 0.12), transparent 60%),
    radial-gradient(360px circle at 12% 95%, rgba(195, 59, 52, 0.08), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.page-header {
  text-align: center;
  padding: 2.5rem 1.25rem 1.5rem;
}

.hero-illustration {
  max-width: 420px;
  width: 100%;
  height: auto;
  margin: 0 auto 0.5rem;
  display: block;
}

.page-header h1 {
  margin: 0 0 0.4rem;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
}

.tagline {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.05rem;
}

.trust {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.trust h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--accent-strong);
}

.trust-points {
  margin: 0 0 1rem;
  padding-left: 0;
  list-style: none;
}

.trust-points li {
  margin-bottom: 0.6rem;
  padding-left: 1.75rem;
  position: relative;
}

.trust-points li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.25rem;
  height: 1.25rem;
  line-height: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  border-radius: 50%;
}

.trust-points code {
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.source-link {
  margin: 0;
  color: var(--text-muted);
}

.connect {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.connect-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.connect-card legend {
  font-weight: 700;
  padding: 0 0.25rem;
  font-size: 1.05rem;
  color: var(--accent-strong);
}

.connect-card label {
  display: block;
  margin-top: 0.85rem;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.connect-card input[type='text'],
.connect-card input[type='password'] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
}

.connect-card input[type='text']:focus,
.connect-card input[type='password']:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.password-row {
  display: flex;
  gap: 0.5rem;
}

.password-row input {
  flex: 1;
}

.secret-field {
  -webkit-text-security: disc;
}

.secret-field.is-visible {
  -webkit-text-security: none;
}

.show-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent-strong);
  border-radius: var(--radius-sm);
  padding: 0 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.show-toggle:hover {
  background: var(--accent-soft);
}

.field-help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

.field-help a {
  color: var(--blue);
}

.connect-actions {
  grid-column: 1 / -1;
  text-align: center;
  padding-top: 0.5rem;
}

#compare-button,
.start-over {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#compare-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

#compare-button:hover:not(:disabled),
.start-over:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.status-message {
  min-height: 1.2em;
  color: var(--text-muted);
  margin: 0.75rem 0 0;
}

.error-message {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid rgba(224, 82, 74, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  margin: 0.75rem auto 0;
  max-width: 32rem;
}

.results {
  margin-top: 2.5rem;
}

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

.column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.column h2 {
  font-size: 1.05rem;
  margin: 0 0 0.3rem;
  color: var(--accent-strong);
}

.column--bluesky h2 {
  color: var(--blue);
}

.matching-explainer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.matching-explainer summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-strong);
}

.matching-explainer ol {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
}

.matching-explainer li {
  margin-bottom: 0.5rem;
}

.matching-explainer li:last-child {
  margin-bottom: 0;
}

.matching-explainer code {
  background: var(--surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.unmatched-section summary {
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--accent-strong);
}

.count {
  color: var(--text-muted);
  font-weight: 400;
}

.column-help {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0;
}

.gap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

.row-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  min-width: 0;
}

.row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.display-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.handle {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row.done .display-name,
.row.done .handle {
  text-decoration: line-through;
  opacity: 0.5;
}

.follow-link {
  flex-shrink: 0;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.follow-link:hover {
  text-decoration: underline;
}

.follow-link-muted {
  color: var(--text-muted);
}

.badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.unmatched-section {
  margin-top: 2.25rem;
  opacity: 0.92;
}

.row-unmatched .row-text {
  gap: 0.1rem;
}

.source-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.reason {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.empty-state[hidden] {
  display: none;
}

.empty-state::before {
  content: '✨';
  font-size: 1.1rem;
}

.start-over {
  display: block;
  margin: 2.5rem auto 0;
}

.page-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 1.25rem;
}

.footer-flourish {
  display: block;
  width: 60px;
  height: auto;
  margin: 0 auto 0.5rem;
  opacity: 0.9;
}

.page-footer a {
  color: var(--blue);
}

@media (max-width: 760px) {
  .connect,
  .columns {
    grid-template-columns: 1fr;
  }
}
