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

:root {
    --primary: #000000;
    --primary-light: #333333;
    --accent: #0066ff;
    --success: #00c853;
    --text: #1a1a1a;
    --text-light: #666666;
    --text-lighter: #999999;
    --border: #e0e0e0;
    --bg: #ffffff;
    --bg-light: #fafafa;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 24px;
}

header {
    text-align: center;
    margin-bottom: 48px;
    padding: 0;
}

header h1 {
    font-size: 42px;
    font-weight: 600;
    letter-spacing: -1px;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.1;
}

header p {
    font-size: 17px;
    color: var(--text-light);
    font-weight: 400;
}

.upload-section, .library-section {
    background: var(--bg);
    padding: 0;
    margin-bottom: 32px;
}

.upload-section h2, .library-section h2 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text);
    margin-bottom: 32px;
    line-height: 1.2;
}

.upload-section > p {
    font-size: 15px;
    color: var(--text-light);
    margin-bottom: 32px;
    line-height: 1.5;
}

.file-input-wrapper {
    margin-bottom: 16px;
}

.or-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
}

.or-line {
    width: 120px;
    height: 1px;
    background: var(--border);
}

.or-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-input-wrapper {
    margin-bottom: 24px;
}

.text-input-wrapper label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.text-input-wrapper input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.text-input-wrapper input[type="text"]:focus {
    outline: none;
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.text-input-wrapper input[type="text"]::placeholder {
    color: var(--text-lighter);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--text);
    flex-shrink: 0;
}

.checkbox-wrapper label {
    font-size: 15px;
    color: var(--text);
    cursor: pointer;
    font-weight: 400;
    margin: 0;
}

.radio-option-wrapper {
    margin-bottom: 24px;
}

.radio-option-wrapper input[type="radio"] {
    display: none;
}

.radio-label {
    display: block;
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg);
}

.radio-label:hover {
    border-color: var(--text-light);
    background: var(--bg-light);
}

