@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #f5f5f0;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-tertiary: #999999;
    --border: #e8e8e8;
    --hover: rgba(26, 26, 26, 0.08);
    --surface: rgba(26, 26, 26, 0.015);
    --surface-hover: rgba(26, 26, 26, 0.03);
    --grid-line: rgba(26, 26, 26, 0.02);
    --whiteboard-bg: #fafaf7;
    --whiteboard-grid: rgba(0, 0, 0, 0.04);
    --shadow-card: rgba(0, 0, 0, 0.04);
    --modal-overlay: rgba(0, 0, 0, 0.4);
    --transition: all 0.3s ease;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --text-primary: #f0f0e8;
    --text-secondary: #b0b0a8;
    --text-tertiary: #707068;
    --border: #2e2e2e;
    --hover: rgba(255, 255, 255, 0.08);
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --grid-line: rgba(255, 255, 255, 0.025);
    --whiteboard-bg: #222220;
    --whiteboard-grid: rgba(255, 255, 255, 0.04);
    --shadow-card: rgba(0, 0, 0, 0.3);
    --modal-overlay: rgba(0, 0, 0, 0.65);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #1a1a1a;
        --text-primary: #f0f0e8;
        --text-secondary: #b0b0a8;
        --text-tertiary: #707068;
        --border: #2e2e2e;
        --hover: rgba(255, 255, 255, 0.08);
        --surface: rgba(255, 255, 255, 0.03);
        --surface-hover: rgba(255, 255, 255, 0.06);
        --grid-line: rgba(255, 255, 255, 0.025);
        --whiteboard-bg: #222220;
        --whiteboard-grid: rgba(255, 255, 255, 0.04);
        --shadow-card: rgba(0, 0, 0, 0.3);
        --modal-overlay: rgba(0, 0, 0, 0.65);
        color-scheme: dark;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Grid background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 3rem 1rem;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.header-text {
    min-width: 0;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1;
}

.theme-toggle:hover {
    border-color: var(--text-secondary);
    background: var(--hover);
    color: var(--text-primary);
}

.lang-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1;
}

.lang-toggle:hover {
    border-color: var(--text-secondary);
    background: var(--hover);
    color: var(--text-primary);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.header .subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Statistics Bar */
.stats-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.stats-bar-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.stat-label {
    color: var(--text-tertiary);
    font-weight: 600;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
}

.stat-sub {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    text-align: center;
    background: none;
    border: none;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
    cursor: default;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--text-primary);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        width: 0;
        left: 50%;
    }
    to {
        width: 100%;
        left: 0;
    }
}

/* Tab Content */
.tab-contents {
    position: relative;
    min-height: 400px;
}

.tab-pane {
    display: none;
    animation: fadeInTab 0.4s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-pane h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

/* Timeline Section */
.timeline {
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, var(--text-primary), transparent);
}

.timeline-year {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 1rem 0;
    z-index: 1;
}

.timeline-year span {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 0.2rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.06em;
    position: relative;
    z-index: 1;
}

.timeline-item {
    display: grid;
    grid-template-columns: 1fr 2.5rem 1fr;
    margin-bottom: 2rem;
    align-items: start;
}

.timeline-node {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: start;
    margin-top: 0.75rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    border: 2px solid var(--bg-primary);
    position: relative;
    z-index: 1;
}

.timeline-card {
    padding: 1.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 2px 8px var(--shadow-card);
    grid-row: 1;
}

.timeline-item.right .timeline-card {
    grid-column: 3;
}

.timeline-item.left .timeline-card {
    grid-column: 1;
}

.timeline-period {
    display: block;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 0.3rem;
}

