body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

#header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    
    background-color: white;
    padding: 6px 20px 8px;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-height: 46px; 
    gap: 4px;
}

h2 { 
    color: #333; 
    margin: 0;
    margin-right: 30px; 
    font-size: 20px; 
}

#controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

#node-count {
    font-size: 14px;
    color: #555;
    font-weight: bold;
}

#search-container {
    margin: 0;
    display: flex; 
    gap: 10px;
}

#search-input {
    padding: 8px 15px; 
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    box-shadow: none;
}

#reset-btn, #select-search-btn {
    padding: 8px 15px; 
    border-radius: 20px;
    font-size: 14px;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

#select-search-btn {
    display: none;
}

.search-within-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
}

.search-within-label span {
    font-size: 13px;
    color: #444;
}

#search-within-checkbox {
    transform: scale(1.05);
}

#reset-btn:hover, #select-search-btn:hover {
    background: #f6f6f6;
    border-color: #ccc;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.filter-controls {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #444;
}
.filter-controls label {
    cursor: pointer;
    display: flex; 
    align-items: center;
    gap: 5px; 
}

.filter-controls input[type="radio"] {
    transform: scale(1.1); 
    margin-right: 3px;
}

#date-filter-container {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 0;
}

#date-filter-container button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border-radius: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
}

#date-filter-container button:hover {
    background: #f3f4f6;
}

#date-filter-timeline {
    position: relative;
    min-width: 0;
    flex: 1;
    display: none;
    align-items: center;
    gap: 8px;
}

#date-track {
    position: relative;
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #d8dde4 0%, #aeb8c4 100%);
}

#date-range-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #1f6feb 0%, #0f4ea3 100%);
    pointer-events: none;
}

.date-handle {
    position: absolute;
    top: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #0f4ea3;
    transform: translate(-50%, -50%);
    cursor: ew-resize;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.date-handle-label {
    position: absolute;
    top: -20px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #555;
    background: rgba(255,255,255,0.95);
    padding: 2px 5px;
    border-radius: 999px;
    border: 1px solid #eee;
    white-space: nowrap;
    pointer-events: none;
}

.date-year-marker {
    position: absolute;
    top: 50%;
    width: 1px;
    height: 10px;
    background: rgba(15, 78, 163, 0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.date-year-label {
    position: absolute;
    top: 6px;
    transform: translateX(-50%);
    font-size: 9px;
    color: #6b7280;
    white-space: nowrap;
    pointer-events: none;
}

.filter-icon {
    width: 35px; 
    height: 20px; 
    vertical-align: middle;
    fill: none; 
}

#container {
    margin-top: 80px; 
    height: calc(100vh - 80px);
    width: 100vw; 
    max-width: none;
    
    border: none;
    box-shadow: none;
    border-radius: 0; 
    overflow: hidden;
    cursor: grab; 
    background-color: white; 
    position: relative; 
}

#info-box {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    max-width: 500px; 
    width: 90%; 
    min-width: 250px;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 250;
    backdrop-filter: blur(5px);
    cursor: move; 
}

#info-box img {
    width: 100%; 
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #eee;
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 15px;
    cursor: pointer;
    font-size: 24px;
    color: #555;
    font-weight: 500;
    line-height: 1;
}

path.link {
    fill: none;
    stroke: #bbb;
    stroke-width: 2px;
    cursor: pointer;
    transition: stroke 0.3s, opacity 0.5s; 
}
path.link:hover { stroke: #555; stroke-width: 3px; }

.node circle { 
    stroke: #fff; 
    stroke-width: 3px; 
    cursor: pointer; 
    transition: all 0.3s, opacity 0.5s, stroke 0.3s, r 0.3s;
}

.node circle.selected {
    stroke: #ff4500;
    stroke-width: 5px;
    filter: drop-shadow(0 0 8px rgba(255, 69, 0, 0.6));
}

.node circle.search-match {
    stroke: #007bff;
    stroke-width: 4px;
    filter: drop-shadow(0 0 6px rgba(0, 123, 255, 0.35));
}

.node text { 
    font-size: 13px; 
    font-weight: bold; 
    pointer-events: none; 
    text-shadow: 2px 2px 4px white; 
    fill: #333;
    transition: opacity 0.5s; 
}

#blog-link {
    font-size: 14px; 
    color: #007bff; 
    text-decoration: none; 
    white-space: nowrap; 
    font-weight: 500;
}

#blog-link:hover {
    text-decoration: underline; 
    color: #0056b3;
}

#shift-hint {
    font-size: 13px;
    color: #555;
    background: rgba(255,255,255,0.9);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #eee;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    white-space: nowrap;
}

/* mobile-only multi-select toggle */
#mobile-multi-toggle {
    display: none;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
    border: 1px solid #eee;
    background: #fff;
    color: #333;
    cursor: pointer;
    margin-right: 8px;
}
#mobile-multi-toggle.active {
    background: #ffefea;
    border-color: #ffdfcf;
    color: #d14400;
    box-shadow: 0 2px 8px rgba(209,68,0,0.08);
}

@media (max-width: 640px) {
    #mobile-multi-toggle { display: inline-flex; align-items:center; }
    #shift-hint { display: none; }
}

@media (max-width: 640px) {    
    #header-bar {
        height: auto;
        flex-direction: column; 
        align-items: flex-start;
        padding: 10px; 
    }

    h2 {
        font-size: 20px; 
        margin-bottom: 15px;
    }

  
    #controls-right {
        width: 100%; 
        flex-direction: column; 
        gap: 15px;
        margin-left: 0;
    }
    
 
    #search-container {
        width: 100%;
        display: flex; 
        gap: 10px;
    }
    
    #search-input, #reset-btn {
        padding: 10px 15px; 
        font-size: 16px;
    }
    
    #search-input {
        flex-grow: 1; 
    }

 
    .filter-controls {
        width: 100%;
        justify-content: space-between; 
        gap: 5px; 
    }

    .filter-controls label {
        flex-direction: row; 
        gap: 8px; 
    }
    
    .filter-icon {
        width: 30px;
        height: 18px; 
    }

    #container {
        margin-top: 200px; 
        height: calc(100vh - 200px);
    }
    
    #info-box {
        max-width: 90%; 
        width: 90%;
        top: 20px; 
        left: 5%; 
        right: 5%;
        cursor: default; 
    }
}