.radio-option-wrapper input[type="radio"]:checked + .radio-label {
    border-color: var(--text);
    background: var(--bg-light);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.radio-option-header {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.radio-option-description {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.6;
    font-weight: 400;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-label {
    display: block;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-light);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
    margin-bottom: 12px;
}

.file-label:hover {
    background: var(--bg);
    border-color: var(--text);
}

.file-label:active {
    transform: scale(0.98);
}

.upload-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 17px;
    font-weight: 500;
    color: var(--bg);
    background: var(--text);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 8px;
}

.upload-btn:hover:not(:disabled) {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.upload-btn:active:not(:disabled) {
    transform: translateY(0);
}

.upload-btn:disabled {
    background: var(--border);
    color: var(--text-lighter);
    cursor: not-allowed;
    transform: none;
}

.status-message {
    margin-top: 24px;
    padding: 16px 20px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
    display: none;
}

.status-message.success {
    display: block;
    background: #f0f9f4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-message.error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-message.progress {
    display: block;
    background: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.progress-bar-wrap {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 12px;
}

.progress-bar-indeterminate {
    height: 100%;
    width: 40%;
    background: var(--text);
    border-radius: 2px;
    animation: progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.library-header h2 {
    margin: 0;
}

.library-header > div {
    display: flex;
    gap: 12px;
    align-items: center;
}

.refresh-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.library-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.library-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.15s ease;
}

.library-item:hover {
    border-color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.library-item img, .library-item video {
    width: 100%;
    height: auto;
    display: block;
}

.library-item-info {
    padding: 20px;
    font-size: 14px;
}

.library-item-info .filename {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.library-item-info .date {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 16px;
}

.library-item-info .jab-data {
    padding: 16px;
    background: var(--bg-light);
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid var(--border);
}

.library-item-info .jab-data h4 {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.2px;
}

.jab-data strong {
    color: var(--text);
    font-weight: 600;
}

.data-item {
    margin-top: 8px;
    color: var(--text-light);
}

.library-item-info .rmse {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-lighter);
}

.loading, .empty-library {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
    font-size: 16px;
}

.pagination {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pagination-info {
    color: var(--text-light);
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 40px;
    min-width: 40px;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--text);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-number {
    min-width: 40px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-number:hover:not(.active) {
    background: var(--bg);
    border-color: var(--text);
}

.page-number.active {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
    cursor: default;
}

.library-link {
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.15s ease;
    padding: 8px 0;
}

.library-link:hover {
    color: var(--text-light);
    text-decoration: none;
}

.verification-result {
    margin-top: 32px;
}

.verification-success {
    padding: 24px;
    background: #f0f9f4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    color: #166534;
}

.verification-success h3 {
    font-size: 20px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.verification-failure {
    padding: 24px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: #991b1b;
}

.verification-failure h3 {
    font-size: 20px;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.verification-details {
    margin-top: 20px;
}

.verification-detail {
    margin-top: 12px;
    padding: 12px 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

.verification-detail:last-child {
    border-bottom: none;
}

.verification-detail strong {
    color: var(--text);
    font-weight: 600;
    display: inline-block;
    min-width: 120px;
}

.comparison-container {
    margin-top: 32px;
    margin-bottom: 32px;
    width: 100%;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 16px;
    width: 100%;
}

.comparison-item {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.comparison-item h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-light);
}

.comparison-item img,
.comparison-item video {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

@media (max-width: 768px) {
    .comparison-row {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.gps-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

.gps-link:hover {
    color: var(--text);
    text-decoration: underline;
}

.original-link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 20px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: inline-block;
    transition: all 0.15s ease;
}

.original-link:hover {
    background: var(--bg);
    border-color: var(--text);
    text-decoration: none;
}

.download-btn {
    color: var(--bg);
    background: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: var(--radius);
    display: inline-block;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
}

.download-btn:hover {
    background: var(--primary-light);
    text-decoration: none;
    transform: translateY(-1px);
}

.delete-btn.library-delete-btn {
    font-weight: 500;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    background: #c62828;
    color: #fff;
    transition: all 0.15s ease;
}

.delete-btn.library-delete-btn:hover:not(:disabled) {
    background: #b71c1c;
}

.delete-btn.library-delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.evigraph-section {
    margin-top: 0;
}

.evigraph-display {
    text-align: center;
    margin-bottom: 40px;
}

.evigraph-display img, .evigraph-display video {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.evigraph-info {
    margin-bottom: 40px;
}

.evigraph-meta {
    margin-top: 24px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-light);
}

.evigraph-actions {
    margin-top: 40px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.danger-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.share-btn, .bookmark-btn {
    color: var(--bg);
    background: var(--text);
    border: none;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.share-btn:hover, .bookmark-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.copy-link-btn {
    color: var(--bg);
    background: var(--text);
    border: none;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.copy-link-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.delete-recreate-btn {
    color: var(--bg);
    background: var(--text);
    border: none;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 24px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.delete-recreate-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.nav-links span {
    color: var(--border);
    font-size: 14px;
}

@media (max-width: 640px) {
    .container {
        padding: 32px 20px;
    }
    
    header h1 {
        font-size: 36px;
    }
    
    header p {
        font-size: 16px;
    }
    
    .upload-section h2, .library-section h2 {
        font-size: 24px;
    }
    
    .text-input-wrapper input[type="text"] {
        font-size: 16px;
    }
    
    .library-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .library-header > div {
        width: 100%;
    }
    
    .refresh-btn {
        width: 100%;
    }
    
    .action-buttons, .danger-actions {
        flex-direction: column;
    }
    
    .share-btn, .bookmark-btn, .copy-link-btn, .delete-recreate-btn, .download-btn {
        width: 100%;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 16px;
    }
    
    .nav-links span {
        display: none;
    }
}

@media (min-width: 641px) {
    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
    }
    
    .library-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
