:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-subtle: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --btn-primary: #238636;
  --btn-primary-hover: #2ea043;
  --radius: 6px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: var(--accent); }
.container { max-width: 720px; margin: 0 auto; padding: 48px 16px 32px; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }

.site-header h1 { margin: 0 0 8px; font-size: 28px; font-weight: 600; }
.subtitle { margin: 0 0 32px; color: var(--text-muted); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.search-form { display: flex; gap: 8px; margin-bottom: 24px; }
.search-form input {
  flex: 1; min-width: 0; padding: 8px 12px; font: inherit; font-size: 14px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.search-form input::placeholder { color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 500; line-height: 20px;
  border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--btn-primary); border-color: rgba(240,246,252,0.1); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-gray { background: var(--bg-subtle); color: var(--text); }
.btn-gray:hover { background: #30363d; }
.btn-green-accent { border-color: var(--btn-primary); }
.btn-small { padding: 4px 12px; }

.loading { color: var(--text-muted); padding: 16px 0; }
.loading .dot { display: inline-block; animation: blink 1.2s infinite both; }
.loading .dot:nth-child(2) { animation-delay: 0.2s; }
.loading .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .loading .dot { animation: none; } }

#error-message {
  color: #f85149; background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.4); padding: 12px 16px;
  border-radius: var(--radius); margin-bottom: 16px; font-size: 14px;
}

.card {
  position: relative; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 24px 32px;
}
.card-top { display: flex; gap: 20px; align-items: flex-start; }
.avatar { width: 96px; height: 96px; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0; background: var(--bg-subtle); }
.card-info { min-width: 0; }
.card-name { margin: 0; font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.card-handle { margin: 0 0 8px; color: var(--text-muted); font-size: 15px; }
.card-bio { margin: 0 0 8px; color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.card-meta { margin: 0; color: var(--text-muted); font-size: 13px; }
.card-stats { display: flex; gap: 32px; margin: 24px 0; flex-wrap: wrap; }
.stat-num { display: block; font-weight: 600; font-size: 18px; }
.stat-label { color: var(--text-muted); font-size: 13px; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-actions .btn { width: 100%; }
.card-brand {
  position: absolute; bottom: 12px; right: 14px; font-size: 10px;
  color: var(--text-muted); opacity: 0.65; letter-spacing: 0.3px;
  user-select: none; pointer-events: none;
}

.site-footer { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; }
.site-footer p { margin: 0 0 8px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 16px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }

dialog { padding: 0; border: 0; background: transparent; color: var(--text); max-width: 560px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(1,4,9,0.8); }
.modal-box { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-height: 85vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-box p { font-size: 14px; overflow-wrap: anywhere; }

@media (max-width: 520px) {
  .search-form { flex-direction: column; }
  .card-top { flex-direction: column; align-items: center; text-align: center; }
  .card-stats { justify-content: center; }
}
