:root {
    --bg-color: #fafafa;
    --surface-color: #ffffff;
    --surface-subtle: #f4f4f5;
    --border-color: #e4e4e7;
    --border-subtle: #f4f4f5;
    
    --text-main: #09090b;
    --text-muted: #71717a;
    --text-subtle: #a1a1aa;
    
    --accent-emerald: #10b981;
    --accent-emerald-subtle: rgba(16, 185, 129, 0.1);
    --btn-bg: #09090b;
    --btn-text: #ffffff;
    --btn-hover: #27272a;
    --cherry-glow: rgba(9, 9, 11, 0.08);
    --accent-glow: rgba(16, 185, 129, 0.15);
    
    --radius: 10px;
    --radius-sm: 6px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition-base: 200ms var(--ease-out);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 2.5rem 1.5rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
}

.header-container {
    max-width: 1040px;
    margin: 0 auto 3rem auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.brand-title-center {
    text-align: center;
}

.brand-title-center h1 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.brand-title-center p {
    font-size: 0.725rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.header-user-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.4rem;
}

.status-badge {
    font-size: 0.725rem;
    font-weight: 500;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    background: var(--surface-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.leaderboard-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.leaderboard-link:hover {
    color: var(--text-main);
}

.glitch-wrapper {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 38px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    border: 1px solid var(--border-color);
    padding: 6px;
}

.glitch-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: grayscale(100%);
    transition: filter var(--transition-base), transform var(--transition-base);
}

.glitch-wrapper:hover .glitch-logo {
    filter: grayscale(0%);
    transform: scale(1.05);
}

main {
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
    flex-grow: 1;
}

.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.section-header {
    text-align: left;
    margin-bottom: 1.75rem;
}

.section-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.35rem;
}

.meta-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    border-color: #d4d4d8;
    box-shadow: var(--shadow-md);
}

