:root {
    --radius: 0.625rem;
    --bg: #06060e;
    --fg: #f0e6d2;
    --accent: #c9a55c;
    --muted: #5a5a6a;
    --muted2: #8a8a9a;
    --text: #c8c8d4;
    --line: rgba(255, 255, 255, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
}

#star-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
}

/* 顶部 UI */
.top-ui {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 20;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 2rem;
}

@media (min-width: 640px) {
    .top-ui {
        padding-top: 3rem;
    }
}

.title {
    pointer-events: auto;
    margin-bottom: 1.5rem;
    color: #f0e6d2;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 200;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    text-shadow: 0 0 40px rgba(201, 165, 92, 0.15);
}

/* 左上角可折叠搜索面板 */
.search-panel {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.search-toggle {
    pointer-events: auto;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--muted2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
}

.search-panel.open .search-toggle {
    color: var(--accent);
    background: rgba(201, 165, 92, 0.08);
    border-color: rgba(201, 165, 92, 0.2);
}

.search-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.3s ease, opacity 0.2s ease;
    pointer-events: none;
}

.search-panel.open .search-content {
    max-width: 22rem;
    opacity: 1;
    pointer-events: auto;
}

.search-wrap {
    pointer-events: auto;
    width: 18rem;
}

.search-box {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.25rem;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.search-input::placeholder {
    color: #4a4a5a;
}

.filters {
    pointer-events: auto;
    display: flex;
    gap: 0.25rem;
}

.filter-btn {
    padding: 0.375rem 1rem;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn.active {
    color: var(--accent);
    background: rgba(201, 165, 92, 0.08);
    border-color: rgba(201, 165, 92, 0.2);
}

/* 底部计数 */
.bottom-info {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 1.5rem;
    z-index: 20;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.bottom-info span {
    color: #3a3a4a;
    font-size: 0.6rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.15em;
}

/* Tooltip */
.tooltip {
    position: fixed;
    pointer-events: none;
    transform: translate(-50%, -100%);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    text-shadow: 0 0 8px rgba(201, 165, 92, 0.5);
}

.tooltip.show {
    opacity: 1;
}

/* Backdrop */
.backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.backdrop.hidden {
    display: none;
}

/* Profile Panel */
.panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: rgba(10, 10, 22, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(201, 165, 92, 0.12);
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 640px) {
    .panel {
        width: 420px;
    }
}

/* Scrollbar */
.panel::-webkit-scrollbar {
    width: 4px;
}

.panel::-webkit-scrollbar-track {
    background: transparent;
}

.panel::-webkit-scrollbar-thumb {
    background: rgba(201, 165, 92, 0.15);
    border-radius: 2px;
}

.panel::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 165, 92, 0.3);
}

.panel-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted2);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 0;
    padding: 0;
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent);
}

.panel-content {
    flex: 1;
    padding: 4rem 2rem 2.5rem;
}

.avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.avatar {
    width: 6rem;
    height: 6rem;
    border-radius: 9999px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(201, 165, 92, 0.15), 0 0 60px rgba(200, 216, 240, 0.08);
    border: 1px solid rgba(201, 165, 92, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 200;
}

.panel-name {
    text-align: center;
    margin: 0 0 0.5rem;
    color: #f0e6d2;
    font-size: 1.5rem;
    font-weight: 200;
    letter-spacing: 0.15em;
}

.panel-signature {
    text-align: center;
    color: var(--muted2);
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.6;
    max-width: 300px;
    margin: 0 auto 2rem;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201, 165, 92, 0.2), transparent);
    margin-bottom: 1.5rem;
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section h3 {
    margin: 0 0 0.75rem;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.oc-img {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(201, 165, 92, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.oc-img img {
    width: 100%;
    height: 12rem;
    object-fit: cover;
    display: block;
}

.works-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.works-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--text);
    font-size: 0.85rem;
    line-height: 1.5;
}

.works-list .idx {
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.65rem;
    margin-top: 3px;
    opacity: 0.6;
    flex-shrink: 0;
}

.website-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    color: #c8d8f0;
    font-size: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: rgba(200, 216, 240, 0.06);
    border: 1px solid rgba(200, 216, 240, 0.1);
    transition: all 0.2s ease;
    word-break: break-all;
}

.website-link:hover {
    background: rgba(200, 216, 240, 0.1);
    border-color: rgba(201, 165, 92, 0.3);
}

.panel-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.panel-footer span {
    color: var(--muted);
    font-size: 0.65rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.1em;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

::selection {
    background: rgba(201, 165, 92, 0.25);
    color: #f0e6d2;
}

.hidden {
    display: none !important;
}