@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap");

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background-color: #000000;
    color: #ffffff;
    letter-spacing: 0.02em;
    line-height: 1.6;
    width: 100vw;
    height: 100vh;

    display: flex;
    justify-content: center;
    padding: 16px;

    position: relative; /* ✅ Allow normal flow */
    overflow-x: hidden; /* ✅ Prevent horizontal scroll only */
    overflow-y: auto; /* ✅ Allow vertical scrolling and interaction */
}

.container {
    width: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
    max-width: calc(100vw - 32px);
    margin: 0 auto;
    z-index: 30;
    /* pointer-events removed to allow child interaction */
}

h1 {
    text-align: left;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#clearHistory {
    position: fixed;
    top: 24px;
    right: 24px;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
    z-index: 30;
    pointer-events: auto;
}

#clearHistory:hover {
    color: rgba(255, 255, 255, 1);
}

#journalForm {
    position: fixed;
    top: 80px;
    left: 32px;
    right: 32px;
    z-index: 10;
    width: calc(100vw - 64px);
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: transparent;
    pointer-events: auto; /* still blocks parent events */
}

#journalInput {
    width: 100%;
    height: 110px;
    background-color: transparent;
    border: none;
    color: #ffffff;
    padding: 0;
    font-size: 40px;
    font-family: "Inter", sans-serif;
    font-weight: 300;
    resize: none;
    letter-spacing: -0.03em;
    line-height: 1.15;
    transition: all 0.3s ease;
    caret-color: #ffffff;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
    pointer-events: auto;
    user-select: text;
    caret-shape: bar;
    animation: blink 1s step-end infinite;
    pointer-events: auto;
}

#journalInput::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome, Safari and Opera */
}

#journalInput:focus {
    outline: none;
}

#journalInput::placeholder {
    color: rgba(255, 255, 255, 0.25);
    user-select: none;
}

#visualization {
    width: 100%;
    height: calc(100vh - 200px);
    min-height: 300px;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.2) 100%
    );
    border: none;
    overflow: hidden;
    margin: 0;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    z-index: 10000;
}

.node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.node circle {
    transition: all 0.3s ease;
    transform-box: fill-box;
    transform-origin: center;
}

.node text {
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    pointer-events: none;
    opacity: 0.95;
    transition: all 0.3s ease;
    fill: rgba(255, 255, 255, 1);
    font-size: 13px;
    text-anchor: middle;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.02em;
    font-weight: 400;
}

#clustersOutput {
    display: none;
}

.tooltip {
    position: absolute;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.95);
    color: rgba(255, 255, 255, 1);
    border-radius: 6px;
    pointer-events: none;
    font-size: 13px;
    line-height: 1.5;
    max-width: 280px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transform-origin: 50% 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    font-family: "Inter", sans-serif;
    letter-spacing: 0.01em;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tooltip.active {
    opacity: 1;
}

@keyframes blink {
    from, to {
        caret-color: #ffffff;
    }
    50% {
        caret-color: transparent;
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.drop-zone {
    position: absolute;
    top: 130px;
    left: 15px;
    width: 380px;
    height: 60px;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;

    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    font-family: sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    background-color: transparent;
    transition: all 0.3s ease;
}

.drop-zone.hover {
    border-color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
}
