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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.app {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #0a0a0a;
}

#visualization {
    display: block;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    cursor: crosshair;
    touch-action: none; /* Essential for custom touch handling */
}

.info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    pointer-events: none;
    opacity: 0.8;
}

.info h1 {
    font-size: 26px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: #bbbbbb;
    font-family: 'Lora', serif;
}

/* Sidebar holding preview and caption */
.sidebar {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 10;
}

.preview {
    position: relative;
    width: 300px;
    height: 300px;
    background: #181818;
    border: 1px solid #333333;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

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

/* Remove absolute positioning from caption box */
.caption-box {
    position: relative;
    width: 300px;
    background: #181818;
    border: 1px solid #333333;
    border-radius: 4px;
    padding: 14px 18px;
    color: #bbbbbb; /* dimmer text */
    font-family: 'Lora', serif;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
    overflow-wrap: break-word;
}

/* Search bar */
.search-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.search-container input {
    width: 260px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #333333;
    background: #181818;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-container input::placeholder {
    color: #666666;
}

.search-container input:focus {
    border-color: #42a5f5;
} 

/* Tooltip for point hover */
.tooltip {
    position: fixed;
    background: rgba(24, 24, 24, 0.92);
    color: #e0e0e0;
    border: 1px solid #333333;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: 'Lora', serif;
    font-size: 14px;
    line-height: 1.4;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, -120%) scale(0.95);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.tooltip.visible {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
}

/* Alternate orientation when tooltip needs to appear below cursor */
.tooltip.below.visible {
    transform: translate(-50%, 10%) scale(1);
} 

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    z-index: 20;
}

.loader .bar{
   width:200px;
   height:6px;
   background:#222;
   border-radius:3px;
   overflow:hidden;
}
.loader .bar-fill{
   width:0%;
   height:100%;
   background:#bbbbbb;
   animation: progressAnim 4s ease-in-out infinite;
}

@keyframes progressAnim{
 0%{width:0%}
 50%{width:100%}
 100%{width:0%}
}

.hidden { display: none; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .info h1 {
        font-size: 22px;
        letter-spacing: 1px;
    }
    
    .info {
        top: 15px;
        left: 15px;
    }
    
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        flex-direction: column;
        align-items: center;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid #333333;
        padding: 15px;
        gap: 15px;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.visible {
        transform: translateY(0);
    }
    
    .preview {
        width: 280px;
        height: 280px;
    }
    
    .caption-box {
        width: 280px;
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .search-container {
        bottom: 15px;
        left: 15px;
        right: 15px;
        transform: none;
    }
    
    .search-container input {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 25px;
    }
    
    .tooltip {
        font-size: 13px;
        padding: 8px 12px;
        max-width: 250px;
        white-space: normal;
        text-align: center;
    }
    
    .loader .bar {
        width: 150px;
        height: 4px;
    }
}

@media (max-width: 480px) {
    .info h1 {
        font-size: 18px;
    }
    
    .info {
        top: 10px;
        left: 10px;
    }
    
    .preview {
        width: 250px;
        height: 250px;
    }
    
    .caption-box {
        width: 250px;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .search-container {
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
    
    .search-container input {
        padding: 10px 14px;
        font-size: 16px;
        border-radius: 20px;
    }
    
    .tooltip {
        font-size: 12px;
        padding: 6px 10px;
        max-width: 200px;
    }
}

/* Mobile-specific enhancements */
@media (max-width: 768px) {
    /* Add close button for mobile sidebar */
    .sidebar::before {
        content: "×";
        position: absolute;
        top: 10px;
        right: 15px;
        font-size: 24px;
        color: #bbbbbb;
        cursor: pointer;
        z-index: 11;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
    }
    
    /* Touch-friendly visualization */
    #visualization {
        cursor: grab;
    }
    
    #visualization:active {
        cursor: grabbing;
    }
    
    /* Prevent text selection on mobile */
    .app {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Ensure proper touch scrolling in sidebar */
    .sidebar {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 70vh;
    }
} 