:root {
    --bg: #09090b;
    --surface: #121215;
    --border: #27272a;
    --border-hover: #3f3f46;
    --text: #fafafa;
    --text-muted: #71717a;
    --text-dim: #3f3f46;
    --discord: #2d336b;
    --discord-hover: #232854;
    --danger: #3f1717;
    --danger-text: #f87171;
    --danger-hover: #521d1d;
}

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

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.header-title a {
    color: var(--text);
    text-decoration: none;
}

.header-title a:hover {
    text-decoration: underline;
}

.header-title .sep {
    color: var(--text-muted);
    font-weight: 400;
}

.user-tag {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

[data-page] {
    display: none !important;
}

[data-page].active {
    display: flex !important;
}

.home-container {
    max-width: 600px;
    padding: 48px 24px;
    gap: 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.auth-container {
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#account-section,
#login-section {
    display: none;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    justify-content: center;
}

#login-section {
    align-items: center;
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.15rem;
    font-weight: 600;
}

.user-id {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.discord-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
}

.discord-bar span:first-child {
    color: var(--text-muted);
}

.action-row {
    display: flex;
    gap: 10px;
}

.project-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    transition: background 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
}

.project-btn:hover {
    border-color: var(--border-hover);
    background: #18181b;
    text-decoration: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-discord {
    background: var(--discord);
    color: #d1d5db;
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-discord:hover {
    background: var(--discord-hover);
    color: #ffffff;
}

.btn-danger {
    background: var(--danger);
    color: var(--danger-text);
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.sb-container {
    max-width: 1100px;
    padding: 32px 32px 100px 32px;
    width: 100%;
}

.layout {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 800px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

.left-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-image-box {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #000000;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.build-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 4px;
}

.build-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.build-id {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.scores-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.score-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-pos {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    width: 20px;
}

.score-player {
    font-weight: 500;
}

.score-val {
    font-family: monospace;
    font-weight: 600;
    color: var(--text);
}

.empty-scores {
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border: 1px dashed var(--border);
    border-radius: 6px;
    text-align: center;
}

.right-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.build-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
}

.build-row:hover {
    color: var(--text);
    border-color: var(--border-hover);
}

.build-row.active {
    color: var(--text);
    background: #18181b;
    border-color: #52525b;
}

.build-row-name {
    font-size: 0.95rem;
    font-weight: 500;
}

.build-row-id {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.build-row.active .build-row-id {
    color: var(--text-muted);
}

.bottom-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 64px);
    max-width: 480px;
    z-index: 50;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    background: #121215;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.search-input:focus {
    border-color: #52525b;
    background: #18181b;
}