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

:root {
    --bg: #07070b;
    --surface: #121218;
    --surface-2: #17171f;
    --border: #1f1f29;
    --accent: #a78bfa;
    --accent-dim: rgba(167, 139, 250, 0.16);
    --text: #ececf1;
    --muted: #86869a;
    --danger: #f87171;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.glow {
    position: fixed;
    top: -30%;
    left: 50%;
    width: 1100px;
    height: 1100px;
    transform: translateX(-50%);
    background: radial-gradient(circle at center, rgba(167, 139, 250, 0.22) 0%, rgba(47, 31, 107, 0.12) 35%, transparent 68%);
    filter: blur(10px);
    pointer-events: none;
    z-index: 0;
    animation: drift 18s ease-in-out infinite;
}

.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    background-image:
        radial-gradient(1.5px 1.5px at 15% 22%, #fff, transparent),
        radial-gradient(1px 1px at 38% 68%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 62% 12%, #fff, transparent),
        radial-gradient(1px 1px at 78% 45%, #fff, transparent),
        radial-gradient(1px 1px at 88% 78%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 25% 88%, #fff, transparent),
        radial-gradient(1px 1px at 52% 34%, #fff, transparent);
    background-repeat: no-repeat;
    animation: twinkle 6s ease-in-out infinite;
}

@keyframes drift {
    0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
    50% { transform: translateX(-46%) translateY(30px) scale(1.06); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.6; }
}

.page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 560px;
    padding: 56px 20px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wordmark {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 48px;
}

.wordmark strong {
    color: var(--accent);
    font-weight: 500;
}

.hero {
    text-align: center;
    margin-bottom: 36px;
}

h1 {
    font-size: 34px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 14px;
}

.hero p {
    font-family: var(--font-display);
    font-size: 15.5px;
    line-height: 1.6;
    color: var(--muted);
    margin: 0;
    max-width: 400px;
    margin-inline: auto;
}

.search-form {
    width: 100%;
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 18px;
}

.search-form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.endpoint-prefix {
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--muted);
    display: flex;
    align-items: center;
    padding: 0 0 0 16px;
    white-space: nowrap;
}

.search-form input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 15px 10px;
}

.search-form input::placeholder {
    color: #4a4a58;
}

.search-form button {
    background: var(--accent);
    border: none;
    padding: 0 22px;
    color: #14101f;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14.5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
}

.search-form button:hover:not(:disabled) {
    background: #b79cfc;
}

.search-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(20, 16, 31, 0.35);
    border-top-color: #14101f;
    animation: spin 0.7s linear infinite;
    display: none;
}

.search-form button.loading .spinner {
    display: inline-block;
}

.search-form button.loading .btn-label {
    display: none;
}

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

.recent {
    width: 100%;
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.recent.visible {
    display: flex;
}

.recent-label {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--muted);
}

.recent-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.recent-chip {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-color: var(--surface-2);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.recent-chip:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.error-box {
    width: 100%;
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.28);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    font-size: 13.5px;
    font-family: var(--font-mono);
    display: none;
    margin-bottom: 20px;
}

.error-box.visible {
    display: block;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.result-card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: none;
    opacity: 0;
    transform: translateY(14px) scale(0.98);
}

.result-card.visible {
    display: block;
    animation: reveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes reveal {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.banner {
    width: 100%;
    height: 148px;
    background-size: cover;
    background-position: center;
    background-color: var(--surface-2);
}

.card-body {
    padding: 0 26px 26px;
}

.avatar-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.avatar {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    border: 4px solid var(--surface);
    margin-top: -46px;
    background-color: var(--surface);
    display: block;
}

.copy-btn {
    margin-top: 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 7px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.copy-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.copy-btn svg {
    width: 13px;
    height: 13px;
}

.identity {
    margin-top: 14px;
}

.display-name {
    font-size: 21px;
    font-weight: 700;
}

.username-line {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 13.5px;
    margin-top: 3px;
}

.tag-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.tag {
    font-family: var(--font-mono);
    font-size: 11.5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid rgba(167, 139, 250, 0.25);
}

.badges-section {
    display: none;
}

.badges-section.visible {
    display: block;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    margin: 22px 0 12px;
}

.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.badge-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    width: 64px;
    opacity: 0;
    transform: translateY(6px);
    animation: badge-in 0.35s ease forwards;
}

@keyframes badge-in {
    to { opacity: 1; transform: translateY(0); }
}

.badge-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}

.badge-icon svg {
    width: 20px;
    height: 20px;
}

.badge-name {
    font-size: 10.5px;
    text-align: center;
    color: var(--muted);
    line-height: 1.3;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
}

.meta-row a {
    color: var(--accent);
    text-decoration: none;
}

.meta-row a:hover {
    text-decoration: underline;
}

footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 40px 20px 32px;
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
}

footer a {
    color: var(--muted);
}

footer code {
    color: var(--accent);
}

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

@media (prefers-reduced-motion: reduce) {
    .glow, .stars, .result-card, .badge-tile, .error-box.visible, .spinner {
        animation: none !important;
    }
    .result-card.visible {
        opacity: 1;
        transform: none;
    }
    .badge-tile {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 27px;
    }
    .endpoint-prefix {
        display: none;
    }
}