.timeline-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.role {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.description {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Books Filter & Sort Controls */
.books-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: center;
}

.books-genres {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: 1;
}

.genre-chip {
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0.25rem 0.65rem;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
}

.genre-chip:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.genre-chip.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.books-sort-select {
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.books-sort-select:hover {
    border-color: var(--text-secondary);
}

/* Books Section */
.book-section {
    grid-column: 1 / -1;
    margin-bottom: 2.5rem;
}

.star-heading {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.book-item {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: var(--transition);
}

.book-item:hover {
    border-color: var(--text-secondary);
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.book-info {
    flex: 2;
    min-width: 0;
}

.book-cover {
    flex: 1;
    min-width: 0;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.author {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
}

.book-item .description {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Book modal */
#book-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

#book-modal-overlay.active {
    display: flex;
}

.book-modal-card {
    position: relative;
    background: var(--bg-primary);
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    animation: stickyPop 0.18s ease;
}

.book-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0.25rem;
    line-height: 1;
}

.book-modal-close:hover {
    color: var(--text-primary);
}

.book-modal-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.book-modal-info {
    flex: 2;
    min-width: 0;
}

.book-modal-image {
    flex: 1;
    min-width: 0;
}

.book-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-modal-star {
    font-size: 0.95rem;
    color: var(--text-tertiary);
    margin-bottom: 0.4rem;
}

.book-modal-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.book-modal-genre {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.book-modal-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

/* Badges Section */
.badges-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.badge-item {
    padding: 1.5rem;
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
    background: var(--surface);
}

.badge-item:hover {
    border-color: var(--text-secondary);
    background: var(--surface-hover);
    transform: scale(1.02);
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.rank-section {
    margin-bottom: 2.5rem;
}

.rank-heading {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid;
}

.rank-gold-heading {
    color: #ffd700;
    border-bottom-color: #ffd700;
}

.rank-silver-heading {
    color: #c0c0c0;
    border-bottom-color: #c0c0c0;
}

.rank-bronze-heading {
    color: #cd7f32;
    border-bottom-color: #cd7f32;
}

.badge-item.rank-gold {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
    background: rgba(255, 215, 0, 0.06);
}

.badge-item.rank-silver {
    border-color: #c0c0c0;
    box-shadow: 0 0 12px rgba(192, 192, 192, 0.3);
    background: rgba(192, 192, 192, 0.06);
}

.badge-item.rank-bronze {
    border-color: #cd7f32;
    box-shadow: 0 0 12px rgba(205, 127, 50, 0.3);
    background: rgba(205, 127, 50, 0.06);
}

.badge-item h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.year {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    margin-bottom: 0.75rem;
}

.badge-item .description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Memory / Whiteboard Section */
.memories-list {
    display: block;
}

.whiteboard {
    position: relative;
    width: 100%;
    background-color: var(--whiteboard-bg);
    background-image:
        linear-gradient(var(--whiteboard-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--whiteboard-grid) 1px, transparent 1px);
    background-size: 32px 32px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.sticky-note {
    position: absolute;
    width: 170px;
    min-height: 120px;
    padding: 1rem;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    border-radius: 2px;
    transition: box-shadow 0.15s ease;
}

.sticky-note:hover {
    box-shadow: 6px 6px 16px rgba(0,0,0,0.22);
    z-index: 999 !important;
}

.sticky-note-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(0,0,0,0.72);
    line-height: 1.4;
    margin-bottom: 0.6rem;
    word-break: break-all;
}

.sticky-note-date {
    font-size: 0.75rem;
    color: rgba(0,0,0,0.48);
}

/* Sticky note modal */
#sticky-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

#sticky-modal-overlay.active {
    display: flex;
}

.sticky-modal-card {
    position: relative;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    border-radius: 2px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    animation: stickyPop 0.18s ease;
}

@keyframes stickyPop {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.sticky-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: rgba(0,0,0,0.4);
    line-height: 1;
    padding: 0.25rem;
}

.sticky-modal-close:hover {
    color: rgba(0,0,0,0.7);
}

.sticky-modal-category-label {
    font-size: 0.8rem;
    color: rgba(0,0,0,0.5);
    margin-bottom: 0.4rem;
}

.sticky-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(0,0,0,0.8);
    margin-bottom: 1rem;
}

.sticky-modal-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: rgba(0,0,0,0.68);
    white-space: pre-wrap;
}

/* Fade-in animation for scroll */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading state */
.loading {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2rem 1rem;
    font-size: 0.95rem;
}

/* Skeleton loader */
@keyframes skeletonPulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.skeleton {
    background: var(--surface);
    border: 1px solid var(--border);
    animation: skeletonPulse 1.4s ease-in-out infinite;
}

.skeleton-card {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    min-height: 96px;
}

.books-grid .skeleton-card,
.badges-list .skeleton-card {
    margin-bottom: 0;
}

.skeleton-line {
    background: var(--hover);
    height: 0.85rem;
    margin-bottom: 0.6rem;
    border-radius: 2px;
}

.skeleton-line:last-child {
    margin-bottom: 0;
}

.skeleton-line.short  { width: 32%; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.long   { width: 92%; }

/* Error state */
.error-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}

.error-state p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.retry-btn {
    background: none;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

/* Works Section */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.work-item {
    border: 1px solid var(--border);
    background: var(--surface);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.work-item:hover {
    border-color: var(--text-secondary);
    background: var(--surface-hover);
    transform: translateY(-2px);
}

.work-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--hover);
}

.work-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.work-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-tertiary);
}

.work-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.work-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.work-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    flex: 1;
}