.stat-icon {
    color: var(--text-main);
    background: var(--surface-subtle);
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-content .lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-content .val {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin-top: 0.15rem;
}

.chart-container-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.chart-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.fancy-segmented-control {
    display: inline-flex;
    background: var(--surface-subtle);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.fancy-segmented-control .toggle-btn {
    background: transparent;
    border: none;
    padding: 0.4rem 0.85rem;
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.fancy-segmented-control .toggle-btn:hover {
    color: var(--text-main);
}

.fancy-segmented-control .toggle-btn.active {
    background: var(--surface-color);
    color: var(--text-main);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chart-wrapper {
    position: relative;
    height: 290px;
    width: 100%;
}

.leaderboard-toolbar {
    margin-bottom: 1.25rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.9rem;
    color: var(--text-subtle);
    pointer-events: none;
    width: 16px;
    height: 16px;
}

.search-input-wrapper .input-text {
    padding-left: 2.5rem;
    width: 100%;
}

.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    background: var(--surface-color);
}

.leaderboard-table th {
    padding: 0.75rem 1rem;
    font-size: 0.725rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: left;
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th.text-right {
    text-align: right;
}

.leaderboard-row {
    background: var(--surface-color);
    transition: background-color var(--transition-fast);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.leaderboard-row:hover {
    background-color: #fafafa;
}

.leaderboard-table td {
    padding: 0.9rem 1rem;
    vertical-align: middle;
}

.rank-num {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.rank-badge.gold {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.rank-badge.silver {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.rank-badge.bronze {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.model-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}

.annotation-chip {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface-subtle);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    border: 1px solid var(--border-subtle);
}

.score-badge {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.score-badge small {
    font-size: 0.725rem;
    color: var(--text-subtle);
    font-weight: 400;
}

.progress-bar-bg {
    width: 90px;
    height: 6px;
    background: var(--surface-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-left: auto;
}

.progress-bar-fill {
    height: 100%;
    background: var(--text-main);
    border-radius: var(--radius-full);
}

.table-empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem !important;
    font-size: 0.875rem;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.input-group-col {
    flex-direction: column;
}

.input-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.35rem;
}

.input-text {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    flex-grow: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.input-text:focus {
    outline: none;
    border-color: var(--text-main);
    box-shadow: 0 0 0 2px rgba(9, 9, 11, 0.1);
}

.btn {
    background: var(--surface-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    background: var(--surface-subtle);
    border-color: #d4d4d8;
}

.btn-primary {
    background: var(--btn-bg);
    border-color: var(--btn-bg);
    color: var(--btn-text);
}

.btn-primary:hover {
    background: var(--btn-hover);
    border-color: var(--btn-hover);
    color: var(--btn-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-fancy-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-fancy-back:hover {
    background: var(--surface-subtle);
    color: var(--text-main);
    border-color: #d4d4d8;
    transform: translateX(-2px);
}

.auth-buttons-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 320px;
    margin: 0 auto;
}

.auth-error-msg {
    color: #ef4444;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 0.75rem;
    display: none;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
}

.custom-file-upload {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface-subtle);
}

.custom-file-upload:hover,
.custom-file-upload.drag-over {
    border-color: var(--text-main);
    background: #fafafa;
}

.upload-icon {
    color: var(--text-muted);
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.primary-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}

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

.hidden-file-input {
    display: none;
}

.file-list-preview {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--text-main);
    border: 1px solid var(--text-main);
    padding: 0.5rem 0.75rem;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.775rem;
    color: #ffffff;
    border-radius: var(--radius-sm);
}

.preview-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-file-size {
    color: var(--text-subtle);
    margin-left: 1rem;
}

.player-header-clean {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.track-number-badge {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.track-counter-badge {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.audio-player {
    width: 100%;
    height: 40px;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    background: var(--surface-subtle);
}

.dimension-grid {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-bottom: 2rem;
}

.dimension-item {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dimension-label {
    font-size: 0.875rem;
    color: var(--text-main);
    font-weight: 500;
}

.required-star {
    color: #ef4444;
}

.scale-options {
    display: flex;
    gap: 0.4rem;
}

.scale-btn {
    flex: 1;
    padding: 0.5rem 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.scale-btn:hover {
    background: var(--surface-subtle);
    color: var(--text-main);
    border-color: #d4d4d8;
}

.scale-btn.selected {
    background: var(--text-main);
    border-color: var(--text-main);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-chip {
    background: var(--surface-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tag-chip:hover {
    background: var(--surface-subtle);
    color: var(--text-main);
    border-color: #d4d4d8;
}

.tag-chip.selected {
    background: var(--text-main);
    color: #ffffff;
    border-color: var(--text-main);
    font-weight: 500;
}

.nav-controls {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

.finished-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.finished-icon {
    margin: 0 auto 1rem auto;
    display: block;
    color: var(--accent-emerald);
}

.finished-state h2 {
    font-size: 1.35rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 9, 11, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.modal-card {
    width: 90%;
    max-width: 440px;
    margin-bottom: 0;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: modal-slide-in 0.2s var(--ease-out);
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    transition: color var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    background: var(--surface-subtle);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid var(--border-subtle);
}

.modal-stat-item {
    display: flex;
    flex-direction: column;
}

.modal-stat-item .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-stat-item .val {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-top: 0.15rem;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.modal-description {
    font-size: 0.825rem;
    color: var(--text-muted);
    line-height: 1.5;
}

footer {
    max-width: 1040px;
    margin: 3rem auto 0 auto;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.hidden { 
    display: none !important; 
}

.flex-1 {
    flex: 1;
}

.space-top {
    margin-top: 1rem;
}

.space-top-lg {
    margin-top: 1.5rem;
}

@media (max-width: 600px) {
    body {
        padding: 1.25rem 0.75rem;
    }
    .header-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
    .brand-logo-wrapper,
    .header-user-controls {
        justify-content: center;
        align-items: center;
    }
    .card {
        padding: 1.25rem;
    }
}