.work-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.work-tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: var(--surface);
    border-radius: 2px;
}

.work-links {
    display: flex;
    gap: 0.75rem;
}

.work-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 0.35rem 0.8rem;
    transition: var(--transition);
}

.work-link:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: var(--hover);
}

/* Running Section */
.running-summary {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.running-best-card {
    flex: 1;
    min-width: 160px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
    text-align: center;
}

.running-best-gold {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.06);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.running-best-gold .running-best-time {
    color: #b8860b;
}

.running-best-silver {
    border-color: #c0c0c0;
    background: rgba(192, 192, 192, 0.06);
    box-shadow: 0 0 12px rgba(192, 192, 192, 0.3);
}

.running-best-silver .running-best-time {
    color: #808080;
}

:root[data-theme="dark"] .running-best-gold .running-best-time  { color: #ffd700; }
:root[data-theme="dark"] .running-best-silver .running-best-time { color: #c0c0c0; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .running-best-gold .running-best-time  { color: #ffd700; }
    :root:not([data-theme="light"]) .running-best-silver .running-best-time { color: #c0c0c0; }
}

.running-best-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.running-best-time {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.running-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.running-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: var(--transition);
}

.running-item:hover {
    background: var(--surface-hover);
    border-color: var(--text-secondary);
}

.running-distance-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 2px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.distance-full    { background: rgba(229,62,62,0.12);  color: #C53030; }
.distance-half    { background: rgba(49,130,206,0.12); color: #2B6CB0; }
.distance-10km    { background: rgba(72,187,120,0.12); color: #276749; }
.distance-5km     { background: rgba(113,128,150,0.12);color: #4A5568; }
.distance-other   { background: var(--hover);           color: var(--text-secondary); }

:root[data-theme="dark"] .distance-full  { color: #FC8181; }
:root[data-theme="dark"] .distance-half  { color: #63B3ED; }
:root[data-theme="dark"] .distance-10km  { color: #68D391; }
:root[data-theme="dark"] .distance-5km   { color: #A0AEC0; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .distance-full  { color: #FC8181; }
    :root:not([data-theme="light"]) .distance-half  { color: #63B3ED; }
    :root:not([data-theme="light"]) .distance-10km  { color: #68D391; }
    :root:not([data-theme="light"]) .distance-5km   { color: #A0AEC0; }
}

.running-item-body {
    flex: 1;
    min-width: 0;
}

.running-item-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.running-item-meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.running-item-time {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* Footer */
.footer {
    margin-top: 4rem;
    padding: 2rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .header .subtitle {
        font-size: 1rem;
    }

    .tabs {
        margin-bottom: 1.5rem;
    }

    .tab-btn {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
    }

    .running-summary {
        gap: 0.75rem;
    }

    .tab-pane h2 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .books-grid,
    .badges-list {
        grid-template-columns: 1fr;
    }

    .timeline::before {
        left: 1rem;
        transform: none;
    }

    .timeline-year {
        justify-content: flex-start;
        padding-left: 2.5rem;
    }

    .timeline-item {
        grid-template-columns: 2.5rem 1fr;
    }

    .timeline-node {
        grid-column: 1;
    }

    .timeline-item.right .timeline-card,
    .timeline-item.left .timeline-card {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 2rem 1rem;
        margin-bottom: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header .subtitle {
        font-size: 0.95rem;
    }

    .tabs {
        font-size: 0.9rem;
    }

    .tab-btn {
        padding: 0.6rem 0.85rem;
        font-size: 0.85rem;
    }

    .running-item {
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .running-item-time {
        font-size: 1.1rem;
    }

    .container {
        padding: 0 0.75rem;
    }

    .book-item,
    .badge-item {
        padding: 1rem;
    }
}
